https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KokkosTimeKernel.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
14namespace Moose::Kokkos
15{
16
20class TimeKernel : public Kernel
21{
22public:
24
29
33 TimeKernel(const TimeKernel & object);
34
42 KOKKOS_FUNCTION void computeResidualAdditional(const unsigned int /* ib */,
43 const unsigned int /* ie */,
44 AssemblyDatum & /* datum */,
45 Real * /* local_re */) const
46 {
47 }
48
53 template <typename Derived>
54 KOKKOS_FUNCTION void computeResidualInternal(const Derived & kernel, AssemblyDatum & datum) const;
55
56protected:
65};
66
67template <typename Derived>
68KOKKOS_FUNCTION void
69TimeKernel::computeResidualInternal(const Derived & kernel, AssemblyDatum & datum) const
70{
72 datum,
73 [&](Real * local_re, const unsigned int ib, const unsigned int ie)
74 {
75 for (unsigned int qp = 0; qp < datum.n_qps(); ++qp)
76 for (unsigned int i = ib; i < ie; ++i)
77 local_re[i] += datum.JxW(qp) * kernel.template computeQpResidual<Derived>(i, qp, datum);
78
79 kernel.computeResidualAdditional(ib, ie, datum, local_re);
80 });
81}
82
83} // namespace Moose::Kokkos
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
The Kokkos array class.
The Kokkos object that holds thread-private data in the parallel operations of Kokkos kernels.
KOKKOS_FUNCTION Real JxW(const unsigned int qp)
Get the transformed Jacobian weight.
KOKKOS_FUNCTION unsigned int n_qps() const
Get the number of local quadrature points.
The base class for a user to derive their own Kokkos kernels.
KOKKOS_FUNCTION void computeResidualInternal(AssemblyDatum &datum, function body) const
The common loop structure template for computing elemental residual.
The base class for Kokkos time-derivative kernels.
KOKKOS_FUNCTION void computeResidualAdditional(const unsigned int, const unsigned int, AssemblyDatum &, Real *) const
Hook for additional computation for residual after the standard calls.
static InputParameters validParams()
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...
const VariableValue _u_dot
Time derivative of the current solution at quadrature points.
TimeKernel(const TimeKernel &object)
Copy constructor for parallel dispatch.
TimeKernel(const InputParameters &parameters)
Constructor.
Array< Real > _du_dot_du
Derivative of u_dot with respect to u.
The Kokkos wrapper classes for MOOSE-like variable value access.