https://mooseframework.inl.gov
KokkosUpperBoundNodalKernel.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 "KokkosBoundNodalKernel.h"
13 
17 class KokkosUpperBoundNodalKernel final : public KokkosBoundNodalKernel<KokkosUpperBoundNodalKernel>
18 {
19 public:
21 
23 
24  KOKKOS_FUNCTION Real getResidual(const ContiguousNodeID node) const;
25  KOKKOS_FUNCTION Real getJacobian(const ContiguousNodeID node) const;
26  KOKKOS_FUNCTION Real getOffDiagJacobian(const unsigned int jvar,
27  const ContiguousNodeID node) const;
28 
29 private:
32 };
33 
34 KOKKOS_FUNCTION inline Real
36 {
37  return ::Kokkos::min(_u(node), _upper_bound - _v(node));
38 }
39 
40 KOKKOS_FUNCTION inline Real
42 {
43  if (_u(node) <= _upper_bound - _v(node))
44  return 1;
45 
46  return 0;
47 }
48 
49 KOKKOS_FUNCTION inline Real
51  const ContiguousNodeID node) const
52 {
53  if (jvar == _v_var)
54  if (_upper_bound - _v(node) < _u(node))
55  return -1;
56 
57  return 0;
58 }
KOKKOS_FUNCTION Real getOffDiagJacobian(const unsigned int jvar, const ContiguousNodeID node) const
const Real _upper_bound
The upper bound on the coupled variable.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
Class used to enforce a upper bound on a coupled variable.
KokkosUpperBoundNodalKernel(const InputParameters &parameters)
dof_id_type ContiguousNodeID
Definition: KokkosMesh.h:21
KOKKOS_FUNCTION Real getJacobian(const ContiguousNodeID node) const
const VariableNodalValue _u
Current solution at nodes.
const unsigned int _v_var
The number of the coupled variable.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
KOKKOS_FUNCTION Real getResidual(const ContiguousNodeID node) const
const Moose::Kokkos::VariableNodalValue _v
The value of the coupled variable.
auto min(const L &left, const R &right)