https://mooseframework.inl.gov
NavierStokesLHDGVelocityDirichletBC.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 
13 
16 {
17  auto params = IntegratedBC::validParams();
19  params.addClassDescription("Weakly imposes Dirichlet boundary conditions for the velocity for a "
20  "hybridized discretization of the Navier-Stokes equations");
21  params.addRequiredParam<MooseFunctorName>("dirichlet_u",
22  "The Dirichlet value for the x-component of velocity");
23  params.addRequiredParam<MooseFunctorName>("dirichlet_v",
24  "The Dirichlet value for the y-component of velocity");
25  params.addParam<MooseFunctorName>(
26  "dirichlet_w", 0, "The Dirichlet value for the z-component of velocity");
27  params.renameParam("variable", "u", "The x-component of velocity");
28  return params;
29 }
30 
32  const InputParameters & parameters)
33  : IntegratedBC(parameters),
34  NavierStokesLHDGAssemblyHelper(this, this, this, this, _fe_problem, _sys, _mesh, _tid),
35  _cached_side(libMesh::invalid_uint)
36 {
37  if (_mesh.dimension() > 2 && !isParamSetByUser("dirichlet_w"))
38  paramError("dirichlet_w",
39  "For a 3D simulation, the Dirichlet value of the z-velocity must be supplied");
40 
41  _dirichlet_vel[0] = &getFunctor<Real>("dirichlet_u");
42  _dirichlet_vel[1] = &getFunctor<Real>("dirichlet_v");
43  _dirichlet_vel[2] = &getFunctor<Real>("dirichlet_w");
44 }
45 
46 void
48 {
49  // This check must occur after FEProblemBase::init()
50  checkCoupling();
51 }
52 
53 void
55 {
56  _cached_elem = nullptr;
58 }
59 
60 void
62 {
64  {
68  }
69 }
70 
71 void
73 {
80  _p_re.resize(_p_dof_indices.size());
81 
82  // qu, u, lm_u
84  _JxW,
85  *_qrule,
86  _normals,
89  _q_point,
92  _u_sol,
93  0,
95  _JxW,
96  *_qrule,
97  _normals,
100  _q_point,
101  _u_vel_re);
102 
103  // qv, v, lm_v
105  _JxW,
106  *_qrule,
107  _normals,
110  _q_point,
113  _v_sol,
114  1,
116  _JxW,
117  *_qrule,
118  _normals,
121  _q_point,
122  _v_vel_re);
123 
124  // p
127 
128  // Set the LMs on these Dirichlet boundary faces to 0
131 
139 }
140 
141 void
143 {
152 
153  // qu, u, lm_u
155 
156  // qv, v, lm_v
158 
159  // Set the LMs on these Dirichlet boundary faces to 0
162 
169  addJacobian(
171  addJacobian(
173 }
MooseMesh & _mesh
const std::vector< dof_id_type > & _lm_u_dof_indices
const MooseArray< Number > & _u_sol
virtual void computeOffDiagJacobian(unsigned int jvar) override
const MooseVariableFE< Real > & _v_var
unsigned int _cached_side
A cache variable to prevent multiple computations of Jacobians.
const unsigned int invalid_uint
const MooseArray< Point > & _normals
const std::vector< dof_id_type > & _u_dof_indices
std::array< const Moose::Functor< Real > *, 3 > _dirichlet_vel
Dirichlet velocity.
const MooseArray< std::vector< Real > > & _lm_phi_face
const Elem *const & _current_elem
void resize(const unsigned int n)
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
const MooseVariableFE< Real > & _v_face_var
static InputParameters validParams()
const MooseArray< libMesh::Gradient > & _qu_sol
const std::vector< dof_id_type > & _qv_dof_indices
Containers for dof indices.
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
Weakly imposes Dirichlet boundary conditions for the velocity for a hybridized discretization of the ...
const std::vector< dof_id_type > & _qu_dof_indices
const MooseArray< Point > & _q_point
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
void scalarDirichletResidual(const MooseArray< Gradient > &vector_sol, const MooseArray< Number > &scalar_sol, const unsigned int vel_component, const std::array< const Moose::Functor< Real > *, 3 > &dirichlet_vel, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, const Elem *const current_elem, const unsigned int current_side, const MooseArray< Point > &q_point_face, DenseVector< Number > &scalar_re)
virtual unsigned int dimension() const
const MooseVariableFE< RealVectorValue > & _grad_v_var
const std::vector< dof_id_type > & _lm_v_dof_indices
const std::vector< dof_id_type > & _v_dof_indices
void paramError(const std::string &param, Args... args) const
void vectorDirichletResidual(const Moose::Functor< Real > &dirichlet_value, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, const Elem *const current_elem, const unsigned int current_side, const MooseArray< Point > &q_point_face, DenseVector< Number > &vector_re)
Assembly & _assembly
const MooseVariableFE< Real > & _pressure_var
bool isParamSetByUser(const std::string &nm) const
const MooseVariableFE< Real > & _u_face_var
const QBase *const & _qrule
const unsigned int & _current_side
const std::vector< dof_id_type > & _p_dof_indices
void pressureDirichletResidual(const std::array< const Moose::Functor< Real > *, 3 > &dirichlet_vel, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, const Elem *const current_elem, const unsigned int current_side, const MooseArray< Point > &q_point_face, DenseVector< Number > &pressure_re)
const MooseVariableFE< Real > & _u_var
const MooseArray< Number > & _lm_u_sol
void createIdentityResidual(const MooseArray< Real > &JxW, const libMesh::QBase &qrule, const MooseArray< std::vector< Real >> &phi, const MooseArray< Number > &sol, DenseVector< Number > &re)
void resize(const unsigned int new_m, const unsigned int new_n)
const MooseArray< Gradient > & _qv_sol
local solutions at quadrature points
const MooseVariableFE< RealVectorValue > & _grad_u_var
NavierStokesLHDGVelocityDirichletBC(const InputParameters &parameters)
void createIdentityJacobian(const MooseArray< Real > &JxW, const libMesh::QBase &qrule, const MooseArray< std::vector< Real >> &phi, DenseMatrix< Number > &ke)
void scalarDirichletJacobian(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_pressure_jac)
Implements all the methods for assembling a hybridized local discontinuous Galerkin (LDG-H)...
const MooseArray< Real > & _JxW
void scalingFactor(const std::vector< Real > &factor)