33 template<
class NumericType>
35 :
libMesh::FEMFunctionBase<NumericType>()
37 if( input.have_variable(
"vis-options/output_vars") )
40 std::cerr <<
"================================================================================" << std::endl
41 <<
"WARNING: Detected input variable 'vis-options/output_vars." << std::endl
42 <<
"WARNING: THIS IS OUTDATED. output_vars is now input within" << std::endl
43 <<
"WARNING: each Physics section." << std::endl
44 <<
" Erroring out to make you aware." << std::endl
45 <<
"================================================================================" << std::endl;
51 template<
class NumericType>
57 template<
class NumericType>
61 if( _quantity_name_index_map.find(name) != _quantity_name_index_map.end() )
63 std::cerr <<
"Error: trying to add existing quantity: " << name << std::endl;
70 unsigned int new_index = _quantity_name_index_map.size()+1;
72 _quantity_name_index_map.insert( std::make_pair( name, new_index ) );
77 template<
class NumericType>
79 libMesh::EquationSystems& equation_systems )
82 if( !_quantity_name_index_map.empty() )
85 _multiphysics_sys = &system;
87 libMesh::System& output_system = equation_systems.add_system<libMesh::System>(
"interior_output");
89 for( std::map<std::string, unsigned int>::const_iterator it = _quantity_name_index_map.begin();
90 it != _quantity_name_index_map.end();
93 unsigned int var = output_system.add_variable( it->first, libMesh::FIRST );
94 _quantity_index_var_map.insert( std::make_pair(var,it->second) );
101 template<
class NumericType>
105 if( !_quantity_name_index_map.empty() )
107 libMesh::System& output_system = equation_systems.get_system<libMesh::System>(
"interior_output");
108 output_system.project_solution(
this);
115 template<
class NumericType>
117 unsigned int component,
118 const libMesh::Point& p,
123 if(context.has_elem() && _multiphysics_context->has_elem())
125 if( &(context.get_elem()) != &(_multiphysics_context->get_elem()) )
127 _multiphysics_context->pre_fe_reinit(*_multiphysics_sys,&context.get_elem());
128 _multiphysics_context->elem_fe_reinit();
131 else if( !context.has_elem() && _multiphysics_context->has_elem() )
134 _multiphysics_context->pre_fe_reinit(*_multiphysics_sys,NULL);
135 _multiphysics_context->elem_fe_reinit();
137 else if( context.has_elem() && !_multiphysics_context->has_elem() )
139 _multiphysics_context->pre_fe_reinit(*_multiphysics_sys,&context.get_elem());
140 _multiphysics_context->elem_fe_reinit();
146 libMesh::Real value = 0.0;
149 libmesh_assert(_quantity_index_var_map.find(component) != _quantity_index_var_map.end());
150 unsigned int quantity_index = _quantity_index_var_map.find(component)->second;
152 _multiphysics_sys->compute_postprocessed_quantity( quantity_index,
153 *(this->_multiphysics_context),
159 template<
class NumericType>
164 for(
typename std::map<VariableIndex,unsigned int>::const_iterator it = _quantity_index_var_map.begin();
165 it != _quantity_index_var_map.end(); it++ )
167 libMesh::FEBase* elem_fe = NULL;
168 context.get_element_fe( it->first, elem_fe );
174 libMesh::FEBase* side_fe = NULL;
175 context.get_side_fe( it->first, side_fe );
183 _multiphysics_context.reset(
new AssemblyContext( *_multiphysics_sys ) );
184 _multiphysics_sys->init_context(*_multiphysics_context);
188 template<
class NumericType>
190 const libMesh::Real time,
191 libMesh::DenseVector<NumericType>& output )
193 for(
unsigned int i = 0; i != output.size(); i++ )
195 output(i) = this->component(context,i,p,time);
200 template<
class NumericType>
202 const libMesh::Point&,
203 const libMesh::Real )
unsigned int register_quantity(std::string name)
Register quantity to be postprocessed.
virtual void initialize(MultiphysicsSystem &system, libMesh::EquationSystems &equation_systems)
virtual NumericType operator()(const libMesh::FEMContext &context, const libMesh::Point &p, const libMesh::Real time=0.)
Interface with libMesh for solving Multiphysics problems.
virtual NumericType component(const libMesh::FEMContext &context, unsigned int i, const libMesh::Point &p, libMesh::Real time=0.)
virtual ~PostProcessedQuantities()
virtual void init_context(const libMesh::FEMContext &context)
virtual void update_quantities(libMesh::EquationSystems &equation_systems)
PostProcessedQuantities()