https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TestNumericalFluxGasMixHLLC Class Reference

Tests NumericalFluxGasMixHLLC. More...

#include <TestNumericalFluxGasMixHLLC.h>

Inheritance diagram for TestNumericalFluxGasMixHLLC:
[legend]

Public Member Functions

 TestNumericalFluxGasMixHLLC ()
 

Protected Member Functions

virtual const NumericalFlux1DcreateFluxObject () override
 Creates the flux object to be tested.
 
virtual std::vector< std::pair< std::vector< ADReal >, std::vector< ADReal > > > getPrimitiveSolutionsSymmetryTest () const override
 Gets a vector of pairs of primitive solution vectors to use for symmetry test.
 
virtual std::vector< std::vector< ADReal > > getPrimitiveSolutionsConsistencyTest () const override
 Gets a vector of primitive solution vectors to use for consistency test.
 
virtual std::vector< ADRealcomputeConservativeSolution (const std::vector< ADReal > &W, const ADReal &A) const override
 Computes the conservative solution from the primitive solution.
 
virtual std::vector< ADRealcomputeFluxFromPrimitive (const std::vector< ADReal > &W, const ADReal &A) const override
 Computes the 1D flux vector from the primitive solution.
 
void addFluidProperties ()
 Adds fluid properties objects needed for testing.
 
void testConsistency ()
 Runs the consistency test(s)
 
void testSymmetry ()
 Runs the symmetry test(s)
 
void buildObjects ()
 
TaddObject (const std::string &type, const std::string &name, InputParameters &params)
 

Protected Attributes

const UserObjectName _fp_mix_name
 Mixture fluid properties name.
 
const IdealGasMixtureFluidProperties_fp_mix
 Fluid properties user object.
 
std::unique_ptr< MooseMesh_mesh
 
std::shared_ptr< MooseApp_app
 
Factory_factory
 
std::shared_ptr< FEProblem_fe_problem
 

Detailed Description

Tests NumericalFluxGasMixHLLC.

Definition at line 17 of file TestNumericalFluxGasMixHLLC.h.

Constructor & Destructor Documentation

◆ TestNumericalFluxGasMixHLLC()

TestNumericalFluxGasMixHLLC::TestNumericalFluxGasMixHLLC ( )

Member Function Documentation

◆ addFluidProperties()

void TestNumericalFluxGasMixBase::addFluidProperties ( )
protectedinherited

Adds fluid properties objects needed for testing.

Definition at line 35 of file TestNumericalFluxGasMixBase.C.

36{
37 const std::string fp_steam_name = "fp_steam";
38 const std::string fp_nitrogen_name = "fp_nitrogen";
39
40 // steam fluid properties; parameters correspond to T in range 298 K to 473 K
41 {
42 const std::string class_name = "IdealGasFluidProperties";
43 InputParameters params = _factory.getValidParams(class_name);
44 params.set<Real>("gamma") = 1.43;
45 params.set<Real>("molar_mass") = 0.01801488;
46 params.set<Real>("mu") = 0.000013277592; // at 400 K and 1.e5 Pa
47 params.set<Real>("k") = 0.026824977826; // at 400 K and 1.e5 Pa
48 _fe_problem->addUserObject(class_name, fp_steam_name, params);
49 }
50
51 // nitrogen fluid properties
52 {
53 const std::string class_name = "IdealGasFluidProperties";
54 InputParameters params = _factory.getValidParams(class_name);
55 params.set<Real>("gamma") = 1.4;
56 params.set<Real>("molar_mass") = 0.028012734746133888;
57 params.set<Real>("mu") = 0.0000222084; // at 400 K and 1.e5 Pa
58 params.set<Real>("k") = 0.032806168; // at 400 K and 1.e5 Pa
59 _fe_problem->addUserObject(class_name, fp_nitrogen_name, params);
60 }
61
62 // mixture fluid properties
63 {
64 const std::string class_name = "IdealGasMixtureFluidProperties";
65 InputParameters params = _factory.getValidParams(class_name);
66 params.set<std::vector<UserObjectName>>("component_fluid_properties") = {fp_steam_name,
67 fp_nitrogen_name};
68 _fe_problem->addUserObject(class_name, _fp_mix_name, params);
70 }
71}
InputParameters getValidParams(const std::string &name) const
Class for fluid properties of an ideal gas mixture.
T & set(const std::string &name, bool quiet_mode=false)
std::shared_ptr< FEProblem > _fe_problem
const UserObjectName _fp_mix_name
Mixture fluid properties name.
const IdealGasMixtureFluidProperties * _fp_mix
Fluid properties user object.
const T & getUserObject(const std::string &param_name, bool is_dependency=true) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by TestNumericalFluxGasMixBase::TestNumericalFluxGasMixBase().

◆ computeConservativeSolution()

