LCOV - code coverage report
Current view: top level - src/kernels - SplitCHCRes.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 23 24 95.8 %
Date: 2025-09-04 07:55:36 Functions: 5 5 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 "SplitCHCRes.h"
      11             : 
      12             : InputParameters
      13        1082 : SplitCHCRes::validParams()
      14             : {
      15        1082 :   InputParameters params = SplitCHBase::validParams();
      16        1082 :   params.addClassDescription("Split formulation Cahn-Hilliard Kernel");
      17        2164 :   params.addRequiredCoupledVar("w", "Chemical potential");
      18        2164 :   params.addRequiredParam<MaterialPropertyName>("kappa_name", "The kappa used with the kernel");
      19        1082 :   return params;
      20           0 : }
      21             : 
      22         567 : SplitCHCRes::SplitCHCRes(const InputParameters & parameters)
      23             :   : SplitCHBase(parameters),
      24         567 :     _kappa(getMaterialProperty<Real>("kappa_name")),
      25         567 :     _w_var(coupled("w")),
      26        1134 :     _w(coupledValue("w"))
      27             : {
      28         567 : }
      29             : 
      30             : /*Real
      31             : SplitCHCRes::computeDFDC(PFFunctionType type)
      32             : {
      33             :   switch (type)
      34             :   {
      35             :   case Residual:
      36             :     return _u[_qp]*_u[_qp]*_u[_qp] - _u[_qp]; // return Residual value
      37             : 
      38             :   case Jacobian:
      39             :     return (3.0*_u[_qp]*_u[_qp] - 1.0)*_phi[_j][_qp]; //return Jacobian value
      40             : 
      41             :   }
      42             : 
      43             :   mooseError("Invalid type passed in");
      44             : }*/
      45             : 
      46             : Real
      47    61725799 : SplitCHCRes::computeQpResidual()
      48             : {
      49             :   Real residual =
      50    61725799 :       SplitCHBase::computeQpResidual(); //(f_prime_zero+e_prime)*_test[_i][_qp] from SplitCHBase
      51             : 
      52    61725799 :   residual += -_w[_qp] * _test[_i][_qp];
      53    61725799 :   residual += _kappa[_qp] * _grad_u[_qp] * _grad_test[_i][_qp];
      54             : 
      55    61725799 :   return residual;
      56             : }
      57             : 
      58             : Real
      59   186838136 : SplitCHCRes::computeQpJacobian()
      60             : {
      61   186838136 :   Real jacobian = SplitCHBase::computeQpJacobian(); //(df_prime_zero_dc+de_prime_dc)*_test[_i][_qp];
      62             :                                                     // from SplitCHBase
      63             : 
      64   186838136 :   jacobian += _kappa[_qp] * _grad_phi[_j][_qp] * _grad_test[_i][_qp];
      65             : 
      66   186838136 :   return jacobian;
      67             : }
      68             : 
      69             : Real
      70   186838136 : SplitCHCRes::computeQpOffDiagJacobian(unsigned int jvar)
      71             : {
      72   186838136 :   if (jvar == _w_var)
      73             :   {
      74   186838136 :     return -_phi[_j][_qp] * _test[_i][_qp];
      75             :   }
      76             : 
      77             :   return 0.0;
      78             : }

Generated by: LCOV version 1.14