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 "KokkosLinearFVElementalKernel.h" 13 : #include "KokkosParsedFunction.h" 14 : 15 : /** 16 : * Kokkos linear finite volume elemental kernel that adds a scaled volumetric source to the 17 : * right-hand side. It is the Kokkos analog of LinearFVSource. 18 : */ 19 : class KokkosLinearFVSource : public Moose::Kokkos::LinearFVElementalKernel 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : KokkosLinearFVSource(const InputParameters & parameters); 25 : 26 : template <typename Derived> 27 : KOKKOS_FUNCTION Real computeRightHandSideContribution(const FVDatum & datum) const; 28 : 29 : private: 30 : /// The source density 31 : const Moose::Kokkos::ReferenceWrapper<const KokkosParsedFunction> _source_density; 32 : /// Coefficient for multiplying the surface density 33 : const Moose::Kokkos::ReferenceWrapper<const KokkosParsedFunction> _scale; 34 : }; 35 : 36 : template <typename Derived> 37 : KOKKOS_FUNCTION inline Real 38 10610 : KokkosLinearFVSource::computeRightHandSideContribution(const FVDatum & datum) const 39 : { 40 10610 : const auto centroid = datum.elementCentroid(); 41 10610 : return _scale->value(_t, centroid) * _source_density->value(_t, centroid) * datum.elementVolume(); 42 : }