std::vector< ADReal > TestNumericalFluxGasMixBase::computeConservativeSolution ( const std::vector< ADReal > &  W,
const ADReal A 
) const
overrideprotectedvirtualinherited

Computes the conservative solution from the primitive solution.

Parameters
[in]WPrimitive solution vector
[in]ACross-sectional area

Implements TestNumericalFlux1D.

Definition at line 21 of file TestNumericalFluxGasMixBase.C.

23{
24 return FlowModelGasMixUtils::computeConservativeSolution<true>(W, A, *_fp_mix);
25}

◆ computeFluxFromPrimitive()

std::vector< ADReal > TestNumericalFluxGasMixBase::computeFluxFromPrimitive ( const std::vector< ADReal > &  W,
const ADReal A 
) const
overrideprotectedvirtualinherited

Computes the 1D flux vector from the primitive solution.

Parameters
[in]WPrimitive solution vector
[in]ACross-sectional area

Implements TestNumericalFlux1D.

Definition at line 28 of file TestNumericalFluxGasMixBase.C.

30{
31 return FlowModelGasMixUtils::computeFluxFromPrimitive<true>(W, A, *_fp_mix);
32}

◆ createFluxObject()

const NumericalFlux1D & TestNumericalFluxGasMixHLLC::createFluxObject ( )
overrideprotectedvirtual

Creates the flux object to be tested.

Implements TestNumericalFlux1D.

Definition at line 21 of file TestNumericalFluxGasMixHLLC.C.

22{
23 const std::string class_name = "NumericalFluxGasMixHLLC";
24 const std::string flux_mix_name = "flux_mix";
25 InputParameters params = _factory.getValidParams(class_name);
26 params.set<UserObjectName>("fluid_properties") = _fp_mix_name;
27 _fe_problem->addUserObject(class_name, flux_mix_name, params);
28
29 return _fe_problem->getUserObject<NumericalFluxGasMixHLLC>(flux_mix_name);
30}
Computes the numerical flux for FlowModelGasMix using the HLLC approximate Riemann solver.

◆ getPrimitiveSolutionsConsistencyTest()

std::vector< std::vector< ADReal > > TestNumericalFluxGasMixHLLC::getPrimitiveSolutionsConsistencyTest ( ) const
overrideprotectedvirtual

Gets a vector of primitive solution vectors to use for consistency test.

Implements TestNumericalFlux1D.

Definition at line 69 of file TestNumericalFluxGasMixHLLC.C.

70{
71 std::vector<ADReal> W1(THMGasMix1D::N_PRIM_VARS);
73 W1[THMGasMix1D::PRESSURE] = 1e5;
75 W1[THMGasMix1D::VELOCITY] = 1.5;
76
77 std::vector<std::vector<ADReal>> W_list;
78 W_list.push_back(W1);
79
80 return W_list;
81}
static const unsigned int N_PRIM_VARS

◆ getPrimitiveSolutionsSymmetryTest()

std::vector< std::pair< std::vector< ADReal >, std::vector< ADReal > > > TestNumericalFluxGasMixHLLC::getPrimitiveSolutionsSymmetryTest ( ) const
overrideprotectedvirtual

Gets a vector of pairs of primitive solution vectors to use for symmetry test.

Implements TestNumericalFlux1D.

Definition at line 33 of file TestNumericalFluxGasMixHLLC.C.

34{
35 // sL < 0 < sM
36 std::vector<ADReal> W1(THMGasMix1D::N_PRIM_VARS);
38 W1[THMGasMix1D::PRESSURE] = 1e5;
40 W1[THMGasMix1D::VELOCITY] = 20;
41
42 std::vector<ADReal> W2(THMGasMix1D::N_PRIM_VARS);
44 W2[THMGasMix1D::PRESSURE] = 2e5;
46 W2[THMGasMix1D::VELOCITY] = 1.2;
47
48 // sL > 0
49 std::vector<ADReal> W3(THMGasMix1D::N_PRIM_VARS);
51 W3[THMGasMix1D::PRESSURE] = 1e5;
53 W3[THMGasMix1D::VELOCITY] = 500;
54
55 std::vector<ADReal> W4(THMGasMix1D::N_PRIM_VARS);
57 W4[THMGasMix1D::PRESSURE] = 2e5;
59 W4[THMGasMix1D::VELOCITY] = 550;
60
61 std::vector<std::pair<std::vector<ADReal>, std::vector<ADReal>>> W_pairs;
62 W_pairs.push_back(std::pair<std::vector<ADReal>, std::vector<ADReal>>(W1, W2));
63 W_pairs.push_back(std::pair<std::vector<ADReal>, std::vector<ADReal>>(W3, W4));
64
65 return W_pairs;
66}

◆ testConsistency()

void TestNumericalFlux1D::testConsistency ( )
protectedinherited

Runs the consistency test(s)

Definition at line 57 of file TestNumericalFlux1D.C.

58{
59 const auto & flux = createFluxObject();
60
61 unsigned int i_side = 0;
62 const auto W_list = getPrimitiveSolutionsConsistencyTest();
63 for (const auto & W : W_list)
64 {
65 const ADReal A = 2.0;
66
67 const auto U = computeConservativeSolution(W, A);
68 const auto F_expected = computeFluxFromPrimitive(W, A);
69
70 const auto & FL_computed_pos = flux.getFlux(i_side, 0, true, U, U, 1.0);
71 const auto & FR_computed_pos = flux.getFlux(i_side, 0, false, U, U, 1.0);
72 i_side++;
73
74 const auto & FL_computed_neg = flux.getFlux(i_side, 0, true, U, U, -1.0);
75 const auto & FR_computed_neg = flux.getFlux(i_side, 0, false, U, U, -1.0);
76 i_side++;
77
78 for (unsigned int i = 0; i < FL_computed_pos.size(); ++i)
79 {
80 REL_TEST(FL_computed_pos[i], F_expected[i], REL_TOL_CONSISTENCY);
81 REL_TEST(FR_computed_pos[i], F_expected[i], REL_TOL_CONSISTENCY);
82
83 REL_TEST(FL_computed_neg[i], F_expected[i], REL_TOL_CONSISTENCY);
84 REL_TEST(FR_computed_neg[i], F_expected[i], REL_TOL_CONSISTENCY);
85 }
86 }
87}
DualNumber< Real, DNDerivativeType, true > ADReal
virtual std::vector< ADReal > computeConservativeSolution(const std::vector< ADReal > &W, const ADReal &A) const =0
Computes the conservative solution from the primitive solution.
virtual const NumericalFlux1D & createFluxObject()=0
Creates the flux object to be tested.
virtual std::vector< ADReal > computeFluxFromPrimitive(const std::vector< ADReal > &W, const ADReal &A) const =0
Computes the 1D flux vector from the primitive solution.
virtual std::vector< std::vector< ADReal > > getPrimitiveSolutionsConsistencyTest() const =0
Gets a vector of primitive solution vectors to use for consistency test.

◆ testSymmetry()

void TestNumericalFlux1D::testSymmetry ( )
protectedinherited

Runs the symmetry test(s)

Definition at line 16 of file TestNumericalFlux1D.C.

17{
18 const auto & flux = createFluxObject();
19
20 std::set<unsigned int> flux_regions;
21
22 unsigned int i_side = 0;
23 const auto W_pairs = getPrimitiveSolutionsSymmetryTest();
24 for (const auto & W_pair : W_pairs)
25 {
26 const auto & WL = W_pair.first;
27 const auto & WR = W_pair.second;
28
29 const ADReal AL = 1.0;
30 const ADReal AR = 1.5;
31
32 const std::vector<ADReal> UL = computeConservativeSolution(WL, AL);
33 const std::vector<ADReal> UR = computeConservativeSolution(WR, AR);
34
35 const auto FLR = flux.getFlux(i_side, 0, true, UL, UR, 1.0);
36 const auto FRL = flux.getFlux(i_side, 0, false, UL, UR, 1.0);
37 i_side++;
38 flux_regions.insert(flux.getLastRegionIndex());
39
40 const auto FRL_flipped = flux.getFlux(i_side, 0, true, UR, UL, -1.0);
41 const auto FLR_flipped = flux.getFlux(i_side, 0, false, UR, UL, -1.0);
42 i_side++;
43 flux_regions.insert(flux.getLastRegionIndex());
44
45 for (unsigned int i = 0; i < FLR.size(); ++i)
46 {
47 REL_TEST(FLR[i], FLR_flipped[i], REL_TOL_CONSISTENCY);
48 REL_TEST(FRL[i], FRL_flipped[i], REL_TOL_CONSISTENCY);
49 }
50 }
51
52 // Check that all of the regions in the flux have been tested.
53 EXPECT_TRUE(flux_regions.size() == flux.getNumberOfRegions());
54}
virtual std::vector< std::pair< std::vector< ADReal >, std::vector< ADReal > > > getPrimitiveSolutionsSymmetryTest() const =0
Gets a vector of pairs of primitive solution vectors to use for symmetry test.

Member Data Documentation

◆ _fp_mix

const IdealGasMixtureFluidProperties* TestNumericalFluxGasMixBase::_fp_mix
protectedinherited

◆ _fp_mix_name

const UserObjectName TestNumericalFluxGasMixBase::_fp_mix_name
protectedinherited

Mixture fluid properties name.

Definition at line 36 of file TestNumericalFluxGasMixBase.h.

Referenced by TestNumericalFluxGasMixBase::addFluidProperties(), and createFluxObject().


The documentation for this class was generated from the following files: