https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Functions
PorousFlowDictatorTest.C File Reference

Go to the source code of this file.

Functions

 TEST_F (PorousFlowDictatorTest, numVariables)
 
 TEST_F (PorousFlowDictatorTest, numPhases)
 
 TEST_F (PorousFlowDictatorTest, numComponents)
 
 TEST_F (PorousFlowDictatorTest, numAqueousEquilibrium)
 
 TEST_F (PorousFlowDictatorTest, numAqueousKinetic)
 
 TEST_F (PorousFlowDictatorTest, aqueousPhaseNumber)
 
 TEST_F (PorousFlowDictatorTest, porousFlowVariableNum)
 
 TEST_F (PorousFlowDictatorTest, mooseVariableNum)
 
 TEST_F (PorousFlowDictatorTest, isPorousFlowVariable)
 
 TEST_F (PorousFlowDictatorTest, notPorousFlowVariable)
 
 TEST_F (PorousFlowDictatorTest, consistentFEType)
 
 TEST_F (PorousFlowDictatorTest, feType)
 
 TEST_F (PorousFlowDictatorTest, coupleAux)
 
 TEST_F (PorousFlowDictatorTest, largeAqueousPhase)
 

Function Documentation

◆ TEST_F() [1/14]

TEST_F ( PorousFlowDictatorTest  ,
aqueousPhaseNumber   
)

Definition at line 42 of file PorousFlowDictatorTest.C.

43{
44 EXPECT_EQ(_dictator->aqueousPhaseNumber(), (unsigned int)1);
45 EXPECT_EQ(_dictator_no_fetype->aqueousPhaseNumber(), (unsigned int)0);
46}

◆ TEST_F() [2/14]

TEST_F ( PorousFlowDictatorTest  ,
consistentFEType   
)

Definition at line 155 of file PorousFlowDictatorTest.C.

156{
157 ASSERT_TRUE(_dictator->consistentFEType());
158 ASSERT_TRUE(!_dictator_no_fetype->consistentFEType());
159}

◆ TEST_F() [3/14]

TEST_F ( PorousFlowDictatorTest  ,
coupleAux   
)

Definition at line 169 of file PorousFlowDictatorTest.C.

170{
171 try
172 {
173 InputParameters params = _factory.getValidParams("PorousFlowDictator");
174 params.set<std::vector<VariableName>>("porous_flow_vars") =
175 std::vector<VariableName>{"var3", "aux_var", "var0", "var5"};
176 params.set<unsigned>("number_fluid_phases") = 1;
177 params.set<unsigned>("number_fluid_components") = 2;
178 _fe_problem->addUserObject("PorousFlowDictator", "dictator_with_aux", params);
179 FAIL();
180 }
181 catch (const std::exception & err)
182 {
183 std::size_t pos =
184 std::string(err.what())
185 .find(
186 "PorousFlowDictator: AuxVariables variables must not be coupled into the Dictator "
187 "for this is against specification #1984. Variable 'aux_var' is either an "
188 "AuxVariable or from a different nonlinear system.");
189 ASSERT_TRUE(pos != std::string::npos);
190 }
191}
T & set(const std::string &name, bool quiet_mode=false)
OStreamProxy err(std::cerr)

◆ TEST_F() [4/14]

TEST_F ( PorousFlowDictatorTest  ,
feType   
)

Definition at line 161 of file PorousFlowDictatorTest.C.

162{
163 auto linear_lagrange = FEType(Utility::string_to_enum<Order>("FIRST"),
164 Utility::string_to_enum<FEFamily>("LAGRANGE"));
165
166 ASSERT_EQ(_dictator->feType(), linear_lagrange);
167}

◆ TEST_F() [5/14]

TEST_F ( PorousFlowDictatorTest  ,
isPorousFlowVariable   
)

Definition at line 133 of file PorousFlowDictatorTest.C.

