https://mooseframework.inl.gov
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
TaggingInterface Class Reference

#include <TaggingInterface.h>

Inheritance diagram for TaggingInterface:
[legend]

Classes

class  MatrixTagsKey
 Class that is used as a parameter to some of our matrix tag APIs that allows only blessed framework classes to call them. More...
 
class  VectorTagsKey
 Class that is used as a parameter to some of our vector tag APIs that allows only blessed framework classes to call them. More...
 

Public Types

enum  ResidualTagType { ResidualTagType::NonReference, ResidualTagType::Reference }
 Enumerate whether a (residual) vector tag is to be of a non-reference or reference tag type. More...
 

Public Member Functions

 TaggingInterface (const MooseObject *moose_object)
 
 TaggingInterface (const TaggingInterface &object, const Moose::Kokkos::FunctorCopy &key)
 Special constructor used for Kokkos functor copy during parallel dispatch. More...
 
virtual ~TaggingInterface ()
 
void useVectorTag (const TagName &tag_name, VectorTagsKey)
 
void useMatrixTag (const TagName &tag_name, MatrixTagsKey)
 
void useVectorTag (TagID tag_id, VectorTagsKey)
 
void useMatrixTag (TagID tag_id, MatrixTagsKey)
 
bool isVectorTagged ()
 
bool isMatrixTagged ()
 
bool hasVectorTags () const
 
const std::set< TagID > & getVectorTags (VectorTagsKey) const
 
const std::set< TagID > & getMatrixTags (MatrixTagsKey) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

void prepareVectorTag (Assembly &assembly, unsigned int ivar)
 Prepare data for computing element residual according to active tags. More...
 
void prepareVectorTag (Assembly &assembly, unsigned int ivar, ResidualTagType tag_type)
 Prepare vector tags in a reference residual problem context. More...
 
void prepareVectorTagNeighbor (Assembly &assembly, unsigned int ivar)
 Prepare data for computing element residual the according to active tags for DG and interface kernels. More...
 
void prepareVectorTagLower (Assembly &assembly, unsigned int ivar)
 Prepare data for computing the residual according to active tags for mortar constraints. More...
 
void prepareMatrixTag (Assembly &assembly, unsigned int ivar, unsigned int jvar)
 Prepare data for computing element jacobian according to the active tags. More...
 
void prepareMatrixTag (Assembly &assembly, unsigned int ivar, unsigned int jvar, DenseMatrix< Number > &k) const
 
void prepareMatrixTagNonlocal (Assembly &assembly, unsigned int ivar, unsigned int jvar)
 Prepare data for computing nonlocal element jacobian according to the active tags. More...
 
void prepareMatrixTagNeighbor (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::DGJacobianType type)
 Prepare data for computing element jacobian according to the active tags for DG and interface kernels. More...
 
void prepareMatrixTagNeighbor (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::DGJacobianType type, DenseMatrix< Number > &k) const
 
void prepareMatrixTagLower (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::ConstraintJacobianType type)
 Prepare data for computing the jacobian according to the active tags for mortar. More...
 
void accumulateTaggedLocalResidual ()
 Local residual blocks will be appended by adding the current local kernel residual. More...
 
void assignTaggedLocalResidual ()
 Local residual blocks will assigned as the current local kernel residual. More...
 
void accumulateTaggedLocalMatrix ()
 Local Jacobian blocks will be appended by adding the current local kernel Jacobian. More...
 
void accumulateTaggedLocalMatrix (Assembly &assembly, unsigned int ivar, unsigned int jvar, const DenseMatrix< Number > &k)
 
void accumulateTaggedLocalMatrix (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::DGJacobianType type, const DenseMatrix< Number > &k)
 
void accumulateTaggedNonlocalMatrix ()
 Nonlocal Jacobian blocks will be appended by adding the current nonlocal kernel Jacobian. More...
 
void assignTaggedLocalMatrix ()
 Local Jacobian blocks will assigned as the current local kernel Jacobian. More...
 
template<typename Residuals , typename Indices >
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. More...
 
template<typename Residuals , typename Indices >
void addResiduals (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, const std::vector< Real > &scaling_factors)
 
template<typename T , typename Indices >
void addResiduals (Assembly &assembly, const DenseVector< T > &residuals, const Indices &dof_indices, Real scaling_factor)
 Add the provided incoming residuals corresponding to the provided dof indices. More...
 
