43 #if GRINS_HAVE_ANTIOCH
47 #if GRINS_HAVE_CANTERA
52 #include "libmesh/parsed_function.h"
68 std::string qoi_list = input(
"QoI/enabled_qois",
"none" );
70 std::vector<std::string> qoi_names;
72 if( qoi_list != std::string(
"none") )
79 if( !qoi_names.empty() )
81 for( std::vector<std::string>::const_iterator name = qoi_names.begin();
82 name != qoi_names.end(); ++name )
84 this->
add_qoi( input, *name, qois );
89 if( input(
"screen-options/echo_qoi",
false ) )
98 void QoIFactory::add_qoi(
const GetPot& input,
const std::string& qoi_name, SharedPtr<CompositeQoI>& qois )
129 std::string
function;
130 if (input.have_variable(
"QoI/IntegratedFunction/function"))
131 function = input(
"QoI/IntegratedFunction/function",
"");
133 libmesh_error_msg(
"ERROR: Could not find function to integrate");
135 unsigned int p_level = input(
"QoI/IntegratedFunction/quadrature_level", 2);
144 std::string material;
145 this->get_var_value<std::string>(input,material,
"QoI/SpectroscopicAbsorption/material",
"NoMaterial!");
147 std::string hitran_data;
148 this->get_var_value<std::string>(input,hitran_data,
"QoI/SpectroscopicAbsorption/hitran_data_file",
"");
150 std::string hitran_partition;
151 this->get_var_value<std::string>(input,hitran_partition,
"QoI/SpectroscopicAbsorption/hitran_partition_function_file",
"");
153 libMesh::Real T_min,T_max,T_step;
154 std::string partition_temp_var =
"QoI/SpectroscopicAbsorption/partition_temperatures";
155 if (input.have_variable(partition_temp_var))
157 T_min = input(partition_temp_var, 0.0, 0);
158 T_max = input(partition_temp_var, 0.0, 1);
159 T_step = input(partition_temp_var, 0.0, 2);
162 libmesh_error_msg(
"ERROR: Could not find tenmperature range specification for partition functions: "+partition_temp_var+
" 'T_min T_max T_step'");
164 SharedPtr<HITRAN> hitran(
new HITRAN(hitran_data,hitran_partition,T_min,T_max,T_step) );
167 this->get_var_value<std::string>(input,species,
"QoI/SpectroscopicAbsorption/species_of_interest",
"");
169 SharedPtr<FEMFunctionAndDerivativeBase<libMesh::Real> > absorb;
171 libMesh::Real thermo_pressure = -1.0;
172 bool calc_thermo_pressure = input(
"QoI/SpectroscopicAbsorption/calc_thermo_pressure",
false );
173 if (!calc_thermo_pressure)
174 thermo_pressure = input(
"Materials/"+material+
"/ThermodynamicPressure/value", 0.0 );
176 libMesh::Real nu_desired;
177 this->get_var_value<libMesh::Real>(input,nu_desired,
"QoI/SpectroscopicAbsorption/desired_wavenumber",0.0);
179 libMesh::Real nu_min;
180 this->get_var_value<libMesh::Real>(input,nu_min,
"QoI/SpectroscopicAbsorption/min_wavenumber",0.0);
182 libMesh::Real nu_max;
183 this->get_var_value<libMesh::Real>(input,nu_max,
"QoI/SpectroscopicAbsorption/max_wavenumber",0.0);
187 #if GRINS_HAVE_ANTIOCH
188 libMesh::UniquePtr<AntiochChemistry> chem_ptr;
190 SharedPtr<AntiochChemistry> chem(chem_ptr.release());
193 #elif GRINS_HAVE_CANTERA
194 libMesh::UniquePtr<CanteraMixture> chem_ptr;
196 SharedPtr<CanteraMixture> chem(chem_ptr.release());
200 libmesh_error_msg(
"ERROR: GRINS must be built with either Antioch or Cantera to use the SpectroscopicAbsorption QoI");
208 libMesh::err <<
"Error: Invalid QoI name " << qoi_name << std::endl;
214 qois->add_qoi( *qoi );
220 const std::string& qoi_name )
222 int num_physics = input.vector_variable_size(
"Physics/enabled_physics");
225 libmesh_assert(num_physics > 0);
227 std::set<std::string> requested_physics;
228 std::set<std::string> required_physics;
231 for(
int i = 0; i < num_physics; i++ )
233 requested_physics.insert( input(
"Physics/enabled_physics",
"NULL", i ) );
251 std::cout <<
"==========================================================" << std::endl
252 <<
"List of Enabled QoIs:" << std::endl;
254 for(
unsigned int q = 0; q < qois->n_qois(); q++ )
256 std::cout << qois->get_qoi(q).name() << std::endl;
259 std::cout <<
"==========================================================" << std::endl;
265 const std::set<std::string>& required_physics,
266 const std::string& qoi_name )
268 bool physics_found =
false;
269 for( std::set<std::string>::const_iterator name = required_physics.begin();
270 name != required_physics.end();
273 if( requested_physics.find( (*name) ) != requested_physics.end() )
274 physics_found =
true;
284 const std::set<std::string>& required_physics )
286 libMesh::err <<
"================================================================" << std::endl
287 <<
"QoI " << qoi_name << std::endl
288 <<
"requires one of the following physics which were not found:" <<std::endl;
290 for( std::set<std::string>::const_iterator name = required_physics.begin();
291 name != required_physics.end();
294 libMesh::err << *name << std::endl;
297 libMesh::err <<
"================================================================" << std::endl;
305 if (input.have_variable(input_var))
306 value = input(input_var, default_value);
308 libmesh_error_msg(
"ERROR: Could not find required input parameter: "+input_var);
311 template void QoIFactory::get_var_value<std::string>(
const GetPot &, std::string &, std::string, std::string);
312 template void QoIFactory::get_var_value<libMesh::Real>(
const GetPot &, libMesh::Real &, std::string, libMesh::Real);
virtual SharedPtr< CompositeQoI > build(const GetPot &input)
static PhysicsName heat_transfer()
virtual void check_qoi_physics_consistency(const GetPot &input, const std::string &qoi_name)
void consistency_error_msg(const std::string &qoi_name, const std::set< std::string > &required_physics)
const std::string spectroscopic_absorption
static PhysicsName low_mach_navier_stokes()
const std::string avg_nusselt
const std::string vorticity
const std::string integrated_function
void get_var_value(const GetPot &input, T &value, std::string input_var, T default_value)
Helper function to read a required value from the input file, or error if value is missing...
QoI class for absorption calculations using the Beer-Lambert Law.
Evaluates the Beer-Lambert Law at a given point in space.
const std::string weighted_flux
const std::string parsed_boundary
void build_chemistry(const GetPot &input, const std::string &material, libMesh::UniquePtr< ChemistryType > &chem_ptr)
void split_string(const std::string &input, const std::string &delimiter, std::vector< std::string > &results)
const std::string parsed_interior
virtual void echo_qoi_list(SharedPtr< CompositeQoI > &qois)
void consistency_helper(const std::set< std::string > &requested_physics, const std::set< std::string > &required_physics, const std::string &qoi_name)
virtual void add_qoi(const GetPot &input, const std::string &qoi_name, SharedPtr< CompositeQoI > &qois)