https://mooseframework.inl.gov
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 
12 registerMooseObject("PhaseFieldApp", MathFreeEnergy);
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 
29 Real
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 
35 Real
36 MathFreeEnergy::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 
45 Real
46 MathFreeEnergy::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 
54 Real
55 MathFreeEnergy::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 }
virtual Real computeF()
MathFreeEnergy(const InputParameters &parameters)
virtual Real computeD3F(unsigned int j_var, unsigned int k_var, unsigned int l_var)
virtual Real computeDF(unsigned int j_var)
const VariableValue & _c
Coupled variable value for the concentration .
Material class that creates the math free energy and its derivatives for use with CHParsed and SplitC...
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
registerMooseObject("PhaseFieldApp", MathFreeEnergy)
virtual Real computeD2F(unsigned int j_var, unsigned int k_var)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _c_var
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()