LCOV - code coverage report
Current view: top level - src/materials - MathFreeEnergy.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #32971 (54bef8) with base c6cf66 Lines: 17 20 85.0 %
Date: 2026-05-29 20:38:39 Functions: 5 6 83.3 %
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 "MathFreeEnergy.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", MathFreeEnergy);
      13             : 
      14             : InputParameters
      15          54 : MathFreeEnergy::validParams()
      16             : {
      17          54 :   InputParameters params = DerivativeFunctionMaterialBase::validParams();
      18          54 :   params.addClassDescription("Material that implements the math free energy and its derivatives: "
      19             :                              "\n$F = 1/4(1 + c)^2(1 - c)^2$");
      20         108 :   params.addRequiredCoupledVar("c", "Concentration variable");
      21          54 :   return params;
      22           0 : }
      23             : 
      24          42 : MathFreeEnergy::MathFreeEnergy(const InputParameters & parameters)
      25          42 :   : DerivativeFunctionMaterialBase(parameters), _c(coupledValue("c")), _c_var(coupled("c"))
      26             : {
      27          42 : }
      28             : 
      29             : Real
      30           0 : MathFreeEnergy::computeF()
      31             : {
      32           0 :   return 1.0 / 4.0 * (1.0 + _c[_qp]) * (1.0 + _c[_qp]) * (1.0 - _c[_qp]) * (1.0 - _c[_qp]);
      33             : }
      34             : 
      35             : Real
      36      918000 : MathFreeEnergy::computeDF(unsigned int j_var)
      37             : {
      38      918000 :   if (j_var == _c_var) // Note that these checks are only really necessary when the material has
      39             :                        // more than one coupled variable
      40      918000 :     return _c[_qp] * (_c[_qp] * _c[_qp] - 1.0);
      41             :   else
      42             :     return 0.0;
      43             : }
      44             : 
      45             : Real
      46     1368000 : MathFreeEnergy::computeD2F(unsigned int j_var, unsigned int k_var)
      47             : {
      48     1368000 :   if ((j_var == _c_var) && (k_var == _c_var))
      49     1368000 :     return 3 * _c[_qp] * _c[_qp] - 1.0;
      50             :   else
      51             :     return 0.0;
      52             : }
      53             : 
      54             : Real
      55      450000 : MathFreeEnergy::computeD3F(unsigned int j_var, unsigned int k_var, unsigned int l_var)
      56             : {
      57      450000 :   if ((j_var == _c_var) && (k_var == _c_var) && (l_var == _c_var))
      58      450000 :     return 6 * _c[_qp];
      59             :   else
      60             :     return 0.0;
      61             : }

Generated by: LCOV version 1.14