www.mooseframework.org
INSChorinPressurePoisson.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 
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("u_star", "star x-velocity");
22  params.addCoupledVar("v_star", "star y-velocity"); // only required in 2D and 3D
23  params.addCoupledVar("w_star", "star z-velocity"); // only required in 3D
24 
25  // Optional parameters
26  params.addParam<MaterialPropertyName>("rho_name", "rho", "density_name");
27 
28  return params;
29 }
30 
31 INSChorinPressurePoisson::INSChorinPressurePoisson(const InputParameters & parameters)
32  : Kernel(parameters),
33 
34  // Gradients
35  _grad_u_star(coupledGradient("u_star")),
36  _grad_v_star(_mesh.dimension() >= 2 ? coupledGradient("v_star") : _grad_zero),
37  _grad_w_star(_mesh.dimension() == 3 ? coupledGradient("w_star") : _grad_zero),
38 
39  // Variable numberings
40  _u_vel_star_var_number(coupled("u_star")),
41  _v_vel_star_var_number(_mesh.dimension() >= 2 ? coupled("v_star") : libMesh::invalid_uint),
42  _w_vel_star_var_number(_mesh.dimension() == 3 ? coupled("w_star") : 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, don't forget to *divide* by _dt
56  Real div_part = (_rho[_qp] / _dt) *
57  (_grad_u_star[_qp](0) + _grad_v_star[_qp](1) + _grad_w_star[_qp](2)) *
58  _test[_i][_qp];
59 
60  // Return the result
61  return laplacian_part + div_part;
62 }
63 
64 Real
66 {
67  return _grad_phi[_j][_qp] * _grad_test[_i][_qp];
68 }
69 
70 Real
72 {
73  if (jvar == _u_vel_star_var_number)
74  return (_rho[_qp] / _dt) * _grad_phi[_j][_qp](0) * _test[_i][_qp];
75 
76  else if (jvar == _v_vel_star_var_number)
77  return (_rho[_qp] / _dt) * _grad_phi[_j][_qp](1) * _test[_i][_qp];
78 
79  else if (jvar == _w_vel_star_var_number)
80  return (_rho[_qp] / _dt) * _grad_phi[_j][_qp](2) * _test[_i][_qp];
81 
82  else
83  return 0;
84 }
virtual Real computeQpOffDiagJacobian(unsigned jvar)
const VariableGradient & _grad_v_star
const MaterialProperty< Real > & _rho
const VariableGradient & _grad_u_star
InputParameters validParams< INSChorinPressurePoisson >()
const VariableGradient & _grad_w_star
INSChorinPressurePoisson(const InputParameters &parameters)