|
| | Model (ShamrockCtx &ctx) |
| |
| void | init () |
| | Initialise the model and all the related data structures (patch scheduler in particular)
|
| |
| void | init_scheduler (u32 crit_split, u32 crit_merge) |
| |
| template<std::enable_if_t< dim==3, int > = 0> |
| Tvec | get_box_dim_fcc_3d (Tscal dr, u32 xcnt, u32 ycnt, u32 zcnt) |
| |
| void | set_cfl_cour (Tscal cfl_cour) |
| |
| void | set_cfl_force (Tscal cfl_force) |
| |
| void | set_particle_mass (Tscal gpart_mass) |
| |
| Tscal | get_particle_mass () |
| |
| void | resize_simulation_box (std::pair< Tvec, Tvec > box) |
| |
| void | do_vtk_dump (std::string filename, bool add_patch_world_id) |
| |
| u64 | get_total_part_count () |
| |
| f64 | total_mass_to_part_mass (f64 totmass) |
| |
| std::pair< Tvec, Tvec > | get_ideal_fcc_box (Tscal dr, std::pair< Tvec, Tvec > box) |
| |
| std::pair< Tvec, Tvec > | get_ideal_hcp_box (Tscal dr, std::pair< Tvec, Tvec > box) |
| |
| Tscal | get_hfact () |
| |
| Tscal | rho_h (Tscal h) |
| |
| void | add_cube_fcc_3d (Tscal dr, std::pair< Tvec, Tvec > _box) |
| |
| void | add_cube_hcp_3d (Tscal dr, std::pair< Tvec, Tvec > _box) |
| |
| template<class T > |
| void | apply_field_from_position (std::string field_name, const std::function< T(Tvec)> pos_to_val) |
| | Apply a position-dependent function to initialize a field.
|
| |
| template<class T > |
| void | set_field_in_box (std::string field_name, T val, std::pair< Tvec, Tvec > box, u32 ivar=0) |
| | Set field value for particles within a box region.
|
| |
| template<class T > |
| void | set_field_in_sphere (std::string field_name, T val, Tvec center, Tscal radius) |
| | Set field value for particles within a spherical region.
|
| |
| template<class T > |
| T | get_sum (std::string name) |
| |
| SolverConfig | gen_default_config () |
| |
| void | set_solver_config (SolverConfig cfg) |
| |
| f64 | solver_logs_last_rate () |
| |
| u64 | solver_logs_last_obj_count () |
| |
| shamsys::SystemMetrics | solver_logs_last_system_metrics () |
| |
| void | load_from_dump (std::string fname) |
| |
| void | dump (std::string fname) |
| |
| TimestepLog | timestep () |
| |
| void | evolve_once () |
| |
| bool | evolve_until (Tscal target_time, i32 niter_max=-1) |
| |
template<class Tvec, template< class > class SPHKernel>
class shammodels::gsph::Model< Tvec, SPHKernel >
The GSPH Model class.
Provides a high-level interface for setting up and running GSPH simulations. The GSPH method uses Riemann solvers at particle interfaces instead of artificial viscosity, giving sharper shock resolution.
- Template Parameters
-
| Tvec | Vector type (e.g., f64_3) |
| SPHKernel | Kernel type (e.g., M4, M6, C2, C4, C6 for Wendland) |
Definition at line 63 of file Model.hpp.
template<class Tvec , template< class > class SPHKernel>
template<class T >
| void shammodels::gsph::Model< Tvec, SPHKernel >::apply_field_from_position |
( |
std::string |
field_name, |
|
|
const std::function< T(Tvec)> |
pos_to_val |
|
) |
| |
|
inline |
Apply a position-dependent function to initialize a field.
Sets field values by evaluating a function at each particle position. Useful for setting up spatially-varying initial conditions.
- Template Parameters
-
| T | Field type (e.g., Tscal for density, Tvec for velocity) |
- Parameters
-
| field_name | Name of the field to modify (e.g., "uint", "vxyz") |
| pos_to_val | Function mapping position to field value |
Example:
model.apply_field_from_position<Tvec>("vxyz", [](Tvec pos) {
return Tvec{pos[0], 0.0, 0.0};
});
Definition at line 158 of file Model.hpp.
template<class Tvec , template< class > class SPHKernel>
template<class T >
| void shammodels::gsph::Model< Tvec, SPHKernel >::set_field_in_box |
( |
std::string |
field_name, |
|
|
T |
val, |
|
|
std::pair< Tvec, Tvec > |
box, |
|
|
u32 |
ivar = 0 |
|
) |
| |
|
inline |
Set field value for particles within a box region.
Sets the specified field to a constant value for all particles whose positions fall within the given axis-aligned box. Useful for setting up discontinuous initial conditions (e.g., Sod shock tube).
- Template Parameters
-
| T | Field type (e.g., Tscal for scalars, Tvec for vectors) |
- Parameters
-
| field_name | Name of the field to modify (e.g., "uint", "vxyz") |
| val | Value to set for particles in the region |
| box | Bounding box as (min_corner, max_corner) |
| ivar | Variable index for multi-variable fields (default: 0) |
Example:
model.set_field_in_box("uint", u_left, {box_min, interface_pos});
model.set_field_in_box("uint", u_right, {interface_pos, box_max});
Definition at line 215 of file Model.hpp.
template<class Tvec , template< class > class SPHKernel>
template<class T >
| void shammodels::gsph::Model< Tvec, SPHKernel >::set_field_in_sphere |
( |
std::string |
field_name, |
|
|
T |
val, |
|
|
Tvec |
center, |
|
|
Tscal |
radius |
|
) |
| |
|
inline |
Set field value for particles within a spherical region.
Sets the specified field to a constant value for all particles whose positions fall within the given sphere. Useful for setting up point-source initial conditions (e.g., Sedov blast).
- Template Parameters
-
| T | Field type (must be single-variable, e.g., Tscal) |
- Parameters
-
| field_name | Name of the field to modify (e.g., "uint") |
| val | Value to set for particles in the region |
| center | Center of the sphere |
| radius | Radius of the sphere |
Example:
Tscal blast_energy_per_particle = E_blast / n_particles_in_sphere;
model.set_field_in_sphere("uint", blast_energy_per_particle, origin, r_blast);
Definition at line 274 of file Model.hpp.