GRINS-0.8.0
List of all members | Public Member Functions | Private Member Functions
GRINSTesting::VariablesTest Class Reference
Inheritance diagram for GRINSTesting::VariablesTest:
Inheritance graph
[legend]
Collaboration diagram for GRINSTesting::VariablesTest:
Collaboration graph
[legend]

Public Member Functions

 CPPUNIT_TEST_SUITE (VariablesTest)
 
 CPPUNIT_TEST (test_variable_builder)
 
 CPPUNIT_TEST (test_var_constraint)
 
 CPPUNIT_TEST (test_variable_arbitrary_names)
 
 CPPUNIT_TEST_SUITE_END ()
 
void tearDown ()
 
void test_variable_builder ()
 
void test_var_constraint ()
 
void test_variable_arbitrary_names ()
 

Private Member Functions

void test_all_variables (const std::string &velocity_name, const std::string &temp_name, const std::string &species_name, const std::string &press_name, const std::string &single_var_name)
 
void test_vel_var_names_2d (const std::vector< std::string > &var_names)
 
void test_vel_var_names_3d (const std::vector< std::string > &var_names)
 
void test_temp_var_names (const std::vector< std::string > &var_names)
 
void test_species_var_names (const std::vector< std::string > &var_names)
 
void test_press_var_names (const std::vector< std::string > &var_names)
 
void test_species_var_names_no_order (const std::vector< std::string > &var_names)
 
void test_vel_fe_2d (const libMesh::System &system)
 
void test_vel_fe_3d (const libMesh::System &system)
 
void test_temp_fe (const libMesh::System &system)
 
void test_press_fe (const libMesh::System &system)
 
void test_species_fe (const libMesh::System &system)
 

Additional Inherited Members

- Protected Member Functions inherited from GRINSTesting::SystemHelper
void setup_multiphysics_system (const std::string &filename)
 
void reset_all ()
 
- Protected Attributes inherited from GRINSTesting::SystemHelper
libMesh::UniquePtr< GetPot > _input
 
GRINS::SharedPtr< libMesh::UnstructuredMesh > _mesh
 
libMesh::UniquePtr< libMesh::EquationSystems > _es
 
GRINS::MultiphysicsSystem_system
 

Detailed Description

Definition at line 53 of file variables.C.

Member Function Documentation

GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_variable_builder  )
GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_var_constraint  )
GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_variable_arbitrary_names  )
GRINSTesting::VariablesTest::CPPUNIT_TEST_SUITE ( VariablesTest  )
GRINSTesting::VariablesTest::CPPUNIT_TEST_SUITE_END ( )
void GRINSTesting::VariablesTest::tearDown ( )
inline

Definition at line 67 of file variables.C.

References GRINSTesting::SystemHelper::reset_all().

68  {
69  this->reset_all();
70  }
void GRINSTesting::VariablesTest::test_all_variables ( const std::string &  velocity_name,
const std::string &  temp_name,
const std::string &  species_name,
const std::string &  press_name,
const std::string &  single_var_name 
)
inlineprivate

Definition at line 129 of file variables.C.

References GRINSTesting::SystemHelper::_system, GRINS::FEVariablesBase::active_var_names(), GRINS::GRINSPrivate::VariableWarehouse::get_variable(), test_press_fe(), test_press_var_names(), test_species_fe(), test_species_var_names(), test_temp_fe(), test_temp_var_names(), test_vel_fe_2d(), and test_vel_var_names_2d().

Referenced by test_variable_arbitrary_names(), and test_variable_builder().

