GRINS-0.7.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, CachedValues &cache)
 Time dependent part(s) of physics for element interiors. More...
 
virtual void mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 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 side_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for scalar variables. More...
 
virtual void element_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for element interiors. More...
 
virtual void side_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for scalar variables. More...
 
virtual void damping_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Damping matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void nonlocal_mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 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 (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_element_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_damping_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
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)
 
- Protected Attributes inherited from GRINS::SpalartAllmarasStabilizationBase< Viscosity >
SpalartAllmarasStabilizationHelper _stab_helper
 
- Protected Attributes inherited from GRINS::SpalartAllmaras< Viscosity >
VelocityFEVariables _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  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

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

Reimplemented from GRINS::SpalartAllmaras< Viscosity >.

Definition at line 66 of file spalart_allmaras_spgsm_stab.C.

69  {
70 #ifdef GRINS_USE_GRVY_TIMERS
71  this->_timer->BeginTimer("SpalartAllmarasSPGSMStabilization::element_time_derivative");
72 #endif
73 
74  // Get a pointer to the current element, we need this for computing the distance to wall for the
75  // quadrature points
76  libMesh::Elem &elem_pointer = context.get_elem();
77 
78  // The number of local degrees of freedom in each variable.
79  const unsigned int n_nu_dofs = context.get_dof_indices(this->_turbulence_vars.nu()).size();
80 
81  // Element Jacobian * quadrature weights for interior integration.
82  const std::vector<libMesh::Real> &JxW =
83  context.get_element_fe(this->_turbulence_vars.nu())->get_JxW();
84 
85  // The viscosity shape function gradients (in global coords.)
86  // at interior quadrature points.
87  const std::vector<std::vector<libMesh::RealGradient> >& nu_gradphi =
88  context.get_element_fe(this->_turbulence_vars.nu())->get_dphi();
89 
90  // Quadrature point locations
91  //const std::vector<libMesh::Point>& nu_qpoint =
92  //context.get_element_fe(this->_turbulence_vars.nu())->get_xyz();
93 
94  //libMesh::DenseSubMatrix<libMesh::Number> &Knunu = context.get_elem_jacobian(this->_turbulence_vars.nu(), this->_turbulence_vars.nu()); // R_{nu},{nu}
95 
96  libMesh::DenseSubVector<libMesh::Number> &Fnu = context.get_elem_residual(this->_turbulence_vars.nu()); // R_{nu}
97 
98  libMesh::FEBase* fe = context.get_element_fe(this->_turbulence_vars.nu());
99 
100  unsigned int n_qpoints = context.get_element_qrule().n_points();
101 
102  // Auto pointer to distance fcn evaluated at quad points
103  libMesh::UniquePtr< libMesh::DenseVector<libMesh::Real> > distance_qp;
104 
105  // Fill the vector of distances to quadrature points
106  distance_qp = this->distance_function->interpolate(&elem_pointer, context.get_element_qrule().get_points());
107 
108  for (unsigned int qp=0; qp != n_qpoints; qp++)
109  {
110  libMesh::Gradient grad_nu;
111  grad_nu = context.interior_gradient(this->_turbulence_vars.nu(), qp);
112 
113  libMesh::Real jac = JxW[qp];
114 
115  // The physical viscosity
116  libMesh::Real _mu_qp = this->_mu(context, qp);
117 
118  // To be fixed
119  // For the channel flow we will just set the distance function analytically
120  //(*distance_qp)(qp) = std::min(fabs(y),fabs(1 - y));
121 
122  // The flow velocity
123  libMesh::Number u,v;
124  u = context.interior_value(this->_flow_vars.u(), qp);
125  v = context.interior_value(this->_flow_vars.v(), qp);
126 
127  libMesh::NumberVectorValue U(u,v);
128  if (this->_dim == 3)
129  U(2) = context.interior_value(this->_flow_vars.w(), qp);
130 
131  // Stabilization terms
132 
133  libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
134  libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
135 
136  libMesh::Real tau_spalart = this->_stab_helper.compute_tau_spalart( context, qp, g, G, this->_rho, U, _mu_qp, this->_is_steady );
137 
138  libMesh::Number RM_spalart = this->_stab_helper.compute_res_spalart_steady( context, qp, this->_rho, _mu_qp, (*distance_qp)(qp), this->_infinite_distance );
139 
140  for (unsigned int i=0; i != n_nu_dofs; i++)
141  {
142  Fnu(i) += jac*( -tau_spalart*RM_spalart*this->_rho*(U*nu_gradphi[i][qp]) );
143  }
144 
145  if( compute_jacobian )
146  {
147  libmesh_not_implemented();
148  }
149 
150  }
151 
152 #ifdef GRINS_USE_GRVY_TIMERS
153  this->_timer->EndTimer("SpalartAllmarasSPGSMStabilization::element_time_derivative");
154 #endif
155 
156  return;
157  }
libMesh::RealTensor compute_G(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:64
libMesh::UniquePtr< DistanceFunction > distance_function
unsigned int _dim
Physical dimension of problem.
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:277
TurbulenceFEVariables _turbulence_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
VelocityFEVariables _flow_vars
SpalartAllmarasStabilizationHelper _stab_helper
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 *  system)
virtual

