https://mooseframework.inl.gov
Loading...
Searching...
No Matches
RegularSolutionFreeEnergy.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("Material that implements the free energy of a regular solution");
19 params.addRequiredCoupledVar("c", "Concentration variable");
20 params.addCoupledVar("T", 300, "Temperature variable");
21 params.addParam<Real>("omega", 0.1, "Regular solution parameter");
22 params.addParam<Real>("kB", 8.6173324e-5, "Boltzmann constant");
23 params.addParam<Real>(
24 "log_tol", "If specified logarithms are evaluated using a Taylor expansion below this value");
25 return params;
26}
27
30 _c("c"),
31 _T("T"),
32 _omega(getParam<Real>("omega")),
33 _kB(getParam<Real>("kB"))
34{
35 EBFunction free_energy;
36 // Definition of the free energy for the expression builder
37 free_energy(_c) =
38 _omega * _c * (1.0 - _c) + _kB * _T * (_c * log(_c) + (1.0 - _c) * log(1.0 - _c));
39
40 // Use Taylor expanded logarithm?
41 if (isParamValid("log_tol"))
42 free_energy.substitute(EBLogPlogSubstitution(getParam<Real>("log_tol")));
43
44 // Parse function for automatic differentiation
45 functionParse(free_energy);
46}
registerMooseObject("PhaseFieldApp", RegularSolutionFreeEnergy)
static InputParameters validParams()
User facing host object for a function. This combines a term with an argument list.
unsigned int substitute(const EBSubstitutionRule &rule)
Substitution rule to replace all occurences of log(x) with plog(x, epsilon) with a user defined term ...
void addRequiredCoupledVar(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 addCoupledVar(const std::string &name, const std::string &doc_string)
bool isParamValid(const std::string &name) const
void functionParse(const std::string &function_expression)
Material class that creates regular solution free energy with the expression builder and uses automat...
static InputParameters validParams()
EBTerm _T
Coupled temperature variable .
const Real _kB
Boltzmann constant.
RegularSolutionFreeEnergy(const InputParameters &parameters)
EBTerm _c
Coupled variable value for the concentration .