www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
INSBase Class Referenceabstract

This class computes strong and weak components of the INS governing equations. More...

#include <INSBase.h>

Inheritance diagram for INSBase:
[legend]

Public Member Functions

 INSBase (const InputParameters &parameters)
 
virtual ~INSBase ()
 

Protected Member Functions

virtual Real computeQpResidual ()=0
 
virtual Real computeQpJacobian ()=0
 
virtual Real computeQpOffDiagJacobian (unsigned jvar)=0
 
virtual RealVectorValue convectiveTerm ()
 
virtual RealVectorValue dConvecDUComp (unsigned comp)
 
virtual RealVectorValue strongViscousTermLaplace ()
 
virtual RealVectorValue strongViscousTermTraction ()
 
virtual RealVectorValue dStrongViscDUCompLaplace (unsigned comp)
 
virtual RealVectorValue dStrongViscDUCompTraction (unsigned comp)
 
virtual RealVectorValue weakViscousTermLaplace (unsigned comp)
 
virtual RealVectorValue weakViscousTermTraction (unsigned comp)
 
virtual RealVectorValue dWeakViscDUCompLaplace ()
 
virtual RealVectorValue dWeakViscDUCompTraction ()
 
virtual RealVectorValue strongPressureTerm ()
 
virtual Real weakPressureTerm ()
 
virtual RealVectorValue dStrongPressureDPressure ()
 
virtual Real dWeakPressureDPressure ()
 
virtual RealVectorValue gravityTerm ()
 
virtual RealVectorValue timeDerivativeTerm ()
 
virtual RealVectorValue dTimeDerivativeDUComp (unsigned comp)
 
virtual Real tau ()
 
virtual Real dTauDUComp (unsigned comp)
 
virtual Real tauNodal ()
 Provides tau which yields superconvergence for 1D advection-diffusion. More...
 

Protected Attributes

const VariablePhiSecond & _second_phi
 second derivatives of the shape function More...
 
const VariableValue & _u_vel
 
const VariableValue & _v_vel
 
const VariableValue & _w_vel
 
const VariableValue & _p
 
const VariableGradient & _grad_u_vel
 
const VariableGradient & _grad_v_vel
 
const VariableGradient & _grad_w_vel
 
const VariableGradient & _grad_p
 
const VariableSecond & _second_u_vel
 
const VariableSecond & _second_v_vel
 
const VariableSecond & _second_w_vel
 
const VariableValue & _u_vel_dot
 
const VariableValue & _v_vel_dot
 
const VariableValue & _w_vel_dot
 
const VariableValue & _d_u_vel_dot_du
 
const VariableValue & _d_v_vel_dot_dv
 
const VariableValue & _d_w_vel_dot_dw
 
unsigned _u_vel_var_number
 
unsigned _v_vel_var_number
 
unsigned _w_vel_var_number
 
unsigned _p_var_number
 
RealVectorValue _gravity
 
const MaterialProperty< Real > & _mu
 
const MaterialProperty< Real > & _rho
 
const Real & _alpha
 
bool _laplace
 
bool _convective_term
 
bool _transient_term
 

Detailed Description

This class computes strong and weak components of the INS governing equations.

These terms can then be assembled in child classes

Definition at line 24 of file INSBase.h.

Constructor & Destructor Documentation

◆ INSBase()

INSBase::INSBase ( const InputParameters &  parameters)

Definition at line 45 of file INSBase.C.

