LCOV - code coverage report
Current view: top level - src/kernels - FunctionDiffusion.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 16 17 94.1 %
Date: 2026-05-29 20:35:17 Functions: 4 4 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 "FunctionDiffusion.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", FunctionDiffusion);
      14             : 
      15             : InputParameters
      16        3396 : FunctionDiffusion::validParams()
      17             : {
      18        3396 :   InputParameters params = Diffusion::validParams();
      19        6792 :   params.addClassDescription("Diffusion with a function coefficient.");
      20       13584 :   params.addParam<FunctionName>("function", 1.0, "Function multiplier for diffusion term.");
      21       10188 :   params.addCoupledVar("v",
      22             :                        "Coupled concentration variable for kernel to operate on; if this "
      23             :                        "is not specified, the kernel's nonlinear variable will be used as "
      24             :                        "usual");
      25        3396 :   return params;
      26           0 : }
      27             : 
      28         175 : FunctionDiffusion::FunctionDiffusion(const InputParameters & parameters)
      29             :   : Diffusion(parameters),
      30         175 :     _function(getFunction("function")),
      31         350 :     _grad_v(isCoupled("v") ? coupledGradient("v") : _grad_u),
      32         350 :     _v_var(isCoupled("v") ? getVar("v", 0) : nullptr),
      33         525 :     _grad_v_phi(isCoupled("v") ? _v_var->gradPhi() : _grad_phi)
      34             : {
      35         175 : }
      36             : 
      37             : Real
      38     2388912 : FunctionDiffusion::computeQpResidual()
      39             : {
      40     2388912 :   return _function.value(_t, _q_point[_qp]) * _grad_v[_qp] * _grad_test[_i][_qp];
      41             : }
      42             : 
      43             : Real
      44     8397568 : FunctionDiffusion::computeQpJacobian()
      45             : {
      46     8397568 :   return _function.value(_t, _q_point[_qp]) * _grad_v_phi[_j][_qp] * _grad_test[_i][_qp];
      47             : }

Generated by: LCOV version 1.14