LCOV - code coverage report
Current view: top level - src/kernels - KKSACBulkF.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #32971 (54bef8) with base c6cf66 Lines: 26 28 92.9 %
Date: 2026-05-29 20:38:39 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 "KKSACBulkF.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", KKSACBulkF);
      13             : 
      14             : InputParameters
      15          95 : KKSACBulkF::validParams()
      16             : {
      17          95 :   InputParameters params = KKSACBulkBase::validParams();
      18          95 :   params.addClassDescription("KKS model kernel (part 1 of 2) for the Bulk Allen-Cahn. This "
      19             :                              "includes all terms NOT dependent on chemical potential.");
      20         190 :   params.addRequiredParam<Real>("w", "Double well height parameter");
      21         190 :   params.addParam<MaterialPropertyName>(
      22             :       "g_name", "g", "Base name for the double well function g(eta)");
      23         190 :   params.addRequiredParam<MaterialPropertyName>(
      24             :       "fb_name",
      25             :       "Base name of the free energy function F (f_base in the corresponding KKSBaseMaterial)");
      26          95 :   return params;
      27           0 : }
      28             : 
      29          51 : KKSACBulkF::KKSACBulkF(const InputParameters & parameters)
      30             :   : KKSACBulkBase(parameters),
      31          51 :     _w(getParam<Real>("w")),
      32          51 :     _prop_dg(getMaterialPropertyDerivative<Real>("g_name", _eta_name)),
      33          51 :     _prop_d2g(getMaterialPropertyDerivative<Real>("g_name", _eta_name, _eta_name)),
      34         102 :     _prop_Fb(getMaterialProperty<Real>("fb_name")),
      35         102 :     _prop_dFb(getMaterialPropertyDerivative<Real>("fb_name", _eta_name))
      36             : {
      37          51 : }
      38             : 
      39             : Real
      40     7419280 : KKSACBulkF::computeDFDOP(PFFunctionType type)
      41             : {
      42     7419280 :   const Real A1 = _prop_Fa[_qp] - _prop_Fb[_qp];
      43     7419280 :   switch (type)
      44             :   {
      45     6921280 :     case Residual:
      46     6921280 :       return -_prop_dh[_qp] * A1 + _w * _prop_dg[_qp];
      47             : 
      48      498000 :     case Jacobian:
      49      498000 :       return _phi[_j][_qp] * (-_prop_d2h[_qp] * A1 + _w * _prop_d2g[_qp]);
      50             :   }
      51             : 
      52           0 :   mooseError("Invalid type passed in");
      53             : }
      54             : 
      55             : Real
      56     5440000 : KKSACBulkF::computeQpOffDiagJacobian(unsigned int jvar)
      57             : {
      58             :   // get the coupled variable jvar is referring to
      59             :   const unsigned int cvar = mapJvarToCvar(jvar);
      60             : 
      61             :   // first get dependence of mobility _L on other variables using parent class
      62             :   // member function
      63     5440000 :   Real res = ACBulk<Real>::computeQpOffDiagJacobian(jvar);
      64             : 
      65     5440000 :   return res - _L[_qp] * _prop_dh[_qp] *
      66     5440000 :                    ((*_derivatives_Fa[cvar])[_qp] - (*_derivatives_Fb[cvar])[_qp]) * _phi[_j][_qp] *
      67     5440000 :                    _test[_i][_qp];
      68             : }

Generated by: LCOV version 1.14