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