https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
21public:
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>
34 KOKKOS_FUNCTION Real computeBoundaryMatrixContribution(
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
40private:
42 KOKKOS_FUNCTION Real normalFaceFlux(const FVDatum & datum) const;
43
46};
47
48template <typename Derived>
49KOKKOS_FUNCTION Real
51{
52 const auto face_flux = normalFaceFlux(datum);
53 return face_flux > 0 ? face_flux * datum.faceArea() : 0;
54}
55
56template <typename Derived>
57KOKKOS_FUNCTION Real
59{
60 const auto face_flux = normalFaceFlux(datum);
61 return face_flux < 0 ? face_flux * datum.faceArea() : 0;
62}
63
64template <typename Derived>
65KOKKOS_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
73template <typename Derived>
74KOKKOS_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
81KOKKOS_FUNCTION inline Real
83{
84 return _velocity * datum.faceNormal();
85}
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Kokkos linear finite volume flux kernel implementing first-order upwind advection with a constant vel...
static InputParameters validParams()
KOKKOS_FUNCTION Real computeBoundaryRightHandSideContribution(const FVDatum &datum, const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
KOKKOS_FUNCTION Real computeInternalNeighborMatrixContribution(const FVDatum &datum) const
const Moose::Kokkos::Real3 _velocity
Constant advecting velocity vector.
KokkosLinearFVAdvection(const InputParameters &parameters)
virtual bool hasInternalRightHandSideContribution() const override
Whether this kernel has nonzero internal-face RHS contributions.
KOKKOS_FUNCTION Real computeInternalMatrixContribution(const FVDatum &datum) const
KOKKOS_FUNCTION Real computeBoundaryMatrixContribution(const FVDatum &datum, const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
KOKKOS_FUNCTION Real normalFaceFlux(const FVDatum &datum) const
Normal advective face flux.
virtual bool needsBoundaryValueData() const override
Whether this kernel needs boundary value data from its boundary conditions.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Device-side geometric context for finite volume kernels and boundary conditions.
KOKKOS_FUNCTION Real faceArea() const
Get the coordinate-weighted area of the current element side.
KOKKOS_FUNCTION Real3 faceNormal() const
Get the outward unit normal of the current element side.
Base class for Kokkos linear finite volume kernels that contribute on faces (flux terms).
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 boundaryValueCoefficient(const int bc_index, const MOOSE_KOKKOS_INDEX_TYPE bc_face_index) const
Boundary value coefficient for this boundary face.