![]() |
Shamrock 2025.10.0
Astrophysical Code
|
GSPH force computation using Riemann solver results. More...
#include "shambase/constants.hpp"#include "shambackends/math.hpp"#include "shambackends/sycl.hpp"#include "shammodels/gsph/math/reconstruction.hpp"#include "shammodels/gsph/math/riemann/iterative.hpp"#include "shammodels/sph/math/forces.hpp"Go to the source code of this file.
Namespaces | |
| namespace | shammodels |
| namespace for models | |
Functions | |
| template<class Tvec, class Tscal> | |
| Tscal | shammodels::gsph::gsph_energy_rate (Tscal m_b, Tscal p_star, Tscal v_star, Tscal rho_a_sq, Tscal rho_b_sq, Tscal omega_a, Tscal omega_b, Tvec v_a, Tvec r_ab_unit, Tvec nabla_W_a, Tvec nabla_W_b) |
| Compute GSPH energy equation contribution. | |
| template<class Tvec, class Tscal> | |
| void | shammodels::gsph::add_gsph_force_contribution (Tscal m_b, Tscal p_star, Tscal v_star, Tscal rho_a, Tscal rho_b, Tscal omega_a, Tscal omega_b, Tscal Fab_a, Tscal Fab_b, Tvec r_ab_unit, Tvec v_a, Tvec &dv_dt, Tscal &du_dt) |
| Add GSPH force contribution from a single neighbor pair. | |
| template<class Tvec, class Tscal> | |
| void | shammodels::gsph::add_gsph_force_contribution_inutsuka (Tscal m_b, Tscal p_star, Tscal v_star, Tscal V2_ij, Tvec grad_W_ij, Tvec r_ab_unit, Tvec v_a, Tvec &dv_dt, Tscal &du_dt) |
| Add Inutsuka (2002) GSPH force contribution from a single neighbor pair. | |
| template<class Kernel, class Tvec, class Tscal> | |
| void | shammodels::gsph::accumulate_gsph_pair_force (bool use_inutsuka_v2, Tscal pmass, Tscal p_star, Tscal v_star, Tscal rho_a, Tscal rho_b, Tscal omega_a, Tscal omega_b, Tscal rab, Tscal rab_inv, Tscal h_a, Tscal h_b, Tvec r_ab_unit, Tvec vxyz_a, Tvec &sum_axyz, Tscal &sum_du_a) |
| Dispatch a single neighbor pair's force contribution to ChaWhitworth or InutsukaV2, given the pair's Riemann solver result. | |
GSPH force computation using Riemann solver results.
Implements the Godunov SPH (GSPH) force formulation following Cha & Whitworth (2003). The key difference from standard SPH is that the interface pressure p* comes from solving the Riemann problem, rather than using artificial viscosity.
References:
Definition in file forces.hpp.
|
inline |
Dispatch a single neighbor pair's force contribution to ChaWhitworth or InutsukaV2, given the pair's Riemann solver result.
Shared by update_derivs_iterative()/update_derivs_exact() in UpdateDerivs.cpp, which only differ in which Riemann solver produced (p_star, v_star).
| Kernel | SPH kernel type (e.g. SPHKernel<Tscal>), for Kernel::dW_3d |
| Tvec | Vector type |
| Tscal | Scalar type |
| use_inutsuka_v2 | Selects InutsukaV2 (true) or ChaWhitworth (false) | |
| pmass | Particle mass (equal-mass GSPH) | |
| p_star | Interface pressure from Riemann solver | |
| v_star | Interface velocity from Riemann solver | |
| rho_a | Density of particle a | |
| rho_b | Density of particle b | |
| omega_a | Grad-h correction factor for particle a | |
| omega_b | Grad-h correction factor for particle b | |
| rab | Pair separation |r_a - r_b| | |
| rab_inv | Inverse of rab | |
| h_a | Smoothing length of particle a | |
| h_b | Smoothing length of particle b | |
| r_ab_unit | Unit vector from a to b | |
| vxyz_a | Velocity of particle a | |
| [out] | sum_axyz | Accumulated acceleration |
| [out] | sum_du_a | Accumulated energy rate |
Definition at line 232 of file forces.hpp.
|
inline |
Add GSPH force contribution from a single neighbor pair.
Convenience function that computes both acceleration and energy rate contributions from a single particle pair, given the Riemann solver result.
| Tvec | Vector type |
| Tscal | Scalar type |
| m_b | Mass of neighbor particle | |
| p_star | Interface pressure from Riemann solver | |
| v_star | Interface velocity from Riemann solver | |
| rho_a | Density of particle a | |
| rho_b | Density of particle b | |
| omega_a | Grad-h correction factor for particle a | |
| omega_b | Grad-h correction factor for particle b | |
| Fab_a | Kernel gradient magnitude |nabla W_ab(h_a)| | |
| Fab_b | Kernel gradient magnitude |nabla W_ab(h_b)| | |
| r_ab_unit | Unit vector from a to b (points toward b) | |
| v_a | Velocity of particle a | |
| [out] | dv_dt | Accumulated acceleration |
| [out] | du_dt | Accumulated energy rate |
Definition at line 121 of file forces.hpp.
|
inline |
Add Inutsuka (2002) GSPH force contribution from a single neighbor pair.
Uses the effective volume/face formulation instead of the Cha & Whitworth symmetric SPH form: acc -= m_b * p* * V2_ij * grad_W_ij, where V2_ij is the effective squared volume element between the pair (see math/reconstruction.hpp) and grad_W_ij is the pair-symmetrized kernel gradient.
| Tvec | Vector type |
| Tscal | Scalar type |
| m_b | Mass of neighbor particle | |
| p_star | Interface pressure from Riemann solver | |
| v_star | Interface velocity from Riemann solver | |
| V2_ij | Effective squared volume element for the pair | |
| grad_W_ij | Pair-symmetrized kernel gradient vector | |
| r_ab_unit | Unit vector from a to b (points toward b) | |
| v_a | Velocity of particle a | |
| [out] | dv_dt | Accumulated acceleration |
| [out] | du_dt | Accumulated energy rate |
Definition at line 187 of file forces.hpp.
|
inline |
Compute GSPH energy equation contribution.
Following Cha & Whitworth (2003), the energy equation uses the same symmetric force as the momentum equation: f_ab = m_b * p* * (nabla_W_a / (rho_a^2 * Omega_a) + nabla_W_b / (rho_b^2 * Omega_b)) du_a/dt = -f_ab dot (v* - v_a)
This ensures proper energy conservation in shocks by using the same force that appears in the momentum equation.
| Tvec | Vector type |
| Tscal | Scalar type |
| m_b | Mass of particle b |
| p_star | Interface pressure from Riemann solver |
| v_star | Interface velocity (scalar, in direction of r_ab) |
| rho_a_sq | Density squared of particle a |
| rho_b_sq | Density squared of particle b |
| omega_a | Grad-h correction factor for particle a |
| omega_b | Grad-h correction factor for particle b |
| v_a | Velocity of particle a |
| r_ab_unit | Unit vector from a to b |
| nabla_W_a | Kernel gradient at r_ab with smoothing length h_a |
| nabla_W_b | Kernel gradient at r_ab with smoothing length h_b |
Definition at line 70 of file forces.hpp.