GRINS-0.7.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_velocity_2d)
 
 CPPUNIT_TEST (test_velocity_3d)
 
 CPPUNIT_TEST (test_temp)
 
 CPPUNIT_TEST (test_species_mass_fracs)
 
 CPPUNIT_TEST (test_pressure)
 
 CPPUNIT_TEST (test_var_constraint_and_warehouse)
 
 CPPUNIT_TEST_SUITE_END ()
 
void tearDown ()
 
void test_velocity_2d ()
 
void test_velocity_3d ()
 
void test_temp ()
 
void test_species_mass_fracs ()
 
void test_var_constraint_and_warehouse ()
 
void test_pressure ()
 

Private Member Functions

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 47 of file variables.C.

Member Function Documentation

GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_velocity_2d  )
GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_velocity_3d  )
GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_temp  )
GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_species_mass_fracs  )
GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_pressure  )
GRINSTesting::VariablesTest::CPPUNIT_TEST ( test_var_constraint_and_warehouse  )
GRINSTesting::VariablesTest::CPPUNIT_TEST_SUITE ( VariablesTest  )
GRINSTesting::VariablesTest::CPPUNIT_TEST_SUITE_END ( )
void GRINSTesting::VariablesTest::tearDown ( )
inline

Definition at line 64 of file variables.C.

References GRINSTesting::SystemHelper::reset_all().

65  {
66  this->reset_all();
67  }
void GRINSTesting::VariablesTest::test_press_fe ( const libMesh::System &  system)
inlineprivate

Definition at line 261 of file variables.C.

Referenced by test_pressure().

262  {
263  libMesh::Order order = system.variable_type("p").order;
264  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("p").family);
265  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
266  }
void GRINSTesting::VariablesTest::test_press_var_names ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 218 of file variables.C.

Referenced by test_pressure().

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

Definition at line 169 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::FEVariablesBase::active_var_names(), GRINS::SingleFETypeVariable::init(), GRINSTesting::SystemHelper::setup_multiphysics_system(), test_press_fe(), and test_press_var_names().

