LCOV - code coverage report
Current view: top level - src/kernels - CoupledSusceptibilityTimeDerivative.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #32971 (54bef8) with base c6cf66 Lines: 24 26 92.3 %
Date: 2026-05-29 20:38:39 Functions: 6 6 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 "CoupledSusceptibilityTimeDerivative.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", CoupledSusceptibilityTimeDerivative);
      13             : 
      14             : InputParameters
      15          71 : CoupledSusceptibilityTimeDerivative::validParams()
      16             : {
      17          71 :   InputParameters params = JvarMapKernelInterface<CoupledTimeDerivative>::validParams();
      18          71 :   params.addClassDescription("A modified coupled time derivative Kernel that multiplies the time "
      19             :                              "derivative of a coupled variable by a generalized susceptibility");
      20         142 :   params.addRequiredParam<MaterialPropertyName>(
      21             :       "f_name", "Susceptibility function F defined in a FunctionMaterial");
      22          71 :   return params;
      23           0 : }
      24             : 
      25          38 : CoupledSusceptibilityTimeDerivative::CoupledSusceptibilityTimeDerivative(
      26          38 :     const InputParameters & parameters)
      27             :   : DerivativeMaterialInterface<JvarMapKernelInterface<CoupledTimeDerivative>>(parameters),
      28          38 :     _F(getMaterialProperty<Real>("f_name")),
      29          38 :     _dFdu(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
      30          76 :     _dFdarg(_n_args)
      31             : {
      32             :   // fetch derivatives
      33          84 :   for (unsigned int i = 0; i < _n_args; ++i)
      34          46 :     _dFdarg[i] = &getMaterialPropertyDerivative<Real>("f_name", i);
      35          38 : }
      36             : 
      37             : void
      38          24 : CoupledSusceptibilityTimeDerivative::initialSetup()
      39             : {
      40          72 :   validateNonlinearCoupling<Real>("f_name");
      41          24 : }
      42             : 
      43             : Real
      44      446464 : CoupledSusceptibilityTimeDerivative::computeQpResidual()
      45             : {
      46      446464 :   return CoupledTimeDerivative::computeQpResidual() * _F[_qp];
      47             : }
      48             : 
      49             : Real
      50     1359872 : CoupledSusceptibilityTimeDerivative::computeQpJacobian()
      51             : {
      52     1359872 :   return CoupledTimeDerivative::computeQpResidual() * _dFdu[_qp] * _phi[_j][_qp];
      53             : }
      54             : 
      55             : Real
      56     1359872 : CoupledSusceptibilityTimeDerivative::computeQpOffDiagJacobian(unsigned int jvar)
      57             : {
      58             :   // get the coupled variable jvar is referring to
      59             :   const unsigned int cvar = mapJvarToCvar(jvar);
      60             : 
      61     1359872 :   if (jvar == _v_var)
      62     1359872 :     return CoupledTimeDerivative::computeQpOffDiagJacobian(jvar) * _F[_qp] +
      63     1359872 :            CoupledTimeDerivative::computeQpResidual() * _phi[_j][_qp] * (*_dFdarg[cvar])[_qp];
      64             : 
      65           0 :   return CoupledTimeDerivative::computeQpResidual() * _phi[_j][_qp] * (*_dFdarg[cvar])[_qp];
      66             : }

Generated by: LCOV version 1.14