Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
shammodels::gsph::Solver< Tvec, SPHKernel > Class Template Reference

The GSPH Solver class. More...

#include <shammodels/gsph/include/shammodels/gsph/Solver.hpp>

+ Collaboration diagram for shammodels::gsph::Solver< Tvec, SPHKernel >:

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

PatchSchedulerscheduler ()
 
void init_required_fields ()
 
void gen_serial_patch_tree ()
 
void reset_serial_patch_tree ()
 
void gen_ghost_handler (Tscal time_val)
 
void reset_ghost_handler ()
 
void build_ghost_cache ()
 
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_omega ()
 
void compute_eos_fields ()
 
void reset_eos_fields ()
 
void copy_eos_to_patchdata ()
 Copy EOS fields from solvergraph to patchdata for persistence.
 
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

ShamrockCtxcontext
 
SolverStorage< Tvec, u_morton > storage {}
 
Config solver_config
 
sph::SolverLog solve_logs
 

Static Public Attributes

static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension
 
static constexpr Tscal Rkern = Kernel::Rkern
 

Detailed Description

template<class Tvec, template< class > class SPHKernel>
class shammodels::gsph::Solver< Tvec, SPHKernel >

The GSPH Solver class.

Implements the Godunov SPH method using Riemann solvers at particle interfaces instead of artificial viscosity.

Template Parameters
TvecVector type (e.g., f64_3)
SPHKernelKernel type (e.g., M4, M6, C2, C4, C6)

Definition at line 68 of file Solver.hpp.

Member Typedef Documentation

◆ Config

template<class Tvec , template< class > class SPHKernel>
using shammodels::gsph::Solver< Tvec, SPHKernel >::Config = SolverConfig<Tvec, SPHKernel>

Definition at line 74 of file Solver.hpp.

◆ GhostHandle

template<class Tvec , template< class > class SPHKernel>
using shammodels::gsph::Solver< Tvec, SPHKernel >::GhostHandle = GSPHGhostHandler<Tvec>

Definition at line 95 of file Solver.hpp.

◆ GhostHandleCache

template<class Tvec , template< class > class SPHKernel>
using shammodels::gsph::Solver< Tvec, SPHKernel >::GhostHandleCache = typename GhostHandle::CacheMap

Definition at line 96 of file Solver.hpp.

◆ Kernel

template<class Tvec , template< class > class SPHKernel>
using shammodels::gsph::Solver< Tvec, SPHKernel >::Kernel = SPHKernel<Tscal>

Definition at line 72 of file Solver.hpp.

◆ RTree

template<class Tvec , template< class > class SPHKernel>
using shammodels::gsph::Solver< Tvec, SPHKernel >::RTree = typename Config::RTree

Definition at line 109 of file Solver.hpp.

◆ Tscal

template<class Tvec , template< class > class SPHKernel>
using shammodels::gsph::Solver< Tvec, SPHKernel >::Tscal = shambase::VecComponent<Tvec>

Definition at line 70 of file Solver.hpp.

◆ u_morton

template<class Tvec , template< class > class SPHKernel>
using shammodels::gsph::Solver< Tvec, SPHKernel >::u_morton = u32

Definition at line 76 of file Solver.hpp.

Constructor & Destructor Documentation

◆ Solver()

template<class Tvec , template< class > class SPHKernel>
shammodels::gsph::Solver< Tvec, SPHKernel >::Solver ( ShamrockCtx context)
inline

Definition at line 180 of file Solver.hpp.

Member Function Documentation

◆ apply_corrector()

template<class Tvec , template< class > class Kern>
bool shammodels::gsph::Solver< Tvec, Kern >::apply_corrector ( Tscal  dt,
u64  Npart_all 
)

Definition at line 1645 of file Solver.cpp.

◆ apply_position_boundary()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::apply_position_boundary ( Tscal  time_val)

Definition at line 516 of file Solver.cpp.

◆ build_ghost_cache()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::build_ghost_cache ( )

Definition at line 185 of file Solver.cpp.

◆ build_merged_pos_trees()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::build_merged_pos_trees ( )

Definition at line 249 of file Solver.cpp.

◆ clear_ghost_cache()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::clear_ghost_cache ( )

Definition at line 198 of file Solver.cpp.

◆ clear_merged_pos_trees()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::clear_merged_pos_trees ( )

Definition at line 288 of file Solver.cpp.

◆ communicate_merge_ghosts_fields()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::communicate_merge_ghosts_fields ( )

Definition at line 643 of file Solver.cpp.

◆ compute_dt_cfl()

template<class Tvec , template< class > class Kern>
shammodels::gsph::Solver< Tvec, Kern >::Tscal shammodels::gsph::Solver< Tvec, Kern >::compute_dt_cfl ( )

Compute CFL timestep constraint.

Computes timestep from:

  • Courant condition: dt_cour = C_cour * h / vsig
  • Force condition: dt_force = C_force * sqrt(h / |a|)
Returns
Minimum CFL timestep across all particles

Definition at line 1541 of file Solver.cpp.

+ Here is the call graph for this function:

◆ compute_eos_fields()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::compute_eos_fields ( )

Definition at line 1116 of file Solver.cpp.

◆ compute_gradients()

template<class Tvec , template< class > class Kern>
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 1286 of file Solver.cpp.

+ Here is the call graph for this function:

◆ compute_omega()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::compute_omega ( )

Definition at line 827 of file Solver.cpp.

◆ compute_presteps_rint()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::compute_presteps_rint ( )

Definition at line 294 of file Solver.cpp.

◆ copy_eos_to_patchdata()

template<class Tvec , template< class > class Kern>
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 1224 of file Solver.cpp.

