www.mooseframework.org
INSPressurePoisson.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 #include "INSPressurePoisson.h"
9 #include "MooseMesh.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<Kernel>();
16 
17  params.addClassDescription("This class computes the pressure Poisson solve which is part of the "
18  "'split' scheme used for solving the incompressible Navier-Stokes "
19  "equations.");
20  // Coupled variables
21  params.addRequiredCoupledVar("a1", "x-acceleration");
22  params.addCoupledVar("a2", "y-acceleration"); // only required in 2D and 3D
23  params.addCoupledVar("a3", "z-acceleration"); // only required in 3D
24 
25  // Optional parameters
26  params.addParam<MaterialPropertyName>("rho_name", "rho", "density_name");
27 
28  return params;
29 }
30 
31 INSPressurePoisson::INSPressurePoisson(const InputParameters & parameters)
32  : Kernel(parameters),
33 
34  // Gradients
35  _grad_a1(coupledGradient("a1")),
36  _grad_a2(_mesh.dimension() >= 2 ? coupledGradient("a2") : _grad_zero),
37  _grad_a3(_mesh.dimension() == 3 ? coupledGradient("a3") : _grad_zero),
38 
39  // Variable numberings
40  _a1_var_number(coupled("a1")),
41  _a2_var_number(_mesh.dimension() >= 2 ? coupled("a2") : libMesh::invalid_uint),
42  _a3_var_number(_mesh.dimension() == 3 ? coupled("a3") : libMesh::invalid_uint),
43 
44  // Material Properties
45  _rho(getMaterialProperty<Real>("rho_name"))
46 {
47 }
48 
49 Real
51 {
52  // Laplacian part
53  Real laplacian_part = _grad_u[_qp] * _grad_test[_i][_qp];
54 
55  // Divergence part
56  Real div_part =
57  _rho[_qp] * (_grad_a1[_qp](0) + _grad_a2[_qp](1) + _grad_a3[_qp](2)) * _test[_i][_qp];
58 
59  // Return the result
60  return laplacian_part + div_part;
61 }
62 
63 Real
65 {
66  return _grad_phi[_j][_qp] * _grad_test[_i][_qp];
67 }
68 
69 Real
71 {
72  if (jvar == _a1_var_number)
73  return _rho[_qp] * _grad_phi[_j][_qp](0) * _test[_i][_qp];
74 
75  else if (jvar == _a2_var_number)
76  return _rho[_qp] * _grad_phi[_j][_qp](1) * _test[_i][_qp];
77 
78  else if (jvar == _a3_var_number)
79  return _rho[_qp] * _grad_phi[_j][_qp](2) * _test[_i][_qp];
80 
81  else
82  return 0;
83 }
const VariableGradient & _grad_a3
InputParameters validParams< INSPressurePoisson >()
virtual Real computeQpResidual()
virtual Real computeQpOffDiagJacobian(unsigned jvar)
INSPressurePoisson(const InputParameters &parameters)
const VariableGradient & _grad_a2
const MaterialProperty< Real > & _rho
virtual Real computeQpJacobian()
const VariableGradient & _grad_a1