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 70 : MathFreeEnergy::validParams() 16 : { 17 70 : InputParameters params = DerivativeFunctionMaterialBase::validParams(); 18 70 : params.addClassDescription("Material that implements the math free energy and its derivatives: " 19 : "\n$F = 1/4(1 + c)^2(1 - c)^2$"); 20 140 : params.addRequiredCoupledVar("c", "Concentration variable"); 21 70 : return params; 22 0 : } 23 : 24 54 : MathFreeEnergy::MathFreeEnergy(const InputParameters & parameters) 25 54 : : DerivativeFunctionMaterialBase(parameters), _c(coupledValue("c")), _c_var(coupled("c")) 26 : { 27 54 : } 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 1083600 : MathFreeEnergy::computeDF(unsigned int j_var) 37 : { 38 1083600 : if (j_var == _c_var) // Note that these checks are only really necessary when the material has 39 : // more than one coupled variable 40 1083600 : return _c[_qp] * (_c[_qp] * _c[_qp] - 1.0); 41 : else 42 : return 0.0; 43 : } 44 : 45 : Real 46 1533600 : MathFreeEnergy::computeD2F(unsigned int j_var, unsigned int k_var) 47 : { 48 1533600 : if ((j_var == _c_var) && (k_var == _c_var)) 49 1533600 : 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 : }