+ Here is the call graph for this function:

◆ do_predictor_leapfrog()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::do_predictor_leapfrog ( Tscal  dt)

Definition at line 563 of file Solver.cpp.

◆ evolve_once()

template<class Tvec , template< class > class Kern>
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 1716 of file Solver.cpp.

+ Here is the call graph for this function:

◆ evolve_once_time_expl()

template<class Tvec , template< class > class SPHKernel>
Tscal shammodels::gsph::Solver< Tvec, SPHKernel >::evolve_once_time_expl ( Tscal  t_current,
Tscal  dt_input 
)
inline

Definition at line 197 of file Solver.hpp.

◆ evolve_until()

template<class Tvec , template< class > class SPHKernel>
bool shammodels::gsph::Solver< Tvec, SPHKernel >::evolve_until ( Tscal  target_time,
i32  niter_max = -1 
)
inline

Definition at line 204 of file Solver.hpp.

◆ gen_ghost_handler()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::gen_ghost_handler ( Tscal  time_val)

Definition at line 135 of file Solver.cpp.

◆ gen_serial_patch_tree()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::gen_serial_patch_tree ( )

Definition at line 126 of file Solver.cpp.

◆ gsph_prestep()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::gsph_prestep ( Tscal  time_val,
Tscal  dt 
)

Definition at line 509 of file Solver.cpp.

◆ init_ghost_layout()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::init_ghost_layout ( )

Definition at line 625 of file Solver.cpp.

◆ init_required_fields()

template<class Tvec , template< class > class SPHKernel>
void shammodels::gsph::Solver< Tvec, SPHKernel >::init_required_fields ( )
inline

Definition at line 88 of file Solver.hpp.

◆ init_solver_graph()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::init_solver_graph ( )

Definition at line 70 of file Solver.cpp.

◆ merge_position_ghost()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::merge_position_ghost ( )

Definition at line 204 of file Solver.cpp.

◆ prepare_corrector()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::prepare_corrector ( )

Definition at line 1469 of file Solver.cpp.

◆ print_timestep_logs()

template<class Tvec , template< class > class SPHKernel>
void shammodels::gsph::Solver< Tvec, SPHKernel >::print_timestep_logs ( )
inline

Definition at line 186 of file Solver.hpp.

◆ reset_eos_fields()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::reset_eos_fields ( )

Definition at line 1219 of file Solver.cpp.

◆ reset_ghost_handler()

template<class Tvec , template< class > class SPHKernel>
void shammodels::gsph::Solver< Tvec, SPHKernel >::reset_ghost_handler ( )
inline

Definition at line 99 of file Solver.hpp.

◆ reset_merge_ghosts_fields()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::reset_merge_ghosts_fields ( )

Definition at line 822 of file Solver.cpp.

◆ reset_neighbors_cache()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::reset_neighbors_cache ( )

Definition at line 504 of file Solver.cpp.

◆ reset_presteps_rint()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::reset_presteps_rint ( )

Definition at line 328 of file Solver.cpp.

◆ reset_serial_patch_tree()

template<class Tvec , template< class > class SPHKernel>
void shammodels::gsph::Solver< Tvec, SPHKernel >::reset_serial_patch_tree ( )
inline

Definition at line 92 of file Solver.hpp.

◆ scheduler()

template<class Tvec , template< class > class SPHKernel>
PatchScheduler & shammodels::gsph::Solver< Tvec, SPHKernel >::scheduler ( )
inline

Definition at line 81 of file Solver.hpp.

◆ start_neighbors_cache()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::start_neighbors_cache ( )

Definition at line 333 of file Solver.cpp.

◆ update_derivs()

template<class Tvec , template< class > class Kern>
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 1534 of file Solver.cpp.

+ Here is the call graph for this function:

◆ update_sync_load_values()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::update_sync_load_values ( )

Definition at line 1713 of file Solver.cpp.

◆ vtk_do_dump()

template<class Tvec , template< class > class Kern>
void shammodels::gsph::Solver< Tvec, Kern >::vtk_do_dump ( std::string  filename,
bool  add_patch_world_id 
)

Definition at line 119 of file Solver.cpp.

Member Data Documentation

◆ context

template<class Tvec , template< class > class SPHKernel>
ShamrockCtx& shammodels::gsph::Solver< Tvec, SPHKernel >::context

Definition at line 80 of file Solver.hpp.

◆ dim

template<class Tvec , template< class > class SPHKernel>
constexpr u32 shammodels::gsph::Solver< Tvec, SPHKernel >::dim = shambase::VectorProperties<Tvec>::dimension
staticconstexpr

Definition at line 71 of file Solver.hpp.

◆ Rkern

template<class Tvec , template< class > class SPHKernel>
constexpr Tscal shammodels::gsph::Solver< Tvec, SPHKernel >::Rkern = Kernel::Rkern
staticconstexpr

Definition at line 78 of file Solver.hpp.

◆ solve_logs

template<class Tvec , template< class > class SPHKernel>
sph::SolverLog shammodels::gsph::Solver< Tvec, SPHKernel >::solve_logs

Definition at line 86 of file Solver.hpp.

◆ solver_config

template<class Tvec , template< class > class SPHKernel>
Config shammodels::gsph::Solver< Tvec, SPHKernel >::solver_config

Definition at line 85 of file Solver.hpp.

◆ storage

template<class Tvec , template< class > class SPHKernel>
SolverStorage<Tvec, u_morton> shammodels::gsph::Solver< Tvec, SPHKernel >::storage {}

Definition at line 83 of file Solver.hpp.


The documentation for this class was generated from the following files: