LCOV - code coverage report
Current view: top level - include/kokkos/bcs - KokkosMatchedValueBC.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 5 6 83.3 %
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 "KokkosNodalBC.h"
      13             : 
      14             : /**
      15             :  * Implements a simple coupled boundary condition where u=v on the boundary.
      16             :  */
      17             : class KokkosMatchedValueBC : public Moose::Kokkos::NodalBC
      18             : {
      19             : public:
      20             :   static InputParameters validParams();
      21             : 
      22             :   KokkosMatchedValueBC(const InputParameters & parameters);
      23             : 
      24             :   template <typename Derived>
      25             :   KOKKOS_FUNCTION Real computeQpResidual(const unsigned int qp, AssemblyDatum & datum) const;
      26             :   template <typename Derived>
      27             :   KOKKOS_FUNCTION Real computeQpOffDiagJacobian(const unsigned int jvar,
      28             :                                                 const unsigned int qp,
      29             :                                                 AssemblyDatum & datum) const;
      30             : 
      31             : protected:
      32             :   const Moose::Kokkos::VariableValue _v;
      33             : 
      34             :   /// The id of the coupled variable
      35             :   const unsigned int _v_num;
      36             :   /// Coefficient for primary variable
      37             :   const Real _u_coeff;
      38             :   /// Coefficient for coupled variable
      39             :   const Real _v_coeff;
      40             : };
      41             : 
      42             : template <typename Derived>
      43             : KOKKOS_FUNCTION Real
      44          36 : KokkosMatchedValueBC::computeQpResidual(const unsigned int qp, AssemblyDatum & datum) const
      45             : {
      46          36 :   return _u_coeff * _u(datum, qp) - _v_coeff * _v(datum, qp);
      47             : }
      48             : 
      49             : template <typename Derived>
      50             : KOKKOS_FUNCTION Real
      51          18 : KokkosMatchedValueBC::computeQpOffDiagJacobian(const unsigned int jvar,
      52             :                                                const unsigned int /* qp */,
      53             :                                                AssemblyDatum & /* datum */) const
      54             : {
      55          18 :   if (jvar == _v_num)
      56          18 :     return -_v_coeff;
      57             :   else
      58           0 :     return 0;
      59             : }

Generated by: LCOV version 1.14