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

Generated by: LCOV version 1.14