23 params.addRequiredParam<NonlinearVariableName>(
24 "gradient_variable",
"The gradient of the diffusing specie concentration");
25 params.addRequiredParam<NonlinearVariableName>(
26 "face_variable",
"The concentration of the diffusing specie on faces");
27 params.addRequiredParam<MaterialPropertyName>(
"diffusivity",
"The diffusivity");
28 params.addParam<Real>(
"tau",
30 "The stabilization coefficient required for discontinuous Galerkin "
31 "schemes. This may be set to 0 for a mixed method with Raviart-Thomas.");
44 _u_var(sys.getFieldVariable<Real>(tid, moose_obj->getParam<NonlinearVariableName>(
"variable"))),
45 _grad_u_var(sys.getFieldVariable<RealVectorValue>(
46 tid, moose_obj->getParam<NonlinearVariableName>(
"gradient_variable"))),
47 _u_face_var(sys.getFieldVariable<Real>(
48 tid, moose_obj->getParam<NonlinearVariableName>(
"face_variable"))),
49 _qu_dof_indices(_grad_u_var.dofIndices()),
50 _u_dof_indices(_u_var.dofIndices()),
51 _lm_u_dof_indices(_u_face_var.dofIndices()),
52 _qu_sol(_grad_u_var.sln()),
54 _lm_u_sol(_u_face_var.sln()),
55 _vector_phi(_grad_u_var.phi()),
56 _scalar_phi(_u_var.phi()),
57 _grad_scalar_phi(_u_var.gradPhi()),
58 _div_vector_phi(_grad_u_var.divPhi()),
59 _vector_phi_face(_grad_u_var.phiFace()),
60 _scalar_phi_face(_u_var.phiFace()),
61 _lm_phi_face(_u_face_var.phiFace()),
62 _diff(mpi->getMaterialProperty<Real>(
"diffusivity")),
64 _tau(moose_obj->getParam<Real>(
"tau")),
65 _cached_elem(nullptr),
66 _moose_obj(*moose_obj),
67 _dhah_fe_problem(fe_problem),
83 for (
const auto i : make_range(cm->size()))
84 for (
const auto j : make_range(cm->size()))
85 if ((*cm)(i, j) !=
true)
93 "This class encodes the full Jacobian regardless of user input file specification, "
94 "so please request full coupling for system ",
96 " in your Preconditioning block for consistency");
104 DenseVector<Number> & vector_re)
106 for (
const auto qp : make_range(qrule.n_points()))
108 const auto vector_qp_term = JxW[qp] * vector_sol[qp];
109 const auto scalar_qp_term = JxW[qp] * scalar_sol[qp];
110 for (
const auto i : index_range(vector_re))
113 vector_re(i) +=
_vector_phi[i][qp] * vector_qp_term;
124 DenseMatrix<Number> & vector_vector_jac,
125 DenseMatrix<Number> & vector_scalar_jac)
127 for (
const auto qp : make_range(qrule.n_points()))
128 for (
const auto i : make_range(vector_vector_jac.m()))
131 const auto vector_qpi_term = JxW[qp] *
_vector_phi[i][qp];
132 for (
const auto j : make_range(vector_vector_jac.n()))
133 vector_vector_jac(i, j) += vector_qpi_term *
_vector_phi[j][qp];
137 for (
const auto j : make_range(vector_scalar_jac.n()))
138 vector_scalar_jac(i, j) += scalar_qpi_term *
_scalar_phi[j][qp];
147 const Elem *
const current_elem,
149 DenseVector<Number> & scalar_re)
151 for (
const auto qp : make_range(qrule.n_points()))
153 const auto vector_qp_term = JxW[qp] *
_diff[qp] * vector_field[qp];
157 const auto source_qp_term = JxW[qp] * f;
159 for (
const auto i : index_range(scalar_re))
164 scalar_re(i) -=
_scalar_phi[i][qp] * source_qp_term;
172 DenseMatrix<Number> & scalar_vector_jac)
174 for (
const auto qp : make_range(qrule.n_points()))
176 const auto qp_term = JxW[qp] *
_diff[qp];
177 for (
const auto i : make_range(scalar_vector_jac.m()))
181 for (
const auto j : make_range(scalar_vector_jac.n()))
182 scalar_vector_jac(i, j) += qpi_term *
_vector_phi[j][qp];
190 const QBase & qrule_face,
192 DenseVector<Number> & vector_re)
195 for (
const auto qp : make_range(qrule_face.n_points()))
197 const auto qp_term = JxW_face[qp] * lm_sol[qp] * normals[qp];
198 for (
const auto i : index_range(vector_re))
205 const QBase & qrule_face,
207 DenseMatrix<Number> & vector_lm_jac)
209 for (
const auto qp : make_range(qrule_face.n_points()))
211 const auto qp_term = JxW_face[qp] * normals[qp];
213 for (
const auto i : make_range(vector_lm_jac.m()))
216 for (
const auto j : make_range(vector_lm_jac.n()))
227 const QBase & qrule_face,
229 DenseVector<Number> & scalar_re)
231 for (
const auto qp : make_range(qrule_face.n_points()))
234 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * (vector_sol[qp] * normals[qp]);
236 const auto stab_qp_term = JxW_face[qp] *
_tau * (normals[qp] * normals[qp]);
238 const auto scalar_qp_term = stab_qp_term * scalar_sol[qp];
240 const auto lm_qp_term = stab_qp_term * lm_sol[qp];
241 for (
const auto i : index_range(scalar_re))
242 scalar_re(i) +=
_scalar_phi_face[i][qp] * (scalar_qp_term - vector_qp_term - lm_qp_term);
248 const QBase & qrule_face,
250 DenseMatrix<Number> & scalar_vector_jac,
251 DenseMatrix<Number> & scalar_scalar_jac,
252 DenseMatrix<Number> & scalar_lm_jac)
254 for (
const auto qp : make_range(qrule_face.n_points()))
256 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * normals[qp];
257 const auto stab_qp_term = JxW_face[qp] *
_tau * normals[qp] * normals[qp];
259 for (
const auto i : make_range(scalar_vector_jac.m()))
262 for (
const auto j : make_range(scalar_vector_jac.n()))
266 for (
const auto j : make_range(scalar_scalar_jac.n()))
268 for (
const auto j : make_range(scalar_lm_jac.n()))
269 scalar_lm_jac(i, j) -= scalar_qpi_term *
_lm_phi_face[j][qp];
279 const QBase & qrule_face,
281 DenseVector<Number> & lm_re)
283 for (
const auto qp : make_range(qrule_face.n_points()))
286 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * (vector_sol[qp] * normals[qp]);
288 const auto stab_qp_term = JxW_face[qp] *
_tau * (normals[qp] * normals[qp]);
290 const auto scalar_qp_term = stab_qp_term * scalar_sol[qp];
292 const auto lm_qp_term = stab_qp_term * lm_sol[qp];
293 for (
const auto i : index_range(lm_re))
294 lm_re(i) +=
_lm_phi_face[i][qp] * (scalar_qp_term - vector_qp_term - lm_qp_term);
300 const QBase & qrule_face,
302 DenseMatrix<Number> & lm_vec_jac,
303 DenseMatrix<Number> & lm_scalar_jac,
304 DenseMatrix<Number> & lm_lm_jac)
306 for (
const auto qp : make_range(qrule_face.n_points()))
308 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * normals[qp];
309 const auto stab_qp_term = JxW_face[qp] *
_tau * normals[qp] * normals[qp];
311 for (
const auto i : make_range(lm_vec_jac.m()))
313 const auto vector_qpi_term = vector_qp_term *
_lm_phi_face[i][qp];
314 for (
const auto j : make_range(lm_vec_jac.n()))
317 const auto lm_qpi_term = stab_qp_term *
_lm_phi_face[i][qp];
318 for (
const auto j : make_range(lm_scalar_jac.n()))
320 for (
const auto j : make_range(lm_lm_jac.n()))
329 const QBase & qrule_face,
331 const Elem *
const current_elem,
332 const unsigned int current_side,
334 DenseVector<Number> & vector_re)
336 for (
const auto qp : make_range(qrule_face.n_points()))
338 const auto scalar_value = dirichlet_value(
341 const auto qp_term = JxW_face[qp] * normals[qp] * scalar_value;
354 const QBase & qrule_face,
356 const Elem *
const current_elem,
357 const unsigned int current_side,
359 DenseVector<Number> & scalar_re)
361 for (
const auto qp : make_range(qrule_face.n_points()))
363 const auto scalar_value = dirichlet_value(
366 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * (vector_sol[qp] * normals[qp]);
367 const auto stab_qp_term = JxW_face[qp] *
_tau * normals[qp] * normals[qp];
368 const auto scalar_qp_term = stab_qp_term * scalar_sol[qp];
369 const auto lm_qp_term = stab_qp_term * scalar_value;
372 scalar_re(i) += (scalar_qp_term - vector_qp_term - lm_qp_term) *
_scalar_phi_face[i][qp];
378 const QBase & qrule_face,
380 DenseMatrix<Number> & scalar_vector_jac,
381 DenseMatrix<Number> & scalar_scalar_jac)
383 for (
const auto qp : make_range(qrule_face.n_points()))
385 const auto vector_qp_term = JxW_face[qp] *
_diff[qp] * normals[qp];
386 const auto scalar_qp_term = JxW_face[qp] *
_tau * normals[qp] * normals[qp];
405 DenseVector<Number> & re)
407 for (
const auto qp : make_range(qrule.n_points()))
409 const auto qp_term = JxW[qp] * sol[qp];
410 for (
const auto i : index_range(phi))
411 re(i) -= phi[i][qp] * qp_term;
419 DenseMatrix<Number> & ke)
421 for (
const auto qp : make_range(qrule.n_points()))
422 for (
const auto i : index_range(phi))
424 const auto qpi_term = JxW[qp] * phi[i][qp];
425 for (
const auto j : index_range(phi))
426 ke(i, j) -= phi[j][qp] * qpi_term;
An interface for accessing Moose::Functors for systems that care about automatic differentiation,...
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 ...
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.
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> + <\tau * (u - \hat{u}) * n * n,...
const std::vector< dof_id_type > & _qu_dof_indices
const MooseArray< std::vector< Real > > & _scalar_phi
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, \hat{u}), or stated simply this routine can be u...
const SystemBase & _dhah_sys
A reference to the nonlinear system used for coupling checks.
const FEProblemBase & _dhah_fe_problem
A reference to the finite element problem used for coupling checks.
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
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: -<\hat{u}, n*v> where \hat{u} is the trace of the...
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, \mu> + <\tau * (u - \hat{u}) * n * n,...
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 ...
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: -<\hat{u}, n*v> where \hat{u} is the trace of the...
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 MooseArray< std::vector< Real > > & _lm_phi_face
const MooseArray< std::vector< RealVectorValue > > & _grad_scalar_phi
const MooseArray< std::vector< Real > > & _div_vector_phi
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, \mu> + <\tau * (u - \hat{u}) * n * n,...
const MaterialProperty< Real > & _diff
The diffusivity.
const MooseObject & _moose_obj
A reference to our associated MooseObject for error reporting.
const TransientInterface & _ti
Reference to transient interface.
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 std::vector< dof_id_type > & _u_dof_indices
static InputParameters validParams()
const MooseArray< std::vector< RealVectorValue > > & _vector_phi
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 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.
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> + <\tau * (u - \hat{u}) * n * n,...
const Real _tau
Our stabilization coefficient.
const MooseVariableFE< Real > & _u_face_var
const MooseArray< std::vector< Real > > & _scalar_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)
const MooseVariableFE< RealVectorValue > & _grad_u_var
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const libMesh::CouplingMatrix * couplingMatrix(const unsigned int nl_sys_num) const override
The coupling matrix defining what blocks exist in the preconditioning matrix.
Moose::CouplingType coupling() const
An interface for accessing Materials.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Every object that can be built by the factory should be derived from this class.
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
Class for stuff related to variables.
This is a wrapper that forwards calls to the implementation, which can be switched out at any time wi...
Base class for a system (of equations)
unsigned int number() const
Gets the number of this system.
virtual const std::string & name() const
Interface for objects that needs transient capabilities.
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
Argument for requesting functor evaluation at a quadrature point location in an element.
Argument for requesting functor evaluation at quadrature point locations on an element side.