25 #include "grins_config.h"
27 #ifdef GRINS_HAVE_CPPUNIT
29 #include <libmesh/ignore_warnings.h>
30 #include <cppunit/extensions/HelperMacros.h>
31 #include <cppunit/TestCase.h>
32 #include <libmesh/restore_warnings.h>
36 #include "grins_test_paths.h"
49 #include <libmesh/ignore_warnings.h>
74 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_2d.in";
91 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_3d.in";
112 std::string filename = std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+
"/variables_arbitrary_names.in";
130 const std::string& temp_name,
131 const std::string& species_name,
132 const std::string& press_name,
133 const std::string& single_var_name )
136 CPPUNIT_ASSERT_EQUAL((
unsigned int)7,
_system->n_vars());
167 const std::vector<std::string>& var_names = species_vars.
active_var_names();
192 CPPUNIT_ASSERT_EQUAL(1,(
int)var_names.size());
193 CPPUNIT_ASSERT_EQUAL(std::string(
"u"),var_names[0]);
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);
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]);
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]);
221 CPPUNIT_ASSERT_EQUAL(1,(
int)var_names.size());
222 CPPUNIT_ASSERT_EQUAL(std::string(
"T"),var_names[0]);
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]);
234 CPPUNIT_ASSERT_EQUAL(1,(
int)var_names.size());
235 CPPUNIT_ASSERT_EQUAL(std::string(
"p"),var_names[0]);
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() );
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);
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);
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);
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);
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);
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);
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);
299 #endif // GRINS_HAVE_CPPUNIT
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)
CPPUNIT_TEST(test_variable_builder)
void test_species_var_names(const std::vector< std::string > &var_names)
void test_species_fe(const libMesh::System &system)
static std::string temperature_section()
void test_vel_fe_2d(const libMesh::System &system)
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_variable_arbitrary_names()
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)
static std::string velocity_section()
static FEVariablesBase & get_variable(const std::string &var_name)
void test_variable_builder()
static std::string species_mass_fractions_section()
void test_vel_var_names_2d(const std::vector< std::string > &var_names)
static void build_variables(const GetPot &input, MultiphysicsSystem &system)
static std::string pressure_section()
void test_vel_var_names_3d(const std::vector< std::string > &var_names)
void test_var_constraint()
Helper class for setting up basic GRINS::MultiphysicsSystem for unit testing.
GRINS::MultiphysicsSystem * _system
static std::string single_var_section()
static void clear()
Clears the var_map()
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.
void set_is_constraint_var(bool is_constraint_var)
Set whether or not this is a "constraint" variable.
libMesh::UniquePtr< GetPot > _input
void test_temp_fe(const libMesh::System &system)