https://mooseframework.inl.gov
KokkosLinearFVAdvection.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 
13 
20 {
21 public:
23 
25 
26  virtual bool needsBoundaryValueData() const override { return true; }
27  virtual bool hasInternalRightHandSideContribution() const override { return false; }
28 
29  template <typename Derived>
30  KOKKOS_FUNCTION Real computeInternalMatrixContribution(const FVDatum & datum) const;
31  template <typename Derived>
32  KOKKOS_FUNCTION Real computeInternalNeighborMatrixContribution(const FVDatum & datum) const;
33  template <typename Derived>
35  const FVDatum & datum, const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const;
36  template <typename Derived>
38  const FVDatum & datum, const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const;
39 
40 private:
42  KOKKOS_FUNCTION Real normalFaceFlux(const FVDatum & datum) const;
43 
46 };
47 
48 template <typename Derived>
49 KOKKOS_FUNCTION Real
51 {
52  const auto face_flux = normalFaceFlux(datum);
53  return face_flux > 0 ? face_flux * datum.faceArea() : 0;
54 }
55 
56 template <typename Derived>
57 KOKKOS_FUNCTION Real
59 {
60  const auto face_flux = normalFaceFlux(datum);
61  return face_flux < 0 ? face_flux * datum.faceArea() : 0;
62 }
63 
64 template <typename Derived>
65 KOKKOS_FUNCTION Real
67  const FVDatum & datum, const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
68 {
69  return normalFaceFlux(datum) * datum.faceArea() *
70  boundaryValueCoefficient(bc_index, bc_face_index);
71 }
72 
73 template <typename Derived>
74 KOKKOS_FUNCTION Real
76  const FVDatum & datum, const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
77 {
78  return -normalFaceFlux(datum) * datum.faceArea() * boundaryValueSource(bc_index, bc_face_index);
79 }
80 
81 KOKKOS_FUNCTION inline Real
83 {
84  return _velocity * datum.faceNormal();
85 }
KOKKOS_FUNCTION Real computeBoundaryMatrixContribution(const FVDatum &datum, const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
KokkosLinearFVAdvection(const InputParameters &parameters)
Kokkos linear finite volume flux kernel implementing first-order upwind advection with a constant vel...
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
virtual bool needsBoundaryValueData() const override
Whether this kernel needs boundary value data from its boundary conditions.
static InputParameters validParams()
KOKKOS_FUNCTION Real computeInternalMatrixContribution(const FVDatum &datum) const
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
KOKKOS_FUNCTION Real3 faceNormal() const
Get the outward unit normal of the current element side.
Definition: KokkosDatum.h:191
KOKKOS_FUNCTION Real normalFaceFlux(const FVDatum &datum) const
Normal advective face flux.
KOKKOS_FUNCTION Real boundaryValueCoefficient(const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
Boundary value coefficient for this boundary face.
KOKKOS_FUNCTION Real computeInternalNeighborMatrixContribution(const FVDatum &datum) const
Base class for Kokkos linear finite volume kernels that contribute on faces (flux terms)...
KOKKOS_FUNCTION Real computeBoundaryRightHandSideContribution(const FVDatum &datum, const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool hasInternalRightHandSideContribution() const override
Whether this kernel has nonzero internal-face RHS contributions.
Device-side geometric context for finite volume kernels and boundary conditions.
Definition: KokkosDatum.h:167
const Moose::Kokkos::Real3 _velocity
Constant advecting velocity vector.
KOKKOS_FUNCTION Real boundaryValueSource(const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
Boundary value source for this boundary face.
KOKKOS_FUNCTION Real faceArea() const
Get the coordinate-weighted area of the current element side.
Definition: KokkosDatum.h:218