25 params.addRequiredParam<NonlinearVariableName>(
26 "gradient_variable",
"The gradient of the diffusing specie concentration");
27 params.addRequiredParam<NonlinearVariableName>(
28 "face_variable",
"The concentration of the diffusing specie on faces");
29 params.addRequiredParam<MaterialPropertyName>(
"diffusivity",
"The diffusivity");
30 params.addParam<
Real>(
"tau",
32 "The stabilization coefficient required for discontinuous Galerkin " 33 "schemes. This may be set to 0 for a mixed method with Raviart-Thomas.");
46 _u_var(sys.getFieldVariable<
Real>(tid, moose_obj->getParam<NonlinearVariableName>(
"variable"))),
48 tid, moose_obj->getParam<NonlinearVariableName>(
"gradient_variable"))),
49 _u_face_var(sys.getFieldVariable<
Real>(
50 tid, moose_obj->getParam<NonlinearVariableName>(
"face_variable"))),
51 _qu_dof_indices(_grad_u_var.dofIndices()),
52 _u_dof_indices(_u_var.dofIndices()),
53 _lm_u_dof_indices(_u_face_var.dofIndices()),
54 _qu_sol(_grad_u_var.sln()),
56 _lm_u_sol(_u_face_var.sln()),
57 _vector_phi(_grad_u_var.phi()),
58 _scalar_phi(_u_var.phi()),
59 _grad_scalar_phi(_u_var.gradPhi()),
60 _div_vector_phi(_grad_u_var.divPhi()),
61 _vector_phi_face(_grad_u_var.phiFace()),
62 _scalar_phi_face(_u_var.phiFace()),
63 _lm_phi_face(_u_face_var.phiFace()),
64 _diff(mpi->getMaterialProperty<
Real>(
"diffusivity")),
66 _tau(moose_obj->getParam<
Real>(
"tau")),
67 _cached_elem(nullptr),
68 _moose_obj(*moose_obj),
69 _dhah_fe_problem(fe_problem),
87 if ((*cm)(i, j) !=
true)
95 "This class encodes the full Jacobian regardless of user input file specification, " 96 "so please request full coupling for system ",
98 " in your Preconditioning block for consistency");
110 const auto vector_qp_term = JxW[qp] * vector_sol[qp];
111 const auto scalar_qp_term = JxW[qp] * scalar_sol[qp];
115 vector_re(i) +=
_vector_phi[i][qp] * vector_qp_term;
130 for (
const auto i :
make_range(vector_vector_jac.
m()))
133 const auto vector_qpi_term = JxW[qp] *
_vector_phi[i][qp];
134 for (
const auto j :
make_range(vector_vector_jac.
n()))
135 vector_vector_jac(i, j) += vector_qpi_term *
_vector_phi[j][qp];
139 for (
const auto j :
make_range(vector_scalar_jac.
n()))
140 vector_scalar_jac(i, j) += scalar_qpi_term *
_scalar_phi[j][qp];
149 const Elem *
const current_elem,
155 const auto vector_qp_term = JxW[qp] *
_diff[qp] * vector_field[qp];
159 const auto source_qp_term = JxW[qp] * f;
166 scalar_re(i) -=
_scalar_phi[i][qp] * source_qp_term;
178 const auto qp_term = JxW[qp] *
_diff[qp];
179 for (
const auto i :
make_range(scalar_vector_jac.
m()))
183 for (
const auto j :
make_range(scalar_vector_jac.
n()))
184 scalar_vector_jac(i, j) += qpi_term *
_vector_phi[j][qp];
192 const QBase & qrule_face,
199 const auto qp_term = JxW_face[qp] * lm_sol[qp] * normals[qp];
207 const QBase & qrule_face,
213 const auto qp_term = JxW_face[qp] * normals[qp];
229 const QBase & qrule_face,
236 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * (vector_sol[qp] * normals[qp]);
238 const auto stab_qp_term = JxW_face[qp] *
_tau * (normals[qp] * normals[qp]);
240 const auto scalar_qp_term = stab_qp_term * scalar_sol[qp];
242 const auto lm_qp_term = stab_qp_term * lm_sol[qp];
244 scalar_re(i) +=
_scalar_phi_face[i][qp] * (scalar_qp_term - vector_qp_term - lm_qp_term);
250 const QBase & qrule_face,
258 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * normals[qp];
259 const auto stab_qp_term = JxW_face[qp] *
_tau * normals[qp] * normals[qp];
261 for (
const auto i :
make_range(scalar_vector_jac.
m()))
264 for (
const auto j :
make_range(scalar_vector_jac.
n()))
268 for (
const auto j :
make_range(scalar_scalar_jac.
n()))
271 scalar_lm_jac(i, j) -= scalar_qpi_term *
_lm_phi_face[j][qp];
281 const QBase & qrule_face,
288 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * (vector_sol[qp] * normals[qp]);
290 const auto stab_qp_term = JxW_face[qp] *
_tau * (normals[qp] * normals[qp]);
292 const auto scalar_qp_term = stab_qp_term * scalar_sol[qp];
294 const auto lm_qp_term = stab_qp_term * lm_sol[qp];
296 lm_re(i) +=
_lm_phi_face[i][qp] * (scalar_qp_term - vector_qp_term - lm_qp_term);
302 const QBase & qrule_face,
310 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * normals[qp];
311 const auto stab_qp_term = JxW_face[qp] *
_tau * normals[qp] * normals[qp];
315 const auto vector_qpi_term = vector_qp_term *
_lm_phi_face[i][qp];
319 const auto lm_qpi_term = stab_qp_term *
_lm_phi_face[i][qp];
331 const QBase & qrule_face,
333 const Elem *
const current_elem,
334 const unsigned int current_side,
340 const auto scalar_value = dirichlet_value(
343 const auto qp_term = JxW_face[qp] * normals[qp] * scalar_value;
356 const QBase & qrule_face,
358 const Elem *
const current_elem,
359 const unsigned int current_side,
365 const auto scalar_value = dirichlet_value(
368 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * (vector_sol[qp] * normals[qp]);
369 const auto stab_qp_term = JxW_face[qp] *
_tau * normals[qp] * normals[qp];
370 const auto scalar_qp_term = stab_qp_term * scalar_sol[qp];
371 const auto lm_qp_term = stab_qp_term * scalar_value;
374 scalar_re(i) += (scalar_qp_term - vector_qp_term - lm_qp_term) *
_scalar_phi_face[i][qp];
380 const QBase & qrule_face,
387 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * normals[qp];
388 const auto scalar_qp_term = JxW_face[qp] *
_tau * normals[qp] * normals[qp];
411 const auto qp_term = JxW[qp] * sol[qp];
413 re(i) -= phi[i][qp] * qp_term;
426 const auto qpi_term = JxW[qp] * phi[i][qp];
428 ke(i, j) -= phi[j][qp] * qpi_term;
const FEProblemBase & _dhah_fe_problem
A reference to the finite element problem used for coupling checks.
const MooseArray< std::vector< Real > > & _scalar_phi_face
const MooseArray< std::vector< Real > > & _scalar_phi
void scalarDirichletResidual(const MooseArray< Gradient > &vector_sol, const MooseArray< Number > &scalar_sol, 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 > &scalar_re)
Weakly imposes a Dirichlet condition for the scalar field in the scalar field equation.
const MooseArray< std::vector< Real > > & _div_vector_phi
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 ...
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< std::vector< Real > > & _lm_phi_face
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
This is a wrapper that forwards calls to the implementation, which can be switched out at any time wi...
const MooseArray< std::vector< RealVectorValue > > & _grad_scalar_phi
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
An interface for accessing Moose::Functors for systems that care about automatic differentiation, e.g.
const libMesh::CouplingMatrix * couplingMatrix(const unsigned int nl_sys_num) const override
The coupling matrix defining what blocks exist in the preconditioning matrix.
const std::vector< dof_id_type > & _qu_dof_indices
virtual const std::string & name() const
Interface for objects that needs transient capabilities.
const SystemBase & _dhah_sys
A reference to the nonlinear system used for coupling checks.
void scalarDirichletJacobian(const MooseArray< Real > &JxW_face, const libMesh::QBase &qrule_face, const MooseArray< Point > &normals, DenseMatrix< Number > &scalar_vector_jac, DenseMatrix< Number > &scalar_scalar_jac)
Computes the Jacobian for a Dirichlet condition for the scalar field in the scalar field equation...
Every object that can be built by the factory should be derived from this class.
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()
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...
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...
unsigned int n_points() const
Argument for requesting functor evaluation at a quadrature point location in an element.
Moose::CouplingType coupling() const
unsigned int number() const
Gets the number of this system.
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)
Weakly imposes a Dirichlet condition for the scalar field in the vector (gradient) equation...
const MaterialProperty< Real > & _diff
The diffusivity.
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...
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 TransientInterface & _ti
Reference to transient interface.
const MooseVariableFE< Real > & _u_face_var
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _tau
Our stabilization coefficient.
An interface for accessing Materials.
const MooseObject & _moose_obj
A reference to our associated MooseObject for error reporting.
void createIdentityResidual(const MooseArray< Real > &JxW, const libMesh::QBase &qrule, const MooseArray< std::vector< Real >> &phi, const MooseArray< Number > &sol, DenseVector< Number > &re)
Creates residuals corresponding to the weak form (v, {u}), or stated simply this routine can be used ...
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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 MooseArray< std::vector< RealVectorValue > > & _vector_phi
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...
void createIdentityJacobian(const MooseArray< Real > &JxW, const libMesh::QBase &qrule, const MooseArray< std::vector< Real >> &phi, DenseMatrix< Number > &ke)
As above, but for the Jacobians.
const MooseArray< std::vector< RealVectorValue > > & _vector_phi_face
DiffusionLHDGAssemblyHelper(const MooseObject *const moose_obj, MaterialPropertyInterface *const mpi, MooseVariableDependencyInterface *const mvdi, const TransientInterface *const ti, const FEProblemBase &fe_problem, SystemBase &sys, const THREAD_ID tid)
auto index_range(const T &sizable)
Argument for requesting functor evaluation at quadrature point locations on an element side...