https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
52Real
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) *
61 _test[_i][_qp];
62
63 // Return the result
64 return laplacian_part + div_part;
65}
66
67Real
72
73Real
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}
registerMooseObject("NavierStokesApp", INSChorinPressurePoisson)
This class computes the pressure Poisson solve which is part of the "split" scheme used for solving t...
const VariableGradient & _grad_u_star
virtual Real computeQpOffDiagJacobian(unsigned jvar)
static InputParameters validParams()
const VariableGradient & _grad_v_star
INSChorinPressurePoisson(const InputParameters &parameters)
const MaterialProperty< Real > & _rho
const VariableGradient & _grad_w_star
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
Real & _dt
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...