https://mooseframework.inl.gov
Loading...
Searching...
No Matches
INSPressurePoisson.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
10#include "INSPressurePoisson.h"
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("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
52Real
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
66Real
71
72Real
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}
registerMooseObject("NavierStokesApp", INSPressurePoisson)
This class computes the pressure Poisson solve which is part of the "split" scheme used for solving t...
virtual Real computeQpOffDiagJacobian(unsigned jvar)
const VariableGradient & _grad_a3
static InputParameters validParams()
virtual Real computeQpJacobian()
const VariableGradient & _grad_a2
const MaterialProperty< Real > & _rho
const VariableGradient & _grad_a1
INSPressurePoisson(const InputParameters &parameters)
virtual Real computeQpResidual()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _qp
unsigned int _j
unsigned int _i
const VariableGradient & _grad_u
const VariableTestValue & _test
static InputParameters validParams()
const VariablePhiGradient & _grad_phi
const VariableTestGradient & _grad_test
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...