Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
SolverConfig.cpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
21
22template<class Tvec, template<class> class SPHKernel>
25
26 // Position
27 pdl.add_field<Tvec>(names::common::xyz, 1);
28
29 // Velocity
30 pdl.add_field<Tvec>(names::newtonian::vxyz, 1);
31
32 // Acceleration
33 pdl.add_field<Tvec>(names::newtonian::axyz, 1);
34
35 // Smoothing length
36 pdl.add_field<Tscal>(names::common::hpart, 1);
37
38 // Internal energy (for adiabatic EOS)
39 if (has_field_uint()) {
40 pdl.add_field<Tscal>(names::newtonian::uint, 1);
41 pdl.add_field<Tscal>(names::newtonian::duint, 1);
42 }
43
44 // Thermodynamic fields - stored in patchdata for persistence across restarts
45 // These are computed during EOS step and copied to patchdata
46 pdl.add_field<Tscal>(names::newtonian::density, 1);
47 pdl.add_field<Tscal>(names::newtonian::pressure, 1);
48 pdl.add_field<Tscal>(names::newtonian::soundspeed, 1);
49}
50
51template<class Tvec, template<class> class SPHKernel>
54
55 // Velocity (needed for Riemann solver)
56 ghost_layout.add_field<Tvec>(names::newtonian::vxyz, 1);
57
58 // Smoothing length
59 ghost_layout.add_field<Tscal>(names::common::hpart, 1);
60
61 // Omega (grad-h correction)
62 ghost_layout.add_field<Tscal>(names::newtonian::omega, 1);
63
64 // Density (computed via SPH summation)
65 ghost_layout.add_field<Tscal>(names::newtonian::density, 1);
66
67 // Internal energy (for adiabatic EOS)
68 if (has_field_uint()) {
69 ghost_layout.add_field<Tscal>(names::newtonian::uint, 1);
70 }
71}
72
73// Explicit template instantiations
74using namespace shammath;
Constants for field names in GSPH solver, organized by physics mode.
void add_field(const std::string &field_name, u32 nvar, SourceLocation loc=SourceLocation{})
add a field of type T to the layout
Configuration for the Godunov SPH (GSPH) solver.
namespace for math utility
Definition AABB.hpp:26
sph kernels
The configuration for a GSPH solver.