46  : Kernel(parameters),
47  _second_phi(_assembly.secondPhi()),
48 
49  // Coupled variables
50  _u_vel(coupledValue("u")),
51  _v_vel(coupledValue("v")),
52  _w_vel(coupledValue("w")),
53  _p(coupledValue("p")),
54 
55  // Gradients
56  _grad_u_vel(coupledGradient("u")),
57  _grad_v_vel(coupledGradient("v")),
58  _grad_w_vel(coupledGradient("w")),
59  _grad_p(coupledGradient("p")),
60 
61  // second derivative tensors
62  _second_u_vel(coupledSecond("u")),
63  _second_v_vel(coupledSecond("v")),
64  _second_w_vel(coupledSecond("w")),
65 
66  // time derivatives
67  _u_vel_dot(_is_transient ? coupledDot("u") : _zero),
68  _v_vel_dot(_is_transient ? coupledDot("v") : _zero),
69  _w_vel_dot(_is_transient ? coupledDot("w") : _zero),
70 
71  // derivatives of time derivatives
72  _d_u_vel_dot_du(_is_transient ? coupledDotDu("u") : _zero),
73  _d_v_vel_dot_dv(_is_transient ? coupledDotDu("v") : _zero),
74  _d_w_vel_dot_dw(_is_transient ? coupledDotDu("w") : _zero),
75 
76  // Variable numberings
77  _u_vel_var_number(coupled("u")),
78  _v_vel_var_number(coupled("v")),
79  _w_vel_var_number(coupled("w")),
80  _p_var_number(coupled("p")),
81 
82  _gravity(getParam<RealVectorValue>("gravity")),
83 
84  // Material properties
85  _mu(getMaterialProperty<Real>("mu_name")),
86  _rho(getMaterialProperty<Real>("rho_name")),
87 
88  _alpha(getParam<Real>("alpha")),
89  _laplace(getParam<bool>("laplace")),
90  _convective_term(getParam<bool>("convective_term")),
91  _transient_term(getParam<bool>("transient_term"))
92 {
93 }

◆ ~INSBase()

virtual INSBase::~INSBase ( )
inlinevirtual

Definition at line 29 of file INSBase.h.

29 {}

Member Function Documentation

◆ computeQpJacobian()

virtual Real INSBase::computeQpJacobian ( )
protectedpure virtual

◆ computeQpOffDiagJacobian()

virtual Real INSBase::computeQpOffDiagJacobian ( unsigned  jvar)
protectedpure virtual

◆ computeQpResidual()

virtual Real INSBase::computeQpResidual ( )
protectedpure virtual

◆ convectiveTerm()

RealVectorValue INSBase::convectiveTerm ( )
protectedvirtual

Definition at line 96 of file INSBase.C.

97 {
98  RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
99  return _rho[_qp] *
100  RealVectorValue(U * _grad_u_vel[_qp], U * _grad_v_vel[_qp], U * _grad_w_vel[_qp]);
101 }

Referenced by INSMomentumBase::computeQpPGJacobian(), INSMass::computeQpPGOffDiagJacobian(), INSMass::computeQpPGResidual(), INSMomentumBase::computeQpPGResidual(), and INSMomentumBase::computeQpResidual().

◆ dConvecDUComp()

RealVectorValue INSBase::dConvecDUComp ( unsigned  comp)
protectedvirtual

Definition at line 104 of file INSBase.C.

105 {
106  RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
107  RealVectorValue d_U_d_comp(0, 0, 0);
108  d_U_d_comp(comp) = _phi[_j][_qp];
109 
110  RealVectorValue convective_term = _rho[_qp] * RealVectorValue(d_U_d_comp * _grad_u_vel[_qp],
111  d_U_d_comp * _grad_v_vel[_qp],
112  d_U_d_comp * _grad_w_vel[_qp]);
113  convective_term(comp) += _rho[_qp] * U * _grad_phi[_j][_qp];
114 
115  return convective_term;
116 }

Referenced by INSMomentumBase::computeQpJacobian(), INSMomentumBase::computeQpOffDiagJacobian(), INSMomentumBase::computeQpPGJacobian(), and INSMass::computeQpPGOffDiagJacobian().

◆ dStrongPressureDPressure()

RealVectorValue INSBase::dStrongPressureDPressure ( )
protectedvirtual

Definition at line 226 of file INSBase.C.

227 {
228  return _grad_phi[_j][_qp];
229 }

Referenced by INSMomentumBase::computeQpOffDiagJacobian(), and INSMass::computeQpPGJacobian().

◆ dStrongViscDUCompLaplace()

