www.mooseframework.org
INSPressurePoisson.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "INSPressurePoisson.h"
11 #include "MooseMesh.h"
12 
13 registerMooseObject("NavierStokesApp", INSPressurePoisson);
14 
17 {
19 
20  params.addClassDescription("This class computes the pressure Poisson solve which is part of the "
21  "'split' scheme used for solving the incompressible Navier-Stokes "
22  "equations.");
23  // Coupled variables
24  params.addRequiredCoupledVar("a1", "x-acceleration");
25  params.addCoupledVar("a2", "y-acceleration"); // only required in 2D and 3D
26  params.addCoupledVar("a3", "z-acceleration"); // only required in 3D
27 
28  // Optional parameters
29  params.addParam<MaterialPropertyName>("rho_name", "rho", "density_name");
30 
31  return params;
32 }
33 
35  : Kernel(parameters),
36 
37  // Gradients
38  _grad_a1(coupledGradient("a1")),
39  _grad_a2(_mesh.dimension() >= 2 ? coupledGradient("a2") : _grad_zero),
40  _grad_a3(_mesh.dimension() == 3 ? coupledGradient("a3") : _grad_zero),
41 
42  // Variable numberings
43  _a1_var_number(coupled("a1")),
44  _a2_var_number(_mesh.dimension() >= 2 ? coupled("a2") : libMesh::invalid_uint),
45  _a3_var_number(_mesh.dimension() == 3 ? coupled("a3") : libMesh::invalid_uint),
46 
47  // Material Properties
48  _rho(getMaterialProperty<Real>("rho_name"))
49 {
50 }
51 
52 Real
54 {
55  // Laplacian part
56  Real laplacian_part = _grad_u[_qp] * _grad_test[_i][_qp];
57 
58  // Divergence part
59  Real div_part =
60  _rho[_qp] * (_grad_a1[_qp](0) + _grad_a2[_qp](1) + _grad_a3[_qp](2)) * _test[_i][_qp];
61 
62  // Return the result
63  return laplacian_part + div_part;
64 }
65 
66 Real
68 {
69  return _grad_phi[_j][_qp] * _grad_test[_i][_qp];
70 }
71 
72 Real
74 {
75  if (jvar == _a1_var_number)
76  return _rho[_qp] * _grad_phi[_j][_qp](0) * _test[_i][_qp];
77 
78  else if (jvar == _a2_var_number)
79  return _rho[_qp] * _grad_phi[_j][_qp](1) * _test[_i][_qp];
80 
81  else if (jvar == _a3_var_number)
82  return _rho[_qp] * _grad_phi[_j][_qp](2) * _test[_i][_qp];
83 
84  else
85  return 0;
86 }
const VariableGradient & _grad_a3
const VariableGradient & _grad_u
static InputParameters validParams()
const unsigned int invalid_uint
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const VariablePhiGradient & _grad_phi
virtual Real computeQpResidual()
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
This class computes the pressure Poisson solve which is part of the "split" scheme used for solving t...
static InputParameters validParams()
virtual Real computeQpOffDiagJacobian(unsigned jvar)
INSPressurePoisson(const InputParameters &parameters)
const VariableTestValue & _test
const VariableGradient & _grad_a2
unsigned int _i
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _j
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableTestGradient & _grad_test
registerMooseObject("NavierStokesApp", INSPressurePoisson)
void addClassDescription(const std::string &doc_string)
const MaterialProperty< Real > & _rho
virtual Real computeQpJacobian()
unsigned int _qp
const VariableGradient & _grad_a1