134  {
135  // There should be 7 variables generated from that input file
136  CPPUNIT_ASSERT_EQUAL((unsigned int)7,_system->n_vars());
137 
138  // Check Velocity variables
139  {
140  const GRINS::FEVariablesBase& vel_vars =
142 
143  const std::vector<std::string>& var_names = vel_vars.active_var_names();
144  this->test_vel_var_names_2d(var_names);
145 
146  // Verify the FE part
147  this->test_vel_fe_2d(*_system);
148  }
149 
150  // Check Temperature variables
151  {
152  const GRINS::FEVariablesBase& temp_vars =
154 
155  const std::vector<std::string>& var_names = temp_vars.active_var_names();
156  this->test_temp_var_names(var_names);
157 
158  // Verify the FE part
159  this->test_temp_fe(*_system);
160  }
161 
162  // Check SpeciesMassFractions variables
163  {
164  const GRINS::FEVariablesBase& species_vars =
166 
167  const std::vector<std::string>& var_names = species_vars.active_var_names();
168  this->test_species_var_names(var_names);
169 
170  // Verify the FE part
171  this->test_species_fe(*_system);
172  }
173 
174  // Check Pressure variable
175  {
176  const GRINS::FEVariablesBase& press_vars =
178 
179  const std::vector<std::string>& var_names = press_vars.active_var_names();
180  this->test_press_var_names(var_names);
181 
182  // Verify the FE part
183  this->test_press_fe(*_system);
184  }
185 
186  // Check Single variable
187  {
188  const GRINS::FEVariablesBase& single_var =
190 
191  const std::vector<std::string>& var_names = single_var.active_var_names();
192  CPPUNIT_ASSERT_EQUAL(1,(int)var_names.size());
193  CPPUNIT_ASSERT_EQUAL(std::string("u"),var_names[0]);
194 
195  // Verify the FE part
196  libMesh::Order order = _system->variable_type("u").order;
197  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,_system->variable_type("u").family);
198  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
199  }
200  }
void test_species_var_names(const std::vector< std::string > &var_names)
Definition: variables.C:225
void test_species_fe(const libMesh::System &system)
Definition: variables.C:283
void test_vel_fe_2d(const libMesh::System &system)
Definition: variables.C:249
void test_temp_var_names(const std::vector< std::string > &var_names)
Definition: variables.C:219
void test_press_fe(const libMesh::System &system)
Definition: variables.C:275
void test_press_var_names(const std::vector< std::string > &var_names)
Definition: variables.C:232
static FEVariablesBase & get_variable(const std::string &var_name)
void test_vel_var_names_2d(const std::vector< std::string > &var_names)
Definition: variables.C:202
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:67
const std::vector< std::string > & active_var_names() const
Return the var names that are active from this class.
void test_temp_fe(const libMesh::System &system)
Definition: variables.C:268
void GRINSTesting::VariablesTest::test_press_fe ( const libMesh::System &  system)
inlineprivate

Definition at line 275 of file variables.C.

Referenced by test_all_variables().

276  {
277  libMesh::Order order = system.variable_type("p").order;
278  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("p").family);
279  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
280  }
void GRINSTesting::VariablesTest::test_press_var_names ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 232 of file variables.C.

Referenced by test_all_variables().

233  {
234  CPPUNIT_ASSERT_EQUAL(1,(int)var_names.size());
235  CPPUNIT_ASSERT_EQUAL(std::string("p"),var_names[0]);
236  }
void GRINSTesting::VariablesTest::test_species_fe ( const libMesh::System &  system)
inlineprivate

Definition at line 283 of file variables.C.

Referenced by test_all_variables().

284  {
285  libMesh::Order order = system.variable_type("Y_N2").order;
286  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Y_N2").family);
287  CPPUNIT_ASSERT_EQUAL(GRINSEnums::SECOND,order);
288 
289  order = system.variable_type("Y_N").order;
290  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Y_N").family);
291  CPPUNIT_ASSERT_EQUAL(GRINSEnums::SECOND,order);
292  }
void GRINSTesting::VariablesTest::test_species_var_names ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 225 of file variables.C.

Referenced by test_all_variables().

226  {
227  CPPUNIT_ASSERT_EQUAL(2,(int)var_names.size());
228  CPPUNIT_ASSERT_EQUAL(std::string("Y_N2"),var_names[0]);
229  CPPUNIT_ASSERT_EQUAL(std::string("Y_N"),var_names[1]);
230  }
void GRINSTesting::VariablesTest::test_species_var_names_no_order ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 238 of file variables.C.

239  {
240  // For this one, we can't guarantee the order, so we check to
241  // make sure both the species are there.
242  CPPUNIT_ASSERT_EQUAL(2,(int)var_names.size());
243  CPPUNIT_ASSERT( std::find( var_names.begin(), var_names.end(),"Y_N2")
244  != var_names.end() );
245  CPPUNIT_ASSERT( std::find( var_names.begin(), var_names.end(),"Y_N")
246  != var_names.end() );
247  }
void GRINSTesting::VariablesTest::test_temp_fe ( const libMesh::System &  system)
inlineprivate

Definition at line 268 of file variables.C.

Referenced by test_all_variables().

269  {
270  libMesh::Order order = system.variable_type("T").order;
271  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("T").family);
272  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
273  }
void GRINSTesting::VariablesTest::test_temp_var_names ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 219 of file variables.C.

Referenced by test_all_variables().

220  {
221  CPPUNIT_ASSERT_EQUAL(1,(int)var_names.size());
222  CPPUNIT_ASSERT_EQUAL(std::string("T"),var_names[0]);
223  }
void GRINSTesting::VariablesTest::test_var_constraint ( )
inline

Definition at line 89 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::VariableBuilder::build_variables(), GRINS::GRINSPrivate::VariableWarehouse::clear(), GRINS::GRINSPrivate::VariableWarehouse::get_variable(), GRINS::FEVariablesBase::is_constraint_var(), GRINS::VariablesParsing::pressure_section(), GRINS::FEVariablesBase::set_is_constraint_var(), GRINSTesting::SystemHelper::setup_multiphysics_system(), and GRINS::VariablesParsing::velocity_section().

