www.mooseframework.org
MathFreeEnergy.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "MathFreeEnergy.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<DerivativeFunctionMaterialBase>();
14  params.addClassDescription("Material that implements the math free energy and its derivatives: "
15  "\nF = 1/4(1 + c)^2*(1 - c)^2");
16  params.addRequiredCoupledVar("c", "Concentration variable");
17  return params;
18 }
19 
20 MathFreeEnergy::MathFreeEnergy(const InputParameters & parameters)
21  : DerivativeFunctionMaterialBase(parameters), _c(coupledValue("c")), _c_var(coupled("c"))
22 {
23 }
24 
25 Real
27 {
28  return 1.0 / 4.0 * (1.0 + _c[_qp]) * (1.0 + _c[_qp]) * (1.0 - _c[_qp]) * (1.0 - _c[_qp]);
29 }
30 
31 Real
32 MathFreeEnergy::computeDF(unsigned int j_var)
33 {
34  if (j_var == _c_var) // Note that these checks are only really necessary when the material has
35  // more than one coupled variable
36  return _c[_qp] * (_c[_qp] * _c[_qp] - 1.0);
37  else
38  return 0.0;
39 }
40 
41 Real
42 MathFreeEnergy::computeD2F(unsigned int j_var, unsigned int k_var)
43 {
44  if ((j_var == _c_var) && (k_var == _c_var))
45  return 3 * _c[_qp] * _c[_qp] - 1.0;
46  else
47  return 0.0;
48 }
49 
50 Real
51 MathFreeEnergy::computeD3F(unsigned int j_var, unsigned int k_var, unsigned int l_var)
52 {
53  if ((j_var == _c_var) && (k_var == _c_var) && (l_var == _c_var))
54  return 6 * _c[_qp];
55  else
56  return 0.0;
57 }
virtual Real computeF()
Override this method to provide the free energy function.
MathFreeEnergy(const InputParameters &parameters)
InputParameters validParams< DerivativeFunctionMaterialBase >()
virtual Real computeD3F(unsigned int j_var, unsigned int k_var, unsigned int l_var)
Override this method to calculate the third derivatives.
virtual Real computeDF(unsigned int j_var)
Override this method for calculating the first derivatives.
InputParameters validParams< MathFreeEnergy >()
const VariableValue & _c
Coupled variable value for the concentration .
Material base class central to compute the a phase free energy and its derivatives.
virtual Real computeD2F(unsigned int j_var, unsigned int k_var)
Override this method to calculate the second derivatives.
unsigned int _c_var