https://mooseframework.inl.gov
ElementAndTraceScalarHDGAssemblyHelper.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 "Assembly.h"
12 #include "MooseFunctor.h"
14 #include "MooseVariableFE.h"
15 #include "SystemBase.h"
16 #include "MooseObject.h"
17 #include "TaggingInterface.h"
18 #include "TransientInterface.h"
19 
20 using namespace libMesh;
21 
24 {
25  auto params = emptyInputParameters();
26  params.addRequiredParam<NonlinearVariableName>("face_variable", "The face variable");
27  return params;
28 }
29 
31  const MooseObject * const moose_obj,
33  const TransientInterface * const ti,
34  SystemBase & sys,
35  const Assembly & assembly,
36  const THREAD_ID tid,
37  const std::set<SubdomainID> & block_ids,
38  const std::set<BoundaryID> & boundary_ids)
39  : ThreeMaterialPropertyInterface(moose_obj, block_ids, boundary_ids),
40  _ti(*ti),
41  _u_var(sys.getFieldVariable<Real>(tid, moose_obj->getParam<NonlinearVariableName>("variable"))),
42  _u_face_var(sys.getFieldVariable<Real>(
43  tid, moose_obj->getParam<NonlinearVariableName>("face_variable"))),
44  _u_dof_indices(_u_var.dofIndices()),
45  _lm_u_dof_indices(_u_face_var.dofIndices()),
46  _u_sol(_u_var.adSln()),
47  _lm_u_sol(_u_face_var.adSln()),
48  _scalar_phi(_u_var.phi()),
49  _grad_scalar_phi(_u_var.gradPhi()),
50  _scalar_phi_face(_u_var.phiFace()),
51  _lm_phi_face(_u_face_var.phiFace()),
52  _elem_volume(assembly.elemVolume()),
53  _side_area(assembly.sideElemVolume()),
54  _current_elem(assembly.elem()),
55  _current_side(assembly.side()),
56  _current_side_elem(assembly.sideElem()),
57  _JxW(assembly.JxW()),
58  _qrule(assembly.qRule()),
59  _q_point(assembly.qPoints()),
60  _JxW_face(assembly.JxWFace()),
61  _qrule_face(assembly.qRuleFace()),
62  _q_point_face(assembly.qPointsFace()),
63  _normals(assembly.normals())
64 {
67 }
68 
69 std::array<ADResidualsPacket, 2>
71 {
74 }
75 
76 std::set<std::string>
78 {
79  return {_u_face_var.name()};
80 }
81 
82 void
84 {
85  for (const auto qp : make_range(_qrule_face->n_points()))
86  {
87  const auto scalar_value = dirichlet_value(
90 
91  for (const auto i : index_range(_lm_re))
92  _lm_re(i) += _JxW_face[qp] * (_lm_u_sol[qp] - scalar_value) * _lm_phi_face[i][qp];
93  }
94 }
95 
96 void
98 {
99  for (const auto qp : make_range(_qrule_face->n_points()))
100  {
101  const auto flux = flux_value(
103  _ti.determineState());
104 
105  for (const auto i : index_range(_lm_re))
106  _lm_re(i) += _JxW_face[qp] * flux * _lm_phi_face[i][qp];
107  }
108 }
const MooseVariableFE< Real > & _u_face_var
Facet trace variable.
const MooseArray< std::vector< Real > > & _lm_phi_face
Facet trace test functions evaluated on a face.
void lmPrescribedFlux(const Moose::Functor< Real > &flux_value)
Applies a prescribed flux in the facet equation.
Keeps track of stuff related to assembling.
Definition: Assembly.h:109
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< Real > & _JxW_face
Face quadrature weights including the transformed Jacobian.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const MooseArray< ADReal > & _lm_u_sol
Facet trace values at face quadrature points.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
Definition: SystemBase.h:85
InputParameters emptyInputParameters()
Interface for objects that needs transient capabilities.
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:103
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
ElementAndTraceScalarHDGAssemblyHelper(const MooseObject *moose_obj, MooseVariableDependencyInterface *mvdi, const TransientInterface *ti, SystemBase &sys, const Assembly &assembly, THREAD_ID tid, const std::set< SubdomainID > &blocks_ids, const std::set< BoundaryID > &boundary_ids)
const MooseVariableFE< Real > & _u_var
Element-interior scalar variable.
unsigned int n_points() const
Utility structure for packaging up all of the residual object&#39;s information needed to add into the sy...
This interface is designed currently for DomainUserObject where material properties on element...
const MooseArray< Point > & _q_point_face
Physical face quadrature points.
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
std::array< ADResidualsPacket, 2 > taggingData() const
const unsigned int & _current_side
Current element-side index.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
DenseVector< ADReal > _scalar_re
Residual for the element-interior scalar equation.
void lmDirichlet(const Moose::Functor< Real > &dirichlet_value)
Enforces a Dirichlet value in the facet equation.
IntRange< T > make_range(T beg, T end)
const std::vector< dof_id_type > & _lm_u_dof_indices
Degree-of-freedom indices for the facet trace.
const TransientInterface & _ti
Transient state used to evaluate boundary functors.
const libMesh::QBase *const & _qrule_face
Face quadrature rule.
auto index_range(const T &sizable)
Argument for requesting functor evaluation at quadrature point locations on an element side...
const std::vector< dof_id_type > & _u_dof_indices
Degree-of-freedom indices for the element-interior scalar.
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.
unsigned int THREAD_ID
Definition: MooseTypes.h:237
DenseVector< ADReal > _lm_re
Residual for the facet trace equation.