36 #include "libmesh/quadrature.h"
67 (
bool compute_jacobian,
72 libMesh::Elem &elem_pointer = context.get_elem();
75 const unsigned int n_nu_dofs = context.get_dof_indices(this->_turbulence_vars.nu()).size();
78 const std::vector<libMesh::Real> &JxW =
79 context.get_element_fe(this->_turbulence_vars.nu())->get_JxW();
83 const std::vector<std::vector<libMesh::RealGradient> >& nu_gradphi =
84 context.get_element_fe(this->_turbulence_vars.nu())->get_dphi();
92 libMesh::DenseSubVector<libMesh::Number> &Fnu = context.get_elem_residual(this->_turbulence_vars.nu());
94 libMesh::FEBase* fe = context.get_element_fe(this->_turbulence_vars.nu());
96 unsigned int n_qpoints = context.get_element_qrule().n_points();
99 libMesh::UniquePtr< libMesh::DenseVector<libMesh::Real> > distance_qp;
102 distance_qp = this->distance_function->interpolate(&elem_pointer, context.get_element_qrule().get_points());
104 for (
unsigned int qp=0; qp != n_qpoints; qp++)
106 libMesh::Gradient grad_nu;
107 grad_nu = context.interior_gradient(this->_turbulence_vars.nu(), qp);
109 libMesh::Real jac = JxW[qp];
112 libMesh::Real _mu_qp = this->_mu(context, qp);
120 u = context.interior_value(this->_flow_vars.u(), qp);
121 v = context.interior_value(this->_flow_vars.v(), qp);
123 libMesh::NumberVectorValue U(u,v);
124 if (this->_flow_vars.dim() == 3)
125 U(2) = context.interior_value(this->_flow_vars.w(), qp);
129 libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
130 libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
132 libMesh::Real tau_spalart = this->_stab_helper.compute_tau_spalart( context, qp, g, G, this->_rho, U, _mu_qp, this->_is_steady );
134 libMesh::Number RM_spalart = this->_stab_helper.compute_res_spalart_steady( context, qp, this->_rho, _mu_qp, (*distance_qp)(qp), this->_infinite_distance );
136 for (
unsigned int i=0; i != n_nu_dofs; i++)
138 Fnu(i) += jac*( -tau_spalart*RM_spalart*this->_rho*(U*nu_gradphi[i][qp]) );
141 if( compute_jacobian )
143 libmesh_not_implemented();
155 libMesh::Elem &elem_pointer = context.get_elem();
158 const unsigned int n_nu_dofs = context.get_dof_indices(this->_turbulence_vars.nu()).size();
161 const std::vector<libMesh::Real> &JxW =
162 context.get_element_fe(this->_turbulence_vars.nu())->get_JxW();
165 const std::vector<std::vector<libMesh::RealGradient> >& nu_gradphi =
166 context.get_element_fe(this->_turbulence_vars.nu())->get_dphi();
168 libMesh::DenseSubVector<libMesh::Number> &Fnu = context.get_elem_residual(this->_turbulence_vars.nu());
170 libMesh::FEBase* fe = context.get_element_fe(this->_turbulence_vars.nu());
172 unsigned int n_qpoints = context.get_element_qrule().n_points();
175 libMesh::UniquePtr< libMesh::DenseVector<libMesh::Real> > distance_qp;
178 distance_qp = this->distance_function->interpolate(&elem_pointer, context.get_element_qrule().get_points());
180 for (
unsigned int qp=0; qp != n_qpoints; qp++)
182 libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
183 libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
185 libMesh::RealGradient U( context.fixed_interior_value( this->_flow_vars.u(), qp ),
186 context.fixed_interior_value( this->_flow_vars.v(), qp ) );
188 libMesh::Real _mu_qp = this->_mu(context, qp);
190 if( this->_flow_vars.dim() == 3 )
192 U(2) = context.fixed_interior_value( this->_flow_vars.w(), qp );
195 libMesh::Real tau_spalart = this->_stab_helper.compute_tau_spalart( context, qp, g, G, this->_rho, U, _mu_qp, this->_is_steady );
197 libMesh::Real RM_spalart = this->_stab_helper.compute_res_spalart_transient( context, qp, this->_rho );
199 for (
unsigned int i=0; i != n_nu_dofs; i++)
201 Fnu(i) += -JxW[qp]*tau_spalart*RM_spalart*this->_rho*(U*nu_gradphi[i][qp]);
204 if( compute_jacobian )
206 libmesh_not_implemented();
INSTANTIATE_TURBULENCE_MODELS_SUBCLASS(SpalartAllmarasSPGSMStabilization)
SpalartAllmarasSPGSMStabilization()
virtual void init_variables(libMesh::FEMSystem *system)
Initialize variables for this physics.
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.
virtual void init_variables(libMesh::FEMSystem *system)
Initialize variables for this physics.
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 register_parameter(const std::string ¶m_name, libMesh::ParameterMultiAccessor< libMesh::Number > ¶m_pointer) const
Each subclass will register its copy of an independent.
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context)
Time dependent part(s) of physics for element interiors.