75 template <
typename Derived>
81 ::Kokkos::abort(
"Default computeQpJacobian() should never be called. Make sure you properly "
82 "redefined this method in your class without typos.");
96 template <
typename Derived>
104 "Default computeQpOffDiagJacobian() should never be called. Make sure you properly "
105 "redefined this method in your class without typos.");
119 template <
typename Derived>
127 "Default computeQpOffDiagJacobianScalar() should never be called. Make sure you properly "
128 "redefined this method in your class without typos.");
140 template <
typename Derived>
143 return &Kernel::computeQpJacobian<Derived>;
145 template <
typename Derived>
148 return &Kernel::computeQpOffDiagJacobian<Derived>;
150 template <
typename Derived>
153 return &Kernel::computeQpOffDiagJacobianScalar<Derived>;
161 template <
typename Derived>
162 KOKKOS_FUNCTION
void operator()(ResidualLoop,
const ThreadID tid,
const Derived & kernel)
const;
163 template <
typename Derived>
164 KOKKOS_FUNCTION
void operator()(JacobianLoop,
const ThreadID tid,
const Derived & kernel)
const;
165 template <
typename Derived>
168 template <
typename Derived>
170 operator()(OffDiagJacobianScalarLoop,
const ThreadID tid,
const Derived & kernel)
const;
184 template <
typename Derived>
191 template <
typename Derived>
198 template <
typename Derived>
206 template <
typename Derived>
238template <
typename Derived>
255 kernel.computeResidualInternal(kernel, datum);
258template <
typename Derived>
275 kernel.computeJacobianInternal(kernel, datum);
278template <
typename Derived>
288 if (!sys.isVariableActive(jvar,
kokkosMesh().getElementInfo(elem).subdomain))
296 kernel.computeOffDiagJacobianInternal(kernel, datum);
299template <
typename Derived>
309 if (!sys.isVariableActive(jvar,
kokkosMesh().getElementInfo(elem).subdomain))
315 kernel.computeOffDiagJacobianScalarInternal(kernel, datum);
318template <
typename Derived>
324 [&](Real * local_re,
const unsigned int ib,
const unsigned int ie)
326 for (
unsigned int qp = 0; qp < datum.
n_qps(); ++qp)
327 for (
unsigned int i = ib; i < ie; ++i)
328 local_re[i] += datum.
JxW(qp) * kernel.template computeQpResidual<Derived>(i, qp, datum);
332template <
typename Derived>
338 [&](Real * local_ke,
const unsigned int ib,
const unsigned int ie,
const unsigned int j)
340 for (
unsigned int qp = 0; qp < datum.
n_qps(); ++qp)
341 for (
unsigned int i = ib; i < ie; ++i)
343 datum.
JxW(qp) * kernel.template computeQpJacobian<Derived>(i, j, qp, datum);
347template <
typename Derived>
353 [&](Real * local_ke,
const unsigned int ib,
const unsigned int ie,
const unsigned int j)
355 for (
unsigned int qp = 0; qp < datum.
n_qps(); ++qp)
356 for (
unsigned int i = ib; i < ie; ++i)
357 local_ke[i] += datum.
JxW(qp) * kernel.template computeQpOffDiagJacobian<Derived>(
358 i, j, datum.
jvar(), qp, datum);
362template <
typename Derived>
368 [&](Real * local_ke,
const unsigned int ib,
const unsigned int ie,
const unsigned int j)
370 for (
unsigned int qp = 0; qp < datum.
n_qps(); ++qp)
371 for (
unsigned int i = ib; i < ie; ++i)
372 local_ke[i] += datum.
JxW(qp) * kernel.template computeQpOffDiagJacobianScalar<Derived>(
373 i, j, datum.
jvar(), qp, datum);
KOKKOS_FUNCTION ContiguousElementID kokkosBlockElementID(Moose::Kokkos::ThreadID tid) const
Get the contiguous element ID this Kokkos thread is operating on.
const InputParameters & parameters() const
Get the parameters of the object.
The Kokkos object that holds thread-private data in the parallel operations of Kokkos kernels.
KOKKOS_FUNCTION unsigned int jvar() const
Get the coupled variable number.
KOKKOS_FUNCTION const Assembly & kokkosAssembly() const
Get the const reference of the Kokkos assembly.
KOKKOS_FUNCTION Real JxW(const unsigned int qp)
Get the transformed Jacobian weight.
KOKKOS_FUNCTION void set_local_parallel(const unsigned int local_thread_id, const unsigned int num_local_threads)
Set local parallelization option.
KOKKOS_FUNCTION unsigned int n_qps() const
Get the number of local quadrature points.
The base class for Kokkos kernels.
The base class for a user to derive their own Kokkos kernels.
static auto defaultOffDiagJacobian()
KOKKOS_FUNCTION void operator()(ResidualLoop, const ThreadID tid, const Derived &kernel) const
The parallel computation entry functions called by Kokkos.
const VariablePhiGradient _grad_phi
Gradient of the current shape function.
static auto defaultOffDiagJacobianScalar()
virtual void computeJacobian() override
Dispatch diagonal and off-diagonal Jacobian calculation.
KOKKOS_FUNCTION void computeJacobianInternal(const Derived &kernel, AssemblyDatum &datum) const
Compute diagonal Jacobian.
const VariableTestGradient _grad_test
Gradient of the current test function.
virtual void computeResidual() override
Dispatch residual calculation.
KOKKOS_FUNCTION Real computeQpJacobian(const unsigned int, const unsigned int, const unsigned int, AssemblyDatum &) const
Default methods to prevent compile errors even when these methods were not defined in the derived cla...
Kernel(const InputParameters ¶meters)
Constructor.
KOKKOS_FUNCTION Real computeQpOffDiagJacobianScalar(const unsigned int, const unsigned int, const unsigned int, const unsigned int, AssemblyDatum &) const
Compute scalar off-diagonal Jacobian contribution on a quadrature point.
const VariableValue _u
Current solution at quadrature points.
const VariableTestValue _test
Current test function.
KOKKOS_FUNCTION void computeOffDiagJacobianInternal(const Derived &kernel, AssemblyDatum &datum) const
Compute off-diagonal Jacobian.
static InputParameters validParams()
static constexpr bool supports_scalar_jacobian
static auto defaultJacobian()
Functions used to check if users have overriden the hook methods, whose calculations can be skipped w...
KOKKOS_FUNCTION void computeOffDiagJacobianScalarInternal(const Derived &kernel, AssemblyDatum &datum) const
Compute scalar off-diagonal Jacobian.
const VariablePhiValue _phi
Current shape function.
KOKKOS_FUNCTION void computeResidualInternal(const Derived &kernel, AssemblyDatum &datum) const
The parallel computation bodies that can be customized in the derived class by defining them in the d...
KOKKOS_FUNCTION Real computeQpOffDiagJacobian(const unsigned int, const unsigned int, const unsigned int, const unsigned int, AssemblyDatum &) const
Compute off-diagonal Jacobian contribution on a quadrature point.
const VariableGradient _grad_u
Gradient of the current solution at quadrature points.
KOKKOS_FUNCTION const Mesh & kokkosMesh() const
Get the const reference of the Kokkos mesh.
Variable _kokkos_var
Kokkos variable.
Thread _thread
Kokkos thread object.
KOKKOS_FUNCTION void computeJacobianInternal(AssemblyDatum &datum, function body) const
The common loop structure template for computing elemental Jacobian.
KOKKOS_FUNCTION void computeResidualInternal(AssemblyDatum &datum, function body) const
The common loop structure template for computing elemental residual.
KOKKOS_FUNCTION thread_id_type size() const
Get the total thread pool size.
The Kokkos wrapper classes for MOOSE-like shape function access.
The Kokkos wrapper classes for MOOSE-like variable value access.
KOKKOS_FUNCTION unsigned int var(unsigned int comp=0) const
Get the variable number of a component.
KOKKOS_FUNCTION unsigned int sys(unsigned int comp=0) const
Get the system number of a component.
MOOSE_KOKKOS_INDEX_TYPE ThreadID
const unsigned int invalid_uint