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 "KokkosIntegratedBC.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 KokkosCoupledVarNeumannBC : public Moose::Kokkos::IntegratedBC 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : KokkosCoupledVarNeumannBC(const InputParameters & parameters); 24 : 25 : KOKKOS_FUNCTION Real computeQpResidual(const unsigned int i, 26 : const unsigned int qp, 27 : AssemblyDatum & datum) const; 28 : KOKKOS_FUNCTION Real computeQpOffDiagJacobian(const unsigned int i, 29 : const unsigned int j, 30 : const unsigned int jvar, 31 : const unsigned int qp, 32 : AssemblyDatum & datum) const; 33 : 34 : protected: 35 : /// Variable providing the value of grad(u) on the boundary. 36 : const Moose::Kokkos::VariableValue _coupled_var; 37 : 38 : /// The identifying number of the coupled variable 39 : const unsigned int _coupled_num; 40 : 41 : /// A coefficient that is multiplied with the residual contribution 42 : const Real _coef; 43 : 44 : /// Scale factor 45 : const Moose::Kokkos::VariableValue _scale_factor; 46 : }; 47 : 48 : KOKKOS_FUNCTION inline Real 49 29396 : KokkosCoupledVarNeumannBC::computeQpResidual(const unsigned int i, 50 : const unsigned int qp, 51 : AssemblyDatum & datum) const 52 : { 53 29396 : return -_scale_factor(datum, qp) * _coef * _test(datum, i, qp) * _coupled_var(datum, qp); 54 : } 55 : 56 : KOKKOS_FUNCTION inline Real 57 80 : KokkosCoupledVarNeumannBC::computeQpOffDiagJacobian(const unsigned int i, 58 : const unsigned int j, 59 : const unsigned int jvar, 60 : const unsigned int qp, 61 : AssemblyDatum & datum) const 62 : { 63 80 : if (jvar == _coupled_num) 64 80 : return -_scale_factor(datum, qp) * _coef * _test(datum, i, qp) * _phi(datum, j, qp); 65 : else 66 0 : return 0; 67 : }