LCOV - code coverage report
Current view: top level - src/kernels - CHSplitChemicalPotential.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #32971 (54bef8) with base c6cf66 Lines: 20 21 95.2 %
Date: 2026-05-29 20:38:39 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 "CHSplitChemicalPotential.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", CHSplitChemicalPotential);
      13             : 
      14             : InputParameters
      15          15 : CHSplitChemicalPotential::validParams()
      16             : {
      17          15 :   InputParameters params = Kernel::validParams();
      18          15 :   params.addClassDescription("Chemical potential kernel in Split Cahn-Hilliard that solves "
      19             :                              "chemical potential in a weak form");
      20          30 :   params.addRequiredParam<MaterialPropertyName>("chemical_potential_prop",
      21             :                                                 "Chemical potential property name");
      22          30 :   params.addRequiredCoupledVar("c", "Concentration");
      23          15 :   return params;
      24           0 : }
      25             : 
      26           8 : CHSplitChemicalPotential::CHSplitChemicalPotential(const InputParameters & parameters)
      27             :   : DerivativeMaterialInterface<Kernel>(parameters),
      28          16 :     _mu_prop_name(getParam<MaterialPropertyName>("chemical_potential_prop")),
      29           8 :     _chemical_potential(getMaterialProperty<Real>(_mu_prop_name)),
      30           8 :     _dchemical_potential_dc(
      31          16 :         getMaterialPropertyDerivative<Real>(_mu_prop_name, coupledName("c", 0))),
      32          16 :     _c_var(coupled("c"))
      33             : {
      34           8 : }
      35             : 
      36             : Real
      37      977600 : CHSplitChemicalPotential::computeQpResidual()
      38             : {
      39      977600 :   return _test[_i][_qp] * (_u[_qp] - _chemical_potential[_qp]);
      40             : }
      41             : 
      42             : Real
      43      921600 : CHSplitChemicalPotential::computeQpJacobian()
      44             : {
      45      921600 :   return _test[_i][_qp] * _phi[_j][_qp];
      46             : }
      47             : 
      48             : Real
      49      921600 : CHSplitChemicalPotential::computeQpOffDiagJacobian(unsigned int jvar)
      50             : {
      51      921600 :   if (jvar == _c_var)
      52      921600 :     return -_test[_i][_qp] * _dchemical_potential_dc[_qp] * _phi[_j][_qp];
      53             :   else
      54             :     return 0.0;
      55             : }

Generated by: LCOV version 1.14