LCOV - code coverage report
Current view: top level - include/kokkos/bcs - KokkosVacuumBC.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 4 4 100.0 %
Date: 2026-05-29 20:35:17 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          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 "KokkosIntegratedBCValue.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 : public Moose::Kokkos::IntegratedBCValue
      21             : {
      22             : public:
      23             :   static InputParameters validParams();
      24             : 
      25             :   KokkosVacuumBC(const InputParameters & parameters);
      26             : 
      27             :   template <typename Derived>
      28             :   KOKKOS_FUNCTION Real computeQpResidual(const unsigned int qp, AssemblyDatum & datum) const;
      29             :   template <typename Derived>
      30             :   KOKKOS_FUNCTION Real computeQpJacobian(const unsigned int j,
      31             :                                          const unsigned int qp,
      32             :                                          AssemblyDatum & datum) const;
      33             : 
      34             : private:
      35             :   /// Ratio of u to du/dn
      36             :   const Real _alpha;
      37             : };
      38             : 
      39             : template <typename Derived>
      40             : KOKKOS_FUNCTION Real
      41       13200 : KokkosVacuumBC::computeQpResidual(const unsigned int qp, AssemblyDatum & datum) const
      42             : {
      43       13200 :   return _alpha * _u(datum, qp) / 2.;
      44             : }
      45             : 
      46             : template <typename Derived>
      47             : KOKKOS_FUNCTION Real
      48         960 : KokkosVacuumBC::computeQpJacobian(const unsigned int j,
      49             :                                   const unsigned int qp,
      50             :                                   AssemblyDatum & datum) const
      51             : {
      52         960 :   return _alpha * _phi(datum, j, qp) / 2.;
      53             : }

Generated by: LCOV version 1.14