https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PressureGradient.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 "PressureGradient.h"
11#include "NS.h"
12
14
17{
19 params.addRequiredCoupledVar(NS::pressure, "pressure");
20 params.addRequiredParam<unsigned int>("component", "number of component (0 = x, 1 = y, 2 = z)");
22 "Implements the pressure gradient term for one of the Navier Stokes momentum equations.");
23 params.addParam<bool>(
24 "integrate_p_by_parts", true, "Whether to integrate the pressure term by parts");
25
26 return params;
27}
28
30 : Kernel(parameters),
31 _integrate_p_by_parts(getParam<bool>("integrate_p_by_parts")),
32 _component(getParam<unsigned int>("component")),
33 _pressure(coupledValue(NS::pressure)),
34 _grad_pressure(coupledGradient(NS::pressure)),
35 _pressure_id(coupled(NS::pressure)),
36 _coord_sys(_assembly.coordSystem()),
37 _rz_radial_coord(_mesh.getAxisymmetricRadialCoord())
38{
39}
40
41Real
43{
45 {
46 auto residual = -_pressure[_qp] * _grad_test[_i][_qp](_component);
48 residual -= _pressure[_qp] / _q_point[_qp](_rz_radial_coord) * _test[_i][_qp];
49 return residual;
50 }
51 else
53}
54
55Real
60
61Real
63{
64 if (jvar == _pressure_id)
65 {
67 {
68 auto residual = -_phi[_j][_qp] * _grad_test[_i][_qp](_component);
70 residual -= _phi[_j][_qp] / _q_point[_qp](_rz_radial_coord) * _test[_i][_qp];
71 return residual;
72 }
73 else
74 return _test[_i][_qp] * _grad_phi[_j][_qp](_component);
75 }
76 else
77 return 0;
78}
registerMooseObject("NavierStokesApp", PressureGradient)
void ErrorVector unsigned int
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(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)
unsigned int _qp
const MooseArray< Point > & _q_point
unsigned int _j
unsigned int _i
const VariablePhiValue & _phi
const VariableTestValue & _test
static InputParameters validParams()
const VariablePhiGradient & _grad_phi
const VariableTestGradient & _grad_test
Adds the pressure gradient term to the Navier-Stokes momentum equation.
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual Real computeQpJacobian() override
const Moose::CoordinateSystemType & _coord_sys
The coordinate system.
const VariableValue & _pressure
The pressure value.
const unsigned int _rz_radial_coord
The radial coordinate index for RZ coordinate systems.
unsigned int _component
The velocity component this object is adding a residual for.
const unsigned int _pressure_id
The number of the pressure variable.
virtual Real computeQpResidual() override
PressureGradient(const InputParameters &parameters)
const VariableGradient & _grad_pressure
The pressure gradient.
const bool _integrate_p_by_parts
Whether to integrate the pressure term by parts.
static InputParameters validParams()
static const std::string pressure
Definition NS.h:57