RealVectorValue INSBase::dStrongViscDUCompLaplace ( unsigned  comp)
protectedvirtual

Reimplemented in INSMassRZ, and INSMomentumLaplaceFormRZ.

Definition at line 134 of file INSBase.C.

135 {
136  RealVectorValue viscous_term(0, 0, 0);
137  viscous_term(comp) = -_mu[_qp] * _second_phi[_j][_qp].tr();
138 
139  return viscous_term;
140 }

Referenced by INSMomentumBase::computeQpPGJacobian(), INSMass::computeQpPGOffDiagJacobian(), INSMomentumLaplaceFormRZ::dStrongViscDUCompLaplace(), and INSMassRZ::dStrongViscDUCompLaplace().

◆ dStrongViscDUCompTraction()

RealVectorValue INSBase::dStrongViscDUCompTraction ( unsigned  comp)
protectedvirtual

Reimplemented in INSMassRZ, and INSMomentumTractionFormRZ.

Definition at line 143 of file INSBase.C.

144 {
145  RealVectorValue viscous_term(0, 0, 0);
146  viscous_term(comp) = -_mu[_qp] * (_second_phi[_j][_qp](0, 0) + _second_phi[_j][_qp](1, 1) +
147  _second_phi[_j][_qp](2, 2));
148  for (unsigned i = 0; i < 3; i++)
149  viscous_term(i) += -_mu[_qp] * _second_phi[_j][_qp](i, comp);
150 
151  return viscous_term;
152 }

Referenced by INSMomentumBase::computeQpPGJacobian(), INSMass::computeQpPGOffDiagJacobian(), INSMomentumTractionFormRZ::dStrongViscDUCompTraction(), and INSMassRZ::dStrongViscDUCompTraction().

◆ dTauDUComp()

Real INSBase::dTauDUComp ( unsigned  comp)
protectedvirtual

Definition at line 298 of file INSBase.C.

299 {
300  Real nu = _mu[_qp] / _rho[_qp];
301  RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
302  Real h = _current_elem->hmax();
303  Real transient_part = _transient_term ? 4. / (_dt * _dt) : 0.;
304  return -_alpha / 2. * std::pow(transient_part + (2. * U.norm() / h) * (2. * U.norm() / h) +
305  9. * (4. * nu / (h * h)) * (4. * nu / (h * h)),
306  -1.5) *
307  2. * (2. * U.norm() / h) * 2. / h * U(comp) * _phi[_j][_qp] /
308  (U.norm() + std::numeric_limits<double>::epsilon());
309 }

Referenced by INSMomentumBase::computeQpPGJacobian(), and INSMass::computeQpPGOffDiagJacobian().

◆ dTimeDerivativeDUComp()

RealVectorValue INSBase::dTimeDerivativeDUComp ( unsigned  comp)
protectedvirtual

Definition at line 250 of file INSBase.C.

251 {
252  Real base = _rho[_qp] * _phi[_j][_qp];
253  switch (comp)
254  {
255  case 0:
256  return RealVectorValue(base * _d_u_vel_dot_du[_qp], 0, 0);
257 
258  case 1:
259  return RealVectorValue(0, base * _d_v_vel_dot_dv[_qp], 0);
260 
261  case 2:
262  return RealVectorValue(0, 0, base * _d_w_vel_dot_dw[_qp]);
263 
264  default:
265  mooseError("comp must be 0, 1, or 2");
266  }
267 }

Referenced by INSMomentumBase::computeQpPGJacobian(), and INSMass::computeQpPGOffDiagJacobian().

◆ dWeakPressureDPressure()

Real INSBase::dWeakPressureDPressure ( )
protectedvirtual

Definition at line 232 of file INSBase.C.

233 {
234  return -_phi[_j][_qp];
235 }

Referenced by INSMomentumBase::computeQpOffDiagJacobian().

◆ dWeakViscDUCompLaplace()

RealVectorValue INSBase::dWeakViscDUCompLaplace ( )
protectedvirtual

Definition at line 202 of file INSBase.C.

