Line data Source code
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 "KokkosADIntegratedBC.h" 13 : 14 : /** 15 : * Implements a Neumann BC where grad(u)=_coupled_var on the boundary. 16 : * Uses the term produced from integrating the diffusion operator by parts. 17 : */ 18 : class KokkosADCoupledVarNeumannBC : public Moose::Kokkos::ADIntegratedBC 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : KokkosADCoupledVarNeumannBC(const InputParameters & parameters); 24 : 25 : template <typename Derived> 26 : KOKKOS_FUNCTION Moose::Kokkos::ADReal 27 : computeQpResidual(const unsigned int i, const unsigned int qp, AssemblyDatum & datum) const; 28 : 29 : protected: 30 : /// Variable providing the value of grad(u) on the boundary. 31 : const Moose::Kokkos::ADVariableValue _coupled_var; 32 : 33 : /// A coefficient that is multiplied with the residual contribution 34 : const Real _coef; 35 : 36 : /// Scale factor 37 : const Moose::Kokkos::ADVariableValue _scale_factor; 38 : }; 39 : 40 : template <typename Derived> 41 : KOKKOS_FUNCTION Moose::Kokkos::ADReal 42 15156 : KokkosADCoupledVarNeumannBC::computeQpResidual(const unsigned int i, 43 : const unsigned int qp, 44 : AssemblyDatum & datum) const 45 : { 46 15156 : return -_test(datum, i, qp) * _scale_factor(datum, qp) * _coef * _coupled_var(datum, qp); 47 : }