33 #include "libmesh/composite_function.h"
34 #include "libmesh/getpot.h"
35 #include "libmesh/parameter_multipointer.h"
41 const std::string& name,
42 const unsigned int number )
43 : FEMSystem(es, name, number),
44 _use_numerical_jacobians_only(false)
63 this->verify_analytic_jacobians = input(
"linear-nonlinear-solver/verify_analytic_jacobians", 0.0 );
64 this->print_solution_norms = input(
"screen-options/print_solution_norms",
false );
65 this->print_solutions = input(
"screen-options/print_solutions",
false );
66 this->print_residual_norms = input(
"screen-options/print_residual_norms",
false );
70 this->print_residuals = input(
"screen-options/print_residual",
false );
71 if (this->print_residuals)
74 this->print_residuals = input(
"screen-options/print_residuals", this->print_residuals );
75 this->print_jacobian_norms = input(
"screen-options/print_jacobian_norms",
false );
76 this->print_jacobians = input(
"screen-options/print_jacobians",
false );
77 this->print_element_solutions = input(
"screen-options/print_element_solutions",
false );
78 this->print_element_residuals = input(
"screen-options/print_element_residuals",
false );
79 this->print_element_jacobians = input(
"screen-options/print_element_jacobians",
false );
83 numerical_jacobian_h =
84 input(
"linear-nonlinear-solver/numerical_jacobian_h",
85 numerical_jacobian_h);
93 use_fixed_solution =
true;
104 (physics_iter->second)->init_variables(
this );
112 (physics_iter->second)->set_time_evolving_vars(
this );
118 (
_physics_list.begin()->second)->set_is_steady((this->time_solver)->is_steady());
126 (physics_iter->second)->init_bcs(
this );
130 libMesh::FEMSystem::init_data();
140 (physics_iter->second)->init_ics(
this, ic_function );
143 if (ic_function.n_subfunctions())
145 this->project_solution(&ic_function);
153 (physics_iter->second)->auxiliary_init( *
this );
163 libMesh::AutoPtr<libMesh::DiffContext> ap(context);
165 libMesh::DifferentiablePhysics* phys = libMesh::FEMSystem::get_physics();
167 libmesh_assert(phys);
170 context->set_mesh_system(phys->get_mesh_system());
171 context->set_mesh_x_var(phys->get_mesh_x_var());
172 context->set_mesh_y_var(phys->get_mesh_y_var());
173 context->set_mesh_z_var(phys->get_mesh_z_var());
175 ap->set_deltat_pointer( &deltat );
178 ap->is_adjoint() = this->get_time_solver().is_adjoint();
197 (
const std::string & param_name,
202 physics_iter != _physics_list.end();
205 (physics_iter->second)->register_parameter( param_name,
214 AssemblyContext& c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
229 libMesh::DiffContext& context,
231 CacheFuncType cachefunc)
233 AssemblyContext& c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
235 bool compute_jacobian =
true;
246 ((*(physics_iter->second)).*cachefunc)( c, cache );
256 if( (physics_iter->second)->enabled_on_elem( &c.get_elem() ) )
258 ((*(physics_iter->second)).*resfunc)( compute_jacobian, c, cache );
263 ((*(physics_iter->second)).*resfunc)( compute_jacobian, c, cache );
269 return compute_jacobian;
273 libMesh::DiffContext& context )
283 libMesh::DiffContext& context )
293 libMesh::DiffContext& context )
303 libMesh::DiffContext& context )
313 libMesh::DiffContext& context )
323 libMesh::DiffContext& context )
333 libMesh::DiffContext& context )
343 libMesh::DiffContext& context )
356 std::cerr <<
"Error: Could not find physics " << physics_name << std::endl;
375 const libMesh::Point& point,
376 libMesh::Real& value )
383 if( (physics_iter->second)->enabled_on_elem( &context.get_elem() ) )
391 #ifdef GRINS_USE_GRVY_TIMERS
392 void MultiphysicsSystem::attach_grvy_timer( GRVY::GRVY_Timer_Class* grvy_timer )
401 (physics_iter->second)->attach_grvy_timer( grvy_timer );
bool _use_numerical_jacobians_only
bool has_physics(const std::string physics_name) const
Query to check if a particular physics has been enabled.
void attach_physics_list(PhysicsList physics_list)
PhysicsList gets built by GRINS::PhysicsFactory and attached here.
std::map< std::string, std::tr1::shared_ptr< GRINS::Physics > > PhysicsList
Container for GRINS::Physics object pointers.
std::tr1::shared_ptr< GRINS::Physics > get_physics(const std::string physics_name)
virtual void init_data()
System initialization. Calls each physics implementation of init_variables()
void register_postprocessing_vars(const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
Each Physics will register their postprocessed quantities with this call.
virtual bool side_constraint(bool request_jacobian, libMesh::DiffContext &context)
Boundary contributions to which do not have time varying components.
std::map< std::string, std::tr1::shared_ptr< GRINS::Physics > >::const_iterator PhysicsListIter
Iterator for PhysicsList.
virtual void nonlocal_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for scalar variables.
void register_parameter(const std::string ¶m_name, libMesh::ParameterMultiPointer< libMesh::Number > ¶m_pointer)
Each Physics will register its copy(s) of an independent variable.
PhysicsList _physics_list
Container of pointers to GRINS::Physics classes requested at runtime.
virtual void compute_mass_residual_cache(const AssemblyContext &context, CachedValues &cache)
virtual void compute_element_time_derivative_cache(const AssemblyContext &context, CachedValues &cache)
virtual bool nonlocal_time_derivative(bool request_jacobian, libMesh::DiffContext &context)
Contributions to on SCALAR variables which have time varying components.
virtual void element_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for element interiors.
virtual void compute_side_constraint_cache(const AssemblyContext &context, CachedValues &cache)
virtual void compute_postprocessed_quantity(unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
~MultiphysicsSystem()
Destructor. Clean up all physics allocations.
virtual bool nonlocal_mass_residual(bool request_jacobian, libMesh::DiffContext &context)
Contributions to on SCALAR variables.
virtual bool element_time_derivative(bool request_jacobian, libMesh::DiffContext &context)
Element interior contributions to which have time varying components.
virtual void compute_element_constraint_cache(const AssemblyContext &context, CachedValues &cache)
virtual void compute_side_time_derivative_cache(const AssemblyContext &context, CachedValues &cache)
virtual libMesh::AutoPtr< libMesh::DiffContext > build_context()
Override FEMSystem::build_context in order to use our own AssemblyContext.
virtual bool nonlocal_constraint(bool request_jacobian, libMesh::DiffContext &context)
Contributions to on SCALAR variables which do not have time varying components.
virtual void side_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for boundaries of elements on the domain boundary.
virtual void nonlocal_mass_residual(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Mass matrix part(s) for scalar variables.
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for element interiors.
bool _general_residual(bool request_jacobian, libMesh::DiffContext &context, ResFuncType resfunc, CacheFuncType cachefunc)
virtual void side_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for boundaries of elements on the domain boundary.
virtual bool element_constraint(bool request_jacobian, libMesh::DiffContext &context)
virtual bool mass_residual(bool request_jacobian, libMesh::DiffContext &context)
Contributions to .
virtual void compute_nonlocal_mass_residual_cache(const AssemblyContext &context, CachedValues &cache)
virtual void compute_nonlocal_time_derivative_cache(const AssemblyContext &context, CachedValues &cache)
virtual void compute_nonlocal_constraint_cache(const AssemblyContext &context, CachedValues &cache)
MultiphysicsSystem(libMesh::EquationSystems &es, const std::string &name, const unsigned int number)
Constructor. Will be called by libMesh only.
virtual bool side_time_derivative(bool request_jacobian, libMesh::DiffContext &context)
Boundary contributions to which have time varying components.
virtual void init_context(libMesh::DiffContext &context)
Context initialization. Calls each physics implementation of init_context()
virtual void nonlocal_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for scalar variables.
virtual void read_input_options(const GetPot &input)
Reads input options for this class and all physics that are enabled.
virtual void mass_residual(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part...