GRINS-0.7.0
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
GRINS::ConvectionDiffusion Class Reference

#include <convection_diffusion.h>

Inheritance diagram for GRINS::ConvectionDiffusion:
Inheritance graph
[legend]
Collaboration diagram for GRINS::ConvectionDiffusion:
Collaboration graph
[legend]

Public Member Functions

 ConvectionDiffusion (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~ConvectionDiffusion ()
 
virtual void init_variables (libMesh::FEMSystem *system)
 Initialize variables for this physics. More...
 
virtual void set_time_evolving_vars (libMesh::FEMSystem *system)
 Set which variables are time evolving. More...
 
virtual void init_context (AssemblyContext &context)
 Initialize context for added physics variables. More...
 
virtual void element_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for element interiors. More...
 
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. More...
 
- Public Member Functions inherited from GRINS::Physics
 Physics (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~Physics ()
 
virtual bool enabled_on_elem (const libMesh::Elem *elem)
 Find if current physics is active on supplied element. More...
 
void set_is_steady (bool is_steady)
 Sets whether this physics is to be solved with a steady solver or not. More...
 
bool is_steady () const
 Returns whether or not this physics is being solved with a steady solver. More...
 
virtual void auxiliary_init (MultiphysicsSystem &system)
 Any auxillary initialization a Physics class may need. More...
 
virtual void register_postprocessing_vars (const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
 Register name of postprocessed quantity with PostProcessedQuantities. More...
 
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. More...
 
virtual void nonlocal_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for scalar variables. More...
 
virtual void element_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for element interiors. More...
 
virtual void side_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for scalar variables. More...
 
virtual void damping_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Damping matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void nonlocal_mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Mass matrix part(s) for scalar variables. More...
 
void init_ics (libMesh::FEMSystem *system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
 
virtual void compute_element_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_element_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_damping_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_mass_residual_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)
 
ICHandlingBaseget_ic_handler ()
 
- Public Member Functions inherited from GRINS::ParameterUser
 ParameterUser (const std::string &user_name)
 
virtual ~ParameterUser ()
 
virtual void set_parameter (libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
 Each subclass can simultaneously read a parameter value from. More...
 
virtual void set_parameter (libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void set_parameter (libMesh::ParsedFEMFunction< libMesh::Number > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void move_parameter (const libMesh::Number &old_parameter, libMesh::Number &new_parameter)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &old_func, libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFEMFunction< libMesh::Number > &old_func, libMesh::ParsedFEMFunction< libMesh::Number > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void register_parameter (const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
 Each subclass will register its copy of an independent. More...
 

Protected Attributes

std::vector< libMesh::ParsedFunction< libMesh::Number > > _v
 Velocity field, $ v(x,y,z,t) $;. More...
 
libMesh::ParsedFunction< libMesh::Number > _kappa
 Diffusivity, $ \kappa(x,y,z,t) $. More...
 
GenericFETypeVariable _var
 
- Protected Attributes inherited from GRINS::Physics
const PhysicsName _physics_name
 Name of the physics object. Used for reading physics specific inputs. More...
 
GRINS::ICHandlingBase_ic_handler
 
std::set< libMesh::subdomain_id_type > _enabled_subdomains
 Subdomains on which the current Physics class is enabled. More...
 

Private Member Functions

 ConvectionDiffusion ()
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::Physics
static void set_is_axisymmetric (bool is_axisymmetric)
 Set whether we should treat the problem as axisymmetric. More...
 
static bool is_axisymmetric ()
 
- Static Public Attributes inherited from GRINS::ParameterUser
static std::string zero_vector_function = std::string("{0}")
 A parseable function string with LIBMESH_DIM components, all 0. More...
 
- Protected Member Functions inherited from GRINS::Physics
libMesh::UniquePtr< libMesh::FEGenericBase< libMesh::Real > > build_new_fe (const libMesh::Elem *elem, const libMesh::FEGenericBase< libMesh::Real > *fe, const libMesh::Point p)
 
void parse_enabled_subdomains (const GetPot &input, const std::string &physics_name)
 
- Static Protected Attributes inherited from GRINS::Physics
static bool _is_steady = false
 Caches whether or not the solver that's being used is steady or not. More...
 
static bool _is_axisymmetric = false
 Caches whether we are solving an axisymmetric problem or not. More...
 

Detailed Description

Definition at line 37 of file convection_diffusion.h.

Constructor & Destructor Documentation

GRINS::ConvectionDiffusion::ConvectionDiffusion ( const GRINS::PhysicsName physics_name,
const GetPot &  input 
)

Definition at line 44 of file convection_diffusion.C.

References GRINS::Physics::_ic_handler, _kappa, _v, _var, GRINS::GRINSPrivate::VariableWarehouse::check_and_register_variable(), GRINS::MaterialsParsing::material_name(), GRINS::GenericFETypeVariable::section_name(), and GRINS::ParameterUser::set_parameter().

46  : Physics(physics_name,input),
48  _kappa("0.0"),
49  _var(input,physics_name)
50  {
51  unsigned int n_v_comps = input.vector_variable_size("Physics/"+physics_name+"/velocity_field");
52 
53  for( unsigned int v = 0; v < n_v_comps; v++ )
54  _v[v].reparse( input("Physics/"+physics_name+"/velocity_field", "0.0", v) );
55 
56  std::string material_name = MaterialsParsing::material_name(input,physics_name);
57 
58  this->set_parameter(this->_kappa, input,
59  "Materials/"+material_name+"/Diffusivity/value",
60  "DIE!");
61 
63 
64  _ic_handler = new GenericICHandler(physics_name,input);
65  }
virtual void set_parameter(libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
GRINS::ICHandlingBase * _ic_handler
Definition: physics.h:269
static void check_and_register_variable(const std::string &var_name, const FEVariablesBase &variable)
First check if var_name is registered and then register.
libMesh::ParsedFunction< libMesh::Number > _kappa
Diffusivity, .
GenericFETypeVariable _var
static std::string material_name(const GetPot &input, const std::string &physics)
Get the name of the material in the Physics/physics section.
std::vector< libMesh::ParsedFunction< libMesh::Number > > _v
Velocity field, ;.
std::string section_name(const std::string &physics_name) const
virtual GRINS::ConvectionDiffusion::~ConvectionDiffusion ( )
inlinevirtual

Definition at line 43 of file convection_diffusion.h.

43 {};
GRINS::ConvectionDiffusion::ConvectionDiffusion ( )
private

Member Function Documentation

void GRINS::ConvectionDiffusion::element_time_derivative ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Time dependent part(s) of physics for element interiors.

Reimplemented from GRINS::Physics.

Definition at line 85 of file convection_diffusion.C.

References _kappa, _v, _var, and GRINS::GenericFETypeVariable::var().

88  {
89  const unsigned int n_dofs = context.get_dof_indices(_var.var()).size();
90 
91  const std::vector<libMesh::Real> &JxW =
92  context.get_element_fe(_var.var())->get_JxW();
93 
94  const std::vector<std::vector<libMesh::Real> >& phi =
95  context.get_element_fe(_var.var())->get_phi();
96 
97  const std::vector<std::vector<libMesh::RealGradient> >& grad_phi =
98  context.get_element_fe(_var.var())->get_dphi();
99 
100  const std::vector<libMesh::Point>& x =
101  context.get_element_fe(_var.var())->get_xyz();
102 
103  libMesh::DenseSubVector<libMesh::Number> &F = context.get_elem_residual(_var.var());
104 
105  libMesh::DenseSubMatrix<libMesh::Number> &K = context.get_elem_jacobian(_var.var(), _var.var());
106 
107  unsigned int n_qpoints = context.get_element_qrule().n_points();
108 
109  for (unsigned int qp=0; qp != n_qpoints; qp++)
110  {
111  libMesh::Number c = context.interior_value(_var.var(), qp);
112 
113  libMesh::Gradient grad_c;
114  context.interior_gradient(_var.var(), qp, grad_c);
115 
116  libMesh::RealGradient v_qp;
117  v_qp(0) = this->_v[0](x[qp], context.get_time());
118  v_qp(1) = this->_v[1](x[qp], context.get_time());
119  v_qp(2) = this->_v[2](x[qp], context.get_time());
120 
121  libMesh::Real kappa_qp = this->_kappa(x[qp], context.time);
122 
123  for (unsigned int i=0; i != n_dofs; i++)
124  {
125  F(i) += JxW[qp]*( c*(v_qp*grad_phi[i][qp])
126  - kappa_qp*(grad_c*grad_phi[i][qp]) );
127 
128  if (compute_jacobian)
129  {
130  for (unsigned int j=0; j != n_dofs; j++)
131  {
132  K(i,j) += context.get_elem_solution_derivative()*
133  JxW[qp]*( phi[j][qp]*(v_qp*grad_phi[i][qp])
134  - kappa_qp*(grad_phi[j][qp]*grad_phi[i][qp]) );
135  }
136  }
137  }
138  }
139  }
libMesh::ParsedFunction< libMesh::Number > _kappa
Diffusivity, .
GenericFETypeVariable _var
std::vector< libMesh::ParsedFunction< libMesh::Number > > _v
Velocity field, ;.
void GRINS::ConvectionDiffusion::init_context ( AssemblyContext context)
virtual

Initialize context for added physics variables.

Reimplemented from GRINS::Physics.

Definition at line 77 of file convection_diffusion.C.

References _var, and GRINS::GenericFETypeVariable::var().

78  {
79  context.get_element_fe(_var.var())->get_JxW();
80  context.get_element_fe(_var.var())->get_phi();
81  context.get_element_fe(_var.var())->get_dphi();
82  context.get_element_fe(_var.var())->get_xyz();
83  }
GenericFETypeVariable _var
void GRINS::ConvectionDiffusion::init_variables ( libMesh::FEMSystem *  system)
virtual

Initialize variables for this physics.

Implements GRINS::Physics.

Definition at line 67 of file convection_diffusion.C.

References _var, and GRINS::SingleFETypeVariable::init().

68  {
69  _var.init(system);
70  }
virtual void init(libMesh::FEMSystem *system)
Add variables to the system.
GenericFETypeVariable _var
void GRINS::ConvectionDiffusion::mass_residual ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part.

Reimplemented from GRINS::Physics.

Definition at line 141 of file convection_diffusion.C.

References _var, and GRINS::GenericFETypeVariable::var().

144  {
145  const unsigned int n_dofs = context.get_dof_indices(_var.var()).size();
146 
147  const std::vector<libMesh::Real> &JxW =
148  context.get_element_fe(_var.var())->get_JxW();
149 
150  const std::vector<std::vector<libMesh::Real> >& phi =
151  context.get_element_fe(_var.var())->get_phi();
152 
153  libMesh::DenseSubVector<libMesh::Number> &F = context.get_elem_residual(_var.var());
154 
155  libMesh::DenseSubMatrix<libMesh::Number> &M = context.get_elem_jacobian(_var.var(), _var.var());
156 
157  unsigned int n_qpoints = context.get_element_qrule().n_points();
158 
159  for (unsigned int qp=0; qp != n_qpoints; qp++)
160  {
161  libMesh::Real c_dot;
162  context.interior_rate(_var.var(), qp, c_dot);
163 
164  for (unsigned int i=0; i != n_dofs; i++)
165  {
166  F(i) -= JxW[qp]*( c_dot*phi[i][qp] );
167 
168  if (compute_jacobian)
169  {
170  for (unsigned int j=0; j != n_dofs; j++)
171  {
172  M(i,j) -=
173  context.get_elem_solution_rate_derivative()*
174  JxW[qp]*( phi[j][qp]*phi[i][qp] );
175  }
176  }
177  }
178  }
179  }
GenericFETypeVariable _var
void GRINS::ConvectionDiffusion::set_time_evolving_vars ( libMesh::FEMSystem *  system)
virtual

Set which variables are time evolving.

Set those variables which evolve in time (as opposed to variables that behave like constraints). This is done separately from init_variables() because the MultiphysicsSystem must initialize its base class before time_evolving variables can be set. Default implementation is no time evolving variables.

Reimplemented from GRINS::Physics.

Definition at line 72 of file convection_diffusion.C.

References _var, and GRINS::GenericFETypeVariable::var().

73  {
74  system->time_evolving(_var.var());
75  }
GenericFETypeVariable _var

Member Data Documentation

libMesh::ParsedFunction<libMesh::Number> GRINS::ConvectionDiffusion::_kappa
protected

Diffusivity, $ \kappa(x,y,z,t) $.

Definition at line 67 of file convection_diffusion.h.

Referenced by ConvectionDiffusion(), and element_time_derivative().

std::vector<libMesh::ParsedFunction<libMesh::Number> > GRINS::ConvectionDiffusion::_v
protected

Velocity field, $ v(x,y,z,t) $;.

Definition at line 64 of file convection_diffusion.h.

Referenced by ConvectionDiffusion(), and element_time_derivative().

GenericFETypeVariable GRINS::ConvectionDiffusion::_var
protected

The documentation for this class was generated from the following files:

Generated on Thu Jun 2 2016 21:52:30 for GRINS-0.7.0 by  doxygen 1.8.10