14 EXPECT_EQ(_dictator->numVariables(), (
unsigned int)3);
15 EXPECT_EQ(_dictator_no_fetype->numVariables(), (
unsigned int)2);
20 EXPECT_EQ(_dictator->numPhases(), (
unsigned int)2);
21 EXPECT_EQ(_dictator_no_fetype->numPhases(), (
unsigned int)1);
26 EXPECT_EQ(_dictator->numComponents(), (
unsigned int)4);
27 EXPECT_EQ(_dictator_no_fetype->numComponents(), (
unsigned int)3);
32 EXPECT_EQ(_dictator->numAqueousEquilibrium(), (
unsigned int)5);
33 EXPECT_EQ(_dictator_no_fetype->numAqueousEquilibrium(), (
unsigned int)0);
38 EXPECT_EQ(_dictator->numAqueousKinetic(), (
unsigned int)6);
39 EXPECT_EQ(_dictator_no_fetype->numAqueousKinetic(), (
unsigned int)0);
44 EXPECT_EQ(_dictator->aqueousPhaseNumber(), (
unsigned int)1);
45 EXPECT_EQ(_dictator_no_fetype->aqueousPhaseNumber(), (
unsigned int)0);
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);
56 _dictator->porousFlowVariableNum(0);
59 catch (
const std::exception &
err)
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);
69 _dictator->porousFlowVariableNum(2);
72 catch (
const std::exception &
err)
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);
82 _dictator->porousFlowVariableNum(5);
85 catch (
const std::exception &
err)
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);
95 _dictator->porousFlowVariableNum(123);
98 catch (
const std::exception &
err)
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);
106 EXPECT_EQ(_dictator_no_fetype->porousFlowVariableNum(1), (
unsigned int)0);
107 EXPECT_EQ(_dictator_no_fetype->porousFlowVariableNum(6), (
unsigned int)1);
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);
118 _dictator->mooseVariableNum(3);
121 catch (
const std::exception &
err)
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);
129 EXPECT_EQ(_dictator_no_fetype->mooseVariableNum(0), (
unsigned int)1);
130 EXPECT_EQ(_dictator_no_fetype->mooseVariableNum(1), (
unsigned int)6);
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));
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));
157 ASSERT_TRUE(_dictator->consistentFEType());
158 ASSERT_TRUE(!_dictator_no_fetype->consistentFEType());
163 auto linear_lagrange = FEType(Utility::string_to_enum<Order>(
"FIRST"),
164 Utility::string_to_enum<FEFamily>(
"LAGRANGE"));
166 ASSERT_EQ(_dictator->feType(), linear_lagrange);
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);
181 catch (
const std::exception &
err)
184 std::string(
err.what())
186 "PorousFlowDictator: AuxVariables variables must not be coupled into the Dictator " 187 "for this is against specification #1984. Variable number 1 is an AuxVariable.");
188 ASSERT_TRUE(pos != std::string::npos);
196 InputParameters params = _factory.getValidParams(
"PorousFlowDictator");
197 params.
set<std::vector<VariableName>>(
"porous_flow_vars") = std::vector<VariableName>{
"var0"};
198 params.
set<
unsigned>(
"number_fluid_phases") = 1;
199 params.
set<
unsigned>(
"number_fluid_components") = 2;
200 params.
set<
unsigned>(
"aqueous_phase_number") = 1;
201 _fe_problem->addUserObject(
202 "PorousFlowDictator",
"dictator_with_large_aqueous_phase_number", params);
205 catch (
const std::exception &
err)
208 std::string(
err.what())
209 .find(
"PorousflowDictator: The aqueous phase number must be less than the number of " 210 "fluid phases. The Dictator does not appreciate jokes.");
211 ASSERT_TRUE(pos != std::string::npos);
TEST_F(PorousFlowDictatorTest, numVariables)
void ErrorVector unsigned int