https://mooseframework.inl.gov
KokkosVariableTimeIntegrationAux.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 "KokkosAuxKernel.h"
13 
20 {
21 public:
23 
25 
26  template <typename Derived>
27  KOKKOS_FUNCTION Real computeValue(const unsigned int qp, AssemblyDatum & datum) const;
28 
29 protected:
30  KOKKOS_FUNCTION Real getIntegralValue(const unsigned int qp, AssemblyDatum & datum) const;
31 
33  const Real _coef;
34  const unsigned int _order;
36 
41 };
42 
43 template <typename Derived>
44 KOKKOS_FUNCTION Real
46 {
47  Real integral = getIntegralValue(qp, datum);
48 
49  if (_order == 3)
50  return _u_older(datum, qp) + _coef * integral;
51 
52  return _u_old(datum, qp) + _coef * integral;
53 }
54 
55 KOKKOS_FUNCTION inline Real
57  AssemblyDatum & datum) const
58 {
59  Real integral_value = 0.0;
60 
61  for (unsigned int i = 0; i < _order; ++i)
62  integral_value += _integration_coef[i] * _coupled_vars[i](datum, qp) * _dt;
63 
71  if (_order == 3 && _dt != _dt_old)
72  {
73  Real x0 = 0.0;
74  Real x1 = _dt_old;
75  Real x2 = _dt + _dt_old;
76  Real y0 = _coupled_vars[2](datum, qp);
77  Real y1 = _coupled_vars[1](datum, qp);
78  Real y2 = _coupled_vars[0](datum, qp);
79  Real term1 = (x2 - x0) * (y0 + (x2 - x0) * (y1 - y0) / (2.0 * (x1 - x0)));
80  Real term2 = (2.0 * x2 * x2 - x0 * x2 - x0 * x0 + 3.0 * x0 * x1 - 3.0 * x1 * x2) / 6.0;
81  Real term3 = (y2 - y1) / (x2 - x1) - (y1 - y0) / (x1 - x0);
82  integral_value = term1 + term2 * term3;
83  }
84 
85  return integral_value;
86 }
Moose::Kokkos::Array< Moose::Kokkos::VariableValue > _coupled_vars
The Kokkos array class.
Definition: KokkosArray.h:64
const Moose::Kokkos::VariableValue _u_old
The old variable value (zero if order == 3)
The base class for a user to derive their own Kokkos auxiliary kernels.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
KokkosVariableTimeIntegrationAux(const InputParameters &parameters)
const Moose::Kokkos::VariableValue _u_older
The older variable value (zero if order != 3)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
An AuxKernel that can be used to integrate a field variable in time using a variety of different inte...
KOKKOS_FUNCTION Real getIntegralValue(const unsigned int qp, AssemblyDatum &datum) const
The Kokkos wrapper classes for MOOSE-like variable value access.
Scalar< Real > _dt_old
Size of the old time step.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
The Kokkos object that holds thread-private data in the parallel operations of Kokkos kernels...
Definition: KokkosDatum.h:364
Scalar< Real > _dt
Time step size.
static InputParameters validParams()
KOKKOS_FUNCTION Real computeValue(const unsigned int qp, AssemblyDatum &datum) const