template<typename Residuals , typename Indices >
void addResidualsAndJacobian (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided dof indices. More...
 
template<typename Residuals , typename Indices >
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. More...
 
template<typename Residuals , typename Indices >
void addJacobian (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, const std::vector< Real > &scaling_factors)
 Add the provided residual derivatives into the Jacobian for the provided dof indices. More...
 
void addResiduals (Assembly &assembly, const ADResidualsPacket &packet)
 Add the provided incoming residuals corresponding to the provided dof indices. More...
 
void addResidualsAndJacobian (Assembly &assembly, const ADResidualsPacket &packet)
 Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided dof indices. More...
 
void addJacobian (Assembly &assembly, const ADResidualsPacket &packet)
 Add the provided residual derivatives into the Jacobian for the provided dof indices. More...
 
template<typename Residuals , typename Indices >
void addResidualsWithoutConstraints (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 Add the provided incoming residuals corresponding to the provided dof indices. More...
 
template<typename Residuals , typename Indices >
void addResidualsAndJacobianWithoutConstraints (Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
 Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided dof indices. More...
 
template<typename Residuals , typename Indices >
void addJacobianWithoutConstraints (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. More...
 
void addJacobianElement (Assembly &assembly, Real value, dof_id_type row_index, dof_id_type column_index, Real scaling_factor)
 Add into a single Jacobian element. More...
 
void addJacobian (Assembly &assembly, DenseMatrix< Real > &local_k, const std::vector< dof_id_type > &row_indices, const std::vector< dof_id_type > &column_indices, Real scaling_factor)
 Add a local Jacobian matrix. More...
 
template<typename T >
void setResidual (SystemBase &sys, const T &residual, MooseVariableFE< T > &var)
 Set residual using the variables' insertion API. More...
 
void setResidual (SystemBase &sys, Real residual, dof_id_type dof_index)
 Set residual at a specified degree of freedom index. More...
 
template<typename SetResidualFunctor >
void setResidual (SystemBase &sys, SetResidualFunctor set_residual_functor)
 Set residuals using the provided functor. More...
 

Protected Attributes

SubProblem_subproblem
 SubProblem that contains tag info. More...
 
DenseVector< Number_local_re
 Holds local residual entries as they are accumulated by this Kernel. More...
 
DenseMatrix< Number_local_ke
 Holds local Jacobian entries as they are accumulated by this Kernel. More...
 
DenseMatrix< Number_nonlocal_ke
 Holds nonlocal Jacobian entries as they are accumulated by this Kernel. More...
 

Private Member Functions

void prepareVectorTagInternal (Assembly &assembly, unsigned int ivar, const std::set< TagID > &vector_tags, const std::set< TagID > &absolute_value_vector_tags)
 Prepare data for computing element residual according to the specified tags Residual blocks for different tags will be extracted from Assembly. More...
 
void checkForNans () const
 Checks _local_re for NaNs/Infs and returns an error if found. More...
 

Private Attributes

std::set< TagID_vector_tags
 The vector tag ids this Kernel will contribute to. More...
 
std::set< TagID_abs_vector_tags
 The absolute value residual tag ids. More...
 
std::set< TagID_matrix_tags
 The matrices this Kernel will contribute to. More...
 
std::set< TagID_non_ref_vector_tags
 A set to hold vector tags excluding the reference residual tag. More...
 
std::set< TagID_non_ref_abs_vector_tags
 A set to hold absolute value vector tags excluding the reference residual tag. More...
 
std::set< TagID_ref_vector_tags
 A set of either size 1 or 0. More...
 
std::set< TagID_ref_abs_vector_tags
 A set of either size 1 or 0. More...
 
const MooseObject_moose_object
 Moose objct this tag works on. More...
 
const InputParameters_tag_params
 Parameters from moose object. More...
 
std::vector< DenseVector< Number > * > _re_blocks
 Residual blocks Vectors For each Tag. More...
 
std::vector< DenseVector< Number > * > _absre_blocks
 Residual blocks for absolute value residual tags. More...
 
std::vector< DenseMatrix< Number > * > _ke_blocks
 Kernel blocks Vectors For each Tag. More...
 
std::vector< Real_absolute_residuals
 A container to hold absolute values of residuals passed into addResiduals. More...
 

Friends

class NonlinearSystemBase
 

Detailed Description

Definition at line 56 of file TaggingInterface.h.

Member Enumeration Documentation

◆ ResidualTagType

Enumerate whether a (residual) vector tag is to be of a non-reference or reference tag type.

Enumerator
NonReference 
Reference 

Definition at line 115 of file TaggingInterface.h.

116  {
117  NonReference,
118  Reference
119  };

Constructor & Destructor Documentation

◆ TaggingInterface() [1/2]

TaggingInterface::TaggingInterface ( const MooseObject moose_object)

Definition at line 56 of file TaggingInterface.C.

57  : _subproblem(*moose_object->parameters().getCheckedPointerParam<SubProblem *>("_subproblem")),
58  _moose_object(*moose_object),
60 {
61  auto & vector_tag_names = _tag_params.get<MultiMooseEnum>("vector_tags");
62 
63  if (!vector_tag_names.isValid())
64  {
65  if (!_tag_params.get<bool>("matrix_only"))
66  mooseError("MUST provide at least one vector_tag for Kernel: ", _moose_object.name());
67  }
68  else
69  {
70  for (auto & vector_tag_name : vector_tag_names)
71  {
72  const TagID vector_tag_id = _subproblem.getVectorTagID(vector_tag_name.name());
74  mooseError("Vector tag '",
75  vector_tag_name.name(),
76  "' for Kernel '",
78  "' is not a residual vector tag");
79  _vector_tags.insert(vector_tag_id);
80  }
81  }
82 
83  // Add extra vector tags. These tags should be created in the System already, otherwise
84  // we can not add the extra tags
85  auto & extra_vector_tags = _tag_params.get<std::vector<TagName>>("extra_vector_tags");
86 
87  for (auto & vector_tag_name : extra_vector_tags)
88  {
89  const TagID vector_tag_id = _subproblem.getVectorTagID(vector_tag_name);
91  mooseError("Extra vector tag '",
92  vector_tag_name,
93  "' for Kernel '",
95  "' is not a residual vector tag");
96  _vector_tags.insert(vector_tag_id);
97  }
98 
99  // Add absolue value vector tags. These tags should be created in the System already, otherwise
100  // we can not add the extra tags
101  auto & abs_vector_tags = _tag_params.get<std::vector<TagName>>("absolute_value_vector_tags");
102 
103  for (auto & vector_tag_name : abs_vector_tags)
104  {
105  const TagID vector_tag_id = _subproblem.getVectorTagID(vector_tag_name);
107  mooseError("Absolute value vector tag '",
108  vector_tag_name,
109  "' for Kernel '",
111  "' is not a residual vector tag");
112  _abs_vector_tags.insert(vector_tag_id);
113  }
114 
115  auto & matrix_tag_names = _tag_params.get<MultiMooseEnum>("matrix_tags");
116 
117  if (matrix_tag_names.isValid())
118  for (auto & matrix_tag_name : matrix_tag_names)
119  _matrix_tags.insert(_subproblem.getMatrixTagID(matrix_tag_name.name()));
120 
121  auto & extra_matrix_tags = _tag_params.get<std::vector<TagName>>("extra_matrix_tags");
122 
123  for (auto & matrix_tag_name : extra_matrix_tags)
124  _matrix_tags.insert(_subproblem.getMatrixTagID(matrix_tag_name));
125 
126  _re_blocks.resize(_vector_tags.size());
127  _absre_blocks.resize(_abs_vector_tags.size());
128  _ke_blocks.resize(_matrix_tags.size());
129 
130  const auto * const fe_problem =
131  moose_object->parameters().getCheckedPointerParam<FEProblemBase *>("_fe_problem_base");
132 
133  for (const auto & conv : fe_problem->getConvergenceObjects())
134  {
135  const auto * const ref_conv = dynamic_cast<const ReferenceResidualConvergence *>(conv.get());
136  if (ref_conv)
137  {
138  const auto reference_tag = ref_conv->referenceVectorTagID({});
139  auto create_tags_split =
140  [reference_tag](const auto & tags, auto & non_ref_tags, auto & ref_tags)
141  {
142  for (const auto tag : tags)
143  if (tag == reference_tag)
144  ref_tags.insert(tag);
145  else
146  non_ref_tags.insert(tag);
147  };
150  }
151  else
152  {
155  }
156  }
157 }
virtual TagID getVectorTagID(const TagName &tag_name) const
Get a TagID from a TagName.
Definition: SubProblem.C:204
std::set< TagID > _ref_abs_vector_tags
A set of either size 1 or 0.
SubProblem & _subproblem
SubProblem that contains tag info.
const InputParameters & _tag_params
Parameters from moose object.
unsigned int TagID
Definition: MooseTypes.h:238
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
std::vector< DenseVector< Number > * > _absre_blocks
Residual blocks for absolute value residual tags.
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
std::set< TagID > _ref_vector_tags
A set of either size 1 or 0.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
std::set< TagID > _abs_vector_tags
The absolute value residual tag ids.
std::set< TagID > _non_ref_abs_vector_tags
A set to hold absolute value vector tags excluding the reference residual tag.
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:103
virtual TagID getMatrixTagID(const TagName &tag_name) const
Get a TagID from a TagName.
Definition: SubProblem.C:343
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
virtual Moose::VectorTagType vectorTagType(const TagID tag_id) const
Definition: SubProblem.C:232
TagID referenceVectorTagID(ReferenceVectorTagIDKey) const
Returns the tag ID associated with the reference vector tag ID key.
std::set< TagID > _non_ref_vector_tags
A set to hold vector tags excluding the reference residual tag.
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
Uses a reference residual to define relative convergence criteria.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
const MooseObject & _moose_object
Moose objct this tag works on.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.

◆ TaggingInterface() [2/2]

TaggingInterface::TaggingInterface ( const TaggingInterface object,
const Moose::Kokkos::FunctorCopy key 
)

Special constructor used for Kokkos functor copy during parallel dispatch.

Definition at line 160 of file TaggingInterface.C.

162  : _subproblem(object._subproblem),
164  _tag_params(object._tag_params)
165 {
166 }
SubProblem & _subproblem
SubProblem that contains tag info.
const InputParameters & _tag_params
Parameters from moose object.
const MooseObject & _moose_object
Moose objct this tag works on.

◆ ~TaggingInterface()

TaggingInterface::~TaggingInterface ( )
virtual

Definition at line 504 of file TaggingInterface.C.

504 {}

Member Function Documentation

◆ accumulateTaggedLocalMatrix() [1/3]

void TaggingInterface::accumulateTaggedLocalMatrix ( )
protected

Local Jacobian blocks will be appended by adding the current local kernel Jacobian.

It should be called after the local element matrix has been computed.

Definition at line 407 of file TaggingInterface.C.

Referenced by DGKernel::computeElemNeighJacobian(), ElemElemConstraint::computeElemNeighJacobian(), ArrayDGKernel::computeElemNeighJacobian(), MassLumpedTimeDerivative::computeJacobian(), TimeDerivative::computeJacobian(), VectorTimeDerivative::computeJacobian(), ScalarKernel::computeJacobian(), Kernel::computeJacobian(), ODEKernel::computeJacobian(), VectorKernel::computeJacobian(), ArrayKernel::computeJacobian(), IntegratedBC::computeJacobian(), VectorIntegratedBC::computeJacobian(), EigenKernel::computeJacobian(), ArrayIntegratedBC::computeJacobian(), NodeElemConstraint::computeJacobian(), NonlocalIntegratedBC::computeJacobian(), KernelGrad::computeJacobian(), KernelValue::computeJacobian(), NonlocalKernel::computeJacobian(), MortarConstraint::computeJacobian(), NodeFaceConstraint::computeJacobian(), LowerDIntegratedBC::computeLowerDJacobian(), ArrayLowerDIntegratedBC::computeLowerDJacobian(), DGLowerDKernel::computeLowerDJacobian(), ArrayDGLowerDKernel::computeLowerDJacobian(), LowerDIntegratedBC::computeLowerDOffDiagJacobian(), ArrayLowerDIntegratedBC::computeLowerDOffDiagJacobian(), DGKernel::computeOffDiagElemNeighJacobian(), ArrayDGKernel::computeOffDiagElemNeighJacobian(), VectorKernel::computeOffDiagJacobian(), Kernel::computeOffDiagJacobian(), EigenKernel::computeOffDiagJacobian(), ArrayKernel::computeOffDiagJacobian(), IntegratedBC::computeOffDiagJacobian(), VectorIntegratedBC::computeOffDiagJacobian(), ArrayIntegratedBC::computeOffDiagJacobian(), NodeElemConstraint::computeOffDiagJacobian(), NonlocalIntegratedBC::computeOffDiagJacobian(), NonlocalKernel::computeOffDiagJacobian(), KernelGrad::computeOffDiagJacobian(), KernelValue::computeOffDiagJacobian(), NodeFaceConstraint::computeOffDiagJacobian(), ODEKernel::computeOffDiagJacobianScalar(), VectorKernel::computeOffDiagJacobianScalar(), ArrayKernel::computeOffDiagJacobianScalar(), VectorIntegratedBC::computeOffDiagJacobianScalar(), IntegratedBC::computeOffDiagJacobianScalar(), Kernel::computeOffDiagJacobianScalar(), ArrayIntegratedBC::computeOffDiagJacobianScalar(), ScalarLagrangeMultiplier::computeOffDiagJacobianScalar(), DGLowerDKernel::computeOffDiagLowerDJacobian(), and ArrayDGLowerDKernel::computeOffDiagLowerDJacobian().

408 {
409  for (auto & ke : _ke_blocks)
410  *ke += _local_ke;
411 }
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.

◆ accumulateTaggedLocalMatrix() [2/3]

void TaggingInterface::accumulateTaggedLocalMatrix ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar,
const DenseMatrix< Number > &  k 
)
protected

Definition at line 414 of file TaggingInterface.C.

418 {
419  _ke_blocks.resize(_matrix_tags.size());
420  mooseAssert(_matrix_tags.size() >= 1, "we need at least one active tag");
421  auto mat_vector = _matrix_tags.begin();
422  for (MooseIndex(_matrix_tags) i = 0; i < _matrix_tags.size(); i++, ++mat_vector)
423  _ke_blocks[i] = &assembly.jacobianBlock(ivar, jvar, Assembly::LocalDataKey{}, *mat_vector);
424  mooseAssert(_ke_blocks[0]->m() == k.m() && _ke_blocks[0]->n() == k.n(),
425  "Passed-in k must match the blocks we are about to sum into");
426  for (auto & ke : _ke_blocks)
427  *ke += k;
428 }
unsigned int m() const
DenseMatrix< Number > & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block for a pair of variables and a tag.
Definition: Assembly.h:1142
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.
unsigned int n() const
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ accumulateTaggedLocalMatrix() [3/3]

void TaggingInterface::accumulateTaggedLocalMatrix ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar,
Moose::DGJacobianType  type,
const DenseMatrix< Number > &  k 
)
protected

Definition at line 431 of file TaggingInterface.C.

436 {
437  _ke_blocks.resize(_matrix_tags.size());
438  mooseAssert(_matrix_tags.size() >= 1, "we need at least one active tag");
439  auto mat_vector = _matrix_tags.begin();
440  for (MooseIndex(_matrix_tags) i = 0; i < _matrix_tags.size(); i++, ++mat_vector)
441  _ke_blocks[i] =
442  &assembly.jacobianBlockNeighbor(type, ivar, jvar, Assembly::LocalDataKey{}, *mat_vector);
443  mooseAssert(_ke_blocks[0]->m() == k.m() && _ke_blocks[0]->n() == k.n(),
444  "Passed-in k must match the blocks we are about to sum into");
445  for (auto & ke : _ke_blocks)
446  *ke += k;
447 }
DenseMatrix< Number > & jacobianBlockNeighbor(Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block of a DG Jacobian type for a pair of variables and a tag. ...
Definition: Assembly.C:3118
unsigned int m() const
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.
unsigned int n() const
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ accumulateTaggedLocalResidual()

void TaggingInterface::accumulateTaggedLocalResidual ( )
protected

Local residual blocks will be appended by adding the current local kernel residual.

It should be called after the local element vector has been computed.

Definition at line 377 of file TaggingInterface.C.

Referenced by FVInterfaceKernel::addResidual(), ADDGKernel::computeElemNeighResidual(), DGKernel::computeElemNeighResidual(), ElemElemConstraint::computeElemNeighResidual(), ArrayDGKernel::computeElemNeighResidual(), DGLowerDKernel::computeLowerDResidual(), ArrayDGLowerDKernel::computeLowerDResidual(), ScalarKernel::computeResidual(), VectorKernel::computeResidual(), Kernel::computeResidual(), ArrayKernel::computeResidual(), LowerDIntegratedBC::computeResidual(), VectorTimeKernel::computeResidual(), ADScalarKernel::computeResidual(), TimeKernel::computeResidual(), ODEKernel::computeResidual(), ODETimeKernel::computeResidual(), ArrayLowerDIntegratedBC::computeResidual(), VectorIntegratedBC::computeResidual(), IntegratedBC::computeResidual(), ArrayIntegratedBC::computeResidual(), NodeElemConstraint::computeResidual(), ADArrayKernel::computeResidual(), EigenKernel::computeResidual(), ADDiracKernel::computeResidual(), ADMortarConstraint::computeResidual(), FVScalarLagrangeMultiplierConstraint::computeResidual(), FVBoundaryScalarLagrangeMultiplierConstraint::computeResidual(), FVFluxBC::computeResidual(), MortarConstraint::computeResidual(), KernelValue::computeResidual(), KernelGrad::computeResidual(), FVElementalKernel::computeResidual(), FVFluxKernel::computeResidual(), and NodeFaceConstraint::computeResidual().

378 {
379 #ifndef NDEBUG
381  checkForNans();
382 #endif
383 
384  for (auto & re : _re_blocks)
385  *re += _local_re;
386  for (auto & absre : _absre_blocks)
387  for (const auto i : index_range(_local_re))
388  (*absre)(i) += std::abs(_local_re(i));
389 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
SubProblem & _subproblem
SubProblem that contains tag info.
std::vector< DenseVector< Number > * > _absre_blocks
Residual blocks for absolute value residual tags.
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
virtual bool checkResidualForNans() const =0
Whether to check residual for NaN/Inf values.
void checkForNans() const
Checks _local_re for NaNs/Infs and returns an error if found.
auto index_range(const T &sizable)

◆ accumulateTaggedNonlocalMatrix()

void TaggingInterface::accumulateTaggedNonlocalMatrix ( )
protected

Nonlocal Jacobian blocks will be appended by adding the current nonlocal kernel Jacobian.

It should be called after the nonlocal element matrix has been computed.

Definition at line 450 of file TaggingInterface.C.

Referenced by NonlocalIntegratedBC::computeNonlocalJacobian(), NonlocalKernel::computeNonlocalJacobian(), NonlocalKernel::computeNonlocalOffDiagJacobian(), and NonlocalIntegratedBC::computeNonlocalOffDiagJacobian().

451 {
452  for (auto & ke : _ke_blocks)
453  *ke += _nonlocal_ke;
454 }
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.
DenseMatrix< Number > _nonlocal_ke
Holds nonlocal Jacobian entries as they are accumulated by this Kernel.

◆ addJacobian() [1/4]

template<typename Residuals , typename Indices >
void TaggingInterface::addJacobian ( Assembly assembly,
const Residuals &  residuals,
const Indices &  dof_indices,
Real  scaling_factor 
)
protected

Add the provided residual derivatives into the Jacobian for the provided dof indices.

Definition at line 583 of file TaggingInterface.h.

Referenced by addJacobian(), addResidualsAndJacobian(), ADScalarKernel::computeADJacobian(), ADDGKernel::computeElemNeighJacobian(), BoundaryIntegralValueConstraint::computeFieldScalarJacobian(), ADDiracKernel::computeFullJacobian(), DiffusionLHDGDirichletBC::computeJacobian(), DiffusionLHDGPrescribedGradientBC::computeJacobian(), IPHDGBC::computeJacobian(), DiffusionLHDGKernel::computeJacobian(), IPHDGKernel::computeJacobian(), ADArrayKernel::computeJacobian(), ADNodeElemConstraint::computeJacobian(), FVElementalKernel::computeJacobian(), ADArrayNodalKernel::computeJacobian(), ADNodalKernel::computeJacobian(), NodalConstraint::computeJacobian(), DiffusionLHDGKernel::computeJacobianOnSide(), IPHDGKernel::computeJacobianOnSide(), ADDGKernel::computeOffDiagElemNeighJacobian(), FVScalarLagrangeMultiplierConstraint::computeOffDiagJacobian(), MortarScalarBase::computeOffDiagJacobianScalar(), KernelScalarBase::computeOffDiagJacobianScalarLocal(), BoundaryIntegralValueConstraint::computeScalarFieldJacobian(), BoundaryIntegralValueConstraint::computeScalarJacobian(), MortarScalarBase::computeScalarJacobian(), KernelScalarBase::computeScalarJacobian(), MortarScalarBase::computeScalarOffDiagJacobian(), KernelScalarBase::computeScalarOffDiagJacobian(), KernelScalarBase::computeScalarOffDiagJacobianScalar(), and MortarScalarBase::computeScalarOffDiagJacobianScalar().

587 {
588  assembly.cacheJacobian(
589  residuals, dof_indices, scaling_factor, Assembly::LocalDataKey{}, _matrix_tags);
590 }
void cacheJacobian(GlobalDataKey)
Takes the values that are currently in _sub_Kee and appends them to the cached values.
Definition: Assembly.C:4046
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ addJacobian() [2/4]

template<typename Residuals , typename Indices >
void TaggingInterface::addJacobian ( Assembly assembly,
const Residuals &  residuals,
const Indices &  dof_indices,
const std::vector< Real > &  scaling_factors 
)
protected

Add the provided residual derivatives into the Jacobian for the provided dof indices.

This overload is meant for array variables because it takes an array of scaling factors

Definition at line 594 of file TaggingInterface.h.

598 {
599  const auto count = scaling_factors.size();
600  mooseAssert(dof_indices.size() % count == 0,
601  "The number of dof indices should be divided cleanly by the variable count");
602  const auto nshapes = dof_indices.size() / count;
603 
604  for (const auto j : make_range(count))
605  // The Residuals type may not offer operator[] (e.g. eigen vectors) but more commonly it
606  // should offer data()
607  addJacobian(assembly,
608  Moose::makeSpan(residuals, j * nshapes, nshapes),
609  Moose::makeSpan(dof_indices, j * nshapes, nshapes),
610  scaling_factors[j]);
611 }
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.
IntRange< T > make_range(T beg, T end)
auto makeSpan(C &container, std::size_t offset, std::size_t n)
Helper function for creating a span from a given container.
Definition: MooseTypes.h:1090

◆ addJacobian() [3/4]

void TaggingInterface::addJacobian ( Assembly assembly,
const ADResidualsPacket packet 
)
protected

Add the provided residual derivatives into the Jacobian for the provided dof indices.

Definition at line 476 of file TaggingInterface.C.

477 {
478  addJacobian(assembly, packet.residuals, packet.dof_indices, packet.scaling_factor);
479 }
const std::vector< dof_id_type > & dof_indices
const Real scaling_factor
const DenseVector< ADReal > & residuals
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.

◆ addJacobian() [4/4]

void TaggingInterface::addJacobian ( Assembly assembly,
DenseMatrix< Real > &  local_k,
const std::vector< dof_id_type > &  row_indices,
const std::vector< dof_id_type > &  column_indices,
Real  scaling_factor 
)
inlineprotected

Add a local Jacobian matrix.

Definition at line 647 of file TaggingInterface.h.

652 {
653  for (const auto matrix_tag : _matrix_tags)
654  assembly.cacheJacobianBlock(
655  local_k, row_indices, column_indices, scaling_factor, Assembly::LocalDataKey{}, matrix_tag);
656 }
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
void cacheJacobianBlock(DenseMatrix< Number > &jac_block, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, Real scaling_factor, LocalDataKey, TagID tag)
Cache a local Jacobian block with the provided rows (idof_indices) and columns (jdof_indices) for eve...
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ addJacobianElement()

void TaggingInterface::addJacobianElement ( Assembly assembly,
Real  value,
dof_id_type  row_index,
dof_id_type  column_index,
Real  scaling_factor 
)
inlineprotected

Add into a single Jacobian element.

Definition at line 636 of file TaggingInterface.h.

Referenced by ArrayNodalBC::computeJacobian(), VectorNodalBC::computeJacobian(), NodalBC::computeJacobian(), NodalKernel::computeJacobian(), NodalConstraint::computeJacobian(), VectorNodalBC::computeOffDiagJacobian(), ArrayNodalBC::computeOffDiagJacobian(), NodalBC::computeOffDiagJacobian(), NodalKernel::computeOffDiagJacobian(), ArrayNodalKernel::setJacobian(), and MortarConstraintBase::zeroInactiveLMDofs().

641 {
642  assembly.cacheJacobian(
643  row_index, column_index, value * scaling_factor, Assembly::LocalDataKey{}, _matrix_tags);
644 }
void cacheJacobian(GlobalDataKey)
Takes the values that are currently in _sub_Kee and appends them to the cached values.
Definition: Assembly.C:4046
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ addJacobianWithoutConstraints()

template<typename Residuals , typename Indices >
void TaggingInterface::addJacobianWithoutConstraints ( Assembly assembly,
const Residuals &  residuals,
const Indices &  dof_indices,
Real  scaling_factor 
)
protected

Add the provided residual derivatives into the Jacobian for the provided dof indices.

This API should only be used if the caller knows that no libMesh-level constraints (hanging nodes or periodic boundary conditions) apply to the provided dof indices

Definition at line 626 of file TaggingInterface.h.

Referenced by addResidualsAndJacobianWithoutConstraints().

630 {
632  residuals, dof_indices, scaling_factor, Assembly::LocalDataKey{}, _matrix_tags);
633 }
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
void cacheJacobianWithoutConstraints(const Residuals &residuals, const Indices &row_indices, Real scaling_factor, LocalDataKey, const std::set< TagID > &matrix_tags)
Process the derivatives() data of a vector of ADReals.
Definition: Assembly.h:3178
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ addResiduals() [1/4]

template<typename Residuals , typename Indices >
void TaggingInterface::addResiduals ( Assembly assembly,
const Residuals &  residuals,
const Indices &  dof_indices,
Real  scaling_factor 
)
protected

Add the provided incoming residuals corresponding to the provided dof indices.

Definition at line 495 of file TaggingInterface.h.

Referenced by addResiduals(), addResidualsAndJacobian(), FVScalarLagrangeMultiplierInterface::computeResidual(), DiffusionLHDGKernel::computeResidual(), DiffusionLHDGDirichletBC::computeResidual(), IPHDGKernel::computeResidual(), IPHDGBC::computeResidual(), DiffusionLHDGPrescribedGradientBC::computeResidual(), ADNodeElemConstraint::computeResidual(), FVBoundaryScalarLagrangeMultiplierConstraint::computeResidual(), FVScalarLagrangeMultiplierConstraint::computeResidual(), ADArrayNodalKernel::computeResidual(), ArrayNodalKernel::computeResidual(), NodalKernel::computeResidual(), ADNodalKernel::computeResidual(), ADKernelScalarBase::computeResidual(), NodalConstraint::computeResidual(), ADMortarScalarBase::computeResidual(), MortarScalarBase::computeResidual(), DiffusionLHDGKernel::computeResidualOnSide(), IPHDGKernel::computeResidualOnSide(), BoundaryIntegralValueConstraint::computeScalarResidual(), KernelScalarBase::computeScalarResidual(), and MortarConstraintBase::zeroInactiveLMDofs().

499 {
500  assembly.cacheResiduals(
501  residuals, dof_indices, scaling_factor, Assembly::LocalDataKey{}, _vector_tags);
502  if (!_abs_vector_tags.empty())
503  {
504  _absolute_residuals.resize(residuals.size());
505  for (const auto i : index_range(residuals))
507 
509  dof_indices,
510  scaling_factor,
513  }
514 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:100
std::set< TagID > _abs_vector_tags
The absolute value residual tag ids.
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
void cacheResiduals(const Residuals &residuals, const Indices &row_indices, Real scaling_factor, LocalDataKey, const std::set< TagID > &vector_tags)
Process the supplied residual values.
Definition: Assembly.h:3058
auto index_range(const T &sizable)
std::vector< Real > _absolute_residuals
A container to hold absolute values of residuals passed into addResiduals.
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ addResiduals() [2/4]

template<typename Residuals , typename Indices >
void TaggingInterface::addResiduals ( Assembly assembly,
const Residuals &  residuals,
const Indices &  dof_indices,
const std::vector< Real > &  scaling_factors 
)
protected

Definition at line 518 of file TaggingInterface.h.

522 {
523  const auto count = scaling_factors.size();
524  mooseAssert(dof_indices.size() % count == 0,
525  "The number of dof indices should be divided cleanly by the variable count");
526  const auto nshapes = dof_indices.size() / count;
527 
528  for (const auto j : make_range(count))
529  // The Residuals type may not offer operator[] (e.g. eigen vectors) but more commonly it
530  // should offer data()
531  addResiduals(assembly,
532  Moose::makeSpan(residuals, j * nshapes, nshapes),
533  Moose::makeSpan(dof_indices, j * nshapes, nshapes),
534  scaling_factors[j]);
535 }
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.
IntRange< T > make_range(T beg, T end)
auto makeSpan(C &container, std::size_t offset, std::size_t n)
Helper function for creating a span from a given container.
Definition: MooseTypes.h:1090

◆ addResiduals() [3/4]

template<typename T , typename Indices >
void TaggingInterface::addResiduals ( Assembly assembly,
const DenseVector< T > &  residuals,
const Indices &  dof_indices,
Real  scaling_factor 
)
protected

Add the provided incoming residuals corresponding to the provided dof indices.

Definition at line 539 of file TaggingInterface.h.

543 {
544  addResiduals(assembly, residuals.get_values(), dof_indices, scaling_factor);
545 }
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.

◆ addResiduals() [4/4]

void TaggingInterface::addResiduals ( Assembly assembly,
const ADResidualsPacket packet 
)
protected

Add the provided incoming residuals corresponding to the provided dof indices.

Definition at line 464 of file TaggingInterface.C.

465 {
466  addResiduals(assembly, packet.residuals, packet.dof_indices, packet.scaling_factor);
467 }
const std::vector< dof_id_type > & dof_indices
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.
const Real scaling_factor
const DenseVector< ADReal > & residuals

◆ addResidualsAndJacobian() [1/2]

template<typename Residuals , typename Indices >
void TaggingInterface::addResidualsAndJacobian ( Assembly assembly,
const Residuals &  residuals,
const Indices &  dof_indices,
Real  scaling_factor 
)
protected

Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided dof indices.

Definition at line 572 of file TaggingInterface.h.

Referenced by addResidualsAndJacobian(), FVScalarLagrangeMultiplierInterface::computeJacobian(), FVBoundaryScalarLagrangeMultiplierConstraint::computeJacobian(), FVFluxBC::computeJacobian(), ADKernelScalarBase::computeJacobian(), FVFluxKernel::computeJacobian(), FVInterfaceKernel::computeJacobian(), IPHDGBC::computeResidualAndJacobian(), ADDiracKernel::computeResidualAndJacobian(), IPHDGKernel::computeResidualAndJacobian(), FVScalarLagrangeMultiplierConstraint::computeResidualAndJacobian(), FVElementalKernel::computeResidualAndJacobian(), ADKernelScalarBase::computeResidualAndJacobian(), and IPHDGKernel::computeResidualAndJacobianOnSide().

576 {
577  addResiduals(assembly, residuals, dof_indices, scaling_factor);
578  addJacobian(assembly, residuals, dof_indices, scaling_factor);
579 }
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.
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.

◆ addResidualsAndJacobian() [2/2]

void TaggingInterface::addResidualsAndJacobian ( Assembly assembly,
const ADResidualsPacket packet 
)
protected

Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided dof indices.

Definition at line 470 of file TaggingInterface.C.

471 {
472  addResidualsAndJacobian(assembly, packet.residuals, packet.dof_indices, packet.scaling_factor);
473 }
void addResidualsAndJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided d...
const std::vector< dof_id_type > & dof_indices
const Real scaling_factor
const DenseVector< ADReal > & residuals

◆ addResidualsAndJacobianWithoutConstraints()

template<typename Residuals , typename Indices >
void TaggingInterface::addResidualsAndJacobianWithoutConstraints ( Assembly assembly,
const Residuals &  residuals,
const Indices &  dof_indices,
Real  scaling_factor 
)
protected

Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided dof indices.

This API should only be used if the caller knows that no libMesh-level constraints (hanging nodes or periodic boundary conditions) apply to the provided dof indices

Definition at line 615 of file TaggingInterface.h.

Referenced by ADMortarConstraint::computeJacobian(), and ADMortarScalarBase::computeJacobian().

619 {
620  addResidualsWithoutConstraints(assembly, residuals, dof_indices, scaling_factor);
621  addJacobianWithoutConstraints(assembly, residuals, dof_indices, scaling_factor);
622 }
void addResidualsWithoutConstraints(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals corresponding to the provided dof indices.
void addJacobianWithoutConstraints(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.

◆ addResidualsWithoutConstraints()

template<typename Residuals , typename Indices >
void TaggingInterface::addResidualsWithoutConstraints ( Assembly assembly,
const Residuals &  residuals,
const Indices &  dof_indices,
Real  scaling_factor 
)
protected

Add the provided incoming residuals corresponding to the provided dof indices.

This API should only be used if the caller knows that no libMesh-level constraints (hanging nodes or periodic boundary conditions) apply to the provided dof indices

Definition at line 549 of file TaggingInterface.h.

Referenced by addResidualsAndJacobianWithoutConstraints().

553 {
555  residuals, dof_indices, scaling_factor, Assembly::LocalDataKey{}, _vector_tags);
556  if (!_abs_vector_tags.empty())
557  {
558  _absolute_residuals.resize(residuals.size());
559  for (const auto i : index_range(residuals))
561 
563  dof_indices,
564  scaling_factor,
567  }
568 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:100
std::set< TagID > _abs_vector_tags
The absolute value residual tag ids.
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
auto index_range(const T &sizable)
std::vector< Real > _absolute_residuals
A container to hold absolute values of residuals passed into addResiduals.
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862
void cacheResidualsWithoutConstraints(const Residuals &residuals, const Indices &row_indices, Real scaling_factor, LocalDataKey, const std::set< TagID > &vector_tags)
Process the supplied residual values.
Definition: Assembly.h:3098

◆ assignTaggedLocalMatrix()

void TaggingInterface::assignTaggedLocalMatrix ( )
protected

Local Jacobian blocks will assigned as the current local kernel Jacobian.

It should be called after the local element matrix has been computed.

Definition at line 457 of file TaggingInterface.C.

Referenced by NodalEqualValueConstraint::computeJacobian().

458 {
459  for (auto & ke : _ke_blocks)
460  *ke = _local_ke;
461 }
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.

◆ assignTaggedLocalResidual()

void TaggingInterface::assignTaggedLocalResidual ( )
protected

Local residual blocks will assigned as the current local kernel residual.

It should be called after the local element vector has been computed.

Definition at line 392 of file TaggingInterface.C.

Referenced by NodalEqualValueConstraint::computeResidual(), and NodeFaceConstraint::computeResidual().

393 {
394 #ifndef NDEBUG
396  checkForNans();
397 #endif
398 
399  for (auto & re : _re_blocks)
400  *re = _local_re;
401  for (auto & absre : _absre_blocks)
402  for (const auto i : index_range(_local_re))
403  (*absre)(i) = std::abs(_local_re(i));
404 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
SubProblem & _subproblem
SubProblem that contains tag info.
std::vector< DenseVector< Number > * > _absre_blocks
Residual blocks for absolute value residual tags.
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
virtual bool checkResidualForNans() const =0
Whether to check residual for NaN/Inf values.
void checkForNans() const
Checks _local_re for NaNs/Infs and returns an error if found.
auto index_range(const T &sizable)

◆ checkForNans()

void TaggingInterface::checkForNans ( ) const
private

Checks _local_re for NaNs/Infs and returns an error if found.

Definition at line 483 of file TaggingInterface.C.

Referenced by accumulateTaggedLocalResidual(), and assignTaggedLocalResidual().

484 {
485  for (const auto i : index_range(_local_re))
486  if (!std::isfinite(_local_re(i)))
487  {
488  std::stringstream ss;
489  ss << "NaN or Inf detected in '" << _moose_object.name() << "'.\n";
490  ss << "To further troubleshoot this value in this residual object, add the following lines "
491  "before returning the value in the computeQpResidual() (or similar) method in the "
492  "source file for the class of '"
493  << _moose_object.name() << "':\n\n";
494  ss << " if (!std::isfinite(<return value>))\n";
495  ss << " mooseError(\"Found NaN or Inf\");\n\n";
496  ss << "Then you can use a breakpoint in a debugger to troubleshoot the origin of the NaN or "
497  "Inf value.";
498 
499  mooseError(ss.str());
500  }
501 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:103
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
const MooseObject & _moose_object
Moose objct this tag works on.
auto index_range(const T &sizable)

◆ getMatrixTags()

const std::set<TagID>& TaggingInterface::getMatrixTags ( MatrixTagsKey  ) const
inline

Definition at line 137 of file TaggingInterface.h.

Referenced by LinearSystemContributionObject::linkTaggedVectorsAndMatrices().

137 { return _matrix_tags; }
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.

◆ getVectorTags()

const std::set<TagID>& TaggingInterface::getVectorTags ( VectorTagsKey  ) const
inline

Definition at line 135 of file TaggingInterface.h.

Referenced by LinearSystemContributionObject::linkTaggedVectorsAndMatrices().

135 { return _vector_tags; }
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.

◆ hasVectorTags()

bool TaggingInterface::hasVectorTags ( ) const
inline

Definition at line 133 of file TaggingInterface.h.

Referenced by Kernel::computeResidual().

133 { return !_vector_tags.empty(); }
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.

◆ isMatrixTagged()

bool TaggingInterface::isMatrixTagged ( )
inline

Definition at line 131 of file TaggingInterface.h.

131 { return _matrix_tags.size() > 0; }
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.

◆ isVectorTagged()

bool TaggingInterface::isVectorTagged ( )
inline

Definition at line 129 of file TaggingInterface.h.

129 { return _vector_tags.size() > 0; }
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.

◆ prepareMatrixTag() [1/2]

void TaggingInterface::prepareMatrixTag ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar 
)
protected

Prepare data for computing element jacobian according to the active tags.

Jacobian blocks for different tags will be extracted from Assembly. A local Jacobian will be zeroed. It should be called right before the local element matrix is computed.

Definition at line 293 of file TaggingInterface.C.

Referenced by DGKernel::computeElemNeighJacobian(), ArrayDGKernel::computeElemNeighJacobian(), TimeDerivative::computeJacobian(), VectorTimeDerivative::computeJacobian(), ScalarKernel::computeJacobian(), MassLumpedTimeDerivative::computeJacobian(), VectorKernel::computeJacobian(), Kernel::computeJacobian(), ODEKernel::computeJacobian(), ArrayKernel::computeJacobian(), VectorIntegratedBC::computeJacobian(), IntegratedBC::computeJacobian(), ArrayIntegratedBC::computeJacobian(), EigenKernel::computeJacobian(), NodalEqualValueConstraint::computeJacobian(), NonlocalIntegratedBC::computeJacobian(), KernelGrad::computeJacobian(), KernelValue::computeJacobian(), NonlocalKernel::computeJacobian(), DGKernel::computeOffDiagElemNeighJacobian(), ArrayDGKernel::computeOffDiagElemNeighJacobian(), Kernel::computeOffDiagJacobian(), VectorKernel::computeOffDiagJacobian(), EigenKernel::computeOffDiagJacobian(), ArrayKernel::computeOffDiagJacobian(), IntegratedBC::computeOffDiagJacobian(), VectorIntegratedBC::computeOffDiagJacobian(), ArrayIntegratedBC::computeOffDiagJacobian(), NonlocalKernel::computeOffDiagJacobian(), NonlocalIntegratedBC::computeOffDiagJacobian(), KernelValue::computeOffDiagJacobian(), KernelGrad::computeOffDiagJacobian(), ODEKernel::computeOffDiagJacobianScalar(), VectorKernel::computeOffDiagJacobianScalar(), ArrayKernel::computeOffDiagJacobianScalar(), IntegratedBC::computeOffDiagJacobianScalar(), VectorIntegratedBC::computeOffDiagJacobianScalar(), ArrayIntegratedBC::computeOffDiagJacobianScalar(), Kernel::computeOffDiagJacobianScalar(), and ScalarLagrangeMultiplier::computeOffDiagJacobianScalar().

294 {
295  _ke_blocks.resize(_matrix_tags.size());
296  mooseAssert(_matrix_tags.size() >= 1, "we need at least one active tag");
297  auto mat_vector = _matrix_tags.begin();
298  for (MooseIndex(_matrix_tags) i = 0; i < _matrix_tags.size(); i++, ++mat_vector)
299  _ke_blocks[i] = &assembly.jacobianBlock(ivar, jvar, Assembly::LocalDataKey{}, *mat_vector);
300 
301  _local_ke.resize(_ke_blocks[0]->m(), _ke_blocks[0]->n());
302 }
DenseMatrix< Number > & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block for a pair of variables and a tag.
Definition: Assembly.h:1142
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
void resize(const unsigned int new_m, const unsigned int new_n)
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ prepareMatrixTag() [2/2]

void TaggingInterface::prepareMatrixTag ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar,
DenseMatrix< Number > &  k 
) const
protected

Definition at line 305 of file TaggingInterface.C.

309 {
310  mooseAssert(!_matrix_tags.empty(), "No matrix tags exist");
311  const auto & ij_mat =
312  assembly.jacobianBlock(ivar, jvar, Assembly::LocalDataKey{}, *_matrix_tags.begin());
313  k.resize(ij_mat.m(), ij_mat.n());
314 }
DenseMatrix< Number > & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block for a pair of variables and a tag.
Definition: Assembly.h:1142
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
void resize(const unsigned int new_m, const unsigned int new_n)
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ prepareMatrixTagLower()

void TaggingInterface::prepareMatrixTagLower ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar,
Moose::ConstraintJacobianType  type 
)
protected

Prepare data for computing the jacobian according to the active tags for mortar.

Jacobian blocks for different tags will be extracted from Assembly. A local Jacobian will be zeroed. It should be called right before the local element matrix is computed.

Definition at line 361 of file TaggingInterface.C.

Referenced by MortarConstraint::computeJacobian(), LowerDIntegratedBC::computeLowerDJacobian(), ArrayLowerDIntegratedBC::computeLowerDJacobian(), DGLowerDKernel::computeLowerDJacobian(), ArrayDGLowerDKernel::computeLowerDJacobian(), LowerDIntegratedBC::computeLowerDOffDiagJacobian(), ArrayLowerDIntegratedBC::computeLowerDOffDiagJacobian(), DGLowerDKernel::computeOffDiagLowerDJacobian(), and ArrayDGLowerDKernel::computeOffDiagLowerDJacobian().

365 {
366  _ke_blocks.resize(_matrix_tags.size());
367  mooseAssert(_matrix_tags.size() >= 1, "we need at least one active tag");
368  auto mat_vector = _matrix_tags.begin();
369  for (MooseIndex(_matrix_tags) i = 0; i < _matrix_tags.size(); i++, ++mat_vector)
370  _ke_blocks[i] =
371  &assembly.jacobianBlockMortar(type, ivar, jvar, Assembly::LocalDataKey{}, *mat_vector);
372 
373  _local_ke.resize(_ke_blocks[0]->m(), _ke_blocks[0]->n());
374 }
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
DenseMatrix< Number > & jacobianBlockMortar(Moose::ConstraintJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Returns the jacobian block for the given mortar Jacobian type.
Definition: Assembly.C:3159
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
void resize(const unsigned int new_m, const unsigned int new_n)
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ prepareMatrixTagNeighbor() [1/2]

void TaggingInterface::prepareMatrixTagNeighbor ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar,
Moose::DGJacobianType  type 
)
protected

Prepare data for computing element jacobian according to the active tags for DG and interface kernels.

Jacobian blocks for different tags will be extracted from Assembly. A local Jacobian will be zeroed. It should be called right before the local element matrix is computed.

Definition at line 332 of file TaggingInterface.C.

Referenced by DGKernel::computeElemNeighJacobian(), ElemElemConstraint::computeElemNeighJacobian(), ArrayDGKernel::computeElemNeighJacobian(), NodeElemConstraint::computeJacobian(), NodeFaceConstraint::computeJacobian(), DGKernel::computeOffDiagElemNeighJacobian(), ArrayDGKernel::computeOffDiagElemNeighJacobian(), NodeElemConstraint::computeOffDiagJacobian(), and NodeFaceConstraint::computeOffDiagJacobian().

336 {
337  _ke_blocks.resize(_matrix_tags.size());
338  mooseAssert(_matrix_tags.size() >= 1, "we need at least one active tag");
339  auto mat_vector = _matrix_tags.begin();
340  for (MooseIndex(_matrix_tags) i = 0; i < _matrix_tags.size(); i++, ++mat_vector)
341  _ke_blocks[i] =
342  &assembly.jacobianBlockNeighbor(type, ivar, jvar, Assembly::LocalDataKey{}, *mat_vector);
343 
344  _local_ke.resize(_ke_blocks[0]->m(), _ke_blocks[0]->n());
345 }
DenseMatrix< Number > & jacobianBlockNeighbor(Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block of a DG Jacobian type for a pair of variables and a tag. ...
Definition: Assembly.C:3118
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
void resize(const unsigned int new_m, const unsigned int new_n)
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ prepareMatrixTagNeighbor() [2/2]

void TaggingInterface::prepareMatrixTagNeighbor ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar,
Moose::DGJacobianType  type,
DenseMatrix< Number > &  k 
) const
protected

Definition at line 348 of file TaggingInterface.C.

353 {
354  mooseAssert(!_matrix_tags.empty(), "No matrix tags exist");
355  const auto & ij_mat = assembly.jacobianBlockNeighbor(
356  type, ivar, jvar, Assembly::LocalDataKey{}, *_matrix_tags.begin());
357  k.resize(ij_mat.m(), ij_mat.n());
358 }
DenseMatrix< Number > & jacobianBlockNeighbor(Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block of a DG Jacobian type for a pair of variables and a tag. ...
Definition: Assembly.C:3118
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
void resize(const unsigned int new_m, const unsigned int new_n)
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ prepareMatrixTagNonlocal()

void TaggingInterface::prepareMatrixTagNonlocal ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar 
)
protected

Prepare data for computing nonlocal element jacobian according to the active tags.

Jacobian blocks for different tags will be extracted from Assembly. A nonlocal Jacobian will be zeroed. It should be called right before the nonlocal element matrix is computed.

Definition at line 317 of file TaggingInterface.C.

Referenced by NonlocalIntegratedBC::computeNonlocalJacobian(), NonlocalKernel::computeNonlocalJacobian(), NonlocalKernel::computeNonlocalOffDiagJacobian(), and NonlocalIntegratedBC::computeNonlocalOffDiagJacobian().

320 {
321  _ke_blocks.resize(_matrix_tags.size());
322  mooseAssert(_matrix_tags.size() >= 1, "we need at least one active tag");
323  auto mat_vector = _matrix_tags.begin();
324  for (MooseIndex(_matrix_tags) i = 0; i < _matrix_tags.size(); i++, ++mat_vector)
325  _ke_blocks[i] =
326  &assembly.jacobianBlockNonlocal(ivar, jvar, Assembly::LocalDataKey{}, *mat_vector);
327 
328  _nonlocal_ke.resize(_ke_blocks[0]->m(), _ke_blocks[0]->n());
329 }
DenseMatrix< Number > & jacobianBlockNonlocal(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block from non-local contribution for a pair of variables and a tag...
Definition: Assembly.h:1153
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
void resize(const unsigned int new_m, const unsigned int new_n)
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.
DenseMatrix< Number > _nonlocal_ke
Holds nonlocal Jacobian entries as they are accumulated by this Kernel.
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ prepareVectorTag() [1/2]

void TaggingInterface::prepareVectorTag ( Assembly assembly,
unsigned int  ivar 
)
protected

Prepare data for computing element residual according to active tags.

Residual blocks for different tags will be extracted from Assembly. A local residual will be zeroed. It should be called right before the local element vector is computed.

Definition at line 206 of file TaggingInterface.C.

Referenced by FVInterfaceKernel::addResidual(), ADDGKernel::computeElemNeighResidual(), DGKernel::computeElemNeighResidual(), ElemElemConstraint::computeElemNeighResidual(), ArrayDGKernel::computeElemNeighResidual(), ScalarKernel::computeResidual(), VectorKernel::computeResidual(), Kernel::computeResidual(), ArrayKernel::computeResidual(), TimeKernel::computeResidual(), ODEKernel::computeResidual(), ODETimeKernel::computeResidual(), VectorTimeKernel::computeResidual(), ADScalarKernel::computeResidual(), VectorIntegratedBC::computeResidual(), IntegratedBC::computeResidual(), ADArrayKernel::computeResidual(), ArrayIntegratedBC::computeResidual(), EigenKernel::computeResidual(), NodeElemConstraint::computeResidual(), NodalEqualValueConstraint::computeResidual(), ADDiracKernel::computeResidual(), ADMortarConstraint::computeResidual(), FVBoundaryScalarLagrangeMultiplierConstraint::computeResidual(), FVScalarLagrangeMultiplierConstraint::computeResidual(), MortarConstraint::computeResidual(), FVFluxBC::computeResidual(), KernelGrad::computeResidual(), KernelValue::computeResidual(), FVElementalKernel::computeResidual(), FVFluxKernel::computeResidual(), and NodeFaceConstraint::computeResidual().

207 {
209 }
std::set< TagID > _abs_vector_tags
The absolute value residual tag ids.
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
void prepareVectorTagInternal(Assembly &assembly, unsigned int ivar, const std::set< TagID > &vector_tags, const std::set< TagID > &absolute_value_vector_tags)
Prepare data for computing element residual according to the specified tags Residual blocks for diffe...

◆ prepareVectorTag() [2/2]

void TaggingInterface::prepareVectorTag ( Assembly assembly,
unsigned int  ivar,
ResidualTagType  tag_type 
)
protected

Prepare vector tags in a reference residual problem context.

Parameters
AssemblyThe assembly object that we obtain the local residual blocks from
ivarThe variable which we are retrieving the local residual blocks for
ref_problemA pointer to a reference residual problem. This can be a nullptr
tag_typeWhat type of tags to prepare

Definition at line 212 of file TaggingInterface.C.

215 {
216  if (tag_type == ResidualTagType::NonReference)
218  else
220 }
std::set< TagID > _ref_abs_vector_tags
A set of either size 1 or 0.
std::set< TagID > _ref_vector_tags
A set of either size 1 or 0.
std::set< TagID > _non_ref_abs_vector_tags
A set to hold absolute value vector tags excluding the reference residual tag.
std::set< TagID > _non_ref_vector_tags
A set to hold vector tags excluding the reference residual tag.
void prepareVectorTagInternal(Assembly &assembly, unsigned int ivar, const std::set< TagID > &vector_tags, const std::set< TagID > &absolute_value_vector_tags)
Prepare data for computing element residual according to the specified tags Residual blocks for diffe...

◆ prepareVectorTagInternal()

void TaggingInterface::prepareVectorTagInternal ( Assembly assembly,
unsigned int  ivar,
const std::set< TagID > &  vector_tags,
const std::set< TagID > &  absolute_value_vector_tags 
)
private

Prepare data for computing element residual according to the specified tags Residual blocks for different tags will be extracted from Assembly.

A local residual will be zeroed. It should be called right before the local element vector is computed.

Definition at line 223 of file TaggingInterface.C.

Referenced by prepareVectorTag().

227 {
228  auto prepare = [this, ivar, &assembly](auto & re_blocks, const auto & tags)
229  {
230  re_blocks.clear();
231  re_blocks.reserve(tags.size());
232  for (const auto tag_id : tags)
233  {
234  const auto & tag = _subproblem.getVectorTag(tag_id);
235  re_blocks.push_back(&assembly.residualBlock(ivar, Assembly::LocalDataKey{}, tag._type_id));
236  }
237  };
238 
239  prepare(_re_blocks, vector_tags);
240  prepare(_absre_blocks, absolute_value_vector_tags);
241 
242  _local_re.resize(_re_blocks.empty()
243  ? (_absre_blocks.empty() ? std::size_t(0) : _absre_blocks[0]->size())
244  : _re_blocks[0]->size());
245 }
SubProblem & _subproblem
SubProblem that contains tag info.
void resize(const unsigned int n)
std::vector< DenseVector< Number > * > _absre_blocks
Residual blocks for absolute value residual tags.
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
DenseVector< Number > & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
Get local residual block for a variable and a tag.
Definition: Assembly.h:1115
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
virtual const VectorTag & getVectorTag(const TagID tag_id) const
Get a VectorTag from a TagID.
Definition: SubProblem.C:162
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ prepareVectorTagLower()

void TaggingInterface::prepareVectorTagLower ( Assembly assembly,
unsigned int  ivar 
)
protected

Prepare data for computing the residual according to active tags for mortar constraints.

Residual blocks for different tags will be extracted from Assembly. A local residual will be zeroed. It should be called right before the local element vector is computed.

Definition at line 271 of file TaggingInterface.C.

Referenced by DGLowerDKernel::computeLowerDResidual(), ArrayDGLowerDKernel::computeLowerDResidual(), LowerDIntegratedBC::computeResidual(), ArrayLowerDIntegratedBC::computeResidual(), ADMortarConstraint::computeResidual(), and MortarConstraint::computeResidual().

272 {
273  _re_blocks.resize(_vector_tags.size());
274  mooseAssert(_vector_tags.size() >= 1, "we need at least one active tag");
275  auto vector_tag = _vector_tags.begin();
276  for (MooseIndex(_vector_tags) i = 0; i < _vector_tags.size(); i++, ++vector_tag)
277  {
278  const VectorTag & tag = _subproblem.getVectorTag(*vector_tag);
279  _re_blocks[i] = &assembly.residualBlockLower(ivar, Assembly::LocalDataKey{}, tag._type_id);
280  }
281  _local_re.resize(_re_blocks[0]->size());
282 
283  _absre_blocks.resize(_abs_vector_tags.size());
284  vector_tag = _abs_vector_tags.begin();
285  for (MooseIndex(_abs_vector_tags) i = 0; i < _abs_vector_tags.size(); i++, ++vector_tag)
286  {
287  const VectorTag & tag = _subproblem.getVectorTag(*vector_tag);
289  }
290 }
SubProblem & _subproblem
SubProblem that contains tag info.
void resize(const unsigned int n)
TagTypeID _type_id
The index for this tag into a vector that contains tags of only its type ordered by ID...
Definition: VectorTag.h:47
std::vector< DenseVector< Number > * > _absre_blocks
Residual blocks for absolute value residual tags.
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
std::set< TagID > _abs_vector_tags
The absolute value residual tag ids.
DenseVector< Number > & residualBlockLower(unsigned int var_num, LocalDataKey, TagID tag_id)
Get residual block for lower.
Definition: Assembly.h:1133
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
Storage for all of the information pretaining to a vector tag.
Definition: VectorTag.h:17
virtual const VectorTag & getVectorTag(const TagID tag_id) const
Get a VectorTag from a TagID.
Definition: SubProblem.C:162
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ prepareVectorTagNeighbor()

void TaggingInterface::prepareVectorTagNeighbor ( Assembly assembly,
unsigned int  ivar 
)
protected

Prepare data for computing element residual the according to active tags for DG and interface kernels.

Residual blocks for different tags will be extracted from Assembly. A local residual will be zeroed. It should be called right before the local element vector is computed.

Definition at line 248 of file TaggingInterface.C.

Referenced by FVInterfaceKernel::addResidual(), ADDGKernel::computeElemNeighResidual(), DGKernel::computeElemNeighResidual(), ElemElemConstraint::computeElemNeighResidual(), ArrayDGKernel::computeElemNeighResidual(), NodeElemConstraint::computeResidual(), ADMortarConstraint::computeResidual(), MortarConstraint::computeResidual(), FVFluxBC::computeResidual(), FVFluxKernel::computeResidual(), and NodeFaceConstraint::computeResidual().

249 {
250  _re_blocks.resize(_vector_tags.size());
251  mooseAssert(_vector_tags.size() >= 1, "we need at least one active tag");
252  auto vector_tag = _vector_tags.begin();
253  for (MooseIndex(_vector_tags) i = 0; i < _vector_tags.size(); i++, ++vector_tag)
254  {
255  const VectorTag & tag = _subproblem.getVectorTag(*vector_tag);
257  }
258  _local_re.resize(_re_blocks[0]->size());
259 
260  _absre_blocks.resize(_abs_vector_tags.size());
261  vector_tag = _abs_vector_tags.begin();
262  for (MooseIndex(_abs_vector_tags) i = 0; i < _abs_vector_tags.size(); i++, ++vector_tag)
263  {
264  const VectorTag & tag = _subproblem.getVectorTag(*vector_tag);
265  _absre_blocks[i] =
266  &assembly.residualBlockNeighbor(ivar, Assembly::LocalDataKey{}, tag._type_id);
267  }
268 }
SubProblem & _subproblem
SubProblem that contains tag info.
void resize(const unsigned int n)
TagTypeID _type_id
The index for this tag into a vector that contains tags of only its type ordered by ID...
Definition: VectorTag.h:47
std::vector< DenseVector< Number > * > _absre_blocks
Residual blocks for absolute value residual tags.
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
std::set< TagID > _abs_vector_tags
The absolute value residual tag ids.
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
DenseVector< Number > & residualBlockNeighbor(unsigned int var_num, LocalDataKey, TagID tag_id)
Get local neighbor residual block for a variable and a tag.
Definition: Assembly.h:1124
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
Storage for all of the information pretaining to a vector tag.
Definition: VectorTag.h:17
virtual const VectorTag & getVectorTag(const TagID tag_id) const
Get a VectorTag from a TagID.
Definition: SubProblem.C:162
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862

◆ setResidual() [1/3]

template<typename T >
void TaggingInterface::setResidual ( SystemBase sys,
const T &  residual,
MooseVariableFE< T > &  var 
)
protected

Set residual using the variables' insertion API.

Definition at line 660 of file TaggingInterface.h.

Referenced by ArrayNodalBC::computeResidual(), VectorNodalBC::computeResidual(), and NodalBC::computeResidual().

661 {
662  for (const auto tag_id : _vector_tags)
663  if (sys.hasVector(tag_id))
664  var.insertNodalValue(sys.getVector(tag_id), residual);
665 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:925
void insertNodalValue(libMesh::NumericVector< libMesh::Number > &residual, const DofValue &v)
Write a nodal value to the passed-in solution vector.
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

◆ setResidual() [2/3]

void TaggingInterface::setResidual ( SystemBase sys,
Real  residual,
dof_id_type  dof_index 
)
inlineprotected

Set residual at a specified degree of freedom index.

Definition at line 668 of file TaggingInterface.h.

669 {
670  for (const auto tag_id : _vector_tags)
671  if (sys.hasVector(tag_id))
672  sys.getVector(tag_id).set(dof_index, residual);
673 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:925
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
virtual void set(const numeric_index_type i, const Number value)=0
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

◆ setResidual() [3/3]

template<typename SetResidualFunctor >
void TaggingInterface::setResidual ( SystemBase sys,
SetResidualFunctor  set_residual_functor 
)
protected

Set residuals using the provided functor.

Definition at line 677 of file TaggingInterface.h.

678 {
679  for (const auto tag_id : _vector_tags)
680  if (sys.hasVector(tag_id))
681  set_residual_functor(sys.getVector(tag_id));
682 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:925
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

◆ useMatrixTag() [1/2]

void TaggingInterface::useMatrixTag ( const TagName &  tag_name,
MatrixTagsKey   
)

Definition at line 179 of file TaggingInterface.C.

180 {
181  if (!_subproblem.matrixTagExists(tag_name))
182  mooseError("Matrix tag ", tag_name, " does not exist in system");
183 
184  _matrix_tags.insert(_subproblem.getMatrixTagID(tag_name));
185 }
SubProblem & _subproblem
SubProblem that contains tag info.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual TagID getMatrixTagID(const TagName &tag_name) const
Get a TagID from a TagName.
Definition: SubProblem.C:343
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:329

◆ useMatrixTag() [2/2]

void TaggingInterface::useMatrixTag ( TagID  tag_id,
MatrixTagsKey   
)

Definition at line 197 of file TaggingInterface.C.

198 {
199  if (!_subproblem.matrixTagExists(tag_id))
200  mooseError("Matrix tag ", tag_id, " does not exist in system");
201 
202  _matrix_tags.insert(tag_id);
203 }
SubProblem & _subproblem
SubProblem that contains tag info.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:329

◆ useVectorTag() [1/2]

void TaggingInterface::useVectorTag ( const TagName &  tag_name,
VectorTagsKey   
)

Definition at line 170 of file TaggingInterface.C.

171 {
172  if (!_subproblem.vectorTagExists(tag_name))
173  mooseError("Vector tag ", tag_name, " does not exist in system");
174 
175  _vector_tags.insert(_subproblem.getVectorTagID(tag_name));
176 }
virtual TagID getVectorTagID(const TagName &tag_name) const
Get a TagID from a TagName.
Definition: SubProblem.C:204
SubProblem & _subproblem
SubProblem that contains tag info.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201

◆ useVectorTag() [2/2]

void TaggingInterface::useVectorTag ( TagID  tag_id,
VectorTagsKey   
)

Definition at line 188 of file TaggingInterface.C.

189 {
190  if (!_subproblem.vectorTagExists(tag_id))
191  mooseError("Vector tag ", tag_id, " does not exist in system");
192 
193  _vector_tags.insert(tag_id);
194 }
SubProblem & _subproblem
SubProblem that contains tag info.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::set< TagID > _vector_tags
The vector tag ids this Kernel will contribute to.
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201

◆ validParams()

InputParameters TaggingInterface::validParams ( )
static

Definition at line 20 of file TaggingInterface.C.

Referenced by ResidualObject::validParams(), LinearSystemContributionObject::validParams(), LinearFVBoundaryCondition::validParams(), FVInterfaceKernel::validParams(), and FVBoundaryCondition::validParams().

21 {
22 
24 
25  // These are the default names for tags, but users will be able to add their own
26  MultiMooseEnum vtags("nontime time", "nontime", true);
27  MultiMooseEnum mtags("nontime system", "system", true);
28 
29  params.addParam<bool>(
30  "matrix_only", false, "Whether this object is only doing assembly to matrices (no vectors)");
31 
32  params.addParam<MultiMooseEnum>(
33  "vector_tags", vtags, "The tag for the vectors this Kernel should fill");
34 
35  params.addParam<MultiMooseEnum>(
36  "matrix_tags", mtags, "The tag for the matrices this Kernel should fill");
37 
38  params.addParam<std::vector<TagName>>("extra_vector_tags",
39  "The extra tags for the vectors this Kernel should fill");
40 
41  params.addParam<std::vector<TagName>>(
42  "absolute_value_vector_tags",
43  "The tags for the vectors this residual object should fill with the "
44  "absolute value of the residual contribution");
45 
46  params.addParam<std::vector<TagName>>("extra_matrix_tags",
47  "The extra tags for the matrices this Kernel should fill");
48 
49  params.addParamNamesToGroup("vector_tags matrix_tags extra_vector_tags extra_matrix_tags "
50  "absolute_value_vector_tags matrix_only",
51  "Contribution to tagged field data");
52 
53  return params;
54 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...

Friends And Related Function Documentation

◆ NonlinearSystemBase

friend class NonlinearSystemBase
friend

Definition at line 477 of file TaggingInterface.h.

Member Data Documentation

◆ _abs_vector_tags

std::set<TagID> TaggingInterface::_abs_vector_tags
private

◆ _absolute_residuals

std::vector<Real> TaggingInterface::_absolute_residuals
private

A container to hold absolute values of residuals passed into addResiduals.

We maintain this data member to avoid constant dynamic heap allocations

Definition at line 475 of file TaggingInterface.h.

Referenced by addResiduals(), and addResidualsWithoutConstraints().

◆ _absre_blocks

std::vector<DenseVector<Number> *> TaggingInterface::_absre_blocks
private

◆ _ke_blocks

std::vector<DenseMatrix<Number> *> TaggingInterface::_ke_blocks
private

◆ _local_ke

DenseMatrix<Number> TaggingInterface::_local_ke
protected

Holds local Jacobian entries as they are accumulated by this Kernel.

Definition at line 407 of file TaggingInterface.h.

Referenced by accumulateTaggedLocalMatrix(), assignTaggedLocalMatrix(), ADDGKernel::computeElemNeighJacobian(), DGKernel::computeElemNeighJacobian(), ElemElemConstraint::computeElemNeighJacobian(), ArrayDGKernel::computeElemNeighJacobian(), TimeDerivative::computeJacobian(), VectorTimeDerivative::computeJacobian(), ScalarKernel::computeJacobian(), MassLumpedTimeDerivative::computeJacobian(), Kernel::computeJacobian(), ODEKernel::computeJacobian(), VectorKernel::computeJacobian(), ArrayKernel::computeJacobian(), VectorIntegratedBC::computeJacobian(), IntegratedBC::computeJacobian(), EigenKernel::computeJacobian(), ArrayIntegratedBC::computeJacobian(), NodalEqualValueConstraint::computeJacobian(), NodeElemConstraint::computeJacobian(), NonlocalIntegratedBC::computeJacobian(), KernelGrad::computeJacobian(), KernelValue::computeJacobian(), NonlocalKernel::computeJacobian(), MortarConstraint::computeJacobian(), NodeFaceConstraint::computeJacobian(), LowerDIntegratedBC::computeLowerDJacobian(), ArrayLowerDIntegratedBC::computeLowerDJacobian(), DGLowerDKernel::computeLowerDJacobian(), ArrayDGLowerDKernel::computeLowerDJacobian(), LowerDIntegratedBC::computeLowerDOffDiagJacobian(), ArrayLowerDIntegratedBC::computeLowerDOffDiagJacobian(), DGKernel::computeOffDiagElemNeighJacobian(), ArrayDGKernel::computeOffDiagElemNeighJacobian(), VectorKernel::computeOffDiagJacobian(), Kernel::computeOffDiagJacobian(), ArrayKernel::computeOffDiagJacobian(), EigenKernel::computeOffDiagJacobian(), IntegratedBC::computeOffDiagJacobian(), VectorIntegratedBC::computeOffDiagJacobian(), ArrayIntegratedBC::computeOffDiagJacobian(), NodeElemConstraint::computeOffDiagJacobian(), NonlocalKernel::computeOffDiagJacobian(), NonlocalIntegratedBC::computeOffDiagJacobian(), KernelGrad::computeOffDiagJacobian(), KernelValue::computeOffDiagJacobian(), NodeFaceConstraint::computeOffDiagJacobian(), ODEKernel::computeOffDiagJacobianScalar(), VectorKernel::computeOffDiagJacobianScalar(), ArrayKernel::computeOffDiagJacobianScalar(), IntegratedBC::computeOffDiagJacobianScalar(), VectorIntegratedBC::computeOffDiagJacobianScalar(), Kernel::computeOffDiagJacobianScalar(), ArrayIntegratedBC::computeOffDiagJacobianScalar(), ScalarLagrangeMultiplier::computeOffDiagJacobianScalar(), MortarScalarBase::computeOffDiagJacobianScalar(), KernelScalarBase::computeOffDiagJacobianScalarLocal(), DGLowerDKernel::computeOffDiagLowerDJacobian(), ArrayDGLowerDKernel::computeOffDiagLowerDJacobian(), MortarScalarBase::computeScalarJacobian(), KernelScalarBase::computeScalarJacobian(), MortarScalarBase::computeScalarOffDiagJacobian(), KernelScalarBase::computeScalarOffDiagJacobian(), KernelScalarBase::computeScalarOffDiagJacobianScalar(), MortarScalarBase::computeScalarOffDiagJacobianScalar(), prepareMatrixTag(), prepareMatrixTagLower(), and prepareMatrixTagNeighbor().

◆ _local_re

DenseVector<Number> TaggingInterface::_local_re
protected

Holds local residual entries as they are accumulated by this Kernel.

Definition at line 404 of file TaggingInterface.h.

Referenced by accumulateTaggedLocalResidual(), FVInterfaceKernel::addResidual(), assignTaggedLocalResidual(), checkForNans(), ADDGKernel::computeElemNeighResidual(), DGKernel::computeElemNeighResidual(), ElemElemConstraint::computeElemNeighResidual(), ArrayDGKernel::computeElemNeighResidual(), DGLowerDKernel::computeLowerDResidual(), ArrayDGLowerDKernel::computeLowerDResidual(), ScalarKernel::computeResidual(), Kernel::computeResidual(), VectorKernel::computeResidual(), LowerDIntegratedBC::computeResidual(), ArrayKernel::computeResidual(), VectorTimeKernel::computeResidual(), ODEKernel::computeResidual(), TimeKernel::computeResidual(), ODETimeKernel::computeResidual(), ADScalarKernel::computeResidual(), ArrayLowerDIntegratedBC::computeResidual(), VectorIntegratedBC::computeResidual(), IntegratedBC::computeResidual(), ArrayIntegratedBC::computeResidual(), ADArrayKernel::computeResidual(), NodeElemConstraint::computeResidual(), EigenKernel::computeResidual(), NodalEqualValueConstraint::computeResidual(), ADDiracKernel::computeResidual(), ADMortarConstraint::computeResidual(), FVBoundaryScalarLagrangeMultiplierConstraint::computeResidual(), FVScalarLagrangeMultiplierConstraint::computeResidual(), MortarConstraint::computeResidual(), FVFluxBC::computeResidual(), KernelValue::computeResidual(), KernelGrad::computeResidual(), FVElementalKernel::computeResidual(), FVFluxKernel::computeResidual(), NodeFaceConstraint::computeResidual(), prepareVectorTagInternal(), prepareVectorTagLower(), and prepareVectorTagNeighbor().

◆ _matrix_tags

std::set<TagID> TaggingInterface::_matrix_tags
private

◆ _moose_object

const MooseObject& TaggingInterface::_moose_object
private

Moose objct this tag works on.

Definition at line 459 of file TaggingInterface.h.

Referenced by checkForNans(), and TaggingInterface().

◆ _non_ref_abs_vector_tags

std::set<TagID> TaggingInterface::_non_ref_abs_vector_tags
private

A set to hold absolute value vector tags excluding the reference residual tag.

If there is no reference residual problem, this container is the same as _abs_vector_tags;

Definition at line 446 of file TaggingInterface.h.

Referenced by prepareVectorTag(), and TaggingInterface().

◆ _non_ref_vector_tags

std::set<TagID> TaggingInterface::_non_ref_vector_tags
private

A set to hold vector tags excluding the reference residual tag.

If there is no reference residual problem, this container is the same as _vector_tags;

Definition at line 442 of file TaggingInterface.h.

Referenced by prepareVectorTag(), and TaggingInterface().

◆ _nonlocal_ke

DenseMatrix<Number> TaggingInterface::_nonlocal_ke
protected

◆ _re_blocks

std::vector<DenseVector<Number> *> TaggingInterface::_re_blocks
private

◆ _ref_abs_vector_tags

std::set<TagID> TaggingInterface::_ref_abs_vector_tags
private

A set of either size 1 or 0.

If we have a reference residual problem and _abs_vector_tags holds the reference vector tag, then this set holds the reference vector tags, otherwise it holds nothing

Definition at line 456 of file TaggingInterface.h.

Referenced by prepareVectorTag(), and TaggingInterface().

◆ _ref_vector_tags

std::set<TagID> TaggingInterface::_ref_vector_tags
private

A set of either size 1 or 0.

If we have a reference residual problem and _vector_tags holds the reference vector tag, then this set holds the reference vector tags, otherwise it holds nothing

Definition at line 451 of file TaggingInterface.h.

Referenced by prepareVectorTag(), and TaggingInterface().

◆ _subproblem

SubProblem& TaggingInterface::_subproblem
protected

◆ _tag_params

const InputParameters& TaggingInterface::_tag_params
private

Parameters from moose object.

Definition at line 462 of file TaggingInterface.h.

Referenced by TaggingInterface().

◆ _vector_tags

std::set<TagID> TaggingInterface::_vector_tags
private

The documentation for this class was generated from the following files: