GRINS-0.7.0
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity > Class Template Reference

Adds Boussinesq bouyancy adjoint stabilization source term. More...

#include <boussinesq_buoyancy_adjoint_stab.h>

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

Public Member Functions

 BoussinesqBuoyancyAdjointStabilization (const std::string &physics_name, const GetPot &input)
 
 ~BoussinesqBuoyancyAdjointStabilization ()
 
virtual void init_context (AssemblyContext &context)
 Initialize context for added physics variables. 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 element_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for element interiors. 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::BoussinesqBuoyancyBase
 BoussinesqBuoyancyBase (const std::string &physics_name, const GetPot &input)
 
 ~BoussinesqBuoyancyBase ()
 
virtual void init_variables (libMesh::FEMSystem *system)
 Initialization of BoussinesqBuoyancy variables. More...
 
- 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 set_time_evolving_vars (libMesh::FEMSystem *system)
 Set which variables are time evolving. 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 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 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 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...
 

Protected Attributes

Viscosity _mu
 Viscosity object. More...
 
IncompressibleNavierStokesStabilizationHelper _stab_helper
 
- Protected Attributes inherited from GRINS::BoussinesqBuoyancyBase
VelocityFEVariables _flow_vars
 
PressureFEVariable _press_var
 
PrimitiveTempFEVariables _temp_vars
 
libMesh::Number _rho
 $ \rho = $ density More...
 
libMesh::Number _T_ref
 $ T_0 = $ reference temperature More...
 
libMesh::Number _beta_T
 $ \beta_T = $ coefficient of thermal expansion More...
 
libMesh::Point _g
 Gravitational vector. More...
 
unsigned int _dim
 Physical dimension of problem. 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...
 

Private Member Functions

 BoussinesqBuoyancyAdjointStabilization ()
 

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 ()
 
- 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::BoussinesqBuoyancyBase
void read_property (const GetPot &input, const std::string &old_option, const std::string &property, libMesh::Real &value)
 Helper function for parsing/maintaing backward compatibility. More...
 
void no_input_warning (const GetPot &input, const std::string &old_option, const std::string &material, const std::string &property)
 Helper function for parsing/maintaing backward compatibility. 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)
 
- 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::BoussinesqBuoyancyAdjointStabilization< Viscosity >

Adds Boussinesq bouyancy adjoint stabilization source term.

This class implements the adjiont stabilization term for the BoussinesqBuoyancy Physics. Intended to be used with IncompressibleNavierStokesAdjointStabilization and HeatTransferStabilization.

Definition at line 42 of file boussinesq_buoyancy_adjoint_stab.h.

Constructor & Destructor Documentation

template<class Mu >
GRINS::BoussinesqBuoyancyAdjointStabilization< Mu >::BoussinesqBuoyancyAdjointStabilization ( const std::string &  physics_name,
const GetPot &  input 
)

Definition at line 44 of file boussinesq_buoyancy_adjoint_stab.C.

45  : BoussinesqBuoyancyBase(physics_name,input),
47  _stab_helper( physics_name+"StabHelper", input )
48  {}
IncompressibleNavierStokesStabilizationHelper _stab_helper
static PhysicsName boussinesq_buoyancy()
static std::string material_name(const GetPot &input, const std::string &physics)
Get the name of the material in the Physics/physics section.

Definition at line 51 of file boussinesq_buoyancy_adjoint_stab.C.

52  {
53  return;
54  }
template<class Viscosity >
GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >::BoussinesqBuoyancyAdjointStabilization ( )
private

Member Function Documentation

template<class Mu >
void GRINS::BoussinesqBuoyancyAdjointStabilization< Mu >::element_constraint ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Constraint part(s) of physics for element interiors.

Reimplemented from GRINS::Physics.

Definition at line 258 of file boussinesq_buoyancy_adjoint_stab.C.

