39 #include "libmesh/utility.h"
40 #include "libmesh/string_to_enum.h"
41 #include "libmesh/getpot.h"
42 #include "libmesh/fem_system.h"
43 #include "libmesh/quadrature.h"
48 template<
class Conductivity>
52 _flow_vars(input,
PhysicsNaming::incompressible_navier_stokes()),
53 _press_var(input,
PhysicsNaming::incompressible_navier_stokes(), true ),
54 _temp_vars(input,
PhysicsNaming::axisymmetric_heat_transfer()),
64 template<
class Conductivity>
72 template<
class Conductivity>
83 template<
class Conductivity>
87 this->_dim = system->get_mesh().mesh_dimension();
89 this->_temp_vars.init(system);
90 this->_flow_vars.init(system);
91 this->_press_var.init(system);
94 template<
class Conductivity>
98 system->time_evolving(this->_temp_vars.T());
102 template<
class Conductivity>
108 context.get_element_fe(_temp_vars.T())->get_JxW();
109 context.get_element_fe(_temp_vars.T())->get_phi();
110 context.get_element_fe(_temp_vars.T())->get_dphi();
111 context.get_element_fe(_temp_vars.T())->get_xyz();
113 context.get_side_fe(_temp_vars.T())->get_JxW();
114 context.get_side_fe(_temp_vars.T())->get_phi();
115 context.get_side_fe(_temp_vars.T())->get_dphi();
116 context.get_side_fe(_temp_vars.T())->get_xyz();
124 template<
class Conductivity>
129 #ifdef GRINS_USE_GRVY_TIMERS
130 this->_timer->BeginTimer(
"AxisymmetricHeatTransfer::element_time_derivative");
134 const unsigned int n_T_dofs = context.get_dof_indices(_temp_vars.T()).size();
135 const unsigned int n_u_dofs = context.get_dof_indices(_flow_vars.u()).size();
143 const std::vector<libMesh::Real> &JxW =
144 context.get_element_fe(_temp_vars.T())->get_JxW();
147 const std::vector<std::vector<libMesh::Real> >& T_phi =
148 context.get_element_fe(_temp_vars.T())->get_phi();
151 const std::vector<std::vector<libMesh::Real> >& vel_phi =
152 context.get_element_fe(_flow_vars.u())->get_phi();
156 const std::vector<std::vector<libMesh::RealGradient> >& T_gradphi =
157 context.get_element_fe(_temp_vars.T())->get_dphi();
160 const std::vector<libMesh::Point>& u_qpoint =
161 context.get_element_fe(_flow_vars.u())->get_xyz();
164 libMesh::DenseSubVector<libMesh::Number> &FT = context.get_elem_residual(_temp_vars.T());
166 libMesh::DenseSubMatrix<libMesh::Number> &KTT = context.get_elem_jacobian(_temp_vars.T(), _temp_vars.T());
168 libMesh::DenseSubMatrix<libMesh::Number> &KTr = context.get_elem_jacobian(_temp_vars.T(), _flow_vars.u());
169 libMesh::DenseSubMatrix<libMesh::Number> &KTz = context.get_elem_jacobian(_temp_vars.T(), _flow_vars.v());
178 unsigned int n_qpoints = context.get_element_qrule().n_points();
180 for (
unsigned int qp=0; qp != n_qpoints; qp++)
182 const libMesh::Number r = u_qpoint[qp](0);
185 libMesh::Number u_r, u_z;
186 u_r = context.interior_value(_flow_vars.u(), qp);
187 u_z = context.interior_value(_flow_vars.v(), qp);
189 libMesh::Gradient grad_T;
190 grad_T = context.interior_gradient(_temp_vars.T(), qp);
192 libMesh::NumberVectorValue U (u_r,u_z);
194 libMesh::Number k = this->_k( context, qp );
201 for (
unsigned int i=0; i != n_T_dofs; i++)
204 (-_rho*_Cp*T_phi[i][qp]*(U*grad_T)
205 -k*(T_gradphi[i][qp]*grad_T) );
207 if (compute_jacobian)
209 libmesh_assert (context.get_elem_solution_derivative() == 1.0);
211 for (
unsigned int j=0; j != n_T_dofs; j++)
216 KTT(i,j) += JxW[qp] * context.get_elem_solution_derivative() *r*
217 (-_rho*_Cp*T_phi[i][qp]*(U*T_gradphi[j][qp])
218 -k*(T_gradphi[i][qp]*T_gradphi[j][qp]));
224 for (
unsigned int j=0; j != n_T_dofs; j++)
227 KTT(i,j) -= JxW[qp] * context.get_elem_solution_derivative() *r*( dk_dT*T_phi[j][qp]*T_gradphi[i][qp]*grad_T );
233 for (
unsigned int j=0; j != n_u_dofs; j++)
235 KTr(i,j) += JxW[qp] * context.get_elem_solution_derivative() *r*(-_rho*_Cp*T_phi[i][qp]*(vel_phi[j][qp]*grad_T(0)));
236 KTz(i,j) += JxW[qp] * context.get_elem_solution_derivative() *r*(-_rho*_Cp*T_phi[i][qp]*(vel_phi[j][qp]*grad_T(1)));
244 #ifdef GRINS_USE_GRVY_TIMERS
245 this->_timer->EndTimer(
"AxisymmetricHeatTransfer::element_time_derivative");
251 template<
class Conductivity>
256 #ifdef GRINS_USE_GRVY_TIMERS
257 this->_timer->BeginTimer(
"AxisymmetricHeatTransfer::mass_residual");
264 const std::vector<libMesh::Real> &JxW =
265 context.get_element_fe(_temp_vars.T())->get_JxW();
268 const std::vector<std::vector<libMesh::Real> >& phi =
269 context.get_element_fe(_temp_vars.T())->get_phi();
272 const unsigned int n_T_dofs = context.get_dof_indices(_temp_vars.T()).size();
275 const std::vector<libMesh::Point>& u_qpoint =
276 context.get_element_fe(_flow_vars.u())->get_xyz();
279 libMesh::DenseSubVector<libMesh::Real> &F =
280 context.get_elem_residual(_temp_vars.T());
282 libMesh::DenseSubMatrix<libMesh::Real> &M =
283 context.get_elem_jacobian(_temp_vars.T(), _temp_vars.T());
285 unsigned int n_qpoints = context.get_element_qrule().n_points();
287 for (
unsigned int qp = 0; qp != n_qpoints; ++qp)
289 const libMesh::Number r = u_qpoint[qp](0);
297 context.interior_rate(_temp_vars.T(), qp, T_dot);
299 for (
unsigned int i = 0; i != n_T_dofs; ++i)
301 F(i) -= JxW[qp]*r*(_rho*_Cp*T_dot*phi[i][qp] );
303 if( compute_jacobian )
305 for (
unsigned int j=0; j != n_T_dofs; j++)
308 M(i,j) -= JxW[qp] * context.get_elem_solution_rate_derivative() *r*_rho*_Cp*phi[j][qp]*phi[i][qp] ;
316 #ifdef GRINS_USE_GRVY_TIMERS
317 this->_timer->EndTimer(
"AxisymmetricHeatTransfer::mass_residual");
323 template<
class Conductivity>
325 (
const std::string & param_name,
330 _k.register_parameter(param_name, param_pointer);
void read_input_options(const GetPot &input)
Read options from GetPot input file.
GRINS::ICHandlingBase * _ic_handler
INSTANTIATE_HEAT_TRANSFER_SUBCLASS(AxisymmetricHeatTransfer)
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
static std::string temperature_section()
virtual void init_variables(libMesh::FEMSystem *system)
Initialization AxisymmetricHeatTransfer variables.
static void check_and_register_variable(const std::string &var_name, const FEVariablesBase &variable)
First check if var_name is registered and then register.
Base class for reading and handling initial conditions for physics classes.
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
static void read_density(const std::string &core_physics_name, const GetPot &input, ParameterUser ¶ms, libMesh::Real &rho)
Helper function to reading density from input.
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
void register_variables()
static void read_specific_heat(const std::string &core_physics_name, const GetPot &input, ParameterUser ¶ms, libMesh::Real &cp)
Helper function to reading scalar specific heat from input.
static std::string velocity_section()
virtual void register_parameter(const std::string ¶m_name, libMesh::ParameterMultiAccessor< libMesh::Number > ¶m_pointer) const
Each subclass will register its copy of an independent.
Helper functions for parsing material properties.
static std::string pressure_section()
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...
static PhysicsName axisymmetric_heat_transfer()
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for element interiors.
virtual void register_parameter(const std::string ¶m_name, libMesh::ParameterMultiAccessor< libMesh::Number > ¶m_pointer) const
Each subclass will register its copy of an independent.
AxisymmetricHeatTransfer()