66 mooseError(
"computeOffDiagJacobian() is not used for Kokkos residual objects.");
123 const unsigned int i,
124 const unsigned int comp = 0)
const;
135 const unsigned int comp = 0)
const;
147 const unsigned int i,
148 const unsigned int j,
149 const unsigned int jvar,
150 const unsigned int comp = 0)
const;
162 const unsigned int jvar,
163 const unsigned int comp = 0)
const;
170 template <
typename function>
177 template <
typename function>
197 KOKKOS_FUNCTION
inline void 200 const unsigned int i,
201 const unsigned int comp)
const 213 if (sys.isResidualTagActive(tag))
219 ::Kokkos::atomic_add(&sys.getVectorDofValue(dof, tag), local_re);
224 KOKKOS_FUNCTION
inline void 228 const unsigned int comp)
const 240 if (sys.isResidualTagActive(tag))
243 sys.getVectorDofValue(dof, tag) += local_re;
245 sys.getVectorDofValue(dof, tag) = local_re;
250 KOKKOS_FUNCTION
inline void 253 const unsigned int i,
254 const unsigned int j,
255 const unsigned int jvar,
256 const unsigned int comp)
const 263 auto col = sys.getElemGlobalDofIndex(elem, j, jvar);
269 if (sys.isMatrixTagActive(tag))
275 ::Kokkos::atomic_add(&sys.getMatrixValue(row, col, tag), local_ke);
280 KOKKOS_FUNCTION
inline void 284 const unsigned int jvar,
285 const unsigned int comp)
const 292 auto col = sys.getNodeGlobalDofIndex(node, jvar);
298 if (sys.isMatrixTagActive(tag))
300 auto & matrix = sys.getMatrix(tag);
303 matrix(row, col) += local_ke;
307 matrix(row, col) = local_ke;
313 template <
typename function>
324 for (
unsigned int batch = 0; batch < num_batches; ++batch)
329 for (
unsigned int i = ib; i < ie; ++i)
330 local_re[i - ib] = 0;
332 body(local_re - ib, ib, ie);
334 for (
unsigned int i = ib; i < ie; ++i)
339 template <
typename function>
350 for (
unsigned int batch = 0; batch < num_batches; ++batch)
355 for (
unsigned int ij = ijb; ij < ije; ++ij)
356 local_ke[ij - ijb] = 0;
358 body(local_ke - ijb, ijb, ije);
360 for (
unsigned int ij = ijb; ij < ije; ++ij)
362 unsigned int i = ij % datum.
n_jdofs();
363 unsigned int j = ij / datum.
n_jdofs();
373 #define usingKokkosResidualObjectMembers \ 375 usingPostprocessorInterfaceMembers; \ 378 using Moose::Kokkos::ResidualObject::kokkosAssembly; \ 379 using Moose::Kokkos::ResidualObject::kokkosSystems; \ 380 using Moose::Kokkos::ResidualObject::kokkosSystem; \ 381 using Moose::Kokkos::ResidualObject::accumulateTaggedElementalResidual; \ 382 using Moose::Kokkos::ResidualObject::accumulateTaggedNodalResidual; \ 383 using Moose::Kokkos::ResidualObject::accumulateTaggedElementalMatrix; \ 384 using Moose::Kokkos::ResidualObject::accumulateTaggedNodalMatrix; \ 385 using Moose::Kokkos::ResidualObject::_var; \ 386 using Moose::Kokkos::ResidualObject::_kokkos_var; \ 387 using Moose::Kokkos::ResidualObject::_thread; \ 388 using Moose::Kokkos::ResidualObject::_t; \ 389 using Moose::Kokkos::ResidualObject::_t_old; \ 390 using Moose::Kokkos::ResidualObject::_t_step; \ 391 using Moose::Kokkos::ResidualObject::_dt; \ 392 using Moose::Kokkos::ResidualObject::_dt_old; \ 395 using Moose::Kokkos::ResidualObject::ResidualLoop; \ 396 using Moose::Kokkos::ResidualObject::JacobianLoop; \ 397 using Moose::Kokkos::ResidualObject::OffDiagJacobianLoop
KOKKOS_FUNCTION unsigned int n_jdofs() const
Get the number of local DOFs for the coupled variable.
KOKKOS_FUNCTION dof_id_type getElemLocalDofIndex(ContiguousElementID elem, unsigned int i, unsigned int var) const
Get the local DOF index of a variable for an element.
Scalar< Real > _dt_old
Size of the old time step.
KOKKOS_FUNCTION unsigned int sys(unsigned int comp=0) const
Get the system number of a component.
Scalar< Real > _t
TODO: Move to TransientInterface.
dof_id_type ContiguousElementID
KOKKOS_FUNCTION void computeJacobianInternal(ResidualDatum &datum, function body) const
The common loop structure template for computing elemental Jacobian.
Array< bool > _is_extra_vector_tag
Flag whether each tag.
const InputParameters & parameters() const
Get the parameters of the object.
ResidualObject(const InputParameters ¶meters, Moose::VarFieldType field_type, bool nodal=false)
Constructor.
KOKKOS_FUNCTION void accumulateTaggedNodalResidual(const bool add, const Real local_re, const ContiguousNodeID node, const unsigned int comp=0) const
Accumulate or set local nodal residual contribution to tagged vectors.
KOKKOS_FUNCTION dof_id_type getNodeLocalDofIndex(ContiguousNodeID node, unsigned int var) const
Get the local DOF index of a variable for a node.
virtual void computeOffDiagJacobian(unsigned int) override final
Computes this object's contribution to off-diagonal blocks of the system Jacobian matrix...
The base class for Kokkos residual objects.
Thread _thread
Kokkos thread object.
MooseVariableFieldBase & _var
Reference of the MOOSE variable.
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual void computeResidualAndJacobian() override final
Compute this object's contribution to the residual and Jacobian simultaneously.
The Kokkos interface that holds the host reference of the Kokkos systems and copies it to device duri...
The Kokkos interface that holds the host reference of the Kokkos mesh and copies it to device during ...
KOKKOS_FUNCTION unsigned int n_dofs() const
Get the number of local DOFs.
KOKKOS_FUNCTION void accumulateTaggedElementalMatrix(const Real local_ke, const ContiguousElementID elem, const unsigned int i, const unsigned int j, const unsigned int jvar, const unsigned int comp=0) const
Accumulate local elemental Jacobian contribution to tagged matrices.
dof_id_type ContiguousNodeID
virtual void computeResidual()=0
Compute this object's contribution to the residual.
KOKKOS_FUNCTION const System & kokkosSystem(unsigned int sys) const
Get the const reference of a Kokkos system.
The Kokkos interface that holds the host reference of the Kokkos assembly and copies it to device dur...
virtual void computeJacobian()=0
Compute this object's contribution to the diagonal Jacobian entries.
Array< bool > _is_extra_matrix_tag
Scalar< const Real > _t_old
Old time.
Scalar< int > _t_step
The number of the time step.
constexpr unsigned int MAX_CACHED_DOF
Maximum number of DOFs to cache during residual and Jacobian computation.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
The Kokkos variable object that carries the coupled variable and tag information. ...
KOKKOS_FUNCTION void accumulateTaggedElementalResidual(const Real local_re, const ContiguousElementID elem, const unsigned int i, const unsigned int comp=0) const
Accumulate local elemental residual contribution to tagged vectors.
KOKKOS_FUNCTION const ElementInfo & elem() const
Get the element information object.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
KOKKOS_FUNCTION void computeResidualInternal(ResidualDatum &datum, function body) const
The common loop structure template for computing elemental residual.
Scalar< Real > _dt
Time step size.
Variable _kokkos_var
Kokkos variable.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
KOKKOS_FUNCTION unsigned int var(unsigned int comp=0) const
Get the variable number of a component.
auto min(const L &left, const R &right)
static InputParameters validParams()
KOKKOS_FUNCTION unsigned int jvar() const
Get the coupled variable number.
Array< TagID > _vector_tags
Tags this object operates on.
The Kokkos object that holds thread-private data in the parallel operations of Kokkos residual object...
KOKKOS_FUNCTION void accumulateTaggedNodalMatrix(const bool add, const Real local_ke, const ContiguousNodeID node, const unsigned int jvar, const unsigned int comp=0) const
Accumulate or set local nodal Jacobian contribution to tagged matrices.
Array< TagID > _matrix_tags
The Kokkos thread object that aids in converting the one-dimensional thread index into multi-dimensio...
KOKKOS_FUNCTION unsigned int n_idofs() const
Get the number of local DOFs.
virtual const MooseVariableBase & variable() const override
Returns the variable that this object operates on.
ContiguousElementID id
Contiguous element ID.