https://mooseframework.inl.gov
DiffusionLHDGPrescribedGradientBC.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 
12 
14 
17 {
18  auto params = IntegratedBC::validParams();
20  params.renameParam("variable", "u", "The diffusing specie concentration");
21  params.addClassDescription("Implements a flux boundary condition for use with a hybridized "
22  "discretization of the diffusion equation");
23  params.addParam<MooseFunctorName>(
24  "normal_gradient", 0, "The prescribed value of the gradient dotted with the normal");
25  return params;
26 }
27 
29  const InputParameters & parameters)
30  : IntegratedBC(parameters),
31  DiffusionLHDGAssemblyHelper(this, this, this, this, _fe_problem, _sys, _tid),
32  _normal_gradient(getFunctor<Real>("normal_gradient")),
33  _cached_side(libMesh::invalid_uint)
34 {
35 }
36 
37 void
39 {
40  checkCoupling();
41 }
42 
43 void
45 {
49 
50  // For notation, please read "A superconvergent LDG-hybridizable Galerkin method for second-order
51  // elliptic problems" by Cockburn
52 
53  // qu, u, lm_u
57 
58  for (const auto qp : make_range(_qrule->n_points()))
59  for (const auto i : index_range(_lm_re))
60  // prescribed normal gradient
61  _lm_re(i) += _JxW[qp] * _diff[qp] * _lm_phi_face[i][qp] *
64  determineState());
65 
69 }
70 
71 void
73 {
83 
84  // qu, u, lm_u
89 
101  addJacobian(
103  addJacobian(
105  addJacobian(
107 }
108 
109 void
111 {
112  _cached_elem = nullptr;
114 }
115 
116 void
118 {
120  {
121  computeJacobian();
124  }
125 }
const std::vector< dof_id_type > & _lm_u_dof_indices
const MooseArray< Number > & _u_sol
const unsigned int invalid_uint
const MooseArray< Point > & _normals
normals at quadrature points
Definition: IntegratedBC.h:85
const std::vector< dof_id_type > & _u_dof_indices
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)
Computes a local residual vector for the weak form: -<{u}, n*v> where {u} is the trace of the scalar ...
const Elem * _cached_elem
A data member used for determining when to compute the Jacobian.
const MooseArray< std::vector< Real > > & _lm_phi_face
const Elem *const & _current_elem
current element
void resize(const unsigned int n)
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals corresponding to the provided dof indices.
static InputParameters validParams()
Definition: IntegratedBC.C:23
const MooseArray< libMesh::Gradient > & _qu_sol
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const std::vector< dof_id_type > & _qu_dof_indices
const MooseArray< Point > & _q_point
active quadrature points
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided residual derivatives into the Jacobian for the provided dof indices.
Implements a fixed normal gradient boundary condition for use with a hybridized discretization of the...
virtual void computeResidual() override
Compute this object&#39;s contribution to the residual.
static InputParameters validParams()
Implements all the methods for assembling a hybridized local discontinuous Galerkin (LDG-H)...
void scalarFaceJacobian(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)
Computes a local Jacobian matrix for the weak form: -<Dq*n, w> + < * (u - {u}) * n * n...
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes d-ivar-residual / d-jvar...
void lmFaceJacobian(const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseMatrix< Number > &lm_vec_jac, DenseMatrix< Number > &lm_scalar_jac, DenseMatrix< Number > &lm_lm_jac)
Computes a local Jacobian matrix for the weak form: -<Dq*n, > + < * (u - {u}) * n * n...
void lmFaceResidual(const MooseArray< Gradient > &vector_sol, const MooseArray< Number > &scalar_sol, const MooseArray< Number > &lm_sol, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseVector< Number > &lm_re)
Computes a local residual vector for the weak form: -<Dq*n, > + < * (u - {u}) * n * n...
Base class for deriving any boundary condition of a integrated type.
Definition: IntegratedBC.h:18
const MaterialProperty< Real > & _diff
The diffusivity.
Assembly & _assembly
Reference to this Kernel&#39;s assembly object.
void vectorFaceJacobian(const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseMatrix< Number > &vector_lm_jac)
Computes a local Jacobian matrix for the weak form: -<{u}, n*v> where {u} is the trace of the scalar ...
const Moose::Functor< Real > & _normal_gradient
Prescribed normal gradient along the boundary.
const MooseVariableFE< Real > & _u_face_var
const QBase *const & _qrule
active quadrature rule
const unsigned int & _current_side
current side of the current element
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseVariableFE< Real > & _u_var
const MooseArray< Number > & _lm_u_sol
DiffusionLHDGPrescribedGradientBC(const InputParameters &parameters)
void resize(const unsigned int new_m, const unsigned int new_n)
IntRange< T > make_range(T beg, T end)
unsigned int _cached_side
A cache variable to prevent multiple computations of Jacobians.
virtual void computeJacobian() override
Compute this object&#39;s contribution to the diagonal Jacobian entries.
const MooseVariableFE< RealVectorValue > & _grad_u_var
void scalarFaceResidual(const MooseArray< Gradient > &vector_sol, const MooseArray< Number > &scalar_sol, const MooseArray< Number > &lm_sol, const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseVector< Number > &scalar_re)
Computes a local residual vector for the weak form: -<Dq*n, w> + < * (u - {u}) * n * n...
registerMooseObject("MooseApp", DiffusionLHDGPrescribedGradientBC)
auto index_range(const T &sizable)
Argument for requesting functor evaluation at quadrature point locations on an element side...
const MooseArray< Real > & _JxW
transformed Jacobian weights
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.
virtual void jacobianSetup() override
Gets called just before the Jacobian is computed and before this object is asked to do its job...