GRINS-0.8.0
List of all members | Public Member Functions | Protected Attributes
GRINS::SpalartAllmarasStabilizationHelper Class Reference

#include <spalart_allmaras_stab_helper.h>

Inheritance diagram for GRINS::SpalartAllmarasStabilizationHelper:
Inheritance graph
[legend]
Collaboration diagram for GRINS::SpalartAllmarasStabilizationHelper:
Collaboration graph
[legend]

Public Member Functions

 SpalartAllmarasStabilizationHelper (const std::string &helper_name, const GetPot &input)
 
 ~SpalartAllmarasStabilizationHelper ()
 
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
 
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
 
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
 
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 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_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_transient (AssemblyContext &context, unsigned int qp, const libMesh::Real rho) const
 
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
 
virtual void register_parameter (const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
 Each subclass will register its copy of an independent. More...
 
- Public Member Functions inherited from GRINS::StabilizationHelper
 StabilizationHelper (const std::string &helper_name)
 
 ~StabilizationHelper ()
 
libMesh::RealGradient compute_g (libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
 
libMesh::RealTensor compute_G (libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
 
- Public Member Functions inherited from GRINS::ParameterUser
 ParameterUser (const std::string &user_name)
 
virtual ~ParameterUser ()
 
virtual void set_parameter (libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
 Each subclass can simultaneously read a parameter value from. More...
 
virtual void set_parameter (libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void set_parameter (libMesh::ParsedFEMFunction< libMesh::Number > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void move_parameter (const libMesh::Number &old_parameter, libMesh::Number &new_parameter)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &old_func, libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFEMFunction< libMesh::Number > &old_func, libMesh::ParsedFEMFunction< libMesh::Number > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 

Protected Attributes

libMesh::Real _C
 
libMesh::Real _tau_factor
 
const VelocityVariable_flow_vars
 
const PressureFEVariable_press_var
 
const TurbulenceFEVariables_turbulence_vars
 
SpalartAllmarasHelper _spalart_allmaras_helper
 
SpalartAllmarasParameters _sa_params
 

Additional Inherited Members

- Static Public Attributes inherited from GRINS::ParameterUser
static std::string zero_vector_function = std::string("{0}")
 A parseable function string with LIBMESH_DIM components, all 0. More...
 

Detailed Description

Definition at line 46 of file spalart_allmaras_stab_helper.h.

Constructor & Destructor Documentation

GRINS::SpalartAllmarasStabilizationHelper::SpalartAllmarasStabilizationHelper ( const std::string &  helper_name,
const GetPot &  input 
)

Definition at line 43 of file spalart_allmaras_stab_helper.C.

References _C, _tau_factor, and GRINS::ParameterUser::set_parameter().

45  : StabilizationHelper(helper_name),
46  _C( input("Stabilization/tau_constant_vel", input("Stabilization/tau_constant", 1.0 ) ) ),
47  _tau_factor( input("Stabilization/tau_factor_vel", input("Stabilization/tau_factor", 0.5 ) ) ),
48  _flow_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<VelocityVariable>(VariablesParsing::velocity_variable_name(input,PhysicsNaming::spalart_allmaras(),VariablesParsing::PHYSICS))),
49  _press_var(GRINSPrivate::VariableWarehouse::get_variable_subclass<PressureFEVariable>(VariablesParsing::press_variable_name(input,PhysicsNaming::spalart_allmaras(),VariablesParsing::PHYSICS))),
50  _turbulence_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<TurbulenceFEVariables>(VariablesParsing::turb_variable_name(input,PhysicsNaming::spalart_allmaras(),VariablesParsing::PHYSICS))),
52  _sa_params(input)
53  {
54  this->set_parameter(this->_C ,input, "Stabilization/tau_constant_vel" , this->_C );
55  this->set_parameter(this->_tau_factor ,input, "Stabilization/tau_factor_sa", this->_tau_factor );
56  }
virtual void set_parameter(libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
static PhysicsName spalart_allmaras()
static std::string velocity_variable_name(const GetPot &input, const std::string &subsection_name, const SECTION_TYPE section_type)
static std::string press_variable_name(const GetPot &input, const std::string &subsection_name, const SECTION_TYPE section_type)
static std::string turb_variable_name(const GetPot &input, const std::string &subsection_name, const SECTION_TYPE section_type)
StabilizationHelper(const std::string &helper_name)
Definition: stab_helper.C:36
GRINS::SpalartAllmarasStabilizationHelper::~SpalartAllmarasStabilizationHelper ( )
inline

Definition at line 52 of file spalart_allmaras_stab_helper.h.

52 {};

Member Function Documentation

libMesh::Real GRINS::SpalartAllmarasStabilizationHelper::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

Definition at line 66 of file spalart_allmaras_stab_helper.C.

References _flow_vars, _sa_params, _spalart_allmaras_helper, _turbulence_vars, GRINS::SpalartAllmarasParameters::destruction_fn(), GRINS::MultcomponentVectorVariable::dim(), GRINS::SpalartAllmarasParameters::get_cb1(), GRINS::SpalartAllmarasParameters::get_cb2(), GRINS::SpalartAllmarasParameters::get_kappa(), GRINS::SpalartAllmarasParameters::get_sigma(), GRINS::TurbulenceFEVariables::nu(), GRINS::SpalartAllmarasParameters::source_fn(), GRINS::MultcomponentVectorVariable::u(), GRINS::MultcomponentVectorVariable::v(), GRINS::SpalartAllmarasHelper::vorticity(), and GRINS::MultcomponentVectorVariable::w().

68  {
69  // The flow velocity
70  libMesh::Number u,v;
71  u = context.interior_value(this->_flow_vars.u(), qp);
72  v = context.interior_value(this->_flow_vars.v(), qp);
73 
74  libMesh::NumberVectorValue U(u,v);
75  if ( this->_flow_vars.dim() == 3 )
76  U(2) = context.interior_value(this->_flow_vars.w(), qp);
77 
78  libMesh::RealGradient grad_u = context.fixed_interior_gradient(this->_flow_vars.u(), qp);
79  libMesh::RealGradient grad_v = context.fixed_interior_gradient(this->_flow_vars.v(), qp);
80 
81  libMesh::Number nu_value = context.interior_value(this->_turbulence_vars.nu(), qp);
82 
83  libMesh::RealGradient grad_nu = context.fixed_interior_gradient(this->_turbulence_vars.nu(), qp);
84 
85  libMesh::RealTensor hess_nu = context.fixed_interior_hessian(this->_turbulence_vars.nu(), qp);
86 
87  // The convection term
88  libMesh::Number rhoUdotGradnu = rho*(U*grad_nu);
89 
90  // The diffusion term
91  libMesh::Number inv_sigmadivnuplusnuphysicalGradnu = (1./this->_sa_params.get_sigma())*(grad_nu*grad_nu + ((nu_value + mu)*(hess_nu(0,0) + hess_nu(1,1) + (this->_flow_vars.dim() == 3)?hess_nu(2,2):0)) + this->_sa_params.get_cb2()*grad_nu*grad_nu);
92 
93  // The source term
94  libMesh::Real vorticity_value_qp = this->_spalart_allmaras_helper.vorticity(context, qp);
95  libMesh::Real S_tilde = this->_sa_params.source_fn(nu_value, mu, distance_qp, vorticity_value_qp, infinite_distance);
96  libMesh::Real source_term = this->_sa_params.get_cb1()*S_tilde*nu_value;
97 
98  libMesh::Real kappa2 = (this->_sa_params.get_kappa())*(this->_sa_params.get_kappa());
99  libMesh::Real cw1 = this->_sa_params.get_cb1()/kappa2 + (1.0 + this->_sa_params.get_cb2())/this->_sa_params.get_sigma();
100 
101  // The destruction term
102  libMesh::Real fw = this->_sa_params.destruction_fn(nu_value, distance_qp, S_tilde, infinite_distance);
103  libMesh::Real destruction_term = 0.0;
104  if(infinite_distance)
105  {
106  destruction_term = 0.0;
107  }
108  else
109  {
110  destruction_term = cw1*fw*pow(nu_value/distance_qp, 2.);
111  }
112 
113  return rhoUdotGradnu + source_term + inv_sigmadivnuplusnuphysicalGradnu - destruction_term;
114  }
libMesh::Real source_fn(libMesh::Number nu, libMesh::Real mu, libMesh::Real wall_distance, libMesh::Real vorticity_value, bool infinite_distance) const
VariableIndex nu() const
libMesh::Real vorticity(AssemblyContext &context, unsigned int qp) const
libMesh::Real destruction_fn(libMesh::Number nu, libMesh::Real wall_distance, libMesh::Real S_tilde, bool infinite_distance) const
unsigned int dim() const
Number of components.
void GRINS::SpalartAllmarasStabilizationHelper::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

Definition at line 117 of file spalart_allmaras_stab_helper.C.

125  {
126  // To be filled when we start using analytic jacobians with SA
127  libmesh_not_implemented();
128  }
libMesh::Real GRINS::SpalartAllmarasStabilizationHelper::compute_res_spalart_transient ( AssemblyContext context,
unsigned int  qp,
const libMesh::Real  rho 
) const

Definition at line 131 of file spalart_allmaras_stab_helper.C.

References _turbulence_vars, and GRINS::TurbulenceFEVariables::nu().

132  {
133  libMesh::Number nu_dot = context.interior_value(this->_turbulence_vars.nu(), qp);
134 
135  return rho*nu_dot;
136  }
VariableIndex nu() const
void GRINS::SpalartAllmarasStabilizationHelper::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

Definition at line 140 of file spalart_allmaras_stab_helper.C.

146  {
147  libmesh_not_implemented();
148  }
libMesh::Real GRINS::SpalartAllmarasStabilizationHelper::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
inline

Definition at line 184 of file spalart_allmaras_stab_helper.h.

References _C, and _tau_factor.

Referenced by compute_tau_spalart().

192  {
193  libMesh::Real tau = (rho*U)*(G*(rho*U)) + this->_C*mat_prop_sq*G.contract(G);
194 
195  if(!is_steady)
196  tau += (2.0*rho/c.get_deltat_value())*(2.0*rho/c.get_deltat_value());
197 
198  return this->_tau_factor/std::sqrt(tau);
199  }
void GRINS::SpalartAllmarasStabilizationHelper::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
inline

Definition at line 204 of file spalart_allmaras_stab_helper.h.

215  {
216  libMesh::Gradient rhoU = rho*U;
217  libMesh::Gradient GrhoU = G*rhoU;
218  libMesh::Real rhoUGrhoU = rhoU * GrhoU;
219  libMesh::Real GG = G.contract(G);
220  tau = rhoUGrhoU + this->_C*mat_prop_sq*GG;
221  d_tau_d_rho = rhoUGrhoU*2/rho;
222  d_tau_d_U = 2*rho*GrhoU;
223 
224  if(!is_steady)
225  {
226  libMesh::Real two_rho_over_dt = 2*rho/c.get_deltat_value();
227  tau += two_rho_over_dt * two_rho_over_dt;
228  d_tau_d_rho += 4*two_rho_over_dt/c.get_deltat_value();
229  }
230 
231  // But what we've computed so far isn't tau; we need
232  // tau = _tau_factor/ sqrt(our_tau)
233 
234  libMesh::Real root_oldtau = std::sqrt(tau);
235  libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau*root_oldtau) / 2;
236 
237  d_tau_d_rho = d_tau_d_oldtau * d_tau_d_rho;
238  d_tau_d_U = d_tau_d_oldtau * d_tau_d_U;
239 
240  tau = this->_tau_factor / root_oldtau;
241  }
libMesh::Real GRINS::SpalartAllmarasStabilizationHelper::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
inline

Definition at line 151 of file spalart_allmaras_stab_helper.h.

References compute_tau().

159  {
160  return this->compute_tau( c, qp, mu*mu, g, G, rho, U, is_steady );
161  }
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
void GRINS::SpalartAllmarasStabilizationHelper::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
inline

Definition at line 165 of file spalart_allmaras_stab_helper.h.

176  {
177  this->compute_tau_and_derivs( c, qp, mu*mu, g, G, rho, U, tau_M,
178  d_tau_M_d_rho, d_tau_M_d_U,
179  is_steady );
180  }
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
void GRINS::SpalartAllmarasStabilizationHelper::register_parameter ( const std::string &  param_name,
libMesh::ParameterMultiAccessor< libMesh::Number > &  param_pointer 
) const
virtual

Each subclass will register its copy of an independent.

Reimplemented from GRINS::ParameterUser.

Definition at line 59 of file spalart_allmaras_stab_helper.C.

References GRINS::ParameterUser::register_parameter().

61  {
62  ParameterUser::register_parameter(param_name, param_pointer);
63  this->_sa_params.register_parameter(param_name, param_pointer);
64  }
virtual void register_parameter(const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
Each subclass will register its copy of an independent.

Member Data Documentation

libMesh::Real GRINS::SpalartAllmarasStabilizationHelper::_C
protected
const VelocityVariable& GRINS::SpalartAllmarasStabilizationHelper::_flow_vars
protected

Definition at line 137 of file spalart_allmaras_stab_helper.h.

Referenced by compute_res_spalart_steady().

const PressureFEVariable& GRINS::SpalartAllmarasStabilizationHelper::_press_var
protected

Definition at line 138 of file spalart_allmaras_stab_helper.h.

SpalartAllmarasParameters GRINS::SpalartAllmarasStabilizationHelper::_sa_params
protected

Definition at line 144 of file spalart_allmaras_stab_helper.h.

Referenced by compute_res_spalart_steady().

SpalartAllmarasHelper GRINS::SpalartAllmarasStabilizationHelper::_spalart_allmaras_helper
protected

Definition at line 142 of file spalart_allmaras_stab_helper.h.

Referenced by compute_res_spalart_steady().

libMesh::Real GRINS::SpalartAllmarasStabilizationHelper::_tau_factor
protected
const TurbulenceFEVariables& GRINS::SpalartAllmarasStabilizationHelper::_turbulence_vars
protected

The documentation for this class was generated from the following files:

Generated on Tue Dec 19 2017 12:47:32 for GRINS-0.8.0 by  doxygen 1.8.9.1