LCOV - code coverage report
Current view: top level - include/kokkos/bcs - KokkosMatchedValueBC.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31653 (1b668c) with base bb0a08 Lines: 5 6 83.3 %
Date: 2025-11-03 17:02:13 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             :   KOKKOS_FUNCTION Real computeQpResidual(const unsigned int qp, AssemblyDatum & datum) const;
      25             :   KOKKOS_FUNCTION Real computeQpOffDiagJacobian(const unsigned int jvar,
      26             :                                                 const unsigned int qp,
      27             :                                                 AssemblyDatum & datum) const;
      28             : 
      29             : protected:
      30             :   const Moose::Kokkos::VariableValue _v;
      31             : 
      32             :   /// The id of the coupled variable
      33             :   const unsigned int _v_num;
      34             :   /// Coefficient for primary variable
      35             :   const Real _u_coeff;
      36             :   /// Coefficient for coupled variable
      37             :   const Real _v_coeff;
      38             : };
      39             : 
      40             : KOKKOS_FUNCTION inline Real
      41          36 : KokkosMatchedValueBC::computeQpResidual(const unsigned int qp, AssemblyDatum & datum) const
      42             : {
      43          36 :   return _u_coeff * _u(datum, qp) - _v_coeff * _v(datum, qp);
      44             : }
      45             : 
      46             : KOKKOS_FUNCTION inline Real
      47          18 : KokkosMatchedValueBC::computeQpOffDiagJacobian(const unsigned int jvar,
      48             :                                                const unsigned int /* qp */,
      49             :                                                AssemblyDatum & /* datum */) const
      50             : {
      51          18 :   if (jvar == _v_num)
      52          18 :     return -_v_coeff;
      53             :   else
      54           0 :     return 0;
      55             : }

Generated by: LCOV version 1.14