Line data Source code
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 : 12 : #include "KokkosLinearFVBoundaryCondition.h" 13 : #include "KokkosParsedFunction.h" 14 : 15 : /** 16 : * Provides prescribed outward normal gradient relations for Kokkos linear finite volume kernels. 17 : */ 18 : class KokkosLinearFVFunctorNeumannBC : public Moose::Kokkos::LinearFVBoundaryCondition 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : KokkosLinearFVFunctorNeumannBC(const InputParameters & parameters); 24 : 25 : template <typename Derived> 26 : KOKKOS_FUNCTION BoundaryRelation computeBoundaryValue(const FVDatum & datum) const; 27 : template <typename Derived> 28 : KOKKOS_FUNCTION BoundaryRelation computeBoundaryNormalGradient(const FVDatum & datum) const; 29 : 30 : private: 31 : /// The functor providing the outward normal gradient on the boundary 32 : const Moose::Kokkos::ReferenceWrapper<const KokkosParsedFunction> _normal_gradient_functor; 33 : }; 34 : 35 : template <typename Derived> 36 : KOKKOS_FUNCTION KokkosLinearFVFunctorNeumannBC::BoundaryRelation 37 14 : KokkosLinearFVFunctorNeumannBC::computeBoundaryValue(const FVDatum & datum) const 38 : { 39 14 : return {1, _normal_gradient_functor->value(_t, datum.faceCentroid()) * datum.faceDCFMag()}; 40 : } 41 : 42 : template <typename Derived> 43 : KOKKOS_FUNCTION KokkosLinearFVFunctorNeumannBC::BoundaryRelation 44 510 : KokkosLinearFVFunctorNeumannBC::computeBoundaryNormalGradient(const FVDatum & datum) const 45 : { 46 510 : return {0, _normal_gradient_functor->value(_t, datum.faceCentroid())}; 47 : }