Base class for reading and handling initial conditions for physics classes.
More...
#include <ic_handling_base.h>
|
| ICHandlingBase (const std::string &physics_name) |
|
virtual | ~ICHandlingBase () |
|
void | attach_initial_func (const libMesh::FunctionBase< libMesh::Number > &initial_val) |
|
virtual void | read_ic_data (const GetPot &input, const std::string &id_str, const std::string &ic_str, const std::string &var_str, const std::string &value_str) |
|
virtual void | init_ic_data (const libMesh::FEMSystem &system, libMesh::CompositeFunction< libMesh::Number > &all_ics) |
| Override this method to initialize any system-dependent data. More...
|
|
virtual int | string_to_int (const std::string &bc_type_in) const |
|
virtual void | init_ic_types (const libMesh::subdomain_id_type ic_id, const std::string &ic_id_string, const int ic_type, const std::string &ic_vars_string, const std::string &ic_value_string, const GetPot &input) |
|
libMesh::FunctionBase< libMesh::Number > * | get_ic_func () const |
|
Base class for reading and handling initial conditions for physics classes.
Definition at line 51 of file ic_handling_base.h.
GRINS::ICHandlingBase::ICHandlingBase |
( |
const std::string & |
physics_name | ) |
|
Definition at line 52 of file ic_handling_base.C.
std::string _physics_name
libMesh::AutoPtr< libMesh::FunctionBase< libMesh::Number > > _ic_func
GRINS::ICHandlingBase::~ICHandlingBase |
( |
| ) |
|
|
virtual |
void GRINS::ICHandlingBase::attach_initial_func |
( |
const libMesh::FunctionBase< libMesh::Number > & |
initial_val | ) |
|
Definition at line 65 of file ic_handling_base.C.
libMesh::AutoPtr< libMesh::FunctionBase< libMesh::Number > > _ic_func
libMesh::FunctionBase< libMesh::Number > * GRINS::ICHandlingBase::get_ic_func |
( |
| ) |
const |
|
inline |
void GRINS::ICHandlingBase::init_ic_data |
( |
const libMesh::FEMSystem & |
system, |
|
|
libMesh::CompositeFunction< libMesh::Number > & |
all_ics |
|
) |
| |
|
virtual |
Override this method to initialize any system-dependent data.
Override this method to, for example, cache a System variable number.
Definition at line 129 of file ic_handling_base.C.
References _subfunction_variables, and get_ic_func().
Referenced by GRINS::Physics::init_ics().
134 std::vector<unsigned int> index_map;
143 all_ics.attach_subfunction(*this->
get_ic_func(), index_map);
libMesh::FunctionBase< libMesh::Number > * get_ic_func() const
std::vector< std::string > _subfunction_variables
void GRINS::ICHandlingBase::init_ic_types |
( |
const libMesh::subdomain_id_type |
ic_id, |
|
|
const std::string & |
ic_id_string, |
|
|
const int |
ic_type, |
|
|
const std::string & |
ic_vars_string, |
|
|
const std::string & |
ic_value_string, |
|
|
const GetPot & |
input |
|
) |
| |
|
virtual |
Definition at line 169 of file ic_handling_base.C.
References _ic_func, _physics_name, _subfunction_variables, CONSTANT, PARSED, and GRINS::StringUtilities::split_string().
Referenced by read_ic_data().
184 _ic_func = libMesh::AutoPtr<libMesh::FunctionBase<libMesh::Number> >
185 (
new libMesh::ParsedFunction<libMesh::Number>(ic_value_string));
191 _ic_func = libMesh::AutoPtr<libMesh::FunctionBase<libMesh::Number> >
192 (
new libMesh::ConstFunction<libMesh::Number>
193 (StringUtilities::string_to_T<libMesh::Number>(ic_value_string)));
199 std::cerr <<
"=========================================================="
200 <<
"Error: Invalid IC type for " <<
_physics_name << std::endl
201 <<
" Detected IC type was " << ic_type << std::endl
202 <<
"==========================================================" << std::endl;
std::string _physics_name
libMesh::AutoPtr< libMesh::FunctionBase< libMesh::Number > > _ic_func
std::vector< std::string > _subfunction_variables
void split_string(const std::string &input, const std::string &delimiter, std::vector< std::string > &results)
void GRINS::ICHandlingBase::read_ic_data |
( |
const GetPot & |
input, |
|
|
const std::string & |
id_str, |
|
|
const std::string & |
ic_str, |
|
|
const std::string & |
var_str, |
|
|
const std::string & |
value_str |
|
) |
| |
|
virtual |
Definition at line 70 of file ic_handling_base.C.
References init_ic_types(), and string_to_int().
Referenced by GRINS::GenericICHandler::GenericICHandler().
75 int num_ids = input.vector_variable_size(id_str);
76 int num_ics = input.vector_variable_size(ic_str);
77 int num_vars = input.vector_variable_size(var_str);
78 int num_values = input.vector_variable_size(value_str);
80 if( num_ids != num_ics )
82 std::cerr <<
"Error: number of subdomain ids " << num_ids
83 <<
"must equal number of initial condition types " << num_ics
88 if( num_ids != num_vars )
90 std::cerr <<
"Error: number of subdomain ids " << num_ids
91 <<
"must equal number of variable name lists " << num_vars
96 if( num_ids != num_values )
98 std::cerr <<
"Error: number of subdomain ids " << num_ids
99 <<
"must equal number of initial condition values " << num_values
106 std::cerr <<
"Error: GRINS does not yet support per-subdomain initial conditions" << std::endl;
107 libmesh_not_implemented();
110 for(
int i = 0; i < num_ids; i++ )
112 int ic_id = input(id_str, -1, i );
113 std::string ic_type_in = input(ic_str,
"NULL", i );
114 std::string ic_value_in = input(value_str,
"NULL", i );
115 std::string ic_vars_in = input(var_str,
"NULL", i );
119 std::stringstream ss;
121 std::string ic_id_string = ss.str();
123 this->
init_ic_types( ic_id, ic_id_string, ic_type, ic_vars_in, ic_value_in, input );
virtual void init_ic_types(const libMesh::subdomain_id_type ic_id, const std::string &ic_id_string, const int ic_type, const std::string &ic_vars_string, const std::string &ic_value_string, const GetPot &input)
virtual int string_to_int(const std::string &bc_type_in) const
int GRINS::ICHandlingBase::string_to_int |
( |
const std::string & |
bc_type_in | ) |
const |
|
virtual |
Definition at line 147 of file ic_handling_base.C.
References _physics_name, CONSTANT, and PARSED.
Referenced by read_ic_data().
150 if( ic_type_in ==
"parsed" )
154 else if( ic_type_in ==
"constant" )
160 std::cerr <<
"==========================================================" << std::endl
161 <<
"Error: Invalid ic_type " << ic_type_in << std::endl
163 <<
"==========================================================" << std::endl;
std::string _physics_name
libMesh::AutoPtr<libMesh::FunctionBase<libMesh::Number> > GRINS::ICHandlingBase::_ic_func |
|
protected |
std::string GRINS::ICHandlingBase::_physics_name |
|
protected |
std::vector<std::string> GRINS::ICHandlingBase::_subfunction_variables |
|
protected |
The documentation for this class was generated from the following files: