18#include <gtest/gtest.h>
38 TEST(MaxWaveSpeed, TakesTheLargerOfTheTwoSides)
40 EXPECT_DOUBLE_EQ(
maxWaveSpeed(10.0, 300.0, 20.0, 340.0), 360.0);
41 EXPECT_DOUBLE_EQ(
maxWaveSpeed(50.0, 400.0, 20.0, 340.0), 450.0);
46 TEST(MaxWaveSpeed, UsesTheMagnitudeOfTheVelocity)
48 EXPECT_DOUBLE_EQ(
maxWaveSpeed(-100.0, 300.0, 0.0, 300.0), 400.0);
49 EXPECT_DOUBLE_EQ(
maxWaveSpeed(-100.0, 300.0, 0.0, 300.0),
56 TEST(MaxWaveSpeed, IsTheSoundSpeedAtRest)
58 EXPECT_DOUBLE_EQ(
maxWaveSpeed(0.0, 347.2, 0.0, 347.2), 347.2);
67 TEST(RusanovScalarFlux, ScalesTheWholeBlendByTheFaceRadius)
71 EXPECT_DOUBLE_EQ(seven, 7.0 * one);
73 EXPECT_DOUBLE_EQ(one, -160.0);
78 TEST(RusanovScalarFlux, VanishesOnAZeroAreaFace)
85 TEST(RusanovScalarFlux, HasNoDissipationWithoutAJump)
88 2.0 * 0.5 * (10.0 * 5.0 + 30.0 * 5.0));
93 TEST(RusanovScalarFlux, DissipationOpposesTheJump)
97 EXPECT_LT(rising, 0.0);
98 EXPECT_GT(falling, 0.0);
99 EXPECT_DOUBLE_EQ(rising, -falling);
109 TEST(RusanovMomentumFlux, CarriesThePressureTerm)
114 2.0 * 0.5 * (1.0e5 + 3.0e5));
119 TEST(RusanovMomentumFlux, MatchesTheClosedFormWithFlowAndPressure)
121 const double expected =
122 3.0 * (0.5 * ((2.0 * 10.0 * 10.0 + 100.0) + (4.0 * 20.0 * 20.0 + 500.0)) -
123 0.5 * 450.0 * (4.0 * 20.0 - 2.0 * 10.0));
132 TEST(RusanovMomentumFlux, DissipatesConservedMomentumNotVelocity)
138 EXPECT_DOUBLE_EQ(flux, 0.5 * (2.0 * 100.0 + 8.0 * 6.25));
148 TEST(RusanovEnergyFlux, AdvectsEnthalpyButDissipatesEnergy)
150 const double expected =
151 2.0 * (0.5 * (10.0 * (1000.0 + 300.0) + 30.0 * (2000.0 + 700.0)) -
152 0.5 * 500.0 * (2000.0 - 1000.0));
161 TEST(RusanovEnergyFlux, IsZeroAtRestAcrossAPressureJump)
176 TEST(FaceVelocityFlux, IsTheAreaWeightedAverageVelocity)
184 TEST(FaceVelocityFlux, CancelsForAMirroredPair)
195 TEST(MomentumGeometricSourceIntegral, IsThePressureTimesTheFaceSpan)
204 TEST(MomentumGeometricSourceIntegral, VanishesWhenTheFaceSpanIsZero)
213 TEST(MomentumGeometricSourceIntegral, CancelsTheFluxDifferenceAtUniformPressure)
215 const double pressure = 1.0e5;
217 const double r_west = 1.0e-3;
218 const double r_east = 1.7e-3;
219 const double flux_west =
221 const double flux_east =
223 const double source =
225 EXPECT_NEAR(flux_east - flux_west - source, 0.0, 1.0e-10);
Pure-arithmetic primitives for the explicit hydrodynamic sub-step of the 1D radial channel: one face'...
double rusanovScalarFlux(double r_face, double phi_left, double phi_right, double u_left, double u_right, double wave_speed)
Rusanov face flux for any node-centred conserved scalar – and each .
double maxWaveSpeed(double u_left, double c_left, double u_right, double c_right)
Rusanov dissipation coefficient at a face: the fastest wave speed that can reach it from either side,...
double momentumGeometricSourceIntegral(double p, double dr)
Cell-integrated cylindrical momentum source, the second term of NUMERICS.md equation (13):
double faceVelocityFlux(double r_face, double u_left, double u_right)
Face velocity flux , whose difference gives the electron-pool compression source of NUMERICS....
double rusanovMomentumFlux(double r_face, double rho_left, double u_left, double p_left, double rho_right, double u_right, double p_right, double wave_speed)
Pressure-inclusive Rusanov face flux for the radial momentum row, NUMERICS.md equation (12):
double rusanovEnergyFlux(double r_face, double E_left, double p_left, double u_left, double E_right, double p_right, double u_right, double wave_speed)
Pressure-inclusive Rusanov face flux for the total energy row, NUMERICS.md equation (14a) – the face ...