LCOV - code coverage report
Current view: top level - src/kernels - ACInterface2DMultiPhase2.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 18 31 58.1 %
Date: 2025-09-04 07:55:36 Functions: 3 4 75.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 "ACInterface2DMultiPhase2.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", ACInterface2DMultiPhase2);
      13             : 
      14             : InputParameters
      15          92 : ACInterface2DMultiPhase2::validParams()
      16             : {
      17          92 :   InputParameters params = ACInterface::validParams();
      18          92 :   params.addClassDescription(
      19             :       "Gradient energy Allen-Cahn Kernel where the interface parameter kappa is considered.");
      20         184 :   params.addParam<MaterialPropertyName>("dkappadgrad_etaa_name",
      21             :                                         "dkappadgrad_etaa",
      22             :                                         "The derivative of the kappa with respect to grad_etaa");
      23          92 :   return params;
      24           0 : }
      25             : 
      26          48 : ACInterface2DMultiPhase2::ACInterface2DMultiPhase2(const InputParameters & parameters)
      27             :   : ACInterface(parameters),
      28          96 :     _dkappadgrad_etaa(getMaterialProperty<RealGradient>("dkappadgrad_etaa_name"))
      29             : {
      30          48 : }
      31             : 
      32             : Real
      33     2764800 : ACInterface2DMultiPhase2::computeQpJacobian()
      34             : {
      35             :   // dsum is the derivative \f$ \frac\partial{\partial \eta} \left( \nabla (L\psi) \right) \f$
      36     2764800 :   RealGradient dsum = _dLdop[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
      37             : 
      38             :   // compute the derivative of the gradient of the mobility
      39     2764800 :   if (_variable_L)
      40             :   {
      41             :     RealGradient dgradL =
      42     2764800 :         _grad_phi[_j][_qp] * _dLdop[_qp] + _grad_u[_qp] * _phi[_j][_qp] * _d2Ldop2[_qp];
      43             : 
      44     2764800 :     for (unsigned int i = 0; i < _n_args; ++i)
      45           0 :       dgradL += (*_gradarg[i])[_qp] * _phi[_j][_qp] * (*_d2Ldargdop[i])[_qp];
      46             : 
      47     2764800 :     dsum += dgradL * _test[_i][_qp];
      48             :   }
      49     2764800 :   Real jac1 = dsum * _kappa[_qp] * _grad_u[_qp];
      50     2764800 :   Real jac2 = nablaLPsi() * _dkappadgrad_etaa[_qp] * _grad_phi[_j][_qp] * _grad_u[_qp];
      51     2764800 :   Real jac3 = nablaLPsi() * _kappa[_qp] * _grad_phi[_j][_qp];
      52     2764800 :   return jac1 + jac2 + jac3;
      53             : }
      54             : 
      55             : Real
      56           0 : ACInterface2DMultiPhase2::computeQpOffDiagJacobian(unsigned int jvar)
      57             : {
      58             :   // get the coupled variable jvar is referring to
      59             :   const unsigned int cvar = mapJvarToCvar(jvar);
      60             : 
      61             :   // dsum is the derivative \f$ \frac\partial{\partial \eta} \left( \nabla (L\psi) \right) \f$
      62           0 :   RealGradient dsum = (*_dLdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
      63             : 
      64             :   // compute the derivative of the gradient of the mobility
      65           0 :   if (_variable_L)
      66             :   {
      67           0 :     RealGradient dgradL = _grad_phi[_j][_qp] * (*_dLdarg[cvar])[_qp] +
      68           0 :                           _grad_u[_qp] * _phi[_j][_qp] * (*_d2Ldargdop[cvar])[_qp];
      69             : 
      70           0 :     for (unsigned int i = 0; i < _n_args; ++i)
      71           0 :       dgradL += (*_gradarg[i])[_qp] * _phi[_j][_qp] * (*_d2Ldarg2[cvar][i])[_qp];
      72             : 
      73           0 :     dsum += dgradL * _test[_i][_qp];
      74             :   }
      75             : 
      76           0 :   Real jac1 = dsum * _kappa[_qp] * _grad_u[_qp];
      77           0 :   Real jac2 = -nablaLPsi() * _dkappadgrad_etaa[_qp] * _grad_phi[_j][_qp] * _grad_u[_qp];
      78           0 :   return jac1 + jac2;
      79             : }

Generated by: LCOV version 1.14