https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PolynomialFreeEnergy.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
11
13
16{
18 params.addClassDescription("Polynomial free energy for single component systems");
19 MooseEnum poly_order("4 6 8");
21 "polynomial_order", poly_order, "Order of polynomial free energy");
22 params.addParam<MaterialPropertyName>(
23 "c_eq_name", "c_eq", "Name of material property storing the equilibrium concentration");
24 params.addParam<MaterialPropertyName>(
25 "W_name", "barr_height", "Name of the material property storing the barrier height");
26 params.addRequiredCoupledVar("c", "Concentration");
27 return params;
28}
29
32 _c("c"),
33 _a("c_eq_name"),
34 _W("W_name"),
35 _order(getParam<MooseEnum>("polynomial_order"))
36{
37 EBFunction free_energy;
38
39 // Free energy
40 switch (_order)
41 {
42 case 0: // 4th order
43 free_energy(_c, _W, _a) = pow(2.0, 4.0) * _W * pow(_c - _a, 2) * pow(1 - _c - _a, 2);
44 break;
45 case 1: // 6th order
46 free_energy(_c, _W, _a) = pow(2.0, 6.0) * _W *
47 (2.0 * pow(_c, 6) - 6.0 * pow(_c, 5) +
48 (3.0 * _a + 27.0 / 4.0 - 3.0 * _a * _a) * pow(_c, 4) +
49 (-6.0 * _a - 7.0 / 2.0 + 6.0 * _a * _a) * pow(_c, 3) +
50 (9.0 / 2.0 * _a - 9.0 / 2.0 * _a * _a + 3.0 / 4.0) * pow(_c, 2) +
51 (3.0 / 2.0 * _a * _a - 3.0 / 2.0 * _a) * _c);
52 break;
53 case 2: // 8th order
54 free_energy(_c, _W, _a) =
55 pow(2.0, 8.0) * _W *
56 (3.0 * pow(_c, 8) - 12.0 * pow(_c, 7) + (-4.0 * _a * _a + 4.0 * _a + 20.0) * pow(_c, 6) +
57 (12.0 * _a * _a - 12.0 * _a - 18.0) * pow(_c, 5) +
58 (15.0 * _a + 75.0 / 8.0 - 15.0 * _a * _a) * pow(_c, 4) +
59 (-10.0 * _a - 11.0 / 4.0 + 10.0 * _a * _a) * pow(_c, 3) +
60 (15.0 / 4.0 * _a - 15.0 / 4.0 * _a * _a + 3.0 / 8.0) * pow(_c, 2) +
61 (3.0 / 4.0 * _a * _a - 3.0 / 4.0 * _a) * _c);
62 break;
63 default:
64 mooseError("Error in PolynomialFreeEnergy: incorrect polynomial order");
65 }
66
67 // Parse function
68 functionParse(free_energy, {}, {}, {"W_name", "c_eq_name"}, {}, {});
69}
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
registerMooseObject("PhaseFieldApp", PolynomialFreeEnergy)
static InputParameters validParams()
User facing host object for a function. This combines a term with an argument list.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
void functionParse(const std::string &function_expression)
Derivative free energy material defining polynomial free energies for single component materials,...
PolynomialFreeEnergy(const InputParameters &parameters)
EBTerm _W
Barrier height.
MooseEnum _order
Polynomial order.
EBTerm _a
Equilibrium concentration.
EBTerm _c
Concentration variable used in the free energy expression.
static InputParameters validParams()