170  {
171  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_2d.in";
172  this->setup_multiphysics_system(filename);
173 
174  // This will add the variables to the system
175  GRINS::PressureFEVariable press_vars(*_input,"PhysicsNameIsDUMMYForThisTest");
176  press_vars.init(_system);
177  CPPUNIT_ASSERT_EQUAL((unsigned int)1,_system->n_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  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void test_press_fe(const libMesh::System &system)
Definition: variables.C:261
void test_press_var_names(const std::vector< std::string > &var_names)
Definition: variables.C:218
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:63
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58
void GRINSTesting::VariablesTest::test_species_fe ( const libMesh::System &  system)
inlineprivate

Definition at line 269 of file variables.C.

Referenced by test_species_mass_fracs().

270  {
271  libMesh::Order order = system.variable_type("Y_N2").order;
272  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Y_N2").family);
273  CPPUNIT_ASSERT_EQUAL(GRINSEnums::SECOND,order);
274 
275  order = system.variable_type("Y_N").order;
276  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Y_N").family);
277  CPPUNIT_ASSERT_EQUAL(GRINSEnums::SECOND,order);
278  }
void GRINSTesting::VariablesTest::test_species_mass_fracs ( )
inline

Definition at line 120 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::FEVariablesBase::active_var_names(), GRINS::SingleFETypeVariable::init(), GRINSTesting::SystemHelper::setup_multiphysics_system(), test_species_fe(), and test_species_var_names().

121  {
122  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_2d.in";
123  this->setup_multiphysics_system(filename);
124 
125  // This will add the variables to the system
126  GRINS::SpeciesMassFractionsFEVariables species_vars(*_input,"TestSpeciesMassFractionsVariables");
127  species_vars.init(_system);
128  CPPUNIT_ASSERT_EQUAL((unsigned int)2,_system->n_vars());
129 
130  const std::vector<std::string>& var_names = species_vars.active_var_names();
131  this->test_species_var_names(var_names);
132 
133  // Verify the FE part
134  this->test_species_fe(*_system);
135  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void test_species_var_names(const std::vector< std::string > &var_names)
Definition: variables.C:211
void test_species_fe(const libMesh::System &system)
Definition: variables.C:269
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:63
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58
void GRINSTesting::VariablesTest::test_species_var_names ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 211 of file variables.C.

Referenced by test_species_mass_fracs().

212  {
213  CPPUNIT_ASSERT_EQUAL(2,(int)var_names.size());
214  CPPUNIT_ASSERT_EQUAL(std::string("Y_N2"),var_names[0]);
215  CPPUNIT_ASSERT_EQUAL(std::string("Y_N"),var_names[1]);
216  }
void GRINSTesting::VariablesTest::test_species_var_names_no_order ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 224 of file variables.C.

225  {
226  // For this one, we can't guarantee the order, so we check to
227  // make sure both the species are there.
228  CPPUNIT_ASSERT_EQUAL(2,(int)var_names.size());
229  CPPUNIT_ASSERT( std::find( var_names.begin(), var_names.end(),"Y_N2")
230  != var_names.end() );
231  CPPUNIT_ASSERT( std::find( var_names.begin(), var_names.end(),"Y_N")
232  != var_names.end() );
233  }
void GRINSTesting::VariablesTest::test_temp ( )
inline

Definition at line 103 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::FEVariablesBase::active_var_names(), GRINS::SingleFETypeVariable::init(), GRINSTesting::SystemHelper::setup_multiphysics_system(), test_temp_fe(), and test_temp_var_names().

104  {
105  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_2d.in";
106  this->setup_multiphysics_system(filename);
107 
108  // This will add the variables to the system
109  GRINS::PrimitiveTempFEVariables temp_vars(*_input,"PhysicsNameIsDUMMYForThisTest");
110  temp_vars.init(_system);
111  CPPUNIT_ASSERT_EQUAL((unsigned int)1,_system->n_vars());
112 
113  const std::vector<std::string>& var_names = temp_vars.active_var_names();
114  this->test_temp_var_names(var_names);
115 
116  // Verify the FE part
117  this->test_temp_fe(*_system);
118  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void test_temp_var_names(const std::vector< std::string > &var_names)
Definition: variables.C:205
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:63
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58
void test_temp_fe(const libMesh::System &system)
Definition: variables.C:254
void GRINSTesting::VariablesTest::test_temp_fe ( const libMesh::System &  system)
inlineprivate

Definition at line 254 of file variables.C.

Referenced by test_temp().

255  {
256  libMesh::Order order = system.variable_type("T").order;
257  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("T").family);
258  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
259  }
void GRINSTesting::VariablesTest::test_temp_var_names ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 205 of file variables.C.

Referenced by test_temp().

206  {
207  CPPUNIT_ASSERT_EQUAL(1,(int)var_names.size());
208  CPPUNIT_ASSERT_EQUAL(std::string("T"),var_names[0]);
209  }
void GRINSTesting::VariablesTest::test_var_constraint_and_warehouse ( )
inline

Definition at line 137 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::GRINSPrivate::VariableWarehouse::check_and_register_variable(), GRINS::GRINSPrivate::VariableWarehouse::clear(), GRINS::GRINSPrivate::VariableWarehouse::get_variable(), GRINS::VelocityFEVariables::init(), GRINS::SingleFETypeVariable::init(), GRINS::FEVariablesBase::is_constraint_var(), GRINS::GRINSPrivate::VariableWarehouse::register_variable(), and GRINSTesting::SystemHelper::setup_multiphysics_system().

138  {
139  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_3d.in";
140  this->setup_multiphysics_system(filename);
141 
142  GRINS::VelocityFEVariables vel_vars(*_input,"PhysicsNameIsDUMMYForThisTest");
143  GRINS::PressureFEVariable press_vars(*_input,"PhysicsNameIsDUMMYForThisTest",true /*is_constraint_variable*/ );
144 
147 
148  // This should not throw an error
151 
152  vel_vars.init(_system);
153  press_vars.init(_system);
154 
155  {
156  const GRINS::FEVariablesBase& vel_base =
158  CPPUNIT_ASSERT(!vel_base.is_constraint_var());
159 
160  const GRINS::FEVariablesBase& press_base =
162  CPPUNIT_ASSERT(press_base.is_constraint_var());
163  }
164 
165  // Clear out the VariableWarehouse so it doesn't interfere with other tests.
167  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
static void check_and_register_variable(const std::string &var_name, const FEVariablesBase &variable)
First check if var_name is registered and then register.
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:63
static void register_variable(const std::string &var_name, const FEVariablesBase &variable)
static void clear()
Clears the var_map()
static const FEVariablesBase & get_variable(const std::string &var_name)
bool is_constraint_var() const
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58
void GRINSTesting::VariablesTest::test_vel_fe_2d ( const libMesh::System &  system)
inlineprivate

Definition at line 235 of file variables.C.

Referenced by test_vel_fe_3d(), and test_velocity_2d().

236  {
237  libMesh::Order order = system.variable_type("Ux").order;
238  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Ux").family);
239  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
240 
241  order = system.variable_type("Uy").order;
242  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Uy").family);
243  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
244  }
void GRINSTesting::VariablesTest::test_vel_fe_3d ( const libMesh::System &  system)
inlineprivate

Definition at line 246 of file variables.C.

References test_vel_fe_2d().

Referenced by test_velocity_3d().

247  {
248  this->test_vel_fe_2d(system);
249  libMesh::Order order = system.variable_type("Uz").order;
250  CPPUNIT_ASSERT_EQUAL(GRINSEnums::LAGRANGE,system.variable_type("Uz").family);
251  CPPUNIT_ASSERT_EQUAL(GRINSEnums::FIRST,order);
252  }
void test_vel_fe_2d(const libMesh::System &system)
Definition: variables.C:235
void GRINSTesting::VariablesTest::test_vel_var_names_2d ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 188 of file variables.C.

Referenced by test_velocity_2d().

189  {
190  // For 2-D, we should only have 2 components
191  CPPUNIT_ASSERT_EQUAL(2,(int)var_names.size());
192  CPPUNIT_ASSERT_EQUAL(std::string("Ux"),var_names[0]);
193  CPPUNIT_ASSERT_EQUAL(std::string("Uy"),var_names[1]);
194  }
void GRINSTesting::VariablesTest::test_vel_var_names_3d ( const std::vector< std::string > &  var_names)
inlineprivate

Definition at line 196 of file variables.C.

Referenced by test_velocity_3d().

197  {
198  // For 3-D, we should have 3 components
199  CPPUNIT_ASSERT_EQUAL(3,(int)var_names.size());
200  CPPUNIT_ASSERT_EQUAL(std::string("Ux"),var_names[0]);
201  CPPUNIT_ASSERT_EQUAL(std::string("Uy"),var_names[1]);
202  CPPUNIT_ASSERT_EQUAL(std::string("Uz"),var_names[2]);
203  }
void GRINSTesting::VariablesTest::test_velocity_2d ( )
inline

Definition at line 69 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::FEVariablesBase::active_var_names(), GRINS::VelocityFEVariables::init(), GRINSTesting::SystemHelper::setup_multiphysics_system(), test_vel_fe_2d(), and test_vel_var_names_2d().

70  {
71  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_2d.in";
72  this->setup_multiphysics_system(filename);
73 
74  // This will add the variables to the system
75  GRINS::VelocityFEVariables vel_vars(*_input,"PhysicsNameIsDUMMYForThisTest");
76  vel_vars.init(_system);
77  CPPUNIT_ASSERT_EQUAL((unsigned int)2,_system->n_vars());
78 
79  const std::vector<std::string>& var_names = vel_vars.active_var_names();
80  this->test_vel_var_names_2d(var_names);
81 
82  // Verify the FE part
83  this->test_vel_fe_2d(*_system);
84  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void test_vel_fe_2d(const libMesh::System &system)
Definition: variables.C:235
void test_vel_var_names_2d(const std::vector< std::string > &var_names)
Definition: variables.C:188
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:63
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58
void GRINSTesting::VariablesTest::test_velocity_3d ( )
inline

Definition at line 86 of file variables.C.

References GRINSTesting::SystemHelper::_input, GRINSTesting::SystemHelper::_system, GRINS::FEVariablesBase::active_var_names(), GRINS::VelocityFEVariables::init(), GRINSTesting::SystemHelper::setup_multiphysics_system(), test_vel_fe_3d(), and test_vel_var_names_3d().

87  {
88  std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_3d.in";
89  this->setup_multiphysics_system(filename);
90 
91  // This will add the variables to the system
92  GRINS::VelocityFEVariables vel_vars(*_input,"PhysicsNameIsDUMMYForThisTest");
93  vel_vars.init(_system);
94  CPPUNIT_ASSERT_EQUAL((unsigned int)3,_system->n_vars());
95 
96  const std::vector<std::string>& var_names = vel_vars.active_var_names();
97  this->test_vel_var_names_3d(var_names);
98 
99  // Verify the FE part
100  this->test_vel_fe_3d(*_system);
101  }
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
void test_vel_fe_3d(const libMesh::System &system)
Definition: variables.C:246
void test_vel_var_names_3d(const std::vector< std::string > &var_names)
Definition: variables.C:196
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:63
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:58

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

Generated on Thu Jun 2 2016 21:52:33 for GRINS-0.7.0 by  doxygen 1.8.10