GRINS-0.8.0
List of all members | Public Member Functions | Private Member Functions
GRINS::SpalartAllmarasSPGSMStabilization< Viscosity > Class Template Reference

Adds SUPG stabilization to the SpalartAllmaras 'physics'. More...

#include <spalart_allmaras_spgsm_stab.h>

Inheritance diagram for GRINS::SpalartAllmarasSPGSMStabilization< Viscosity >:
Inheritance graph
[legend]
Collaboration diagram for GRINS::SpalartAllmarasSPGSMStabilization< Viscosity >:
Collaboration graph
[legend]

Public Member Functions

 SpalartAllmarasSPGSMStabilization (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~SpalartAllmarasSPGSMStabilization ()
 
virtual void init_variables (libMesh::FEMSystem *system)
 Initialize variables for this physics. More...
 
virtual void element_time_derivative (bool compute_jacobian, AssemblyContext &context)
 Time dependent part(s) of physics for element interiors. More...
 
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. More...
 
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::SpalartAllmarasStabilizationBase< Viscosity >
 SpalartAllmarasStabilizationBase (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~SpalartAllmarasStabilizationBase ()
 
virtual void init_context (AssemblyContext &context)
 Initialize context for added physics variables. More...
 
- Public Member Functions inherited from GRINS::SpalartAllmaras< Viscosity >
 SpalartAllmaras (const std::string &physics_name, const GetPot &input)
 
 ~SpalartAllmaras ()
 
virtual void set_time_evolving_vars (libMesh::FEMSystem *system)
 Sets velocity variables to be time-evolving. More...
 
- Public Member Functions inherited from GRINS::TurbulenceModelsBase< Viscosity >
 TurbulenceModelsBase (const std::string &physics_name, const GetPot &input)
 
 ~TurbulenceModelsBase ()
 
- Public Member Functions inherited from GRINS::Physics
 Physics (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~Physics ()
 
virtual bool enabled_on_elem (const libMesh::Elem *elem)
 Find if current physics is active on supplied element. More...
 
void set_is_steady (bool is_steady)
 Sets whether this physics is to be solved with a steady solver or not. More...
 
bool is_steady () const
 Returns whether or not this physics is being solved with a steady solver. More...
 
virtual void auxiliary_init (MultiphysicsSystem &system)
 Any auxillary initialization a Physics class may need. More...
 
virtual void register_postprocessing_vars (const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
 Register name of postprocessed quantity with PostProcessedQuantities. More...
 
virtual void preassembly (MultiphysicsSystem &)
 Perform any necessary setup before element assembly begins. More...
 
virtual void reinit (MultiphysicsSystem &)
 Any reinitialization that needs to be done. More...
 
virtual void side_time_derivative (bool, AssemblyContext &)
 Time dependent part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_time_derivative (bool, AssemblyContext &)
 Time dependent part(s) of physics for scalar variables. More...
 
virtual void element_constraint (bool, AssemblyContext &)
 Constraint part(s) of physics for element interiors. More...
 
virtual void side_constraint (bool, AssemblyContext &)
 Constraint part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_constraint (bool, AssemblyContext &)
 Constraint part(s) of physics for scalar variables. More...
 
virtual void damping_residual (bool, AssemblyContext &)
 Damping matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void nonlocal_mass_residual (bool, AssemblyContext &)
 Mass matrix part(s) for scalar variables. More...
 
void init_ics (libMesh::FEMSystem *system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
 
virtual void compute_element_time_derivative_cache (AssemblyContext &)
 
virtual void compute_side_time_derivative_cache (AssemblyContext &)
 
virtual void compute_nonlocal_time_derivative_cache (AssemblyContext &)
 
virtual void compute_element_constraint_cache (AssemblyContext &)
 
virtual void compute_side_constraint_cache (AssemblyContext &)
 
virtual void compute_nonlocal_constraint_cache (AssemblyContext &)
 
virtual void compute_damping_residual_cache (AssemblyContext &)
 
virtual void compute_mass_residual_cache (AssemblyContext &)
 
virtual void compute_nonlocal_mass_residual_cache (AssemblyContext &)
 
virtual void compute_postprocessed_quantity (unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
 
ICHandlingBaseget_ic_handler ()
 
- 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...
 

Private Member Functions

 SpalartAllmarasSPGSMStabilization ()
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::Physics
static void set_is_axisymmetric (bool is_axisymmetric)
 Set whether we should treat the problem as axisymmetric. More...
 
static bool is_axisymmetric ()
 
- Public Attributes inherited from GRINS::SpalartAllmaras< Viscosity >
libMesh::UniquePtr< DistanceFunctiondistance_function
 
libMesh::UniquePtr< libMesh::SerialMesh > boundary_mesh
 
- 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...
 
- Protected Member Functions inherited from GRINS::Physics
libMesh::UniquePtr< libMesh::FEGenericBase< libMesh::Real > > build_new_fe (const libMesh::Elem *elem, const libMesh::FEGenericBase< libMesh::Real > *fe, const libMesh::Point p)
 
void parse_enabled_subdomains (const GetPot &input, const std::string &physics_name)
 
void check_var_subdomain_consistency (const FEVariablesBase &var) const
 Check that var is enabled on at least the subdomains this Physics is. More...
 
- Protected Attributes inherited from GRINS::SpalartAllmarasStabilizationBase< Viscosity >
SpalartAllmarasStabilizationHelper _stab_helper
 
- Protected Attributes inherited from GRINS::SpalartAllmaras< Viscosity >
VelocityVariable_flow_vars
 
PressureFEVariable_press_var
 
TurbulenceFEVariables_turbulence_vars
 
SpalartAllmarasHelper _spalart_allmaras_helper
 
SpalartAllmarasParameters _sa_params
 Object handling the plethora of parameters. More...
 
std::set< libMesh::boundary_id_type > _wall_ids
 
unsigned int _no_of_walls
 
bool _infinite_distance
 
- Protected Attributes inherited from GRINS::TurbulenceModelsBase< Viscosity >
unsigned int _dim
 Physical dimension of problem. More...
 
libMesh::Number _rho
 Material parameters, read from input. More...
 
Viscosity _mu
 Viscosity object. More...
 
- Protected Attributes inherited from GRINS::Physics
const PhysicsName _physics_name
 Name of the physics object. Used for reading physics specific inputs. More...
 
GRINS::ICHandlingBase_ic_handler
 
std::set< libMesh::subdomain_id_type > _enabled_subdomains
 Subdomains on which the current Physics class is enabled. More...
 
- Static Protected Attributes inherited from GRINS::Physics
static bool _is_steady = false
 Caches whether or not the solver that's being used is steady or not. More...
 
static bool _is_axisymmetric = false
 Caches whether we are solving an axisymmetric problem or not. More...
 

Detailed Description

template<class Viscosity>
class GRINS::SpalartAllmarasSPGSMStabilization< Viscosity >

Adds SUPG stabilization to the SpalartAllmaras 'physics'.

Definition at line 36 of file spalart_allmaras_spgsm_stab.h.

Constructor & Destructor Documentation

template<class Mu >
GRINS::SpalartAllmarasSPGSMStabilization< Mu >::SpalartAllmarasSPGSMStabilization ( const GRINS::PhysicsName physics_name,
const GetPot &  input 
)

Definition at line 42 of file spalart_allmaras_spgsm_stab.C.

44  : SpalartAllmarasStabilizationBase<Mu>(physics_name,input)
45  {}
template<class Viscosity >
virtual GRINS::SpalartAllmarasSPGSMStabilization< Viscosity >::~SpalartAllmarasSPGSMStabilization ( )
inlinevirtual

Definition at line 42 of file spalart_allmaras_spgsm_stab.h.

42 {};
template<class Viscosity >
GRINS::SpalartAllmarasSPGSMStabilization< Viscosity >::SpalartAllmarasSPGSMStabilization ( )
private

Member Function Documentation

template<class Mu >
void GRINS::SpalartAllmarasSPGSMStabilization< Mu >::element_time_derivative ( bool  ,
AssemblyContext  
)
virtual

Time dependent part(s) of physics for element interiors.

Reimplemented from GRINS::SpalartAllmaras< Viscosity >.

Definition at line 67 of file spalart_allmaras_spgsm_stab.C.

69  {
70  // Get a pointer to the current element, we need this for computing the distance to wall for the
71  // quadrature points
72  libMesh::Elem &elem_pointer = context.get_elem();
73 
74  // The number of local degrees of freedom in each variable.
75  const unsigned int n_nu_dofs = context.get_dof_indices(this->_turbulence_vars.nu()).size();
76 
77  // Element Jacobian * quadrature weights for interior integration.
78  const std::vector<libMesh::Real> &JxW =
79  context.get_element_fe(this->_turbulence_vars.nu())->get_JxW();
80 
81  // The viscosity shape function gradients (in global coords.)
82  // at interior quadrature points.
83  const std::vector<std::vector<libMesh::RealGradient> >& nu_gradphi =
84  context.get_element_fe(this->_turbulence_vars.nu())->get_dphi();
85 
86  // Quadrature point locations
87  //const std::vector<libMesh::Point>& nu_qpoint =
88  //context.get_element_fe(this->_turbulence_vars.nu())->get_xyz();
89 
90  //libMesh::DenseSubMatrix<libMesh::Number> &Knunu = context.get_elem_jacobian(this->_turbulence_vars.nu(), this->_turbulence_vars.nu()); // R_{nu},{nu}
91 
92  libMesh::DenseSubVector<libMesh::Number> &Fnu = context.get_elem_residual(this->_turbulence_vars.nu()); // R_{nu}
93 
94  libMesh::FEBase* fe = context.get_element_fe(this->_turbulence_vars.nu());
95 
96  unsigned int n_qpoints = context.get_element_qrule().n_points();
97 
98  // Auto pointer to distance fcn evaluated at quad points
99  libMesh::UniquePtr< libMesh::DenseVector<libMesh::Real> > distance_qp;
100 
101  // Fill the vector of distances to quadrature points
102  distance_qp = this->distance_function->interpolate(&elem_pointer, context.get_element_qrule().get_points());
103 
104  for (unsigned int qp=0; qp != n_qpoints; qp++)
105  {
106  libMesh::Gradient grad_nu;
107  grad_nu = context.interior_gradient(this->_turbulence_vars.nu(), qp);
108 
109  libMesh::Real jac = JxW[qp];
110 
111  // The physical viscosity
112  libMesh::Real _mu_qp = this->_mu(context, qp);
113 
114  // To be fixed
115  // For the channel flow we will just set the distance function analytically
116  //(*distance_qp)(qp) = std::min(fabs(y),fabs(1 - y));
117 
118  // The flow velocity
119  libMesh::Number u,v;
120  u = context.interior_value(this->_flow_vars.u(), qp);
121  v = context.interior_value(this->_flow_vars.v(), qp);
122 
123  libMesh::NumberVectorValue U(u,v);
124  if (this->_flow_vars.dim() == 3)
125  U(2) = context.interior_value(this->_flow_vars.w(), qp);
126 
127  // Stabilization terms
128 
129  libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
130  libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
131 
132  libMesh::Real tau_spalart = this->_stab_helper.compute_tau_spalart( context, qp, g, G, this->_rho, U, _mu_qp, this->_is_steady );
133 
134  libMesh::Number RM_spalart = this->_stab_helper.compute_res_spalart_steady( context, qp, this->_rho, _mu_qp, (*distance_qp)(qp), this->_infinite_distance );
135 
136  for (unsigned int i=0; i != n_nu_dofs; i++)
137  {
138  Fnu(i) += jac*( -tau_spalart*RM_spalart*this->_rho*(U*nu_gradphi[i][qp]) );
139  }
140 
141  if( compute_jacobian )
142  {
143  libmesh_not_implemented();
144  }
145 
146  }
147  }
TurbulenceFEVariables & _turbulence_vars
libMesh::RealTensor compute_G(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:69
libMesh::UniquePtr< DistanceFunction > distance_function
VariableIndex nu() const
libMesh::RealGradient compute_g(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:47
Viscosity _mu
Viscosity object.
static bool _is_steady
Caches whether or not the solver that's being used is steady or not.
Definition: physics.h:266
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
VelocityVariable & _flow_vars
SpalartAllmarasStabilizationHelper _stab_helper
unsigned int dim() const
Number of components.
libMesh::Number _rho
Material parameters, read from input.
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
template<class Mu >
void GRINS::SpalartAllmarasSPGSMStabilization< Mu >::init_variables ( libMesh::FEMSystem *  )
virtual

Initialize variables for this physics.

Reimplemented from GRINS::SpalartAllmaras< Viscosity >.

Definition at line 48 of file spalart_allmaras_spgsm_stab.C.

References GRINS::SpalartAllmaras< Viscosity >::init_variables().

49  {
50  // Init base class variables for stab_helper and distance function initialization
52 
53  return;
54  }
virtual void init_variables(libMesh::FEMSystem *system)
Initialize variables for this physics.
template<class Mu >
void GRINS::SpalartAllmarasSPGSMStabilization< Mu >::mass_residual ( bool  ,
AssemblyContext  
)
virtual

Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part.

Reimplemented from GRINS::SpalartAllmaras< Viscosity >.

Definition at line 151 of file spalart_allmaras_spgsm_stab.C.

152  {
153  // Get a pointer to the current element, we need this for computing the distance to wall for the
154  // quadrature points
155  libMesh::Elem &elem_pointer = context.get_elem();
156 
157  // The number of local degrees of freedom in each variable.
158  const unsigned int n_nu_dofs = context.get_dof_indices(this->_turbulence_vars.nu()).size();
159 
160  // Element Jacobian * quadrature weights for interior integration.
161  const std::vector<libMesh::Real> &JxW =
162  context.get_element_fe(this->_turbulence_vars.nu())->get_JxW();
163 
164  // The pressure shape functions at interior quadrature points.
165  const std::vector<std::vector<libMesh::RealGradient> >& nu_gradphi =
166  context.get_element_fe(this->_turbulence_vars.nu())->get_dphi();
167 
168  libMesh::DenseSubVector<libMesh::Number> &Fnu = context.get_elem_residual(this->_turbulence_vars.nu()); // R_{nu}
169 
170  libMesh::FEBase* fe = context.get_element_fe(this->_turbulence_vars.nu());
171 
172  unsigned int n_qpoints = context.get_element_qrule().n_points();
173 
174  // Auto pointer to distance fcn evaluated at quad points
175  libMesh::UniquePtr< libMesh::DenseVector<libMesh::Real> > distance_qp;
176 
177  // Fill the vector of distances to quadrature points
178  distance_qp = this->distance_function->interpolate(&elem_pointer, context.get_element_qrule().get_points());
179 
180  for (unsigned int qp=0; qp != n_qpoints; qp++)
181  {
182  libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
183  libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
184 
185  libMesh::RealGradient U( context.fixed_interior_value( this->_flow_vars.u(), qp ),
186  context.fixed_interior_value( this->_flow_vars.v(), qp ) );
187  // Compute the viscosity at this qp
188  libMesh::Real _mu_qp = this->_mu(context, qp);
189 
190  if( this->_flow_vars.dim() == 3 )
191  {
192  U(2) = context.fixed_interior_value( this->_flow_vars.w(), qp );
193  }
194 
195  libMesh::Real tau_spalart = this->_stab_helper.compute_tau_spalart( context, qp, g, G, this->_rho, U, _mu_qp, this->_is_steady );
196 
197  libMesh::Real RM_spalart = this->_stab_helper.compute_res_spalart_transient( context, qp, this->_rho );
198 
199  for (unsigned int i=0; i != n_nu_dofs; i++)
200  {
201  Fnu(i) += -JxW[qp]*tau_spalart*RM_spalart*this->_rho*(U*nu_gradphi[i][qp]);
202  }
203 
204  if( compute_jacobian )
205  {
206  libmesh_not_implemented();
207  }
208 
209  }
210  }
TurbulenceFEVariables & _turbulence_vars
libMesh::RealTensor compute_G(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:69
libMesh::UniquePtr< DistanceFunction > distance_function
VariableIndex nu() const
libMesh::RealGradient compute_g(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:47
Viscosity _mu
Viscosity object.
libMesh::Real compute_res_spalart_transient(AssemblyContext &context, unsigned int qp, const libMesh::Real rho) const
static bool _is_steady
Caches whether or not the solver that's being used is steady or not.
Definition: physics.h:266
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
VelocityVariable & _flow_vars
SpalartAllmarasStabilizationHelper _stab_helper
unsigned int dim() const
Number of components.
libMesh::Number _rho
Material parameters, read from input.
template<class Mu >
void GRINS::SpalartAllmarasSPGSMStabilization< Mu >::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::SpalartAllmarasStabilizationBase< Viscosity >.

Definition at line 58 of file spalart_allmaras_spgsm_stab.C.

References GRINS::SpalartAllmarasStabilizationBase< Viscosity >::register_parameter().

60  {
61  // Register base class parameters
63  }
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.

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