25 #include "grins_config.h"
27 #ifdef GRINS_HAVE_CPPUNIT
29 #include <cppunit/extensions/HelperMacros.h>
30 #include <cppunit/TestCase.h>
34 #include "grins_test_paths.h"
71 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_2d.in";
77 CPPUNIT_ASSERT_EQUAL((
unsigned int)2,
_system->n_vars());
88 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_3d.in";
94 CPPUNIT_ASSERT_EQUAL((
unsigned int)3,
_system->n_vars());
105 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_2d.in";
111 CPPUNIT_ASSERT_EQUAL((
unsigned int)1,
_system->n_vars());
122 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_2d.in";
128 CPPUNIT_ASSERT_EQUAL((
unsigned int)2,
_system->n_vars());
130 const std::vector<std::string>& var_names = species_vars.
active_var_names();
139 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_3d.in";
162 CPPUNIT_ASSERT(press_base.is_constraint_var());
171 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_2d.in";
177 CPPUNIT_ASSERT_EQUAL((
unsigned int)1,
_system->n_vars());
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]);
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]);
207 CPPUNIT_ASSERT_EQUAL(1,(
int)var_names.size());
208 CPPUNIT_ASSERT_EQUAL(std::string(
"T"),var_names[0]);
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]);
220 CPPUNIT_ASSERT_EQUAL(1,(
int)var_names.size());
221 CPPUNIT_ASSERT_EQUAL(std::string(
"p"),var_names[0]);
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() );
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);
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);
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);
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);
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);
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);
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);
285 #endif // GRINS_HAVE_CPPUNIT
void test_species_mass_fracs()
virtual void init(libMesh::FEMSystem *system)
Add variables to the system.
CPPUNIT_TEST_SUITE_REGISTRATION(AntiochAirNASA9ThermoTest)
void test_species_var_names_no_order(const std::vector< std::string > &var_names)
void setup_multiphysics_system(const std::string &filename)
void test_species_var_names(const std::vector< std::string > &var_names)
void test_species_fe(const libMesh::System &system)
CPPUNIT_TEST(test_velocity_2d)
void test_vel_fe_2d(const libMesh::System &system)
virtual void init(libMesh::FEMSystem *system)
Add variables to the system.
static void check_and_register_variable(const std::string &var_name, const FEVariablesBase &variable)
First check if var_name is registered and then register.
void test_temp_var_names(const std::vector< std::string > &var_names)
void test_press_fe(const libMesh::System &system)
void test_press_var_names(const std::vector< std::string > &var_names)
void test_vel_fe_3d(const libMesh::System &system)
void test_vel_var_names_2d(const std::vector< std::string > &var_names)
void test_var_constraint_and_warehouse()
void test_vel_var_names_3d(const std::vector< std::string > &var_names)
Helper class for setting up basic GRINS::MultiphysicsSystem for unit testing.
GRINS::MultiphysicsSystem * _system
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
CPPUNIT_TEST_SUITE(VariablesTest)
const std::vector< std::string > & active_var_names() const
Return the var names that are active from this class.
libMesh::UniquePtr< GetPot > _input
void test_temp_fe(const libMesh::System &system)