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

Generated by: LCOV version 1.14