261  {
262 #ifdef GRINS_USE_GRVY_TIMERS
263  this->_timer->BeginTimer("BoussinesqBuoyancyAdjointStabilization::element_constraint");
264 #endif
265 
266  // The number of local degrees of freedom in each variable.
267  const unsigned int n_p_dofs = context.get_dof_indices(_press_var.p()).size();
268  const unsigned int n_u_dofs = context.get_dof_indices(_flow_vars.u()).size();
269  const unsigned int n_T_dofs = context.get_dof_indices(_temp_vars.T()).size();
270 
271  // Element Jacobian * quadrature weights for interior integration.
272  const std::vector<libMesh::Real> &JxW =
273  context.get_element_fe(_flow_vars.u())->get_JxW();
274 
275  const std::vector<std::vector<libMesh::Real> >& T_phi =
276  context.get_element_fe(this->_temp_vars.T())->get_phi();
277 
278  const std::vector<std::vector<libMesh::Real> >& u_phi =
279  context.get_element_fe(this->_flow_vars.u())->get_phi();
280 
281  const std::vector<std::vector<libMesh::RealGradient> >& p_dphi =
282  context.get_element_fe(this->_press_var.p())->get_dphi();
283 
284  libMesh::DenseSubVector<libMesh::Number> &Fp = context.get_elem_residual(this->_press_var.p()); // R_{p}
285 
286  libMesh::DenseSubMatrix<libMesh::Number> &KpT =
287  context.get_elem_jacobian(_press_var.p(), _temp_vars.T()); // J_{pT}
288  libMesh::DenseSubMatrix<libMesh::Number> &Kpu =
289  context.get_elem_jacobian(_press_var.p(), _flow_vars.u()); // J_{pu}
290  libMesh::DenseSubMatrix<libMesh::Number> &Kpv =
291  context.get_elem_jacobian(_press_var.p(), _flow_vars.v()); // J_{pv}
292  libMesh::DenseSubMatrix<libMesh::Number> *Kpw = NULL;
293 
294  if(this->_dim == 3)
295  {
296  Kpw = &context.get_elem_jacobian
297  (_press_var.p(), _flow_vars.w()); // J_{pw}
298  }
299 
300  // Now we will build the element Jacobian and residual.
301  // Constructing the residual requires the solution and its
302  // gradient from the previous timestep. This must be
303  // calculated at each quadrature point by summing the
304  // solution degree-of-freedom values by the appropriate
305  // weight functions.
306  unsigned int n_qpoints = context.get_element_qrule().n_points();
307 
308  libMesh::FEBase* fe = context.get_element_fe(this->_flow_vars.u());
309 
310  for (unsigned int qp=0; qp != n_qpoints; qp++)
311  {
312  libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
313  libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
314 
315  libMesh::RealGradient U( context.interior_value( this->_flow_vars.u(), qp ),
316  context.interior_value( this->_flow_vars.v(), qp ) );
317  if( this->_dim == 3 )
318  {
319  U(2) = context.interior_value( this->_flow_vars.w(), qp );
320  }
321 
322  // Compute the viscosity at this qp
323  libMesh::Real mu_qp = this->_mu(context, qp);
324 
325  libMesh::Real tau_M;
326  libMesh::Real d_tau_M_d_rho;
327  libMesh::Gradient d_tau_M_dU;
328 
329  if (compute_jacobian)
331  ( context, qp, g, G, this->_rho, U, mu_qp,
332  tau_M, d_tau_M_d_rho, d_tau_M_dU,
333  this->_is_steady );
334  else
335  tau_M = this->_stab_helper.compute_tau_momentum
336  ( context, qp, g, G, this->_rho, U, mu_qp,
337  this->_is_steady );
338 
339  // Compute the solution & its gradient at the old Newton iterate.
340  libMesh::Number T;
341  T = context.interior_value(_temp_vars.T(), qp);
342 
343  libMesh::RealGradient d_residual_dT = _rho*_beta_T*_g;
344  // d_residual_dU = 0
345  libMesh::RealGradient residual = (T-_T_ref)*d_residual_dT;
346 
347  // First, an i-loop over the velocity degrees of freedom.
348  // We know that n_u_dofs == n_v_dofs so we can compute contributions
349  // for both at the same time.
350  for (unsigned int i=0; i != n_p_dofs; i++)
351  {
352  Fp(i) += tau_M*residual*p_dphi[i][qp]*JxW[qp];
353 
354  if (compute_jacobian)
355  {
356  for (unsigned int j=0; j != n_T_dofs; ++j)
357  {
358  KpT(i,j) += tau_M*d_residual_dT*T_phi[j][qp]*p_dphi[i][qp]*JxW[qp] * context.get_elem_solution_derivative();
359  }
360 
361  for (unsigned int j=0; j != n_u_dofs; ++j)
362  {
363  Kpu(i,j) += d_tau_M_dU(0)*u_phi[j][qp]*residual*p_dphi[i][qp]*JxW[qp] * context.get_elem_solution_derivative();
364  Kpv(i,j) += d_tau_M_dU(1)*u_phi[j][qp]*residual*p_dphi[i][qp]*JxW[qp] * context.get_elem_solution_derivative();
365  }
366  if( this->_dim == 3 )
367  for (unsigned int j=0; j != n_u_dofs; ++j)
368  {
369  (*Kpw)(i,j) += d_tau_M_dU(2)*u_phi[j][qp]*residual*p_dphi[i][qp]*JxW[qp] * context.get_elem_solution_derivative();
370  }
371  }
372  }
373  } // End quadrature loop
374 
375 #ifdef GRINS_USE_GRVY_TIMERS
376  this->_timer->EndTimer("BoussinesqBuoyancyAdjointStabilization::element_constraint");
377 #endif
378 
379  return;
380  }
libMesh::Point _g
Gravitational vector.
void compute_tau_momentum_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::RealTensor compute_G(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:64
unsigned int _dim
Physical dimension of problem.
IncompressibleNavierStokesStabilizationHelper _stab_helper
libMesh::RealGradient compute_g(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:47
VariableIndex p() const
libMesh::Number _T_ref
reference temperature
static bool _is_steady
Caches whether or not the solver that's being used is steady or not.
Definition: physics.h:277
libMesh::Number _beta_T
coefficient of thermal expansion
libMesh::Real compute_tau_momentum(AssemblyContext &c, unsigned int qp, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, libMesh::Real mu, bool is_steady) const
PrimitiveTempFEVariables _temp_vars
template<class Mu >
void GRINS::BoussinesqBuoyancyAdjointStabilization< Mu >::element_time_derivative ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

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

Reimplemented from GRINS::Physics.

Definition at line 68 of file boussinesq_buoyancy_adjoint_stab.C.

71  {
72 #ifdef GRINS_USE_GRVY_TIMERS
73  this->_timer->BeginTimer("BoussinesqBuoyancyAdjointStabilization::element_time_derivative");
74 #endif
75 
76  // The number of local degrees of freedom in each variable.
77  const unsigned int n_u_dofs = context.get_dof_indices(_flow_vars.u()).size();
78  const unsigned int n_T_dofs = context.get_dof_indices(_temp_vars.T()).size();
79 
80  // Element Jacobian * quadrature weights for interior integration.
81  const std::vector<libMesh::Real> &JxW =
82  context.get_element_fe(_flow_vars.u())->get_JxW();
83 
84  const std::vector<std::vector<libMesh::Real> >& T_phi =
85  context.get_element_fe(this->_temp_vars.T())->get_phi();
86 
87  const std::vector<std::vector<libMesh::Real> >& u_phi =
88  context.get_element_fe(this->_flow_vars.u())->get_phi();
89 
90  const std::vector<std::vector<libMesh::RealGradient> >& u_gradphi =
91  context.get_element_fe(this->_flow_vars.u())->get_dphi();
92 
93  const std::vector<std::vector<libMesh::RealTensor> >& u_hessphi =
94  context.get_element_fe(this->_flow_vars.u())->get_d2phi();
95 
96  // Get residuals and jacobians
97  libMesh::DenseSubVector<libMesh::Number> &Fu = context.get_elem_residual(_flow_vars.u()); // R_{u}
98  libMesh::DenseSubVector<libMesh::Number> &Fv = context.get_elem_residual(_flow_vars.v()); // R_{v}
99  libMesh::DenseSubVector<libMesh::Number> *Fw = NULL;
100 
101  libMesh::DenseSubMatrix<libMesh::Number> &KuT =
102  context.get_elem_jacobian(_flow_vars.u(), _temp_vars.T()); // J_{uT}
103  libMesh::DenseSubMatrix<libMesh::Number> &KvT =
104  context.get_elem_jacobian(_flow_vars.v(), _temp_vars.T()); // J_{vT}
105  libMesh::DenseSubMatrix<libMesh::Number> &Kuu =
106  context.get_elem_jacobian(_flow_vars.u(), _flow_vars.u()); // J_{uu}
107  libMesh::DenseSubMatrix<libMesh::Number> &Kuv =
108  context.get_elem_jacobian(_flow_vars.u(), _flow_vars.v()); // J_{uv}
109  libMesh::DenseSubMatrix<libMesh::Number> &Kvu =
110  context.get_elem_jacobian(_flow_vars.v(), _flow_vars.u()); // J_{vu}
111  libMesh::DenseSubMatrix<libMesh::Number> &Kvv =
112  context.get_elem_jacobian(_flow_vars.v(), _flow_vars.v()); // J_{vv}
113 
114  libMesh::DenseSubMatrix<libMesh::Number> *KwT = NULL;
115  libMesh::DenseSubMatrix<libMesh::Number> *Kuw = NULL;
116  libMesh::DenseSubMatrix<libMesh::Number> *Kvw = NULL;
117  libMesh::DenseSubMatrix<libMesh::Number> *Kwu = NULL;
118  libMesh::DenseSubMatrix<libMesh::Number> *Kwv = NULL;
119  libMesh::DenseSubMatrix<libMesh::Number> *Kww = NULL;
120 
121  if(this->_dim == 3)
122  {
123  Fw = &context.get_elem_residual(this->_flow_vars.w()); // R_{w}
124  KwT = &context.get_elem_jacobian
125  (_flow_vars.w(), _temp_vars.T()); // J_{wT}
126  Kuw = &context.get_elem_jacobian
127  (_flow_vars.u(), _flow_vars.w()); // J_{uw}
128  Kvw = &context.get_elem_jacobian
129  (_flow_vars.v(), _flow_vars.w()); // J_{vw}
130  Kwu = &context.get_elem_jacobian
131  (_flow_vars.w(), _flow_vars.u()); // J_{wu}
132  Kwv = &context.get_elem_jacobian
133  (_flow_vars.w(), _flow_vars.v()); // J_{wv}
134  Kww = &context.get_elem_jacobian
135  (_flow_vars.w(), _flow_vars.w()); // J_{ww}
136  }
137 
138  // Now we will build the element Jacobian and residual.
139  // Constructing the residual requires the solution and its
140  // gradient from the previous timestep. This must be
141  // calculated at each quadrature point by summing the
142  // solution degree-of-freedom values by the appropriate
143  // weight functions.
144  unsigned int n_qpoints = context.get_element_qrule().n_points();
145 
146  libMesh::FEBase* fe = context.get_element_fe(this->_flow_vars.u());
147 
148  for (unsigned int qp=0; qp != n_qpoints; qp++)
149  {
150  libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
151  libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
152 
153  libMesh::RealGradient U( context.interior_value( this->_flow_vars.u(), qp ),
154  context.interior_value( this->_flow_vars.v(), qp ) );
155  if( this->_dim == 3 )
156  {
157  U(2) = context.interior_value( this->_flow_vars.w(), qp );
158  }
159 
160  // Compute the viscosity at this qp
161  libMesh::Real mu_qp = this->_mu(context, qp);
162 
163  libMesh::Real tau_M;
164  libMesh::Real d_tau_M_d_rho;
165  libMesh::Gradient d_tau_M_dU;
166 
167  if (compute_jacobian)
169  ( context, qp, g, G, this->_rho, U, mu_qp,
170  tau_M, d_tau_M_d_rho, d_tau_M_dU,
171  this->_is_steady );
172  else
173  tau_M = this->_stab_helper.compute_tau_momentum
174  ( context, qp, g, G, this->_rho, U, mu_qp,
175  this->_is_steady );
176 
177  // Compute the solution & its gradient at the old Newton iterate.
178  libMesh::Number T;
179  T = context.interior_value(_temp_vars.T(), qp);
180 
181  libMesh::RealGradient d_residual_dT = _rho*_beta_T*_g;
182  // d_residual_dU = 0
183  libMesh::RealGradient residual = (T-_T_ref)*d_residual_dT;
184 
185  for (unsigned int i=0; i != n_u_dofs; i++)
186  {
187  libMesh::Real test_func = this->_rho*U*u_gradphi[i][qp] +
188  mu_qp*( u_hessphi[i][qp](0,0) + u_hessphi[i][qp](1,1) + u_hessphi[i][qp](2,2) );
189  Fu(i) += -tau_M*residual(0)*test_func*JxW[qp];
190 
191  Fv(i) += -tau_M*residual(1)*test_func*JxW[qp];
192 
193  if (_dim == 3)
194  {
195  (*Fw)(i) += -tau_M*residual(2)*test_func*JxW[qp];
196  }
197 
198  if (compute_jacobian)
199  {
200  libMesh::Gradient d_test_func_dU = this->_rho*u_gradphi[i][qp];
201  // d_test_func_dT = 0
202 
203  for (unsigned int j=0; j != n_u_dofs; ++j)
204  {
205  Kuu(i,j) += -tau_M*residual(0)*d_test_func_dU(0)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
206  Kuu(i,j) += -d_tau_M_dU(0)*u_phi[j][qp]*residual(0)*test_func*JxW[qp] * context.get_elem_solution_derivative();
207  Kuv(i,j) += -tau_M*residual(0)*d_test_func_dU(1)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
208  Kuv(i,j) += -d_tau_M_dU(1)*u_phi[j][qp]*residual(0)*test_func*JxW[qp] * context.get_elem_solution_derivative();
209  Kvu(i,j) += -tau_M*residual(1)*d_test_func_dU(0)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
210  Kvu(i,j) += -d_tau_M_dU(0)*u_phi[j][qp]*residual(1)*test_func*JxW[qp] * context.get_elem_solution_derivative();
211  Kvv(i,j) += -tau_M*residual(1)*d_test_func_dU(1)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
212  Kvv(i,j) += -d_tau_M_dU(1)*u_phi[j][qp]*residual(1)*test_func*JxW[qp] * context.get_elem_solution_derivative();
213  }
214 
215  for (unsigned int j=0; j != n_T_dofs; ++j)
216  {
217  // KuT(i,j) += -tau_M*residual(0)*dtest_func_dT[j]*JxW[qp] * context.get_elem_solution_derivative();
218  KuT(i,j) += -tau_M*d_residual_dT(0)*T_phi[j][qp]*test_func*JxW[qp] * context.get_elem_solution_derivative();
219  // KvT(i,j) += -tau_M*residual(1)*dtest_func_dT[j]*JxW[qp] * context.get_elem_solution_derivative();
220  KvT(i,j) += -tau_M*d_residual_dT(1)*T_phi[j][qp]*test_func*JxW[qp] * context.get_elem_solution_derivative();
221  }
222  if (_dim == 3)
223  {
224  for (unsigned int j=0; j != n_T_dofs; ++j)
225  {
226  // KwT(i,j) += -tau_M*residual(2)*dtest_func_dT[j]*JxW[qp] * context.get_elem_solution_derivative();
227  (*KwT)(i,j) += -tau_M*d_residual_dT(2)*T_phi[j][qp]*test_func*JxW[qp] * context.get_elem_solution_derivative();
228  }
229 
230  for (unsigned int j=0; j != n_u_dofs; ++j)
231  {
232  (*Kuw)(i,j) += -tau_M*residual(0)*d_test_func_dU(2)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
233  (*Kuw)(i,j) += -d_tau_M_dU(2)*u_phi[j][qp]*residual(0)*test_func*JxW[qp] * context.get_elem_solution_derivative();
234  (*Kvw)(i,j) += -tau_M*residual(1)*d_test_func_dU(2)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
235  (*Kvw)(i,j) += -d_tau_M_dU(2)*u_phi[j][qp]*residual(1)*test_func*JxW[qp] * context.get_elem_solution_derivative();
236  (*Kwu)(i,j) += -tau_M*residual(2)*d_test_func_dU(0)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
237  (*Kwu)(i,j) += -d_tau_M_dU(0)*u_phi[j][qp]*residual(2)*test_func*JxW[qp] * context.get_elem_solution_derivative();
238  (*Kwv)(i,j) += -tau_M*residual(2)*d_test_func_dU(1)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
239  (*Kwv)(i,j) += -d_tau_M_dU(1)*u_phi[j][qp]*residual(2)*test_func*JxW[qp] * context.get_elem_solution_derivative();
240  (*Kww)(i,j) += -tau_M*residual(2)*d_test_func_dU(2)*u_phi[j][qp]*JxW[qp] * context.get_elem_solution_derivative();
241  (*Kww)(i,j) += -d_tau_M_dU(2)*u_phi[j][qp]*residual(2)*test_func*JxW[qp] * context.get_elem_solution_derivative();
242  }
243  }
244 
245  } // End compute_jacobian check
246 
247  } // End i dof loop
248  } // End quadrature loop
249 
250 #ifdef GRINS_USE_GRVY_TIMERS
251  this->_timer->EndTimer("BoussinesqBuoyancyAdjointStabilization::element_time_derivative");
252 #endif
253 
254  return;
255  }
libMesh::Point _g
Gravitational vector.
void compute_tau_momentum_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::RealTensor compute_G(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:64
unsigned int _dim
Physical dimension of problem.
IncompressibleNavierStokesStabilizationHelper _stab_helper
libMesh::RealGradient compute_g(libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
Definition: stab_helper.C:47
libMesh::Number _T_ref
reference temperature
static bool _is_steady
Caches whether or not the solver that's being used is steady or not.
Definition: physics.h:277
libMesh::Number _beta_T
coefficient of thermal expansion
libMesh::Real compute_tau_momentum(AssemblyContext &c, unsigned int qp, libMesh::RealGradient &g, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Gradient U, libMesh::Real mu, bool is_steady) const
PrimitiveTempFEVariables _temp_vars
template<class Mu >
void GRINS::BoussinesqBuoyancyAdjointStabilization< Mu >::init_context ( AssemblyContext context)
virtual

Initialize context for added physics variables.

Reimplemented from GRINS::Physics.

Definition at line 57 of file boussinesq_buoyancy_adjoint_stab.C.

58  {
59  context.get_element_fe(this->_press_var.p())->get_dphi();
60 
61  context.get_element_fe(this->_flow_vars.u())->get_dphi();
62  context.get_element_fe(this->_flow_vars.u())->get_d2phi();
63 
64  return;
65  }
VariableIndex p() const
template<class Mu >
void GRINS::BoussinesqBuoyancyAdjointStabilization< 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::ParameterUser.

Definition at line 384 of file boussinesq_buoyancy_adjoint_stab.C.

References GRINS::ParameterUser::register_parameter().

387  {
388  ParameterUser::register_parameter(param_name, param_pointer);
389  _mu.register_parameter(param_name, param_pointer);
390  }
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

template<class Viscosity >
Viscosity GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >::_mu
protected

Viscosity object.

Definition at line 70 of file boussinesq_buoyancy_adjoint_stab.h.

template<class Viscosity >
IncompressibleNavierStokesStabilizationHelper GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >::_stab_helper
protected

Definition at line 72 of file boussinesq_buoyancy_adjoint_stab.h.


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

Generated on Thu Jun 2 2016 21:52:30 for GRINS-0.7.0 by  doxygen 1.8.10