https://mooseframework.inl.gov
INSChorinPressurePoisson.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 
11 #include "MooseMesh.h"
12 
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("u_star", "star x-velocity");
25  params.addCoupledVar("v_star", "star y-velocity"); // only required in 2D and 3D
26  params.addCoupledVar("w_star", "star z-velocity"); // 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_u_star(coupledGradient("u_star")),
39  _grad_v_star(_mesh.dimension() >= 2 ? coupledGradient("v_star") : _grad_zero),
40  _grad_w_star(_mesh.dimension() == 3 ? coupledGradient("w_star") : _grad_zero),
41 
42  // Variable numberings
43  _u_vel_star_var_number(coupled("u_star")),
44  _v_vel_star_var_number(_mesh.dimension() >= 2 ? coupled("v_star") : libMesh::invalid_uint),
45  _w_vel_star_var_number(_mesh.dimension() == 3 ? coupled("w_star") : 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, don't forget to *divide* by _dt
59  Real div_part = (_rho[_qp] / _dt) *
60  (_grad_u_star[_qp](0) + _grad_v_star[_qp](1) + _grad_w_star[_qp](2)) *
61  _test[_i][_qp];
62 
63  // Return the result
64  return laplacian_part + div_part;
65 }
66 
67 Real
69 {
70  return _grad_phi[_j][_qp] * _grad_test[_i][_qp];
71 }
72 
73 Real
75 {
76  if (jvar == _u_vel_star_var_number)
77  return (_rho[_qp] / _dt) * _grad_phi[_j][_qp](0) * _test[_i][_qp];
78 
79  else if (jvar == _v_vel_star_var_number)
80  return (_rho[_qp] / _dt) * _grad_phi[_j][_qp](1) * _test[_i][_qp];
81 
82  else if (jvar == _w_vel_star_var_number)
83  return (_rho[_qp] / _dt) * _grad_phi[_j][_qp](2) * _test[_i][_qp];
84 
85  else
86  return 0;
87 }
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 computeQpOffDiagJacobian(unsigned jvar)
This class computes the pressure Poisson solve which is part of the "split" scheme used for solving t...
const VariableGradient & _grad_v_star
Real & _dt
const MaterialProperty< Real > & _rho
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
const VariableGradient & _grad_u_star
const VariableTestValue & _test
const VariableGradient & _grad_w_star
unsigned int _i
registerMooseObject("NavierStokesApp", INSChorinPressurePoisson)
static InputParameters validParams()
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
void addClassDescription(const std::string &doc_string)
INSChorinPressurePoisson(const InputParameters &parameters)
unsigned int _qp