LCOV - code coverage report
Current view: top level - include/kernels - ADSplitCHWResBase.h (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 11 12 91.7 %
Date: 2025-09-04 07:55:36 Functions: 3 6 50.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             : #pragma once
      11             : 
      12             : #include "ADKernelGrad.h"
      13             : #include "DerivativeMaterialInterface.h"
      14             : 
      15             : /**
      16             :  * ADSplitCHWResBase implements the residual for the chemical potential in the
      17             :  * split form of the Cahn-Hilliard equation in a general way that can be templated
      18             :  * to a scalar or tensor mobility.
      19             :  */
      20             : template <typename T>
      21             : class ADSplitCHWResBase : public ADKernelGrad
      22             : {
      23             : public:
      24             :   static InputParameters validParams();
      25             : 
      26             :   ADSplitCHWResBase(const InputParameters & parameters);
      27             : 
      28             : protected:
      29             :   virtual ADRealVectorValue precomputeQpResidual();
      30             : 
      31             :   const MaterialPropertyName _mob_name;
      32             :   const ADMaterialProperty<T> & _mob;
      33             : };
      34             : 
      35             : template <typename T>
      36          17 : ADSplitCHWResBase<T>::ADSplitCHWResBase(const InputParameters & parameters)
      37             :   : ADKernelGrad(parameters),
      38          34 :     _mob_name(getParam<MaterialPropertyName>("mob_name")),
      39          51 :     _mob(getADMaterialProperty<T>("mob_name"))
      40             : {
      41          17 : }
      42             : 
      43             : template <typename T>
      44             : ADRealVectorValue
      45     2410800 : ADSplitCHWResBase<T>::precomputeQpResidual()
      46             : {
      47     2410800 :   return _mob[_qp] * _grad_u[_qp];
      48             : }
      49             : 
      50             : template <typename T>
      51             : InputParameters
      52          32 : ADSplitCHWResBase<T>::validParams()
      53             : {
      54          32 :   InputParameters params = ADKernelGrad::validParams();
      55          32 :   params.addClassDescription(
      56             :       "Split formulation Cahn-Hilliard Kernel for the chemical potential variable");
      57          64 :   params.addParam<MaterialPropertyName>("mob_name", "mobtemp", "The mobility used with the kernel");
      58          32 :   return params;
      59           0 : }

Generated by: LCOV version 1.14