www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
INSSplitMomentum Class Reference

This class computes the "split" momentum equation residual. More...

#include <INSSplitMomentum.h>

Inheritance diagram for INSSplitMomentum:
[legend]

Public Member Functions

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

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned jvar)
 

Protected Attributes

const VariableValue & _u_vel
 
const VariableValue & _v_vel
 
const VariableValue & _w_vel
 
const VariableValue & _a1
 
const VariableValue & _a2
 
const VariableValue & _a3
 
const VariableGradient & _grad_u_vel
 
const VariableGradient & _grad_v_vel
 
const VariableGradient & _grad_w_vel
 
unsigned _u_vel_var_number
 
unsigned _v_vel_var_number
 
unsigned _w_vel_var_number
 
unsigned _a1_var_number
 
unsigned _a2_var_number
 
unsigned _a3_var_number
 
RealVectorValue _gravity
 
unsigned _component
 
const MaterialProperty< Real > & _mu
 
const MaterialProperty< Real > & _rho
 

Detailed Description

This class computes the "split" momentum equation residual.

In the split method, this is a time-independent vector equation for "a", an intermediate "acceleration" vector. The pressure is not coupled directly to momentum in the split method. Note: this equation is divided through by the density, so "nu" appears rather than "mu", for instance.

Do not use, USE INSChorinPredictor and related classes instead.

Definition at line 31 of file INSSplitMomentum.h.

Constructor & Destructor Documentation

◆ INSSplitMomentum()

INSSplitMomentum::INSSplitMomentum ( const InputParameters &  parameters)

Definition at line 44 of file INSSplitMomentum.C.

45  : Kernel(parameters),
46 
47  // Coupled variables
48  _u_vel(coupledValue("u")),
49  _v_vel(_mesh.dimension() >= 2 ? coupledValue("v") : _zero),
50  _w_vel(_mesh.dimension() == 3 ? coupledValue("w") : _zero),
51 
52  _a1(coupledValue("a1")),
53  _a2(_mesh.dimension() >= 2 ? coupledValue("a2") : _zero),
54  _a3(_mesh.dimension() == 3 ? coupledValue("a3") : _zero),
55 
56  // Gradients
57  _grad_u_vel(coupledGradient("u")),
58  _grad_v_vel(_mesh.dimension() >= 2 ? coupledGradient("v") : _grad_zero),
59  _grad_w_vel(_mesh.dimension() == 3 ? coupledGradient("w") : _grad_zero),
60 
61  // Variable numberings
62  _u_vel_var_number(coupled("u")),
63  _v_vel_var_number(_mesh.dimension() >= 2 ? coupled("v") : libMesh::invalid_uint),
64  _w_vel_var_number(_mesh.dimension() == 3 ? coupled("w") : libMesh::invalid_uint),
65 
66  _a1_var_number(coupled("a1")),
67  _a2_var_number(_mesh.dimension() >= 2 ? coupled("a2") : libMesh::invalid_uint),
68  _a3_var_number(_mesh.dimension() == 3 ? coupled("a3") : libMesh::invalid_uint),
69 
70  // Required parameters
71  _gravity(getParam<RealVectorValue>("gravity")),
72  _component(getParam<unsigned>("component")),
73 
74  // Material properties
75  _mu(getMaterialProperty<Real>("mu_name")),
76  _rho(getMaterialProperty<Real>("rho_name"))
77 {
78 }
const VariableValue & _a2
unsigned _u_vel_var_number
const MaterialProperty< Real > & _mu
const VariableValue & _a1
RealVectorValue _gravity
const MaterialProperty< Real > & _rho
const VariableGradient & _grad_u_vel
const VariableGradient & _grad_v_vel
const VariableValue & _u_vel
const VariableValue & _w_vel
const VariableGradient & _grad_w_vel
unsigned _v_vel_var_number
unsigned _w_vel_var_number
const VariableValue & _v_vel
const VariableValue & _a3

◆ ~INSSplitMomentum()

virtual INSSplitMomentum::~INSSplitMomentum ( )
inlinevirtual

Definition at line 36 of file INSSplitMomentum.h.

36 {}

Member Function Documentation

◆ computeQpJacobian()

Real INSSplitMomentum::computeQpJacobian ( )
protectedvirtual

Definition at line 134 of file INSSplitMomentum.C.

135 {
136  // The on-diagonal Jacobian contribution (derivative of a.test wrt a)
137  // is just the mass matrix entry.
138  return _phi[_j][_qp] * _test[_i][_qp];
139 }

◆ computeQpOffDiagJacobian()

Real INSSplitMomentum::computeQpOffDiagJacobian ( unsigned  jvar)
protectedvirtual

Definition at line 142 of file INSSplitMomentum.C.

143 {
144  if ((jvar == _u_vel_var_number) || (jvar == _v_vel_var_number) || (jvar == _w_vel_var_number))
145  {
146  // Derivative of viscous stress tensor
147  RealTensorValue dtau;
148 
149  // Initialize to invalid value, then determine correct value.
150  unsigned vel_index = 99;
151 
152  // Set index and build dtau for that index
153  if (jvar == _u_vel_var_number)
154  {
155  vel_index = 0;
156  dtau(0, 0) = 2. * _grad_phi[_j][_qp](0);
157  dtau(0, 1) = _grad_phi[_j][_qp](1);
158  dtau(0, 2) = _grad_phi[_j][_qp](2);
159  dtau(1, 0) = _grad_phi[_j][_qp](1);
160  dtau(2, 0) = _grad_phi[_j][_qp](2);
161  }
162  else if (jvar == _v_vel_var_number)
163  {
164  vel_index = 1;
165  /* */ dtau(0, 1) = _grad_phi[_j][_qp](0);
166  dtau(1, 0) = _grad_phi[_j][_qp](0);
167  dtau(1, 1) = 2. * _grad_phi[_j][_qp](1);
168  dtau(1, 2) = _grad_phi[_j][_qp](2);
169  /* */ dtau(2, 1) = _grad_phi[_j][_qp](2);
170  }
171  else if (jvar == _w_vel_var_number)
172  {
173  vel_index = 2;
174  /* */ dtau(0, 2) =
175  _grad_phi[_j][_qp](0);
176  /* */ dtau(1, 2) =
177  _grad_phi[_j][_qp](1);
178  dtau(2, 0) = _grad_phi[_j][_qp](0);
179  dtau(2, 1) = _grad_phi[_j][_qp](1);
180  dtau(2, 2) = 2. * _grad_phi[_j][_qp](2);
181  }
182 
183  // Vector object for test function
184  RealVectorValue test;
185  test(_component) = _test[_i][_qp];
186 
187  // Vector object for U
188  RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
189 
190  // Tensor object for test function gradient
191  RealTensorValue grad_test;
192  for (unsigned k = 0; k < 3; ++k)
193  grad_test(_component, k) = _grad_test[_i][_qp](k);
194 
195  // Compute the convective part
196  RealVectorValue convective_jac = _phi[_j][_qp] * RealVectorValue(_grad_u_vel[_qp](vel_index),
197  _grad_v_vel[_qp](vel_index),
198  _grad_w_vel[_qp](vel_index));
199 
200  // Extra contribution in vel_index component
201  convective_jac(vel_index) += U * _grad_phi[_j][_qp];
202  Real convective_part = convective_jac * test;
203 
204  // Compute the viscous part
205  Real viscous_part = (_mu[_qp] / _rho[_qp]) * dtau.contract(grad_test);
206 
207  // Return the result
208  return convective_part + viscous_part;
209  }
210 
211  else
212  return 0;
213 }
unsigned _u_vel_var_number
const MaterialProperty< Real > & _mu
const MaterialProperty< Real > & _rho
const VariableGradient & _grad_u_vel
const VariableGradient & _grad_v_vel
const VariableValue & _u_vel
const VariableValue & _w_vel
const VariableGradient & _grad_w_vel
unsigned _v_vel_var_number
unsigned _w_vel_var_number
const VariableValue & _v_vel

◆ computeQpResidual()

Real INSSplitMomentum::computeQpResidual ( )
protectedvirtual

Definition at line 81 of file INSSplitMomentum.C.

82 {
83  // Vector object for a
84  RealVectorValue a(_a1[_qp], _a2[_qp], _a3[_qp]);
85 
86  // Vector object for test function
87  RealVectorValue test;
88  test(_component) = _test[_i][_qp];
89 
90  // Tensor object for "grad U" = d(u_i)/d(x_j)
91  RealTensorValue grad_U(_grad_u_vel[_qp], _grad_v_vel[_qp], _grad_w_vel[_qp]);
92 
93  // Vector object for U
94  RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
95 
96  // Viscous stress tensor object
97  RealTensorValue tau(
98  // Row 1
99  2. * _grad_u_vel[_qp](0),
100  _grad_u_vel[_qp](1) + _grad_v_vel[_qp](0),
101  _grad_u_vel[_qp](2) + _grad_w_vel[_qp](0),
102  // Row 2
103  _grad_v_vel[_qp](0) + _grad_u_vel[_qp](1),
104  2. * _grad_v_vel[_qp](1),
105  _grad_v_vel[_qp](2) + _grad_w_vel[_qp](1),
106  // Row 3
107  _grad_w_vel[_qp](0) + _grad_u_vel[_qp](2),
108  _grad_w_vel[_qp](1) + _grad_v_vel[_qp](2),
109  2. * _grad_w_vel[_qp](2));
110 
111  // Tensor object for test function gradient
112  RealTensorValue grad_test;
113  for (unsigned k = 0; k < 3; ++k)
114  grad_test(_component, k) = _grad_test[_i][_qp](k);
115 
116  //
117  // Compute the different pieces...
118  //
119 
120  // "Symmetric" part, a.test
121  Real symmetric_part = a(_component) * _test[_i][_qp];
122 
123  // The convection part, (u.grad) * u_component * test_scalar. Which can also be
124  // written as (grad_U * U) * test_vec
125  Real convective_part = (grad_U * U) * test;
126 
127  // The viscous part, tau : grad(v)
128  Real viscous_part = (_mu[_qp] / _rho[_qp]) * tau.contract(grad_test);
129 
130  return symmetric_part + convective_part + viscous_part;
131 }
const VariableValue & _a2
const MaterialProperty< Real > & _mu
const VariableValue & _a1
const MaterialProperty< Real > & _rho
const VariableGradient & _grad_u_vel
const VariableGradient & _grad_v_vel
const VariableValue & _u_vel
const VariableValue & _w_vel
const VariableGradient & _grad_w_vel
const VariableValue & _v_vel
const VariableValue & _a3

Member Data Documentation

◆ _a1

const VariableValue& INSSplitMomentum::_a1
protected

Definition at line 49 of file INSSplitMomentum.h.

Referenced by computeQpResidual().

◆ _a1_var_number

unsigned INSSplitMomentum::_a1_var_number
protected

Definition at line 63 of file INSSplitMomentum.h.

◆ _a2

const VariableValue& INSSplitMomentum::_a2
protected

Definition at line 50 of file INSSplitMomentum.h.

Referenced by computeQpResidual().

◆ _a2_var_number

unsigned INSSplitMomentum::_a2_var_number
protected

Definition at line 64 of file INSSplitMomentum.h.

◆ _a3

const VariableValue& INSSplitMomentum::_a3
protected

Definition at line 51 of file INSSplitMomentum.h.

Referenced by computeQpResidual().

◆ _a3_var_number

unsigned INSSplitMomentum::_a3_var_number
protected

Definition at line 65 of file INSSplitMomentum.h.

◆ _component

unsigned INSSplitMomentum::_component
protected

Definition at line 69 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _grad_u_vel

const VariableGradient& INSSplitMomentum::_grad_u_vel
protected

Definition at line 54 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _grad_v_vel

const VariableGradient& INSSplitMomentum::_grad_v_vel
protected

Definition at line 55 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _grad_w_vel

const VariableGradient& INSSplitMomentum::_grad_w_vel
protected

Definition at line 56 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _gravity

RealVectorValue INSSplitMomentum::_gravity
protected

Definition at line 68 of file INSSplitMomentum.h.

◆ _mu

const MaterialProperty<Real>& INSSplitMomentum::_mu
protected

Definition at line 72 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _rho

const MaterialProperty<Real>& INSSplitMomentum::_rho
protected

Definition at line 73 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _u_vel

const VariableValue& INSSplitMomentum::_u_vel
protected

Definition at line 44 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _u_vel_var_number

unsigned INSSplitMomentum::_u_vel_var_number
protected

Definition at line 59 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian().

◆ _v_vel

const VariableValue& INSSplitMomentum::_v_vel
protected

Definition at line 45 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _v_vel_var_number

unsigned INSSplitMomentum::_v_vel_var_number
protected

Definition at line 60 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian().

◆ _w_vel

const VariableValue& INSSplitMomentum::_w_vel
protected

Definition at line 46 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ _w_vel_var_number

unsigned INSSplitMomentum::_w_vel_var_number
protected

Definition at line 61 of file INSSplitMomentum.h.

Referenced by computeQpOffDiagJacobian().


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