203 {
204  return _mu[_qp] * _grad_phi[_j][_qp];
205 }

◆ dWeakViscDUCompTraction()

RealVectorValue INSBase::dWeakViscDUCompTraction ( )
protectedvirtual

Definition at line 208 of file INSBase.C.

209 {
210  return _mu[_qp] * _grad_phi[_j][_qp];
211 }

◆ gravityTerm()

RealVectorValue INSBase::gravityTerm ( )
protectedvirtual

◆ strongPressureTerm()

RealVectorValue INSBase::strongPressureTerm ( )
protectedvirtual

◆ strongViscousTermLaplace()

RealVectorValue INSBase::strongViscousTermLaplace ( )
protectedvirtual

◆ strongViscousTermTraction()

RealVectorValue INSBase::strongViscousTermTraction ( )
protectedvirtual

◆ tau()

Real INSBase::tau ( )
protectedvirtual

Definition at line 270 of file INSBase.C.

271 {
272  Real nu = _mu[_qp] / _rho[_qp];
273  RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
274  Real h = _current_elem->hmax();
275  Real transient_part = _transient_term ? 4. / (_dt * _dt) : 0.;
276  return _alpha / std::sqrt(transient_part + (2. * U.norm() / h) * (2. * U.norm() / h) +
277  9. * (4. * nu / (h * h)) * (4. * nu / (h * h)));
278 }

Referenced by Advection::computeQpJacobian(), INSMomentumBase::computeQpOffDiagJacobian(), INSMass::computeQpPGJacobian(), INSMomentumBase::computeQpPGJacobian(), INSMass::computeQpPGOffDiagJacobian(), INSMass::computeQpPGResidual(), INSMomentumBase::computeQpPGResidual(), and Advection::computeQpResidual().

◆ tauNodal()

Real INSBase::tauNodal ( )
protectedvirtual

Provides tau which yields superconvergence for 1D advection-diffusion.

Definition at line 281 of file INSBase.C.

282 {
283  Real nu = _mu[_qp] / _rho[_qp];
284  RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
285  Real h = _current_elem->hmax();
286  Real xi;
287  if (nu < std::numeric_limits<Real>::epsilon())
288  xi = 1;
289  else
290  {
291  Real alpha = U.norm() * h / (2 * nu);
292  xi = 1. / std::tanh(alpha) - 1. / alpha;
293  }
294  return h / (2 * U.norm()) * xi;
295 }

Referenced by Advection::computeQpJacobian(), and Advection::computeQpResidual().

◆ timeDerivativeTerm()

RealVectorValue INSBase::timeDerivativeTerm ( )
protectedvirtual

Definition at line 244 of file INSBase.C.

245 {
246  return _rho[_qp] * RealVectorValue(_u_vel_dot[_qp], _v_vel_dot[_qp], _w_vel_dot[_qp]);
247 }

Referenced by INSMomentumBase::computeQpPGJacobian(), INSMass::computeQpPGOffDiagJacobian(), INSMass::computeQpPGResidual(), and INSMomentumBase::computeQpPGResidual().

◆ weakPressureTerm()

Real INSBase::weakPressureTerm ( )
protectedvirtual

Definition at line 220 of file INSBase.C.

221 {
222  return -_p[_qp];
223 }

Referenced by INSMomentumBase::computeQpResidual().

◆ weakViscousTermLaplace()

RealVectorValue INSBase::weakViscousTermLaplace ( unsigned  comp)
protectedvirtual

Definition at line 155 of file INSBase.C.

156 {
157  switch (comp)
158  {
159  case 0:
160  return _mu[_qp] * _grad_u_vel[_qp];
161 
162  case 1:
163  return _mu[_qp] * _grad_v_vel[_qp];
164 
165  case 2:
166  return _mu[_qp] * _grad_w_vel[_qp];
167 
168  default:
169  return _zero[_qp];
170  }
171 }

◆ weakViscousTermTraction()

RealVectorValue INSBase::weakViscousTermTraction ( unsigned  comp)
protectedvirtual

