30 #include "grins_config.h"
37 #include "libmesh/getpot.h"
38 #include "libmesh/quadrature.h"
39 #include "libmesh/boundary_info.h"
58 if( input.have_variable(section) )
60 unsigned int n_vars = input.vector_variable_size(section);
62 for(
unsigned int v = 0; v < n_vars; v++ )
64 std::string name = input(section,
"DIE!",v);
66 if( name == std::string(
"k") )
73 <<
" Found " << name << std::endl
74 <<
" Acceptable values are: k" << std::endl;
85 (
bool compute_jacobian,
89 const unsigned int n_T_dofs = context.get_dof_indices(this->_temp_vars.T()).size();
90 const unsigned int n_u_dofs = context.get_dof_indices(this->_flow_vars.u()).size();
98 const std::vector<libMesh::Real> &JxW =
99 context.get_element_fe(this->_temp_vars.T())->get_JxW();
102 const std::vector<std::vector<libMesh::Real> >& T_phi =
103 context.get_element_fe(this->_temp_vars.T())->get_phi();
106 const std::vector<std::vector<libMesh::Real> >& vel_phi =
107 context.get_element_fe(this->_flow_vars.u())->get_phi();
111 const std::vector<std::vector<libMesh::RealGradient> >& T_gradphi =
112 context.get_element_fe(this->_temp_vars.T())->get_dphi();
114 const std::vector<libMesh::Point>& u_qpoint =
115 context.get_element_fe(this->_flow_vars.u())->get_xyz();
117 libMesh::DenseSubMatrix<libMesh::Number> &KTT = context.get_elem_jacobian(this->_temp_vars.T(), this->_temp_vars.T());
119 libMesh::DenseSubMatrix<libMesh::Number> &KTu = context.get_elem_jacobian(this->_temp_vars.T(), this->_flow_vars.u());
120 libMesh::DenseSubMatrix<libMesh::Number> &KTv = context.get_elem_jacobian(this->_temp_vars.T(), this->_flow_vars.v());
121 libMesh::DenseSubMatrix<libMesh::Number>* KTw = NULL;
123 libMesh::DenseSubVector<libMesh::Number> &FT = context.get_elem_residual(this->_temp_vars.T());
125 if( this->_flow_vars.dim() == 3 )
127 KTw = &context.get_elem_jacobian(this->_temp_vars.T(), this->_flow_vars.w());
136 unsigned int n_qpoints = context.get_element_qrule().n_points();
138 for (
unsigned int qp=0; qp != n_qpoints; qp++)
141 libMesh::Number u, v;
142 u = context.interior_value(this->_flow_vars.u(), qp);
143 v = context.interior_value(this->_flow_vars.v(), qp);
145 libMesh::Gradient grad_T;
146 grad_T = context.interior_gradient(this->_temp_vars.T(), qp);
148 libMesh::NumberVectorValue U (u,v);
149 if (this->_flow_vars.dim() == 3)
150 U(2) = context.interior_value(this->_flow_vars.w(), qp);
152 const libMesh::Number r = u_qpoint[qp](0);
154 libMesh::Real jac = JxW[qp];
157 libMesh::Real _k_qp = this->_k(context, qp);
165 for (
unsigned int i=0; i != n_T_dofs; i++)
168 (-this->_rho*this->_Cp*T_phi[i][qp]*(U*grad_T)
169 -_k_qp*(T_gradphi[i][qp]*grad_T) );
171 if (compute_jacobian)
173 for (
unsigned int j=0; j != n_T_dofs; j++)
178 KTT(i,j) += jac * context.get_elem_solution_derivative() *
179 (-this->_rho*this->_Cp*T_phi[i][qp]*(U*T_gradphi[j][qp])
180 -_k_qp*(T_gradphi[i][qp]*T_gradphi[j][qp]));
184 for (
unsigned int j=0; j != n_u_dofs; j++)
186 KTu(i,j) += jac * context.get_elem_solution_derivative()*(-this->_rho*this->_Cp*T_phi[i][qp]*(vel_phi[j][qp]*grad_T(0)));
187 KTv(i,j) += jac * context.get_elem_solution_derivative()*(-this->_rho*this->_Cp*T_phi[i][qp]*(vel_phi[j][qp]*grad_T(1)));
188 if (this->_flow_vars.dim() == 3)
189 (*KTw)(i,j) += jac * context.get_elem_solution_derivative()*(-this->_rho*this->_Cp*T_phi[i][qp]*(vel_phi[j][qp]*grad_T(2)));
206 const std::vector<libMesh::Real> &JxW =
207 context.get_element_fe(this->_temp_vars.T())->get_JxW();
210 const std::vector<std::vector<libMesh::Real> >& phi =
211 context.get_element_fe(this->_temp_vars.T())->get_phi();
213 const std::vector<libMesh::Point>& u_qpoint =
214 context.get_element_fe(this->_flow_vars.u())->get_xyz();
217 const unsigned int n_T_dofs = context.get_dof_indices(this->_temp_vars.T()).size();
220 libMesh::DenseSubVector<libMesh::Real> &F = context.get_elem_residual(this->_temp_vars.T());
222 libMesh::DenseSubMatrix<libMesh::Real> &M = context.get_elem_jacobian(this->_temp_vars.T(), this->_temp_vars.T());
224 unsigned int n_qpoints = context.get_element_qrule().n_points();
226 for (
unsigned int qp = 0; qp != n_qpoints; ++qp)
234 context.interior_rate(this->_temp_vars.T(), qp, T_dot);
236 const libMesh::Number r = u_qpoint[qp](0);
238 libMesh::Real jac = JxW[qp];
245 for (
unsigned int i = 0; i != n_T_dofs; ++i)
247 F(i) -= this->_rho*this->_Cp*T_dot*phi[i][qp]*jac;
249 if( compute_jacobian )
251 for (
unsigned int j=0; j != n_T_dofs; j++)
254 M(i,j) -= this->_rho*this->_Cp*phi[j][qp]*phi[i][qp]*jac * context.get_elem_solution_rate_derivative();
266 const libMesh::Point& point,
267 libMesh::Real& value )
269 if( quantity_index == this->_k_index )
270 value = this->_k(point, context.get_time());
static bool is_axisymmetric()
static PhysicsName heat_transfer()
unsigned int register_quantity(std::string name)
Register quantity to be postprocessed.
GRINS::ICHandlingBase * _ic_handler
Physics class for Heat Transfer.
Base class for reading and handling initial conditions for physics classes.
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context)
Time dependent part(s) of physics for element interiors.
virtual void mass_residual(bool compute_jacobian, AssemblyContext &context)
Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part...
virtual void compute_postprocessed_quantity(unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
Compute value of postprocessed quantities at libMesh::Point.
INSTANTIATE_HEAT_TRANSFER_SUBCLASS(HeatTransfer)
virtual void register_postprocessing_vars(const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
Register postprocessing variables for HeatTransfer.