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