LCOV - code coverage report
Current view: top level - src/materials - ADMathFreeEnergy.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #32971 (54bef8) with base c6cf66 Lines: 17 18 94.4 %
Date: 2026-05-29 20:38:39 Functions: 3 3 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 "ADMathFreeEnergy.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", ADMathFreeEnergy);
      13             : 
      14             : InputParameters
      15          50 : ADMathFreeEnergy::validParams()
      16             : {
      17          50 :   InputParameters params = Material::validParams();
      18          50 :   params.addClassDescription("Material that implements the math free energy and its derivatives: "
      19             :                              "\n$F = 1/4(1 + c)^2(1 - c)^2$");
      20         100 :   params.addParam<MaterialPropertyName>("f_name", "F", "function property name");
      21         100 :   params.addRequiredCoupledVar("c", "Concentration variable");
      22          50 :   return params;
      23           0 : }
      24             : 
      25          39 : ADMathFreeEnergy::ADMathFreeEnergy(const InputParameters & parameters)
      26             :   : Material(parameters),
      27          39 :     _c(adCoupledValue("c")),
      28          39 :     _f_name(getParam<MaterialPropertyName>("f_name")),
      29          39 :     _prop_F(declareADProperty<Real>(_f_name)),
      30          39 :     _prop_dFdc(
      31          78 :         declareADProperty<Real>(derivativePropertyNameFirst(_f_name, this->coupledName("c", 0))))
      32             : {
      33          39 : }
      34             : 
      35             : void
      36     2403600 : ADMathFreeEnergy::computeQpProperties()
      37             : {
      38    14421600 :   _prop_F[_qp] = 1.0 / 4.0 * (1.0 + _c[_qp]) * (1.0 + _c[_qp]) * (1.0 - _c[_qp]) * (1.0 - _c[_qp]);
      39     7210800 :   _prop_dFdc[_qp] = _c[_qp] * (_c[_qp] * _c[_qp] - 1.0);
      40     2403600 : }

Generated by: LCOV version 1.14