25 #ifndef GRINS_SPALART_ALLMARAS_STAB_HELPER_H
26 #define GRINS_SPALART_ALLMARAS_STAB_HELPER_H
44 class TurbulenceFEVariables;
54 void init( libMesh::FEMSystem& system );
59 libMesh::RealGradient& g,
60 libMesh::RealTensor& G,
64 bool is_steady )
const;
68 libMesh::RealGradient& g,
69 libMesh::RealTensor& G,
74 libMesh::Real &d_tau_M_d_rho,
75 libMesh::Gradient &d_tau_M_d_U,
76 bool is_steady )
const;
80 libMesh::Real mat_prop_sq,
81 libMesh::RealGradient& g,
82 libMesh::RealTensor& G,
85 bool is_steady )
const;
89 libMesh::Real mat_prop_sq,
90 libMesh::RealGradient& g,
91 libMesh::RealTensor& G,
95 libMesh::Real& d_tau_d_rho,
96 libMesh::Gradient& d_tau_d_U,
97 bool is_steady )
const;
102 const libMesh::Real rho,
103 const libMesh::Real mu,
104 const libMesh::Real distance_qp,
105 const bool infinite_distance)
const;
109 const libMesh::Real rho,
110 const libMesh::Real mu,
111 libMesh::Gradient &res_M,
112 libMesh::Tensor &d_res_M_dgradp,
113 libMesh::Tensor &d_res_M_dU,
114 libMesh::Gradient &d_res_Muvw_dgraduvw,
115 libMesh::Tensor &d_res_Muvw_dhessuvw
120 const libMesh::Real rho )
const;
124 const libMesh::Real rho,
125 libMesh::RealGradient &res_M,
126 libMesh::Real &d_res_Muvw_duvw
132 (
const std::string & param_name,
160 libMesh::RealGradient& g,
161 libMesh::RealTensor& G,
165 bool is_steady )
const
167 return this->
compute_tau( c, qp, mu*mu, g, G, rho, U, is_steady );
174 libMesh::RealGradient& g,
175 libMesh::RealTensor& G,
179 libMesh::Real& tau_M,
180 libMesh::Real &d_tau_M_d_rho,
181 libMesh::Gradient &d_tau_M_d_U,
182 bool is_steady )
const
184 this->compute_tau_and_derivs( c, qp, mu*mu, g, G, rho, U, tau_M,
185 d_tau_M_d_rho, d_tau_M_d_U,
193 libMesh::Real mat_prop_sq,
194 libMesh::RealGradient& ,
195 libMesh::RealTensor& G,
198 bool is_steady )
const
200 libMesh::Real tau = (rho*U)*(G*(rho*U)) + this->
_C*mat_prop_sq*G.contract(G);
203 tau += (2.0*rho/c.get_deltat_value())*(2.0*rho/c.get_deltat_value());
213 libMesh::Real mat_prop_sq,
214 libMesh::RealGradient& ,
215 libMesh::RealTensor& G,
219 libMesh::Real& d_tau_d_rho,
220 libMesh::Gradient& d_tau_d_U,
221 bool is_steady )
const
223 libMesh::Gradient rhoU = rho*U;
224 libMesh::Gradient GrhoU = G*rhoU;
225 libMesh::Real rhoUGrhoU = rhoU * GrhoU;
226 libMesh::Real GG = G.contract(G);
227 tau = rhoUGrhoU + this->_C*mat_prop_sq*GG;
228 d_tau_d_rho = rhoUGrhoU*2/rho;
229 d_tau_d_U = 2*rho*GrhoU;
233 libMesh::Real two_rho_over_dt = 2*rho/c.get_deltat_value();
234 tau += two_rho_over_dt * two_rho_over_dt;
235 d_tau_d_rho += 4*two_rho_over_dt/c.get_deltat_value();
241 libMesh::Real root_oldtau = std::sqrt(tau);
242 libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau*root_oldtau) / 2;
244 d_tau_d_rho = d_tau_d_oldtau * d_tau_d_rho;
245 d_tau_d_U = d_tau_d_oldtau * d_tau_d_U;
247 tau = this->_tau_factor / root_oldtau;
251 #endif // GRINS_SPALART_ALLMARAS_STAB_HELPER_H
void compute_res_spalart_transient_and_derivs(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, libMesh::RealGradient &res_M, libMesh::Real &d_res_Muvw_duvw) const
const TurbulenceFEVariables & _turbulence_vars
~SpalartAllmarasStabilizationHelper()
libMesh::Real compute_tau(AssemblyContext &c, unsigned int qp, libMesh::Real mat_prop_sq, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, bool is_steady) const
libMesh::Real compute_res_spalart_transient(AssemblyContext &context, unsigned int qp, const libMesh::Real rho) const
void init(libMesh::FEMSystem &system)
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.
void compute_tau_and_derivs(AssemblyContext &c, unsigned int qp, libMesh::Real mat_prop_sq, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, libMesh::Real &tau, libMesh::Real &d_tau_d_rho, libMesh::Gradient &d_tau_d_U, bool is_steady) const
libMesh::Real _tau_factor
const VelocityFEVariables & _flow_vars
libMesh::Real compute_tau_spalart(AssemblyContext &c, unsigned int qp, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, libMesh::Real mu, bool is_steady) const
SpalartAllmarasHelper _spalart_allmaras_helper
const PressureFEVariable & _press_var
SpalartAllmarasStabilizationHelper(const std::string &helper_name, const GetPot &input)
SpalartAllmarasParameters _sa_params
unsigned int _dim
Physical dimension of problem.
Encapsulate Spalart-Allmaras model parameters.
void compute_res_spalart_steady_and_derivs(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real mu, libMesh::Gradient &res_M, libMesh::Tensor &d_res_M_dgradp, libMesh::Tensor &d_res_M_dU, libMesh::Gradient &d_res_Muvw_dgraduvw, libMesh::Tensor &d_res_Muvw_dhessuvw) const
libMesh::Real compute_res_spalart_steady(AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real mu, const libMesh::Real distance_qp, const bool infinite_distance) const
void compute_tau_spalart_and_derivs(AssemblyContext &c, unsigned int qp, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, libMesh::Real T, libMesh::Real &tau_M, libMesh::Real &d_tau_M_d_rho, libMesh::Gradient &d_tau_M_d_U, bool is_steady) const