https://mooseframework.inl.gov
KokkosTimeKernel.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "KokkosKernel.h"
13 
14 namespace Moose::Kokkos
15 {
16 
20 class TimeKernel : public Kernel
21 {
22 public:
24 
29 
37  KOKKOS_FUNCTION void computeResidualAdditional(const unsigned int /* ib */,
38  const unsigned int /* ie */,
39  AssemblyDatum & /* datum */,
40  Real * /* local_re */) const
41  {
42  }
43 
48  template <typename Derived>
49  KOKKOS_FUNCTION void computeResidualInternal(const Derived & kernel, AssemblyDatum & datum) const;
50 
51 protected:
60 };
61 
62 template <typename Derived>
63 KOKKOS_FUNCTION void
64 TimeKernel::computeResidualInternal(const Derived & kernel, AssemblyDatum & datum) const
65 {
67  datum,
68  [&](Real * local_re, const unsigned int ib, const unsigned int ie)
69  {
70  for (unsigned int qp = 0; qp < datum.n_qps(); ++qp)
71  for (unsigned int i = ib; i < ie; ++i)
72  local_re[i] += datum.JxW(qp) * kernel.template computeQpResidual<Derived>(i, qp, datum);
73 
74  kernel.computeResidualAdditional(ib, ie, datum, local_re);
75  });
76 }
77 
78 } // namespace Moose::Kokkos
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
KOKKOS_FUNCTION void computeResidualInternal(const Derived &kernel, AssemblyDatum &datum) const
The parallel computation body that hides the base class method to allow additional computation for re...
The base class for Kokkos time-derivative kernels.
const Scalar< const Real > _du_dot_du
Derivative of u_dot with respect to u.
TimeKernel(const InputParameters &parameters)
Constructor.
const VariableValue _u_dot
Time derivative of the current solution at quadrature points.
KOKKOS_FUNCTION unsigned int n_qps() const
Get the number of local quadrature points.
Definition: KokkosDatum.h:118
The Kokkos wrapper classes for MOOSE-like variable value access.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
KOKKOS_FUNCTION void computeResidualAdditional(const unsigned int, const unsigned int, AssemblyDatum &, Real *) const
Hook for additional computation for residual after the standard calls.
The Kokkos object that holds thread-private data in the parallel operations of Kokkos kernels...
Definition: KokkosDatum.h:364
KOKKOS_FUNCTION Real JxW(const unsigned int qp)
Get the transformed Jacobian weight.
Definition: KokkosDatum.h:311
The base class for a user to derive their own Kokkos kernels.
Definition: KokkosKernel.h:39
KOKKOS_FUNCTION void computeResidualInternal(AssemblyDatum &datum, function body) const
The common loop structure template for computing elemental residual.