Definition at line 174 of file INSBase.C.

175 {
176  switch (comp)
177  {
178  case 0:
179  {
180  RealVectorValue transpose(_grad_u_vel[_qp](0), _grad_v_vel[_qp](0), _grad_w_vel[_qp](0));
181  return _mu[_qp] * _grad_u_vel[_qp] + _mu[_qp] * transpose;
182  }
183 
184  case 1:
185  {
186  RealVectorValue transpose(_grad_u_vel[_qp](1), _grad_v_vel[_qp](1), _grad_w_vel[_qp](1));
187  return _mu[_qp] * _grad_v_vel[_qp] + _mu[_qp] * transpose;
188  }
189 
190  case 2:
191  {
192  RealVectorValue transpose(_grad_u_vel[_qp](2), _grad_v_vel[_qp](2), _grad_w_vel[_qp](2));
193  return _mu[_qp] * _grad_w_vel[_qp] + _mu[_qp] * transpose;
194  }
195 
196  default:
197  return _zero[_qp];
198  }
199 }

Member Data Documentation

◆ _alpha

const Real& INSBase::_alpha
protected

Definition at line 107 of file INSBase.h.

Referenced by dTauDUComp(), and tau().

◆ _convective_term

bool INSBase::_convective_term
protected

◆ _d_u_vel_dot_du

const VariableValue& INSBase::_d_u_vel_dot_du
protected

Definition at line 91 of file INSBase.h.

Referenced by dTimeDerivativeDUComp().

◆ _d_v_vel_dot_dv

const VariableValue& INSBase::_d_v_vel_dot_dv
protected

Definition at line 92 of file INSBase.h.

Referenced by dTimeDerivativeDUComp().

◆ _d_w_vel_dot_dw

const VariableValue& INSBase::_d_w_vel_dot_dw
protected

Definition at line 93 of file INSBase.h.

Referenced by dTimeDerivativeDUComp().

◆ _grad_p

const VariableGradient& INSBase::_grad_p
protected

Definition at line 78 of file INSBase.h.

Referenced by strongPressureTerm().

◆ _grad_u_vel

const VariableGradient& INSBase::_grad_u_vel
protected

◆ _grad_v_vel

const VariableGradient& INSBase::_grad_v_vel
protected

◆ _grad_w_vel

const VariableGradient& INSBase::_grad_w_vel
protected

◆ _gravity

RealVectorValue INSBase::_gravity
protected

Definition at line 101 of file INSBase.h.

Referenced by gravityTerm().

◆ _laplace

bool INSBase::_laplace
protected

◆ _mu

const MaterialProperty<Real>& INSBase::_mu
protected

◆ _p

const VariableValue& INSBase::_p
protected

◆ _p_var_number

unsigned INSBase::_p_var_number
protected

◆ _rho

const MaterialProperty<Real>& INSBase::_rho
protected

◆ _second_phi

const VariablePhiSecond& INSBase::_second_phi
protected

second derivatives of the shape function

Definition at line 66 of file INSBase.h.

Referenced by dStrongViscDUCompLaplace(), and dStrongViscDUCompTraction().

◆ _second_u_vel

const VariableSecond& INSBase::_second_u_vel
protected

Definition at line 81 of file INSBase.h.

Referenced by strongViscousTermLaplace(), and strongViscousTermTraction().

◆ _second_v_vel

const VariableSecond& INSBase::_second_v_vel
protected

Definition at line 82 of file INSBase.h.

Referenced by strongViscousTermLaplace(), and strongViscousTermTraction().

◆ _second_w_vel

const VariableSecond& INSBase::_second_w_vel
protected

Definition at line 83 of file INSBase.h.

Referenced by strongViscousTermLaplace(), and strongViscousTermTraction().

◆ _transient_term

bool INSBase::_transient_term
protected

◆ _u_vel

const VariableValue& INSBase::_u_vel
protected

◆ _u_vel_dot

const VariableValue& INSBase::_u_vel_dot
protected

Definition at line 86 of file INSBase.h.

Referenced by timeDerivativeTerm().

◆ _u_vel_var_number

unsigned INSBase::_u_vel_var_number
protected

◆ _v_vel

const VariableValue& INSBase::_v_vel
protected

◆ _v_vel_dot

const VariableValue& INSBase::_v_vel_dot
protected

Definition at line 87 of file INSBase.h.

Referenced by timeDerivativeTerm().

◆ _v_vel_var_number

unsigned INSBase::_v_vel_var_number
protected

◆ _w_vel

const VariableValue& INSBase::_w_vel
protected

◆ _w_vel_dot

const VariableValue& INSBase::_w_vel_dot
protected

Definition at line 88 of file INSBase.h.

Referenced by timeDerivativeTerm().

◆ _w_vel_var_number

unsigned INSBase::_w_vel_var_number
protected

The documentation for this class was generated from the following files:
INSBase::_second_u_vel
const VariableSecond & _second_u_vel
Definition: INSBase.h:81
INSBase::_d_v_vel_dot_dv
const VariableValue & _d_v_vel_dot_dv
Definition: INSBase.h:92
INSBase::_second_phi
const VariablePhiSecond & _second_phi
second derivatives of the shape function
Definition: INSBase.h:66
INSBase::_v_vel
const VariableValue & _v_vel
Definition: INSBase.h:70
INSBase::_convective_term
bool _convective_term
Definition: INSBase.h:109
INSBase::_gravity
RealVectorValue _gravity
Definition: INSBase.h:101
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
INSBase::_w_vel_dot
const VariableValue & _w_vel_dot
Definition: INSBase.h:88
INSBase::_d_w_vel_dot_dw
const VariableValue & _d_w_vel_dot_dw
Definition: INSBase.h:93
INSBase::strongViscousTermLaplace
virtual RealVectorValue strongViscousTermLaplace()
Definition: INSBase.C:119
INSBase::_v_vel_dot
const VariableValue & _v_vel_dot
Definition: INSBase.h:87
INSBase::_p_var_number
unsigned _p_var_number
Definition: INSBase.h:99
INSBase::_u_vel_var_number
unsigned _u_vel_var_number
Definition: INSBase.h:96
INSBase::_d_u_vel_dot_du
const VariableValue & _d_u_vel_dot_du
Definition: INSBase.h:91
INSBase::_second_w_vel
const VariableSecond & _second_w_vel
Definition: INSBase.h:83
INSBase::_grad_w_vel
const VariableGradient & _grad_w_vel
Definition: INSBase.h:77
INSBase::_p
const VariableValue & _p
Definition: INSBase.h:72
INSBase::_v_vel_var_number
unsigned _v_vel_var_number
Definition: INSBase.h:97
INSBase::_rho
const MaterialProperty< Real > & _rho
Definition: INSBase.h:105
INSBase::_grad_p
const VariableGradient & _grad_p
Definition: INSBase.h:78
INSBase::_grad_u_vel
const VariableGradient & _grad_u_vel
Definition: INSBase.h:75
INSBase::_alpha
const Real & _alpha
Definition: INSBase.h:107
INSBase::_u_vel
const VariableValue & _u_vel
Definition: INSBase.h:69
INSBase::_w_vel_var_number
unsigned _w_vel_var_number
Definition: INSBase.h:98
INSBase::_grad_v_vel
const VariableGradient & _grad_v_vel
Definition: INSBase.h:76
INSBase::_laplace
bool _laplace
Definition: INSBase.h:108
INSBase::_w_vel
const VariableValue & _w_vel
Definition: INSBase.h:71
INSBase::_transient_term
bool _transient_term
Definition: INSBase.h:110
INSBase::_second_v_vel
const VariableSecond & _second_v_vel
Definition: INSBase.h:82
INSBase::_mu
const MaterialProperty< Real > & _mu
Definition: INSBase.h:104
INSBase::_u_vel_dot
const VariableValue & _u_vel_dot
Definition: INSBase.h:86