https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MathFreeEnergy.C
Go to the documentation of this file.
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
13
16{
18 params.addClassDescription("Material that implements the math free energy and its derivatives: "
19 "\n$F = 1/4(1 + c)^2(1 - c)^2$");
20 params.addRequiredCoupledVar("c", "Concentration variable");
21 return params;
22}
23
25 : DerivativeFunctionMaterialBase(parameters), _c(coupledValue("c")), _c_var(coupled("c"))
26{
27}
28
29Real
31{
32 return 1.0 / 4.0 * (1.0 + _c[_qp]) * (1.0 + _c[_qp]) * (1.0 - _c[_qp]) * (1.0 - _c[_qp]);
33}
34
35Real
36MathFreeEnergy::computeDF(unsigned int j_var)
37{
38 if (j_var == _c_var) // Note that these checks are only really necessary when the material has
39 // more than one coupled variable
40 return _c[_qp] * (_c[_qp] * _c[_qp] - 1.0);
41 else
42 return 0.0;
43}
44
45Real
46MathFreeEnergy::computeD2F(unsigned int j_var, unsigned int k_var)
47{
48 if ((j_var == _c_var) && (k_var == _c_var))
49 return 3 * _c[_qp] * _c[_qp] - 1.0;
50 else
51 return 0.0;
52}
53
54Real
55MathFreeEnergy::computeD3F(unsigned int j_var, unsigned int k_var, unsigned int l_var)
56{
57 if ((j_var == _c_var) && (k_var == _c_var) && (l_var == _c_var))
58 return 6 * _c[_qp];
59 else
60 return 0.0;
61}
registerMooseObject("PhaseFieldApp", MathFreeEnergy)
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Material class that creates the math free energy and its derivatives for use with CHParsed and SplitC...
virtual Real computeF()
const VariableValue & _c
Coupled variable value for the concentration .
virtual Real computeDF(unsigned int j_var)
virtual Real computeD3F(unsigned int j_var, unsigned int k_var, unsigned int l_var)
virtual Real computeD2F(unsigned int j_var, unsigned int k_var)
static InputParameters validParams()
unsigned int _c_var
MathFreeEnergy(const InputParameters &parameters)