38 template<
class Mu,
class SH,
class TC>
42 _stab_helper( physics_name+
"StabHelper", input )
45 template<
class Mu,
class SH,
class TC>
52 context.get_element_fe(this->_press_var.p())->get_dphi();
55 context.get_element_fe(this->_flow_vars.u())->get_d2phi();
56 context.get_element_fe(this->_temp_vars.T())->get_d2phi();
59 template<
class Mu,
class SH,
class TC>
61 unsigned int qp )
const
63 libMesh::Real T = context.fixed_interior_value(this->_temp_vars.T(), qp);
64 libMesh::RealGradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T(), qp);
66 libMesh::RealGradient U( context.fixed_interior_value(this->_flow_vars.u(), qp),
67 context.fixed_interior_value(this->_flow_vars.v(), qp) );
69 libMesh::RealGradient grad_u, grad_v;
71 grad_u = context.fixed_interior_gradient(this->_flow_vars.u(), qp);
72 grad_v = context.fixed_interior_gradient(this->_flow_vars.v(), qp);
74 libMesh::Real divU = grad_u(0) + grad_v(1);
77 if( this->_flow_vars.dim() == 3 )
79 U(2) = context.fixed_interior_value(this->_flow_vars.w(), qp);
80 divU += (context.fixed_interior_gradient(this->_flow_vars.w(), qp))(2);
83 return divU - (U*grad_T)/T;
86 template<
class Mu,
class SH,
class TC>
88 unsigned int qp )
const
90 libMesh::Real T = context.fixed_interior_value(this->_temp_vars.T(), qp);
91 libMesh::Real T_dot = context.interior_value(this->_temp_vars.T(), qp);
93 libMesh::Real RC_t = -T_dot/T;
95 if( this->_enable_thermo_press_calc )
97 libMesh::Real p0 = context.fixed_interior_value(this->_p0_var->p0(), qp);
98 libMesh::Real p0_dot = context.interior_value(this->_p0_var->p0(), qp);
106 template<
class Mu,
class SH,
class TC>
108 unsigned int qp )
const
110 libMesh::Real T = context.fixed_interior_value(this->_temp_vars.T(), qp);
112 libMesh::Real rho = this->rho(T, this->get_p0_transient(context,qp) );
114 libMesh::RealGradient U( context.fixed_interior_value(this->_flow_vars.u(), qp),
115 context.fixed_interior_value(this->_flow_vars.v(), qp) );
117 if(this->_flow_vars.dim() == 3)
118 U(2) = context.fixed_interior_value(this->_flow_vars.w(), qp);
120 libMesh::RealGradient grad_p = context.fixed_interior_gradient(this->_press_var.p(), qp);
122 libMesh::RealGradient grad_u = context.fixed_interior_gradient(this->_flow_vars.u(), qp);
123 libMesh::RealGradient grad_v = context.fixed_interior_gradient(this->_flow_vars.v(), qp);
125 libMesh::RealTensor hess_u = context.fixed_interior_hessian(this->_flow_vars.u(), qp);
126 libMesh::RealTensor hess_v = context.fixed_interior_hessian(this->_flow_vars.v(), qp);
128 libMesh::RealGradient rhoUdotGradU;
129 libMesh::RealGradient divGradU;
130 libMesh::RealGradient divGradUT;
131 libMesh::RealGradient divdivU;
133 if( this->_flow_vars.dim() < 3 )
135 rhoUdotGradU = rho*_stab_helper.UdotGradU( U, grad_u, grad_v );
136 divGradU = _stab_helper.div_GradU( hess_u, hess_v );
137 divGradUT = _stab_helper.div_GradU_T( hess_u, hess_v );
138 divdivU = _stab_helper.div_divU_I( hess_u, hess_v );
142 libMesh::RealGradient grad_w = context.fixed_interior_gradient(this->_flow_vars.w(), qp);
143 libMesh::RealTensor hess_w = context.fixed_interior_hessian(this->_flow_vars.w(), qp);
145 rhoUdotGradU = rho*_stab_helper.UdotGradU( U, grad_u, grad_v, grad_w );
147 divGradU = _stab_helper.div_GradU( hess_u, hess_v, hess_w );
148 divGradUT = _stab_helper.div_GradU_T( hess_u, hess_v, hess_w );
149 divdivU = _stab_helper.div_divU_I( hess_u, hess_v, hess_w );
152 libMesh::RealGradient divT = this->_mu(T)*(divGradU + divGradUT - 2.0/3.0*divdivU);
154 if( this->_mu.deriv(T) != 0.0 )
156 libMesh::Gradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T(), qp);
158 libMesh::Gradient grad_u = context.fixed_interior_gradient(this->_flow_vars.u(), qp);
159 libMesh::Gradient grad_v = context.fixed_interior_gradient(this->_flow_vars.v(), qp);
161 libMesh::Gradient gradTgradu( grad_T*grad_u, grad_T*grad_v );
163 libMesh::Gradient gradTgraduT( grad_T(0)*grad_u(0) + grad_T(1)*grad_u(1),
164 grad_T(0)*grad_v(0) + grad_T(1)*grad_v(1) );
166 libMesh::Real divU = grad_u(0) + grad_v(1);
168 libMesh::Gradient gradTdivU( grad_T(0)*divU, grad_T(1)*divU );
170 if(this->_flow_vars.dim() == 3)
172 libMesh::Gradient grad_w = context.fixed_interior_gradient(this->_flow_vars.w(), qp);
174 gradTgradu(2) = grad_T*grad_w;
176 gradTgraduT(0) += grad_T(2)*grad_u(2);
177 gradTgraduT(1) += grad_T(2)*grad_v(2);
178 gradTgraduT(2) = grad_T(0)*grad_w(0) + grad_T(1)*grad_w(1) + grad_T(2)*grad_w(2);
181 gradTdivU(0) += grad_T(0)*grad_w(2);
182 gradTdivU(1) += grad_T(1)*grad_w(2);
183 gradTdivU(2) += grad_T(2)*divU;
186 divT += this->_mu.deriv(T)*( gradTgradu + gradTgraduT - 2.0/3.0*gradTdivU );
189 libMesh::RealGradient rhog( rho*this->_g(0), rho*this->_g(1) );
190 if(this->_flow_vars.dim() == 3)
191 rhog(2) = rho*this->_g(2);
193 return rhoUdotGradU + grad_p - divT - rhog;
196 template<
class Mu,
class SH,
class TC>
198 unsigned int qp )
const
200 libMesh::Real T = context.fixed_interior_value(this->_temp_vars.T(), qp);
201 libMesh::Real rho = this->rho(T, this->get_p0_transient(context,qp) );
203 libMesh::RealGradient u_dot( context.interior_value(this->_flow_vars.u(), qp), context.interior_value(this->_flow_vars.v(), qp) );
205 if(this->_flow_vars.dim() == 3)
206 u_dot(2) = context.interior_value(this->_flow_vars.w(), qp);
211 template<
class Mu,
class SH,
class TC>
213 unsigned int qp )
const
215 libMesh::Real T = context.fixed_interior_value(this->_temp_vars.T(), qp);
216 libMesh::Gradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T(), qp);
217 libMesh::Tensor hess_T = context.fixed_interior_hessian(this->_temp_vars.T(), qp);
219 libMesh::Real rho = this->rho(T, this->get_p0_transient(context,qp) );
220 libMesh::Real rho_cp = rho*this->_cp(T);
222 libMesh::RealGradient rhocpU( rho_cp*context.fixed_interior_value(this->_flow_vars.u(), qp),
223 rho_cp*context.fixed_interior_value(this->_flow_vars.v(), qp) );
225 if(this->_flow_vars.dim() == 3)
226 rhocpU(2) = rho_cp*context.fixed_interior_value(this->_flow_vars.w(), qp);
228 libMesh::Real hess_term = hess_T(0,0) + hess_T(1,1);
230 hess_term += hess_T(2,2);
233 return rhocpU*grad_T - this->_k.deriv(T)*(grad_T*grad_T) - this->_k(T)*(hess_term);
237 template<
class Mu,
class SH,
class TC>
239 unsigned int qp )
const
241 libMesh::Real T = context.fixed_interior_value(this->_temp_vars.T(), qp);
242 libMesh::Real rho = this->rho(T, this->get_p0_transient(context,qp) );
243 libMesh::Real rho_cp = rho*this->_cp(T);
244 libMesh::Real T_dot = context.interior_value(this->_temp_vars.T(), qp);
246 libMesh::Real RE_t = rho_cp*T_dot;
248 if( this->_enable_thermo_press_calc )
250 RE_t -= context.interior_value(this->_p0_var->p0(), qp);
libMesh::RealGradient compute_res_momentum_transient(AssemblyContext &context, unsigned int qp) const
libMesh::Real compute_res_energy_steady(AssemblyContext &context, unsigned int qp) const
Adds VMS-based stabilization to LowMachNavierStokes physics class.
libMesh::Real compute_res_energy_transient(AssemblyContext &context, unsigned int qp) const
Physics class for Incompressible Navier-Stokes.
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
libMesh::RealGradient compute_res_momentum_steady(AssemblyContext &context, unsigned int qp) const
libMesh::Real compute_res_continuity_steady(AssemblyContext &context, unsigned int qp) const
libMesh::Real compute_res_continuity_transient(AssemblyContext &context, unsigned int qp) const
LowMachNavierStokesStabilizationBase()