134{
135 ASSERT_TRUE(!_dictator->isPorousFlowVariable(0));
136 ASSERT_TRUE(_dictator->isPorousFlowVariable(1));
137 ASSERT_TRUE(!_dictator->isPorousFlowVariable(2));
138 ASSERT_TRUE(_dictator->isPorousFlowVariable(3));
139 ASSERT_TRUE(_dictator->isPorousFlowVariable(4));
140 ASSERT_TRUE(!_dictator->isPorousFlowVariable(5));
141 ASSERT_TRUE(!_dictator->isPorousFlowVariable(123));
142}

◆ TEST_F() [6/14]

TEST_F ( PorousFlowDictatorTest  ,
largeAqueousPhase   
)

Definition at line 193 of file PorousFlowDictatorTest.C.

194{
195 try
196 {
197 InputParameters params = _factory.getValidParams("PorousFlowDictator");
198 params.set<std::vector<VariableName>>("porous_flow_vars") = std::vector<VariableName>{"var0"};
199 params.set<unsigned>("number_fluid_phases") = 1;
200 params.set<unsigned>("number_fluid_components") = 2;
201 params.set<unsigned>("aqueous_phase_number") = 1;
202 _fe_problem->addUserObject(
203 "PorousFlowDictator", "dictator_with_large_aqueous_phase_number", params);
204 FAIL();
205 }
206 catch (const std::exception & err)
207 {
208 std::size_t pos =
209 std::string(err.what())
210 .find("PorousflowDictator: The aqueous phase number must be less than the number of "
211 "fluid phases. The Dictator does not appreciate jokes.");
212 ASSERT_TRUE(pos != std::string::npos);
213 }
214}

◆ TEST_F() [7/14]

TEST_F ( PorousFlowDictatorTest  ,
mooseVariableNum   
)

Definition at line 110 of file PorousFlowDictatorTest.C.

111{
112 EXPECT_EQ(_dictator->mooseVariableNum(0), (unsigned int)1);
113 EXPECT_EQ(_dictator->mooseVariableNum(1), (unsigned int)4);
114 EXPECT_EQ(_dictator->mooseVariableNum(2), (unsigned int)3);
115
116 try
117 {
118 _dictator->mooseVariableNum(3);
119 FAIL();
120 }
121 catch (const std::exception & err)
122 {
123 std::size_t pos = std::string(err.what())
124 .find("The Dictator proclaims that there is no such PorousFlow variable "
125 "with number 3. Exiting with error code 1984.");
126 ASSERT_TRUE(pos != std::string::npos);
127 }
128
129 EXPECT_EQ(_dictator_no_fetype->mooseVariableNum(0), (unsigned int)1);
130 EXPECT_EQ(_dictator_no_fetype->mooseVariableNum(1), (unsigned int)6);
131}

◆ TEST_F() [8/14]

TEST_F ( PorousFlowDictatorTest  ,
notPorousFlowVariable   
)

Definition at line 144 of file PorousFlowDictatorTest.C.

145{
146 ASSERT_TRUE(_dictator->notPorousFlowVariable(0));
147 ASSERT_TRUE(!_dictator->notPorousFlowVariable(1));
148 ASSERT_TRUE(_dictator->notPorousFlowVariable(2));
149 ASSERT_TRUE(!_dictator->notPorousFlowVariable(3));
150 ASSERT_TRUE(!_dictator->notPorousFlowVariable(4));
151 ASSERT_TRUE(_dictator->notPorousFlowVariable(5));
152 ASSERT_TRUE(_dictator->notPorousFlowVariable(123));
153}

◆ TEST_F() [9/14]

TEST_F ( PorousFlowDictatorTest  ,
numAqueousEquilibrium   
)

Definition at line 30 of file PorousFlowDictatorTest.C.

31{
32 EXPECT_EQ(_dictator->numAqueousEquilibrium(), (unsigned int)5);
33 EXPECT_EQ(_dictator_no_fetype->numAqueousEquilibrium(), (unsigned int)0);
34}

