![]() |
Shamrock 2025.10.0
Astrophysical Code
|
The GSPH Solver class. More...
#include <shammodels/gsph/include/shammodels/gsph/Solver.hpp>
Public Types | |
| using | Tscal = shambase::VecComponent<Tvec> |
| using | Kernel = SPHKernel<Tscal> |
| using | Config = SolverConfig<Tvec, SPHKernel> |
| using | u_morton = u32 |
| using | GhostHandle = GSPHGhostHandler<Tvec> |
| using | GhostHandleCache = typename GhostHandle::CacheMap |
| using | RTree = typename Config::RTree |
Public Member Functions | |
| PatchScheduler & | scheduler () |
| Tscal & | time_edge_value () |
| Access synchronized simulation time (scheduler edge "time"). | |
| Tscal & | dt_edge_value () |
| Access synchronized next dt (scheduler edge "dt"). | |
| Tscal | get_time () |
| void | set_time (Tscal t) |
| Tscal | get_dt () |
| void | set_next_dt (Tscal dt) |
| void | init_required_fields () |
| void | gen_serial_patch_tree () |
| void | reset_serial_patch_tree () |
| void | reset_ghost_handler () |
| void | build_ghost_cache (Tscal time_val) |
| void | clear_ghost_cache () |
| void | merge_position_ghost () |
| void | build_merged_pos_trees () |
| void | clear_merged_pos_trees () |
| void | compute_presteps_rint () |
| void | reset_presteps_rint () |
| void | start_neighbors_cache () |
| void | reset_neighbors_cache () |
| void | gsph_prestep (Tscal time_val, Tscal dt) |
| void | apply_position_boundary (Tscal time_val) |
| void | do_predictor_leapfrog (Tscal dt) |
| void | init_ghost_layout () |
| void | communicate_merge_ghosts_fields () |
| void | reset_merge_ghosts_fields () |
| void | compute_eos_fields () |
| void | reset_eos_fields () |
| void | copy_eos_to_patchdata () |
| Copy EOS fields from solvergraph to patchdata for persistence. | |
| void | compute_density () |
| Compute SPH-summation density for GSPH. | |
| void | compute_gradients () |
| Compute gradients for MUSCL reconstruction. | |
| void | prepare_corrector () |
| void | update_derivs () |
| Update derivatives using GSPH Riemann solver. | |
| Tscal | compute_dt_cfl () |
| Compute CFL timestep constraint. | |
| bool | apply_corrector (Tscal dt, u64 Npart_all) |
| void | update_sync_load_values () |
| Solver (ShamrockCtx &context) | |
| void | init_solver_graph () |
| void | vtk_do_dump (std::string filename, bool add_patch_world_id) |
| void | print_timestep_logs () |
| TimestepLog | evolve_once () |
| Tscal | evolve_once_time_expl (Tscal t_current, Tscal dt_input) |
| bool | evolve_until (Tscal target_time, i32 niter_max=-1) |
Public Attributes | |
| ShamrockCtx & | context |
| SolverStorage< Tvec, u_morton > | storage {} |
| Config | solver_config |
| SolverLog | solve_logs |
Static Public Attributes | |
| static constexpr u32 | dim = shambase::VectorProperties<Tvec>::dimension |
| static constexpr Tscal | Rkern = Kernel::Rkern |
The GSPH Solver class.
Implements the Godunov SPH method using Riemann solvers at particle interfaces instead of artificial viscosity.
| Tvec | Vector type (e.g., f64_3) |
| SPHKernel | Kernel type (e.g., M4, M6, C2, C4, C6) |
Definition at line 71 of file Solver.hpp.
| using shammodels::gsph::Solver< Tvec, SPHKernel >::Config = SolverConfig<Tvec, SPHKernel> |
Definition at line 77 of file Solver.hpp.
| using shammodels::gsph::Solver< Tvec, SPHKernel >::GhostHandle = GSPHGhostHandler<Tvec> |
Definition at line 119 of file Solver.hpp.
| using shammodels::gsph::Solver< Tvec, SPHKernel >::GhostHandleCache = typename GhostHandle::CacheMap |
Definition at line 120 of file Solver.hpp.
| using shammodels::gsph::Solver< Tvec, SPHKernel >::Kernel = SPHKernel<Tscal> |
Definition at line 75 of file Solver.hpp.
| using shammodels::gsph::Solver< Tvec, SPHKernel >::RTree = typename Config::RTree |
Definition at line 134 of file Solver.hpp.
| using shammodels::gsph::Solver< Tvec, SPHKernel >::Tscal = shambase::VecComponent<Tvec> |
Definition at line 73 of file Solver.hpp.
| using shammodels::gsph::Solver< Tvec, SPHKernel >::u_morton = u32 |
Definition at line 79 of file Solver.hpp.
|
inline |
Definition at line 217 of file Solver.hpp.
| bool shammodels::gsph::Solver< Tvec, Kern >::apply_corrector | ( | Tscal | dt, |
| u64 | Npart_all ) |
Definition at line 1819 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::apply_position_boundary | ( | Tscal | time_val | ) |
Definition at line 979 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::build_ghost_cache | ( | Tscal | time_val | ) |
Generates the ghost handler and builds the ghost interface cache, with boundary conditions evaluated at time_val
Definition at line 172 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::build_merged_pos_trees | ( | ) |
Definition at line 358 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::clear_ghost_cache | ( | ) |
Definition at line 307 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::clear_merged_pos_trees | ( | ) |
Definition at line 397 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::communicate_merge_ghosts_fields | ( | ) |
Definition at line 1106 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::compute_density | ( | ) |
Compute SPH-summation density for GSPH.
Unlike the plain SPH solver, which derives density analytically from the converged smoothing length via rho_h(pmass, h, hfact), GSPH needs an explicit summed density field (Sigma m_j W_ij) because the Riemann reconstruction and MUSCL gradients consume density directly, not just through h. This computes that summation into storage.density.
Must have h converged, neighbor cache valid.
Definition at line 638 of file Solver.cpp.
| shammodels::gsph::Solver< Tvec, Kern >::Tscal shammodels::gsph::Solver< Tvec, Kern >::compute_dt_cfl | ( | ) |
Compute CFL timestep constraint.
Computes timestep from:
Definition at line 1715 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::compute_eos_fields | ( | ) |
Definition at line 1290 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::compute_gradients | ( | ) |
Compute gradients for MUSCL reconstruction.
Computes density, pressure, and velocity gradients for each particle using SPH kernel gradient summation. Only called when MUSCL reconstruction is enabled (reconstruct_config.is_muscl() == true).
Reference: Cha & Whitworth (2003)
Definition at line 1460 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::compute_presteps_rint | ( | ) |
Definition at line 403 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::copy_eos_to_patchdata | ( | ) |
Copy EOS fields from solvergraph to patchdata for persistence.
Copies density, pressure, and soundspeed from the temporary solvergraph fields to the persistent patchdata layout. This ensures thermodynamic state is preserved across simulation restarts and available for VTK output.
Definition at line 1398 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::do_predictor_leapfrog | ( | Tscal | dt | ) |
Definition at line 1026 of file Solver.cpp.
|
inline |
Access synchronized next dt (scheduler edge "dt").
Definition at line 100 of file Solver.hpp.
| shammodels::gsph::TimestepLog shammodels::gsph::Solver< Tvec, Kern >::evolve_once | ( | ) |
patch_rank_owner is automatically updated since it is just a lambda
Definition at line 1894 of file Solver.cpp.
|
inline |
Definition at line 234 of file Solver.hpp.
|
inline |
Definition at line 241 of file Solver.hpp.
| void shammodels::gsph::Solver< Tvec, Kern >::gen_serial_patch_tree | ( | ) |
Definition at line 163 of file Solver.cpp.
|
inline |
Definition at line 109 of file Solver.hpp.
|
inline |
Definition at line 107 of file Solver.hpp.
| void shammodels::gsph::Solver< Tvec, Kern >::gsph_prestep | ( | Tscal | time_val, |
| Tscal | dt ) |
Definition at line 730 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::init_ghost_layout | ( | ) |
Definition at line 1088 of file Solver.cpp.
|
inline |
Definition at line 112 of file Solver.hpp.
| void shammodels::gsph::Solver< Tvec, Kern >::init_solver_graph | ( | ) |
Definition at line 83 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::merge_position_ghost | ( | ) |
Definition at line 313 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::prepare_corrector | ( | ) |
Definition at line 1643 of file Solver.cpp.
|
inline |
Definition at line 223 of file Solver.hpp.
| void shammodels::gsph::Solver< Tvec, Kern >::reset_eos_fields | ( | ) |
Definition at line 1393 of file Solver.cpp.
|
inline |
Definition at line 122 of file Solver.hpp.
| void shammodels::gsph::Solver< Tvec, Kern >::reset_merge_ghosts_fields | ( | ) |
Definition at line 1285 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::reset_neighbors_cache | ( | ) |
Definition at line 633 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::reset_presteps_rint | ( | ) |
Definition at line 448 of file Solver.cpp.
|
inline |
Definition at line 116 of file Solver.hpp.
|
inline |
Definition at line 84 of file Solver.hpp.
|
inline |
Definition at line 110 of file Solver.hpp.
|
inline |
Definition at line 108 of file Solver.hpp.
| void shammodels::gsph::Solver< Tvec, Kern >::start_neighbors_cache | ( | ) |
Definition at line 453 of file Solver.cpp.
|
inline |
Access synchronized simulation time (scheduler edge "time").
Definition at line 92 of file Solver.hpp.
| void shammodels::gsph::Solver< Tvec, Kern >::update_derivs | ( | ) |
Update derivatives using GSPH Riemann solver.
This is the core GSPH step: for each particle pair, solve the 1D Riemann problem and compute forces from the interface pressure p*.
Definition at line 1708 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::update_sync_load_values | ( | ) |
Definition at line 1887 of file Solver.cpp.
| void shammodels::gsph::Solver< Tvec, Kern >::vtk_do_dump | ( | std::string | filename, |
| bool | add_patch_world_id ) |
Definition at line 156 of file Solver.cpp.
| ShamrockCtx& shammodels::gsph::Solver< Tvec, SPHKernel >::context |
Definition at line 83 of file Solver.hpp.
|
staticconstexpr |
Definition at line 74 of file Solver.hpp.
|
staticconstexpr |
Definition at line 81 of file Solver.hpp.
| SolverLog shammodels::gsph::Solver< Tvec, SPHKernel >::solve_logs |
Definition at line 89 of file Solver.hpp.
| Config shammodels::gsph::Solver< Tvec, SPHKernel >::solver_config |
Definition at line 88 of file Solver.hpp.
| SolverStorage<Tvec, u_morton> shammodels::gsph::Solver< Tvec, SPHKernel >::storage {} |
Definition at line 86 of file Solver.hpp.