90  {
91  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_3d.in";
92  this->setup_multiphysics_system(filename);
93 
95 
96  const GRINS::FEVariablesBase& vel_vars =
98 
99  GRINS::FEVariablesBase& press_vars =
101  press_vars.set_is_constraint_var(true);
102 
103  CPPUNIT_ASSERT(!vel_vars.is_constraint_var());
104  CPPUNIT_ASSERT(press_vars.is_constraint_var());
105 
106  // Clear out the VariableWarehouse so it doesn't interfere with other tests.
108  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
static std::string velocity_section()
static FEVariablesBase & get_variable(const std::string &var_name)
static void build_variables(const GetPot &input, MultiphysicsSystem &system)
static std::string pressure_section()
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:67
static void clear()
Clears the var_map()
bool is_constraint_var() const
void set_is_constraint_var(bool is_constraint_var)
Set whether or not this is a "constraint" variable.
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:62
void GRINSTesting::VariablesTest::test_variable_arbitrary_names ( )
inline

Definition at line 110 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::VariableBuilder::build_variables(), GRINS::GRINSPrivate::VariableWarehouse::clear(), GRINSTesting::SystemHelper::setup_multiphysics_system(), and test_all_variables().

111  {
112  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_arbitrary_names.in";
113  this->setup_multiphysics_system(filename);
114 
116 
117  this->test_all_variables( "MySpeed",
118  "TestingIsSoHot",
119  "MassFractions",
120  "SoMuchPressure",
121  "ForeverAlone" );
122 
123  // Clear out the VariableWarehouse so it doesn't interfere with other tests.
125  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void test_all_variables(const std::string &velocity_name, const std::string &temp_name, const std::string &species_name, const std::string &press_name, const std::string &single_var_name)
Definition: variables.C:129
static void build_variables(const GetPot &input, MultiphysicsSystem &system)
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:67
static void clear()
Clears the var_map()
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:62
void GRINSTesting::VariablesTest::test_variable_builder ( )
inline

Definition at line 72 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::VariableBuilder::build_variables(), GRINS::GRINSPrivate::VariableWarehouse::clear(), GRINS::VariablesParsing::pressure_section(), GRINSTesting::SystemHelper::setup_multiphysics_system(), GRINS::VariablesParsing::single_var_section(), GRINS::VariablesParsing::species_mass_fractions_section(), GRINS::VariablesParsing::temperature_section(), test_all_variables(), and GRINS::VariablesParsing::velocity_section().

73  {
74  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_2d.in";
75  this->setup_multiphysics_system(filename);
76 
78 
84 
85  // Clear out the VariableWarehouse so it doesn't interfere with other tests.
87  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
static std::string temperature_section()
void test_all_variables(const std::string &velocity_name, const std::string &temp_name, const std::string &species_name, const std::string &press_name, const std::string &single_var_name)
Definition: variables.C:129
static std::string velocity_section()
static std::string species_mass_fractions_section()
static void build_variables(const GetPot &input, MultiphysicsSystem &system)
static std::string pressure_section()
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:67
static std::string single_var_section()
static void clear()
Clears the var_map()
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:62
void GRINSTesting::VariablesTest::test_vel_fe_2d ( const libMesh::System &  system)
inlineprivate

Definition at line 249 of file variables.C.

Referenced by test_all_variables(), and test_vel_fe_3d().

250  {
251  libMesh::Order order = system.variable_type("Ux").order;
252  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Ux").family);
253  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
254 
255  order = system.variable_type("Uy").order;
256  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Uy").family);
257  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
258  }
void GRINSTesting::VariablesTest::test_vel_fe_3d ( const libMesh::System &  system)
inlineprivate

Definition at line 260 of file variables.C.

References test_vel_fe_2d().

261  {
262  this->test_vel_fe_2d(system);
263  libMesh::Order order = system.variable_type("Uz").order;
264  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Uz").family);
265  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
266  }
void test_vel_fe_2d(const libMesh::System &system)
Definition: variables.C:249
void GRINSTesting::VariablesTest::test_vel_var_names_2d ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 202 of file variables.C.

Referenced by test_all_variables().

203  {
204  // For 2-D, we should only have 2 components
205  CPPUNIT_ASSERT_EQUAL(2,(int)var_names.size());
206  CPPUNIT_ASSERT_EQUAL(std::string("Ux"),var_names[0]);
207  CPPUNIT_ASSERT_EQUAL(std::string("Uy"),var_names[1]);
208  }
void GRINSTesting::VariablesTest::test_vel_var_names_3d ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 210 of file variables.C.

211  {
212  // For 3-D, we should have 3 components
213  CPPUNIT_ASSERT_EQUAL(3,(int)var_names.size());
214  CPPUNIT_ASSERT_EQUAL(std::string("Ux"),var_names[0]);
215  CPPUNIT_ASSERT_EQUAL(std::string("Uy"),var_names[1]);
216  CPPUNIT_ASSERT_EQUAL(std::string("Uz"),var_names[2]);
217  }

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

Generated on Tue Dec 19 2017 12:47:33 for GRINS-0.8.0 by  doxygen 1.8.9.1