Initialize variables for this physics.

Reimplemented from GRINS::SpalartAllmarasStabilizationBase< Viscosity >.

Definition at line 48 of file spalart_allmaras_spgsm_stab.C.

References GRINS::SpalartAllmarasStabilizationBase< 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  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
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 160 of file spalart_allmaras_spgsm_stab.C.

163  {
164 #ifdef GRINS_USE_GRVY_TIMERS
165  this->_timer->BeginTimer("SpalartAllmarasSPGSMStabilization::mass_residual");
166 #endif
167 
168  // Get a pointer to the current element, we need this for computing the distance to wall for the
169  // quadrature points
170  libMesh::Elem &elem_pointer = context.get_elem();
171 
172  // The number of local degrees of freedom in each variable.
173  const unsigned int n_nu_dofs = context.get_dof_indices(this->_turbulence_vars.nu()).size();
174 
175  // Element Jacobian * quadrature weights for interior integration.
176  const std::vector<libMesh::Real> &JxW =
177  context.get_element_fe(this->_turbulence_vars.nu())->get_JxW();
178 
179  // The pressure shape functions at interior quadrature points.
180  const std::vector<std::vector<libMesh::RealGradient> >& nu_gradphi =
181  context.get_element_fe(this->_turbulence_vars.nu())->get_dphi();
182 
183  libMesh::DenseSubVector<libMesh::Number> &Fnu = context.get_elem_residual(this->_turbulence_vars.nu()); // R_{nu}
184 
185  libMesh::FEBase* fe = context.get_element_fe(this->_turbulence_vars.nu());
186 
187  unsigned int n_qpoints = context.get_element_qrule().n_points();
188 
189  // Auto pointer to distance fcn evaluated at quad points
190  libMesh::UniquePtr< libMesh::DenseVector<libMesh::Real> > distance_qp;
191 
192  // Fill the vector of distances to quadrature points
193  distance_qp = this->distance_function->interpolate(&elem_pointer, context.get_element_qrule().get_points());
194 
195  for (unsigned int qp=0; qp != n_qpoints; qp++)
196  {
197  libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
198  libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
199 
200  libMesh::RealGradient U( context.fixed_interior_value( this->_flow_vars.u(), qp ),
201  context.fixed_interior_value( this->_flow_vars.v(), qp ) );
202  // Compute the viscosity at this qp
203  libMesh::Real _mu_qp = this->_mu(context, qp);
204 
205  if( this->_dim == 3 )
206  {
207  U(2) = context.fixed_interior_value( this->_flow_vars.w(), qp );
208  }
209 
210  libMesh::Real tau_spalart = this->_stab_helper.compute_tau_spalart( context, qp, g, G, this->_rho, U, _mu_qp, this->_is_steady );
211 
212  libMesh::Real RM_spalart = this->_stab_helper.compute_res_spalart_transient( context, qp, this->_rho );
213 
214  for (unsigned int i=0; i != n_nu_dofs; i++)
215  {
216  Fnu(i) += -JxW[qp]*tau_spalart*RM_spalart*this->_rho*(U*nu_gradphi[i][qp]);
217  }
218 
219  if( compute_jacobian )
220  {
221  libmesh_not_implemented();
222  }
223 
224  }
225 
226 #ifdef GRINS_USE_GRVY_TIMERS
227  this->_timer->EndTimer("SpalartAllmarasSPGSMStabilization::mass_residual");
228 #endif
229 
230  return;
231  }
libMesh::RealTensor compute_G(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:64
libMesh::UniquePtr< DistanceFunction > distance_function
unsigned int _dim
Physical dimension of problem.
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:277
TurbulenceFEVariables _turbulence_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
VelocityFEVariables _flow_vars
SpalartAllmarasStabilizationHelper _stab_helper
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 Thu Jun 2 2016 21:52:32 for GRINS-0.7.0 by  doxygen 1.8.10