11 const Float u = P3 / P;
15 const Float fp = (u - 1.) * c * term2;
17 c * term2 / P + (u - 1.) * c / term2 * (-1. /
sqr(term1)) * sod.
gamma * (sod.
gamma + 1.) / P;
21 const Float fp = (
pow(u, beta) - 1.) * (2. * c / (sod.
gamma - 1.));
22 const Float dfdp = 2. * c / (sod.
gamma - 1.) * beta *
pow(u, (beta - 1.)) / P;
37 Float f_L = 0._f, f_R = 0._f;
38 while (fabs(P3 - P_new) > 1e-6) {
41 tie(f_L, dfdp_L) = computeCharacteristics(sod, P3, sod.
P_l, c_l);
42 tie(f_R, dfdp_R) = computeCharacteristics(sod, P3, sod.
P_r, c_r);
44 const Float df = dfdp_L + dfdp_R;
45 const Float dp = -f / df;
49 return { P_new, v_3 };
53 const Float x_min = -0.5;
54 const Float x_max = 0.5;
63 tie(P_post, v_post) = solveRiemannProblem(sod);
65 const Float rho_post = sod.
rho_r * (((P_post / sod.
P_r) +
sqr(mu)) / (1 + mu * mu * (P_post / sod.
P_r)));
66 const Float v_shock = v_post * ((rho_post / sod.
rho_r) / ((rho_post / sod.
rho_r) - 1));
70 const Float x1 = sod.
x0 - c_l * t;
71 const Float x3 = sod.
x0 + v_post * t;
72 const Float x4 = sod.
x0 + v_shock * t;
75 const Float c_2 = c_l - ((sod.
gamma - 1) / 2) * v_post;
76 const Float x2 = sod.
x0 + (v_post - c_2) * t;
79 for (
Size i = 0; i < pos.
size(); ++i) {
80 const Float x = x_min + (x_max - x_min) / pos.
size() * i;
95 for (
Size i = 0; i < r.size(); ++i) {
102 }
else if (x1 <= x && x <= x2) {
104 const Float c = mu * mu * ((sod.
x0 - x) / t) + (1 - mu * mu) * c_l;
107 v[i][
X] = (1 - mu * mu) * ((-(sod.
x0 - x) / t) + c_l);
108 }
else if (x2 <= x && x <= x3) {
113 }
else if (x3 <= x && x <= x4) {
124 u[i] = P[i] / ((sod.
gamma - 1._f) * rho[i]);
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
constexpr INLINE T sqr(const T &f) noexcept
Return a squared value.
INLINE T sqrt(const T f)
Return a squared root of a value.
constexpr INLINE Float pow(const Float v)
Power for floats.
#define NAMESPACE_SPH_END
@ PRESSURE
Pressure, affected by yielding and fragmentation model, always a scalar quantity.
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
@ ENERGY
Specific internal energy, always a scalar quantity.
@ DENSITY
Density, always a scalar quantity.
Holder of quantity values and their temporal derivatives.
@ FIRST
Quantity with 1st derivative.
@ ZERO
Quantity without derivatives, or "zero order" of quantity.
Storage analyticSod(const SodConfig &sod, const Float t)
StaticArray< T0 &, sizeof...(TArgs)+1 > tie(T0 &t0, TArgs &... rest)
Creates a static array from a list of l-value references.
Container for storing particle quantities and materials.
BasicVector< Float > Vector
Object providing safe access to continuous memory of data.
Generic dynamically allocated resizable storage.
INLINE TCounter size() const noexcept
Array with fixed number of allocated elements.
Container storing all quantities used within the simulations.
Quantity & insert(const QuantityId key, const OrderEnum order, const TValue &defaultValue)
Creates a quantity in the storage, given its key, value type and order.
StaticArray< Array< TValue > &, 3 > getAll(const QuantityId key)
Retrieves quantity buffers from the storage, given its key and value type.
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.