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 simple Vacuum BC for neutron diffusion on the boundary. 16 : * Vacuum BC is defined as \f$ D\frac{du}{dn}+\frac{u}{2} = 0\f$, where u is neutron flux. 17 : * Hence, \f$ D\frac{du}{dn}=-\frac{u}{2} \f$ and \f$ -\frac{u}{2} \f$ is substituted into 18 : * the Neumann BC term produced from integrating the diffusion operator by parts. 19 : */ 20 : class KokkosVacuumBC final : public Moose::Kokkos::IntegratedBC<KokkosVacuumBC> 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : KokkosVacuumBC(const InputParameters & parameters); 26 : 27 : KOKKOS_FUNCTION Real computeQpResidual(const unsigned int i, 28 : const unsigned int qp, 29 : ResidualDatum & datum) const; 30 : KOKKOS_FUNCTION Real computeQpJacobian(const unsigned int i, 31 : const unsigned int j, 32 : const unsigned int qp, 33 : ResidualDatum & datum) const; 34 : 35 : private: 36 : /// Ratio of u to du/dn 37 : const Real _alpha; 38 : }; 39 : 40 : KOKKOS_FUNCTION inline Real 41 13200 : KokkosVacuumBC::computeQpResidual(const unsigned int i, 42 : const unsigned int qp, 43 : ResidualDatum & datum) const 44 : { 45 13200 : return _test(datum, i, qp) * _alpha * _u(datum, qp) / 2.; 46 : } 47 : 48 : KOKKOS_FUNCTION inline Real 49 3840 : KokkosVacuumBC::computeQpJacobian(const unsigned int i, 50 : const unsigned int j, 51 : const unsigned int qp, 52 : ResidualDatum & datum) const 53 : { 54 3840 : return _test(datum, i, qp) * _alpha * _phi(datum, j, qp) / 2.; 55 : }