Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Namespaces | Functions
forces.hpp File Reference

GSPH force computation using Riemann solver results. More...

#include "shambackends/math.hpp"
#include "shambackends/sycl.hpp"
#include "shammodels/gsph/math/riemann/iterative.hpp"
#include "shammodels/sph/math/forces.hpp"
+ Include dependency graph for forces.hpp:
+ This graph shows which files directly or indirectly include this file:

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.
 

Detailed Description

GSPH force computation using Riemann solver results.

Author
Guo Yansong (guo.y.nosp@m.anso.nosp@m.ng.ng.nosp@m.y@gm.nosp@m.ail.c.nosp@m.om)
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)
Yona Lapeyre (yona..nosp@m.lape.nosp@m.yre@e.nosp@m.ns-l.nosp@m.yon.f.nosp@m.r)

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.

Function Documentation

◆ add_gsph_force_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 
)
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.

Template Parameters
TvecVector type
TscalScalar type
Parameters
m_bMass of neighbor particle
p_starInterface pressure from Riemann solver
v_starInterface velocity from Riemann solver
rho_aDensity of particle a
rho_bDensity of particle b
omega_aGrad-h correction factor for particle a
omega_bGrad-h correction factor for particle b
Fab_aKernel gradient magnitude |nabla W_ab(h_a)|
Fab_bKernel gradient magnitude |nabla W_ab(h_b)|
r_ab_unitUnit vector from a to b (points toward b)
v_aVelocity of particle a
[out]dv_dtAccumulated acceleration
[out]du_dtAccumulated energy rate

Definition at line 119 of file forces.hpp.

+ Here is the call graph for this function:

◆ gsph_energy_rate()

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 
)
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.

Template Parameters
TvecVector type
TscalScalar type
Parameters
m_bMass of particle b
p_starInterface pressure from Riemann solver
v_starInterface velocity (scalar, in direction of r_ab)
rho_a_sqDensity squared of particle a
rho_b_sqDensity squared of particle b
omega_aGrad-h correction factor for particle a
omega_bGrad-h correction factor for particle b
v_aVelocity of particle a
r_ab_unitUnit vector from a to b
nabla_W_aKernel gradient at r_ab with smoothing length h_a
nabla_W_bKernel gradient at r_ab with smoothing length h_b
Returns
Energy rate contribution from this pair

Definition at line 68 of file forces.hpp.

+ Here is the call graph for this function: