https://mooseframework.inl.gov
KokkosLowerBoundNodalKernel.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 KokkosLowerBoundNodalKernel final : public KokkosBoundNodalKernel<KokkosLowerBoundNodalKernel>
18 {
19 public:
21 
23 
24  KOKKOS_FUNCTION Real getResidual(const unsigned int qp, ResidualDatum & datum) const;
25  KOKKOS_FUNCTION Real getJacobian(const unsigned int qp, ResidualDatum & datum) const;
26  KOKKOS_FUNCTION Real getOffDiagJacobian(const unsigned int jvar,
27  const unsigned int qp,
28  ResidualDatum & datum) const;
29 
30 private:
33 };
34 
35 KOKKOS_FUNCTION inline Real
36 KokkosLowerBoundNodalKernel::getResidual(const unsigned int qp, ResidualDatum & datum) const
37 {
38  return ::Kokkos::min(_u(datum, qp), _v(datum, qp) - _lower_bound);
39 }
40 
41 KOKKOS_FUNCTION inline Real
42 KokkosLowerBoundNodalKernel::getJacobian(const unsigned int qp, ResidualDatum & datum) const
43 {
44  if (_u(datum, qp) <= _v(datum, qp) - _lower_bound)
45  return 1;
46 
47  return 0;
48 }
49 
50 KOKKOS_FUNCTION inline Real
52  const unsigned int qp,
53  ResidualDatum & datum) const
54 {
55  if (jvar == _v_var)
56  if (_v(datum, qp) - _lower_bound < _u(datum, qp))
57  return 1;
58 
59  return 0;
60 }
KOKKOS_FUNCTION Real getResidual(const unsigned int qp, ResidualDatum &datum) const
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
KOKKOS_FUNCTION Real getOffDiagJacobian(const unsigned int jvar, const unsigned int qp, ResidualDatum &datum) const
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
KokkosLowerBoundNodalKernel(const InputParameters &parameters)
const Real _lower_bound
The lower bound on the coupled variable.
Class used to enforce a lower bound on a coupled variable.
const unsigned int _v_var
The number of the coupled variable.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableValue _u
Current solution at nodes.
const Moose::Kokkos::VariableValue _v
The value of the coupled variable.
KOKKOS_FUNCTION Real getJacobian(const unsigned int qp, ResidualDatum &datum) const
static InputParameters validParams()
auto min(const L &left, const R &right)
The Kokkos object that holds thread-private data in the parallel operations of Kokkos residual object...
Definition: KokkosDatum.h:245