25 #ifndef GRINS_SPALART_ALLMARAS_STAB_HELPER_H
26 #define GRINS_SPALART_ALLMARAS_STAB_HELPER_H
52 void init( libMesh::FEMSystem& system );
57 libMesh::RealGradient& g,
58 libMesh::RealTensor& G,
62 bool is_steady )
const;
66 libMesh::RealGradient& g,
67 libMesh::RealTensor& G,
72 libMesh::Real &d_tau_M_d_rho,
73 libMesh::Gradient &d_tau_M_d_U,
74 bool is_steady )
const;
78 libMesh::Real mat_prop_sq,
79 libMesh::RealGradient& g,
80 libMesh::RealTensor& G,
83 bool is_steady )
const;
87 libMesh::Real mat_prop_sq,
88 libMesh::RealGradient& g,
89 libMesh::RealTensor& G,
93 libMesh::Real& d_tau_d_rho,
94 libMesh::Gradient& d_tau_d_U,
95 bool is_steady )
const;
100 const libMesh::Real rho,
101 const libMesh::Real mu,
102 const libMesh::Real distance_qp)
const;
106 const libMesh::Real rho,
107 const libMesh::Real mu,
108 libMesh::Gradient &res_M,
109 libMesh::Tensor &d_res_M_dgradp,
110 libMesh::Tensor &d_res_M_dU,
111 libMesh::Gradient &d_res_Muvw_dgraduvw,
112 libMesh::Tensor &d_res_Muvw_dhessuvw
117 const libMesh::Real rho )
const;
121 const libMesh::Real rho,
122 libMesh::RealGradient &res_M,
123 libMesh::Real &d_res_Muvw_duvw
149 libMesh::RealGradient& g,
150 libMesh::RealTensor& G,
154 bool is_steady )
const
156 return this->
compute_tau( c, qp, mu*mu, g, G, rho, U, is_steady );
163 libMesh::RealGradient& g,
164 libMesh::RealTensor& G,
168 libMesh::Real& tau_M,
169 libMesh::Real &d_tau_M_d_rho,
170 libMesh::Gradient &d_tau_M_d_U,
171 bool is_steady )
const
173 this->compute_tau_and_derivs( c, qp, mu*mu, g, G, rho, U, tau_M,
174 d_tau_M_d_rho, d_tau_M_d_U,
182 libMesh::Real mat_prop_sq,
183 libMesh::RealGradient& ,
184 libMesh::RealTensor& G,
187 bool is_steady )
const
189 libMesh::Real tau = (rho*U)*(G*(rho*U)) + this->
_C*mat_prop_sq*G.contract(G);
192 tau += (2.0*rho/c.get_deltat_value())*(2.0*rho/c.get_deltat_value());
202 libMesh::Real mat_prop_sq,
203 libMesh::RealGradient& ,
204 libMesh::RealTensor& G,
208 libMesh::Real& d_tau_d_rho,
209 libMesh::Gradient& d_tau_d_U,
210 bool is_steady )
const
212 libMesh::Gradient rhoU = rho*U;
213 libMesh::Gradient GrhoU = G*rhoU;
214 libMesh::Real rhoUGrhoU = rhoU * GrhoU;
215 libMesh::Real GG = G.contract(G);
216 tau = rhoUGrhoU + this->_C*mat_prop_sq*GG;
217 d_tau_d_rho = rhoUGrhoU*2/rho;
218 d_tau_d_U = 2*rho*GrhoU;
222 libMesh::Real two_rho_over_dt = 2*rho/c.get_deltat_value();
223 tau += two_rho_over_dt * two_rho_over_dt;
224 d_tau_d_rho += 4*two_rho_over_dt/c.get_deltat_value();
230 libMesh::Real root_oldtau = std::sqrt(tau);
231 libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau*root_oldtau) / 2;
233 d_tau_d_rho = d_tau_d_oldtau * d_tau_d_rho;
234 d_tau_d_U = d_tau_d_oldtau * d_tau_d_U;
236 tau = this->_tau_factor / root_oldtau;
240 #endif // GRINS_SPALART_ALLMARAS_STAB_HELPER_H
PrimitiveFlowVariables _flow_vars
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
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
~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)
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
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
TurbulenceVariables _turbulence_vars
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
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