LCOV - code coverage report
Current view: top level - src/kokkos/auxkernels - KokkosVariableTimeIntegrationAux.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31653 (1b668c) with base bb0a08 Lines: 39 42 92.9 %
Date: 2025-11-03 17:02:13 Functions: 3 3 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             : #include "KokkosVariableTimeIntegrationAux.h"
      11             : 
      12      187985 : registerKokkosAuxKernel("MooseApp", KokkosVariableTimeIntegrationAux);
      13             : 
      14             : InputParameters
      15        9424 : KokkosVariableTimeIntegrationAux::validParams()
      16             : {
      17        9424 :   InputParameters params = AuxKernel::validParams();
      18       18848 :   params.addClassDescription("Integrates a field variable in time.");
      19       37696 :   params.addRequiredCoupledVar("variable_to_integrate", "The variable to be integrated");
      20       37696 :   params.addParam<Real>("coefficient", 1.0, "A simple coefficient multiplying the integral");
      21       18868 :   params.addParam<unsigned int>(
      22       18808 :       "order", 2, "The order of global truncation error: midpoint=1, trapezoidal=2, Simpson=3");
      23        9424 :   return params;
      24           0 : }
      25             : 
      26          36 : KokkosVariableTimeIntegrationAux::KokkosVariableTimeIntegrationAux(
      27          72 :     const InputParameters & parameters)
      28             :   : AuxKernel(parameters),
      29          54 :     _coef(getParam<Real>("coefficient")),
      30          54 :     _order(getParam<unsigned int>("order")),
      31          27 :     _u_old(_order != 3 ? uOld() : kokkosZeroValue()),
      32          81 :     _u_older(_order == 3 ? uOlder() : kokkosZeroValue())
      33             : {
      34          36 :   _integration_coef.create(_order);
      35          36 :   _coupled_vars.create(_order);
      36             : 
      37          36 :   switch (_order)
      38             :   {
      39          12 :     case 1:
      40          12 :       _integration_coef[0] = 1.0;
      41          24 :       _coupled_vars[0] = kokkosCoupledValue("variable_to_integrate");
      42          12 :       break;
      43          12 :     case 2:
      44          12 :       _integration_coef[0] = 0.5;
      45          12 :       _integration_coef[1] = 0.5;
      46          24 :       _coupled_vars[0] = kokkosCoupledValue("variable_to_integrate");
      47          24 :       _coupled_vars[1] = kokkosCoupledValueOld("variable_to_integrate");
      48          12 :       break;
      49          12 :     case 3:
      50          12 :       _integration_coef[0] = 1.0 / 3.0;
      51          12 :       _integration_coef[1] = 4.0 / 3.0;
      52          12 :       _integration_coef[2] = 1.0 / 3.0;
      53          24 :       _coupled_vars[0] = kokkosCoupledValue("variable_to_integrate");
      54          24 :       _coupled_vars[1] = kokkosCoupledValueOld("variable_to_integrate");
      55          24 :       _coupled_vars[2] = kokkosCoupledValueOlder("variable_to_integrate");
      56          12 :       break;
      57           0 :     default:
      58           0 :       mooseError("KokkosVariableTimeIntegrationAux: unknown time integration order specified");
      59             :   }
      60             : 
      61          36 :   _integration_coef.copyToDevice();
      62          36 :   _coupled_vars.copyToDevice();
      63          36 : }

Generated by: LCOV version 1.14