![]() |
Shamrock 2025.10.0
Astrophysical Code
|
The shamrock SPH model. More...
#include <shammodels/sph/include/shammodels/sph/Solver.hpp>
Classes | |
| struct | SolverStepCallback |
Public Types | |
| using | Tscal = shambase::VecComponent<Tvec> |
| using | Kernel = SPHKernel<Tscal> |
| using | Config = SolverConfig<Tvec, SPHKernel> |
| using | Cfg_MHD = typename Config::MHDConfig |
| using | NoneMHD = typename Cfg_MHD::None |
| using | IdealMHD = typename Cfg_MHD::IdealMhdConstrainedHyperPara |
| using | NonIdealMHD = typename Cfg_MHD::NonIdealMHD |
| using | u_morton = typename Config::u_morton |
| using | GhostHandle = sph::BasicSPHGhostHandler<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", not solver_graph "dt"). | |
| Tscal & | cfl_multiplier_edge_value () |
| Access synchronized CFL multiplier (scheduler edge "cfl_multiplier"). | |
| Tscal | get_time () |
| void | set_time (Tscal t) |
| Tscal | get_dt_sph () |
| void | set_next_dt (Tscal dt) |
| Tscal | get_cfl_multipler () |
| void | set_cfl_multipler (Tscal lambda) |
| void | set_cfl_dt_edge_value (const std::string &name, Tscal value) |
| Store a CFL dt value in its synchronized edge. | |
| std::map< std::string, Tscal > | get_last_cfl_dts () |
| Get the last CFL dt values stored in the synchronized edges. | |
| 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) |
| Generates the ghost handler and builds the ghost particle interface cache for inter-patch communication. | |
| void | clear_ghost_cache () |
| Clears ghost particle cache to free memory. | |
| void | merge_position_ghost () |
| Merges ghost particle positions from neighboring patches. | |
| void | build_merged_pos_trees () |
| Builds spatial BVH trees for merged positions including ghosts. | |
| void | clear_merged_pos_trees () |
| Clears merged position trees to free memory. | |
| void | compute_presteps_rint () |
| Computes maximum smoothing length in tree nodes for neighbor search. | |
| void | reset_presteps_rint () |
| Resets tree radius interval field. | |
| void | start_neighbors_cache () |
| Builds neighbor particle cache for SPH calculations. | |
| void | reset_neighbors_cache () |
| Resets neighbor cache. | |
| void | sph_prestep (Tscal time_val, Tscal dt) |
| Performs pre-step operations for SPH timestep. | |
| void | apply_position_boundary (Tscal time_val) |
| Applies position-based boundary conditions. | |
| void | update_artificial_viscosity (Tscal dt) |
| Updates artificial viscosity coefficients for shock capturing. | |
| void | update_j () |
| Updates the magnetic current field (for NIMHD). | |
| void | init_ghost_layout () |
| Initializes data layout for ghost particle fields. | |
| void | communicate_merge_ghosts_fields () |
| Communicates and merges ghost particle fields across processes. | |
| void | reset_merge_ghosts_fields () |
| Resets merged ghost field data. | |
| void | compute_eos_fields () |
| Computes equation of state fields (pressure, sound speed). | |
| void | reset_eos_fields () |
| Frees memory allocated for EOS fields. | |
| void | prepare_corrector () |
| Saves old derivative fields for predictor-corrector integration. | |
| void | update_derivs (Tscal dt_hydro) |
| Updates time derivatives and applies external forces. | |
| bool | apply_corrector (Tscal dt, u64 Npart_all) |
| void | update_sync_load_values () |
| Updates load balancing values and synchronizes patch ownership. | |
| Solver (ShamrockCtx &context) | |
| void | init_solver_graph () |
| Initializes the solver graph for computation pipeline. | |
| void | vtk_do_dump (std::string filename, bool add_patch_world_id) |
| Writes VTK dump file for visualization. | |
| void | set_debug_dump (bool _do_debug_dump, std::string _debug_dump_filename) |
| void | print_timestep_logs () |
| TimestepLog | evolve_once () |
| Performs one complete SPH timestep evolution. | |
| Tscal | evolve_once_time_expl (Tscal t_current, Tscal dt_input) |
| Evolves system by one explicit timestep with specified time and dt. | |
| EvolveUntilResults | evolve_until (Tscal target_time, i32 niter_max, f64 max_walltime=-1) |
Static Public Member Functions | |
| static bool | is_cfl_dt_edge_name (const std::string &name) |
| Check whether a synchronized edge name is one of the last CFL dt edges. | |
Public Attributes | |
| ShamrockCtx & | context |
| SolverStorage< Tvec, u_morton > | storage {} |
| Config | solver_config |
| SolverLog | solve_logs |
| std::vector< SolverStepCallback > | timestep_callbacks {} |
Static Public Attributes | |
| static constexpr u32 | dim = shambase::VectorProperties<Tvec>::dimension |
| static constexpr Tscal | Rkern = Kernel::Rkern |
| static constexpr const char * | cfl_dt_edge_name = "cfl_dt" |
| Name of the synchronized edge holding the last global CFL dt. | |
| static constexpr const char * | cfl_dt_detail_edge_prefix = "cfl_dt_" |
| Prefix of the synchronized edges holding the last CFL dt per CFL type. | |
The shamrock SPH model.
| Tvec | |
| SPHKernel |
Definition at line 152 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::Cfg_MHD = typename Config::MHDConfig |
Definition at line 159 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::Config = SolverConfig<Tvec, SPHKernel> |
Definition at line 158 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::GhostHandle = sph::BasicSPHGhostHandler<Tvec> |
Definition at line 266 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::GhostHandleCache = typename GhostHandle::CacheMap |
Definition at line 267 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::IdealMHD = typename Cfg_MHD::IdealMhdConstrainedHyperPara |
Definition at line 162 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::Kernel = SPHKernel<Tscal> |
Definition at line 156 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::NoneMHD = typename Cfg_MHD::None |
Definition at line 161 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::NonIdealMHD = typename Cfg_MHD::NonIdealMHD |
Definition at line 163 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::RTree = typename Config::RTree |
Definition at line 282 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::Tscal = shambase::VecComponent<Tvec> |
Definition at line 154 of file Solver.hpp.
| using shammodels::sph::Solver< Tvec, SPHKernel >::u_morton = typename Config::u_morton |
Definition at line 165 of file Solver.hpp.
|
inline |
Definition at line 340 of file Solver.hpp.
| bool shammodels::sph::Solver< Tvec, Kern >::apply_corrector | ( | Tscal | dt, |
| u64 | Npart_all ) |
Definition at line 2893 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::apply_position_boundary | ( | Tscal | time_val | ) |
Applies position-based boundary conditions.
Applies position boundary conditions to the particles.
| time_val | the current time value |
Definition at line 1588 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::build_ghost_cache | ( | Tscal | time_val | ) |
Generates the ghost handler and builds the ghost particle interface cache for inter-patch communication.
| time_val | the time at which the boundary conditions are evaluated |
Definition at line 1634 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::build_merged_pos_trees | ( | ) |
Builds spatial BVH trees for merged positions including ghosts.
Definition at line 1911 of file Solver.cpp.
|
inline |
Access synchronized CFL multiplier (scheduler edge "cfl_multiplier").
Definition at line 194 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::clear_ghost_cache | ( | ) |
Clears ghost particle cache to free memory.
Definition at line 1862 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::clear_merged_pos_trees | ( | ) |
Clears merged position trees to free memory.
Definition at line 1916 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::communicate_merge_ghosts_fields | ( | ) |
Communicates and merges ghost particle fields across processes.
Definition at line 2300 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::compute_eos_fields | ( | ) |
Computes equation of state fields (pressure, sound speed).
Definition at line 2619 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::compute_presteps_rint | ( | ) |
Computes maximum smoothing length in tree nodes for neighbor search.
Definition at line 2223 of file Solver.cpp.
|
inline |
Access synchronized next dt (scheduler edge "dt", not solver_graph "dt").
Definition at line 186 of file Solver.hpp.
| shammodels::sph::TimestepLog shammodels::sph::Solver< Tvec, Kern >::evolve_once | ( | ) |
Performs one complete SPH timestep evolution.
patch_rank_owner is automatically updated since it is just a lambda
must be after the mpi timer to not count the barrier of the system metrics
Definition at line 2905 of file Solver.cpp.
|
inline |
Evolves system by one explicit timestep with specified time and dt.
Definition at line 363 of file Solver.hpp.
|
inline |
Definition at line 370 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::gen_serial_patch_tree | ( | ) |
Definition at line 1574 of file Solver.cpp.
|
inline |
Definition at line 206 of file Solver.hpp.
|
inline |
Definition at line 204 of file Solver.hpp.
|
inline |
Get the last CFL dt values stored in the synchronized edges.
Returns the global CFL dt (edge "cfl_dt") and, if show_cfl_detail is enabled, the CFL dt per CFL type (edges "cfl_dt_<type>"), keyed by edge name. All values are 0 before the first step. An edge whose CFL type was not evaluated in the last step (e.g. "cfl_dt_sink_sink" with no sinks) keeps its previous value.
Definition at line 240 of file Solver.hpp.
|
inline |
Definition at line 202 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::init_ghost_layout | ( | ) |
Initializes data layout for ghost particle fields.
Definition at line 2208 of file Solver.cpp.
|
inline |
Definition at line 259 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::init_solver_graph | ( | ) |
Initializes the solver graph for computation pipeline.
Definition at line 273 of file Solver.cpp.
|
inlinestatic |
Check whether a synchronized edge name is one of the last CFL dt edges.
Definition at line 215 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::merge_position_ghost | ( | ) |
Merges ghost particle positions from neighboring patches.
Definition at line 1868 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::prepare_corrector | ( | ) |
Saves old derivative fields for predictor-corrector integration.
Definition at line 2631 of file Solver.cpp.
|
inline |
Definition at line 352 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::reset_eos_fields | ( | ) |
Frees memory allocated for EOS fields.
Definition at line 2625 of file Solver.cpp.
|
inline |
Definition at line 269 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::reset_merge_ghosts_fields | ( | ) |
Resets merged ghost field data.
Definition at line 2542 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::reset_neighbors_cache | ( | ) |
Resets neighbor cache.
Definition at line 2295 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::reset_presteps_rint | ( | ) |
Resets tree radius interval field.
Definition at line 2260 of file Solver.cpp.
|
inline |
Definition at line 263 of file Solver.hpp.
|
inline |
Definition at line 170 of file Solver.hpp.
|
inline |
Store a CFL dt value in its synchronized edge.
The edge must already exist (registered by init_solver_graph). The value must be identical on every rank (i.e. already reduced).
Definition at line 225 of file Solver.hpp.
|
inline |
Definition at line 207 of file Solver.hpp.
|
inline |
Definition at line 348 of file Solver.hpp.
|
inline |
Definition at line 205 of file Solver.hpp.
|
inline |
Definition at line 203 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::sph_prestep | ( | Tscal | time_val, |
| Tscal | dt ) |
Performs pre-step operations for SPH timestep.
Definition at line 1922 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::start_neighbors_cache | ( | ) |
Builds neighbor particle cache for SPH calculations.
Definition at line 2265 of file Solver.cpp.
|
inline |
Access synchronized simulation time (scheduler edge "time").
Definition at line 178 of file Solver.hpp.
| void shammodels::sph::Solver< Tvec, Kern >::update_artificial_viscosity | ( | Tscal | dt | ) |
Updates artificial viscosity coefficients for shock capturing.
Definition at line 2551 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::update_derivs | ( | Tscal | dt_hydro | ) |
Updates time derivatives and applies external forces.
Definition at line 2727 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::update_j | ( | ) |
Updates the magnetic current field (for NIMHD).
Definition at line 2558 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::update_sync_load_values | ( | ) |
Updates load balancing values and synchronizes patch ownership.
Definition at line 2898 of file Solver.cpp.
| void shammodels::sph::Solver< Tvec, Kern >::vtk_do_dump | ( | std::string | filename, |
| bool | add_patch_world_id ) |
Writes VTK dump file for visualization.
Definition at line 1411 of file Solver.cpp.
|
staticconstexpr |
Prefix of the synchronized edges holding the last CFL dt per CFL type.
Definition at line 212 of file Solver.hpp.
|
staticconstexpr |
Name of the synchronized edge holding the last global CFL dt.
Definition at line 210 of file Solver.hpp.
| ShamrockCtx& shammodels::sph::Solver< Tvec, SPHKernel >::context |
Definition at line 169 of file Solver.hpp.
|
staticconstexpr |
Definition at line 155 of file Solver.hpp.
|
staticconstexpr |
Definition at line 167 of file Solver.hpp.
| SolverLog shammodels::sph::Solver< Tvec, SPHKernel >::solve_logs |
Definition at line 175 of file Solver.hpp.
| Config shammodels::sph::Solver< Tvec, SPHKernel >::solver_config |
Definition at line 174 of file Solver.hpp.
| SolverStorage<Tvec, u_morton> shammodels::sph::Solver< Tvec, SPHKernel >::storage {} |
Definition at line 172 of file Solver.hpp.
| std::vector<SolverStepCallback> shammodels::sph::Solver< Tvec, SPHKernel >::timestep_callbacks {} |
Definition at line 257 of file Solver.hpp.