https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NavierStokesLHDGKernel.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 "MooseVariableFE.h"
12#include "MooseVariableScalar.h"
13#include "FEProblemBase.h"
14
16
19{
20 auto params = HDGKernel::validParams();
22 params.addParam<MooseFunctorName>(
23 "body_force_x", 0, "Body force for the momentum equation in the x-direction");
24 params.addParam<MooseFunctorName>(
25 "body_force_y", 0, "Body force for the momentum equation in the y-direction");
26 params.addParam<MooseFunctorName>(
27 "body_force_z", 0, "Body force for the momentum equation in the z-direction");
28 params.addParam<MooseFunctorName>(
29 "pressure_mms_forcing_function",
30 0,
31 "A forcing function for the pressure (mass) equation for conducting MMS studies");
32 params.addClassDescription("Implements the steady incompressible Navier-Stokes equations for a "
33 "hybridized discretization");
34 params.renameParam("variable", "u", "The x-component of velocity");
35 return params;
36}
37
39 : HDGKernel(parameters),
40 NavierStokesLHDGAssemblyHelper(this, this, this, this, _fe_problem, _sys, _mesh, _tid),
41 // body forces
42 _body_force_x(getFunctor<Real>("body_force_x")),
43 _body_force_y(getFunctor<Real>("body_force_y")),
44 _body_force_z(getFunctor<Real>("body_force_z")),
45 _pressure_mms_forcing_function(getFunctor<Real>("pressure_mms_forcing_function")),
46 _qrule_face(_assembly.qRuleFace()),
47 _q_point_face(_assembly.qPointsFace()),
48 _JxW_face(_assembly.JxWFace()),
49 _normals(_assembly.normals()),
50 _current_side(_assembly.side())
51{
52 if (_mesh.dimension() > 2)
53 mooseError("This class only supports 2D simulations at this time");
54
55 _body_forces.push_back(&_body_force_x);
56 _body_forces.push_back(&_body_force_y);
57 _body_forces.push_back(&_body_force_z);
58}
59
60void
93
94void
96{
114 _p_dof_indices.size());
115
116 // qu and u
119
120 // qv and v
123
124 // p
126
146 {
157 }
158}
159
160void
162{
163 const Elem * const neigh = _current_elem->neighbor_ptr(_current_side);
164
172
173 // qu, u, lm_u
178
179 // qv, v, lm_v
184
185 // p
187
195}
196
197void
199{
200 const Elem * const neigh = _current_elem->neighbor_ptr(_current_side);
201
226
227 // qu, u, lm_u
230 _JxW_face,
232 _normals,
234 _u_u_jac,
236 _u_p_jac,
240 _JxW_face,
242 _normals,
243 neigh,
250
251 // qv, v, lm_v
254 _JxW_face,
256 _normals,
258 _v_v_jac,
260 _v_p_jac,
264 _JxW_face,
266 _normals,
267 neigh,
274
275 // p
277
316}
317
318void
320{
321 // This check must occur after FEProblemBase::init()
323}
324
325void
330
331void
340
341std::set<std::string>
343{
344 std::set<std::string> covered_vars = {_grad_u_var.name(),
346 _v_var.name(),
351 covered_vars.insert(_enclosure_lm_var->name());
352 return covered_vars;
353}
registerMooseObject("NavierStokesApp", NavierStokesLHDGKernel)
void vectorVolumeResidual(const MooseArray< Gradient > &vector_sol, const MooseArray< Number > &scalar_sol, const MooseArray< Real > &JxW, const libMesh::QBase &qrule, DenseVector< Number > &vector_re)
const std::vector< dof_id_type > & _qu_dof_indices
const MooseVariableFE< Real > & _u_var
void vectorFaceResidual(const MooseArray< Number > &lm_sol, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseVector< Number > &vector_re)
const MooseArray< Number > & _u_sol
void vectorVolumeJacobian(const MooseArray< Real > &JxW, const libMesh::QBase &qrule, DenseMatrix< Number > &vector_vector_jac, DenseMatrix< Number > &vector_scalar_jac)
void vectorFaceJacobian(const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseMatrix< Number > &vector_lm_jac)
const std::vector< dof_id_type > & _lm_u_dof_indices
const MooseArray< libMesh::Gradient > & _qu_sol
const MooseArray< Number > & _lm_u_sol
const std::vector< dof_id_type > & _u_dof_indices
const MooseVariableFE< Real > & _u_face_var
const MooseVariableFE< RealVectorValue > & _grad_u_var
static InputParameters validParams()
const MooseArray< Point > & _q_point
const MooseArray< Real > & _JxW
const Elem *const & _current_elem
const QBase *const & _qrule
const std::string & name() const
void mooseError(Args &&... args) const
virtual unsigned int dimension() const
void scalingFactor(const std::vector< Real > &factor)
Implements all the methods for assembling a hybridized local discontinuous Galerkin (LDG-H),...
void pressureFaceJacobian(const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseMatrix< Number > &p_lm_u_vel_jac, DenseMatrix< Number > &p_lm_v_vel_jac)
const std::vector< dof_id_type > & _lm_v_dof_indices
const std::vector< dof_id_type > & _qv_dof_indices
Containers for dof indices.
void pressureVolumeResidual(const Moose::Functor< Real > &pressure_mms_forcing_function, const MooseArray< Real > &JxW, const libMesh::QBase &qrule, const Elem *const current_elem, const MooseArray< Point > &q_point, DenseVector< Number > &pressure_re, DenseVector< Number > &global_lm_re)
Compute the volumetric contributions to the pressure residual, e.g.
void pressureVolumeJacobian(const MooseArray< Real > &JxW, const libMesh::QBase &qrule, DenseMatrix< Number > &p_u_vel_jac, DenseMatrix< Number > &p_v_vel_jac, DenseMatrix< Number > &p_global_lm_jac, DenseMatrix< Number > &global_lm_p_jac)
Compute the volumetric contributions to the pressure Jacobian, e.g.
const MooseArray< Gradient > & _qv_sol
local solutions at quadrature points
void scalarFaceJacobian(const unsigned int vel_component, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseMatrix< Number > &scalar_vector_jac, DenseMatrix< Number > &scalar_scalar_jac, DenseMatrix< Number > &scalar_lm_jac, DenseMatrix< Number > &scalar_p_jac, DenseMatrix< Number > &scalar_lm_u_vel_jac, DenseMatrix< Number > &scalar_lm_v_vel_jac)
const std::vector< dof_id_type > & _p_dof_indices
const MooseVariableFE< Real > & _v_face_var
const MooseVariableFE< Real > & _pressure_var
const std::vector< dof_id_type > *const _global_lm_dof_indices
void lmFaceJacobian(const unsigned int vel_component, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, const Elem *const neigh, DenseMatrix< Number > &lm_vec_jac, DenseMatrix< Number > &lm_scalar_jac, DenseMatrix< Number > &lm_lm_jac, DenseMatrix< Number > &lm_p_jac, DenseMatrix< Number > &lm_lm_u_vel_jac, DenseMatrix< Number > &lm_lm_v_vel_jac)
void scalarFaceResidual(const MooseArray< Gradient > &vector_sol, const MooseArray< Number > &scalar_sol, const MooseArray< Number > &lm_sol, const unsigned int vel_component, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseVector< Number > &scalar_re)
const MooseVariableFE< RealVectorValue > & _grad_v_var
void scalarVolumeJacobian(const unsigned int vel_component, const MooseArray< Real > &JxW, const libMesh::QBase &qrule, DenseMatrix< Number > &scalar_vector_jac, DenseMatrix< Number > &scalar_u_vel_jac, DenseMatrix< Number > &scalar_v_vel_jac, DenseMatrix< Number > &scalar_p_jac)
Compute the volumetric contributions to a velocity Jacobian.
void pressureFaceResidual(const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseVector< Number > &pressure_re)
void lmFaceResidual(const MooseArray< Gradient > &vector_sol, const MooseArray< Number > &scalar_sol, const MooseArray< Number > &lm_sol, const unsigned int vel_component, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, const Elem *const neigh, DenseVector< Number > &lm_re)
void scalarVolumeResidual(const MooseArray< Gradient > &vel_gradient, const unsigned int vel_component, const Moose::Functor< Real > &body_force, const MooseArray< Real > &JxW, const libMesh::QBase &qrule, const Elem *const current_elem, const MooseArray< Point > &q_point, DenseVector< Number > &scalar_re)
Compute the volumetric contributions to a velocity residual for a provided velocity gradient and stre...
const MooseVariableScalar *const _enclosure_lm_var
const std::vector< dof_id_type > & _v_dof_indices
Implements the steady incompressible Navier-Stokes equations for a hybridized discretization.
const QBase *const & _qrule_face
The face quadrature rule.
static InputParameters validParams()
std::vector< const Moose::Functor< Real > * > _body_forces
const MooseArray< Point > & _normals
face normals
NavierStokesLHDGKernel(const InputParameters &parameters)
virtual void computeResidualOnSide() override
virtual void computeResidual() override
virtual std::set< std::string > additionalROVariables() override
virtual void computeJacobian() override
Compute this object's entire element interior Jacobian, both on- and off-diagonal.
const Moose::Functor< Real > & _pressure_mms_forcing_function
const unsigned int & _current_side
The current side when doing face evaluations.
const MooseArray< Real > & _JxW_face
transformed Jacobian weights on the current element face
virtual void jacobianSetup() override
virtual void computeOffDiagJacobian(unsigned int jvar) override
Forwards to computeJacobian() the first time this is called for a given element.
const Moose::Functor< Real > & _body_force_y
virtual void initialSetup() override
const Moose::Functor< Real > & _body_force_x
virtual void computeJacobianOnSide() override
const Moose::Functor< Real > & _body_force_z
MooseMesh & _mesh
Assembly & _assembly
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
void resize(const unsigned int new_m, const unsigned int new_n)
void resize(const unsigned int n)