https://mooseframework.inl.gov
DiffusionLHDGKernel.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 "DiffusionLHDGKernel.h"
12 #include "MooseVariableFE.h"
13 #include "MooseVariableScalar.h"
14 #include "SystemBase.h"
15 #include "MooseMesh.h"
16 #include "MooseObject.h"
18 #include "NonlinearThread.h"
19 
20 using namespace libMesh;
21 
23 
26 {
27  auto params = HDGKernel::validParams();
29  params.renameParam("variable", "u", "The diffusing specie concentration");
30  params.addParam<MooseFunctorName>("source", 0, "Source for the diffusing species");
31  params.addClassDescription("Adds the element and interior face weak forms for a hybridized local "
32  "discontinuous Galerkin discretization of a diffusion term.");
33  return params;
34 }
35 
37  : HDGKernel(params),
38  DiffusionLHDGAssemblyHelper(this, this, this, this, _fe_problem, _sys, _tid),
39  _source(getFunctor<Real>("source")),
40  _qrule_face(_assembly.qRuleFace()),
41  _q_point_face(_assembly.qPointsFace()),
42  _JxW_face(_assembly.JxWFace()),
43  _normals(_assembly.normals())
44 {
45 }
46 
47 void
49 {
50  // This check must occur after FEProblemBase::init()
51  checkCoupling();
52 }
53 
54 void
56 {
59 
60  // qu and u
63 
66 }
67 
68 void
70 {
74 
75  // qu, u, lm_u
79 
83 }
84 
85 void
87 {
91 
92  // qu and u
95 
100  addJacobian(
102 }
103 
104 void
106 {
114 
115  // qu, u, lm_u
120 
121  addJacobian(
123  addJacobian(
126  addJacobian(
128  addJacobian(
130  addJacobian(
132  addJacobian(
134 }
135 
136 void
138 {
139  _cached_elem = nullptr;
140 }
141 
142 void
144 {
146  {
147  computeJacobian();
149  }
150 }
151 
152 std::set<std::string>
154 {
155  return {_grad_u_var.name(), _u_face_var.name()};
156 }
const std::vector< dof_id_type > & _lm_u_dof_indices
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
const MooseArray< Number > & _u_sol
A kernel for hybridized finite element formulations.
Definition: HDGKernel.h:17
static InputParameters validParams()
void vectorVolumeJacobian(const MooseArray< Real > &JxW, const libMesh::QBase &qrule, DenseMatrix< Number > &vector_vector_jac, DenseMatrix< Number > &vector_scalar_jac)
Computes a local Jacobian matrix for the weak form: (q, v) + (u, div(v)) where q is the vector field ...
virtual void computeResidual() override
Compute this Kernel&#39;s contribution to the residual.
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 MooseArray< Real > & _JxW
The current quadrature point weight value.
Definition: KernelBase.h:52
const Elem * _cached_elem
A data member used for determining when to compute the Jacobian.
const MooseArray< Point > & _normals
face normals
virtual void computeJacobian() override
Compute this object&#39;s entire Jacobian, both on- and off-diagonal.
void resize(const unsigned int n)
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.
virtual void computeResidualOnSide() override
const std::string & name() const override
Get the variable name.
const MooseArray< libMesh::Gradient > & _qu_sol
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Moose::Functor< Real > & _source
optional source
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Implements the diffusion equation for a hybridized discretization.
virtual void jacobianSetup() override
Gets called just before the Jacobian is computed and before this object is asked to do its job...
const std::vector< dof_id_type > & _qu_dof_indices
virtual void computeOffDiagJacobian(unsigned int jvar) override
Forwards to computeJacobian() the first time this is called for a given element.
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.
virtual std::set< std::string > additionalROVariables() override
void vectorVolumeResidual(const MooseArray< Gradient > &vector_sol, const MooseArray< Number > &scalar_sol, const MooseArray< Real > &JxW, const libMesh::QBase &qrule, DenseVector< Number > &vector_re)
Computes a local residual vector for the weak form: (q, v) + (u, div(v)) where q is the vector field ...
static InputParameters validParams()
Implements all the methods for assembling a hybridized local discontinuous Galerkin (LDG-H)...
const QBase *const & _qrule
active quadrature rule
Definition: KernelBase.h:49
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 computeJacobianOnSide() override
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...
registerMooseObject("MooseApp", DiffusionLHDGKernel)
void scalarVolumeResidual(const MooseArray< Gradient > &vector_field, const Moose::Functor< Real > &source, const MooseArray< Real > &JxW, const libMesh::QBase &qrule, const Elem *const current_elem, const MooseArray< Point > &q_point, DenseVector< Number > &scalar_re)
Computes a local residual vector for the weak form: (Dq, grad(w)) - (f, w) where D is 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 MooseVariableFE< Real > & _u_face_var
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseVariableFE< Real > & _u_var
const MooseArray< Number > & _lm_u_sol
void resize(const unsigned int new_m, const unsigned int new_n)
const MooseArray< Real > & _JxW_face
transformed Jacobian weights on the current element face
void scalarVolumeJacobian(const MooseArray< Real > &JxW, const libMesh::QBase &qrule, DenseMatrix< Number > &scalar_vector_jac)
Computes a local Jacobian matrix for the weak form: (Dq, grad(w)) - (f, w) where D is the diffusivity...
const Elem *const & _current_elem
Current element.
Definition: KernelBase.h:37
const MooseVariableFE< RealVectorValue > & _grad_u_var
static InputParameters validParams()
Definition: HDGKernel.C:14
DiffusionLHDGKernel(const InputParameters &params)
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...
const QBase *const & _qrule_face
The face quadrature rule.
const MooseArray< Point > & _q_point
The physical location of the element&#39;s quadrature Points, indexed by _qp.
Definition: KernelBase.h:46
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.