◆ TEST_F() [10/14]

TEST_F ( PorousFlowDictatorTest  ,
numAqueousKinetic   
)

Definition at line 36 of file PorousFlowDictatorTest.C.

37{
38 EXPECT_EQ(_dictator->numAqueousKinetic(), (unsigned int)6);
39 EXPECT_EQ(_dictator_no_fetype->numAqueousKinetic(), (unsigned int)0);
40}

◆ TEST_F() [11/14]

TEST_F ( PorousFlowDictatorTest  ,
numComponents   
)

Definition at line 24 of file PorousFlowDictatorTest.C.

25{
26 EXPECT_EQ(_dictator->numComponents(), (unsigned int)4);
27 EXPECT_EQ(_dictator_no_fetype->numComponents(), (unsigned int)3);
28}

◆ TEST_F() [12/14]

TEST_F ( PorousFlowDictatorTest  ,
numPhases   
)

Definition at line 18 of file PorousFlowDictatorTest.C.

19{
20 EXPECT_EQ(_dictator->numPhases(), (unsigned int)2);
21 EXPECT_EQ(_dictator_no_fetype->numPhases(), (unsigned int)1);
22}

◆ TEST_F() [13/14]

TEST_F ( PorousFlowDictatorTest  ,
numVariables   
)

Definition at line 12 of file PorousFlowDictatorTest.C.

13{
14 EXPECT_EQ(_dictator->numVariables(), (unsigned int)3);
15 EXPECT_EQ(_dictator_no_fetype->numVariables(), (unsigned int)2);
16}

◆ TEST_F() [14/14]

TEST_F ( PorousFlowDictatorTest  ,
porousFlowVariableNum   
)

Definition at line 48 of file PorousFlowDictatorTest.C.

49{
50 EXPECT_EQ(_dictator->porousFlowVariableNum(1), (unsigned int)0);
51 EXPECT_EQ(_dictator->porousFlowVariableNum(4), (unsigned int)1);
52 EXPECT_EQ(_dictator->porousFlowVariableNum(3), (unsigned int)2);
53
54 try
55 {
56 _dictator->porousFlowVariableNum(0);
57 FAIL();
58 }
59 catch (const std::exception & err)
60 {
61 std::size_t pos = std::string(err.what())
62 .find("The Dictator proclaims that the moose variable with number 0 is "
63 "not a PorousFlow variable. Exiting with error code 1984.");
64 ASSERT_TRUE(pos != std::string::npos);
65 }
66
67 try
68 {
69 _dictator->porousFlowVariableNum(2);
70 FAIL();
71 }
72 catch (const std::exception & err)
73 {
74 std::size_t pos = std::string(err.what())
75 .find("The Dictator proclaims that the moose variable with number 2 is "
76 "not a PorousFlow variable. Exiting with error code 1984.");
77 ASSERT_TRUE(pos != std::string::npos);
78 }
79
80 try
81 {
82 _dictator->porousFlowVariableNum(5);
83 FAIL();
84 }
85 catch (const std::exception & err)
86 {
87 std::size_t pos = std::string(err.what())
88 .find("The Dictator proclaims that the moose variable with number 5 is "
89 "not a PorousFlow variable. Exiting with error code 1984.");
90 ASSERT_TRUE(pos != std::string::npos);
91 }
92
93 try
94 {
95 _dictator->porousFlowVariableNum(123);
96 FAIL();
97 }
98 catch (const std::exception & err)
99 {
100 std::size_t pos = std::string(err.what())
101 .find("The Dictator proclaims that the moose variable with number 123 is "
102 "not a PorousFlow variable. Exiting with error code 1984.");
103 ASSERT_TRUE(pos != std::string::npos);
104 }
105
106 EXPECT_EQ(_dictator_no_fetype->porousFlowVariableNum(1), (unsigned int)0);
107 EXPECT_EQ(_dictator_no_fetype->porousFlowVariableNum(6), (unsigned int)1);
108}