LCOV - code coverage report
Current view: top level - src/kernels - KKSACBulkF.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 26 28 92.9 %
Date: 2025-09-04 07:55:36 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         131 : KKSACBulkF::validParams()
      16             : {
      17         131 :   InputParameters params = KKSACBulkBase::validParams();
      18         131 :   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         262 :   params.addRequiredParam<Real>("w", "Double well height parameter");
      21         262 :   params.addParam<MaterialPropertyName>(
      22             :       "g_name", "g", "Base name for the double well function g(eta)");
      23         262 :   params.addRequiredParam<MaterialPropertyName>(
      24             :       "fb_name",
      25             :       "Base name of the free energy function F (f_base in the corresponding KKSBaseMaterial)");
      26         131 :   return params;
      27           0 : }
      28             : 
      29          69 : KKSACBulkF::KKSACBulkF(const InputParameters & parameters)
      30             :   : KKSACBulkBase(parameters),
      31          69 :     _w(getParam<Real>("w")),
      32          69 :     _prop_dg(getMaterialPropertyDerivative<Real>("g_name", _eta_name)),
      33          69 :     _prop_d2g(getMaterialPropertyDerivative<Real>("g_name", _eta_name, _eta_name)),
      34         138 :     _prop_Fb(getMaterialProperty<Real>("fb_name")),
      35         138 :     _prop_dFb(getMaterialPropertyDerivative<Real>("fb_name", _eta_name))
      36             : {
      37          69 : }
      38             : 
      39             : Real
      40     8374780 : KKSACBulkF::computeDFDOP(PFFunctionType type)
      41             : {
      42     8374780 :   const Real A1 = _prop_Fa[_qp] - _prop_Fb[_qp];
      43     8374780 :   switch (type)
      44             :   {
      45     7801180 :     case Residual:
      46     7801180 :       return -_prop_dh[_qp] * A1 + _w * _prop_dg[_qp];
      47             : 
      48      573600 :     case Jacobian:
      49      573600 :       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     6030400 : 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     6030400 :   Real res = ACBulk<Real>::computeQpOffDiagJacobian(jvar);
      64             : 
      65     6030400 :   return res - _L[_qp] * _prop_dh[_qp] *
      66     6030400 :                    ((*_derivatives_Fa[cvar])[_qp] - (*_derivatives_Fb[cvar])[_qp]) * _phi[_j][_qp] *
      67     6030400 :                    _test[_i][_qp];
      68             : }

Generated by: LCOV version 1.14