67 mooseError(
"computeOffDiagJacobian() is not used for Kokkos residual objects.");
132 const unsigned int i,
133 const unsigned int comp = 0)
const;
144 const unsigned int comp = 0)
const;
156 const unsigned int i,
157 const unsigned int j,
158 const unsigned int jvar,
159 const unsigned int comp = 0)
const;
171 const unsigned int jvar,
172 const unsigned int comp = 0)
const;
179 template <
typename function>
186 template <
typename function>
206 KOKKOS_FUNCTION
inline void 209 const unsigned int i,
210 const unsigned int comp)
const 222 if (sys.isResidualTagActive(tag))
228 ::Kokkos::atomic_add(&sys.getVectorDofValue(dof, tag), local_re);
233 KOKKOS_FUNCTION
inline void 237 const unsigned int comp)
const 249 if (sys.isResidualTagActive(tag))
252 sys.getVectorDofValue(dof, tag) += local_re;
254 sys.getVectorDofValue(dof, tag) = local_re;
259 KOKKOS_FUNCTION
inline void 262 const unsigned int i,
263 const unsigned int j,
264 const unsigned int jvar,
265 const unsigned int comp)
const 272 auto col = sys.getElemGlobalDofIndex(elem, j, jvar);
278 if (sys.isMatrixTagActive(tag))
284 ::Kokkos::atomic_add(&sys.getMatrixValue(row, col, tag), local_ke);
289 KOKKOS_FUNCTION
inline void 293 const unsigned int jvar,
294 const unsigned int comp)
const 301 auto col = sys.getNodeGlobalDofIndex(node, jvar);
307 if (sys.isMatrixTagActive(tag))
309 auto & matrix = sys.getMatrix(tag);
312 matrix(row, col) += local_ke;
316 matrix(row, col) = local_ke;
322 template <
typename function>
333 for (
unsigned int batch = 0; batch < num_batches; ++batch)
338 for (
unsigned int i = ib; i < ie; ++i)
339 local_re[i - ib] = 0;
341 body(local_re - ib, ib, ie);
343 for (
unsigned int i = ib; i < ie; ++i)
348 template <
typename function>
359 for (
unsigned int batch = 0; batch < num_batches; ++batch)
364 for (
unsigned int ij = ijb; ij < ije; ++ij)
365 local_ke[ij - ijb] = 0;
367 body(local_ke - ijb, ijb, ije);
369 for (
unsigned int ij = ijb; ij < ije; ++ij)
371 unsigned int i = ij % datum.
n_jdofs();
372 unsigned int j = ij / datum.
n_jdofs();
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.
std::unique_ptr< DispatcherBase > _jacobian_dispatcher
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.
std::unique_ptr< DispatcherBase > _offdiag_jacobian_dispatcher
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.
std::unique_ptr< DispatcherBase > _residual_dispatcher
Kokkos functor dispatchers.
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.