https://mooseframework.inl.gov
phase_field
src
materials
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
10
#include "
RegularSolutionFreeEnergy.h
"
11
12
registerMooseObject
(
"PhaseFieldApp"
,
RegularSolutionFreeEnergy
);
13
14
InputParameters
15
RegularSolutionFreeEnergy::validParams
()
16
{
17
InputParameters
params =
DerivativeParsedMaterialHelper::validParams
();
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
28
RegularSolutionFreeEnergy::RegularSolutionFreeEnergy
(
const
InputParameters
& parameters)
29
:
DerivativeParsedMaterialHelper
(parameters),
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
}
RegularSolutionFreeEnergy::_omega
const Real _omega
Prefactor.
Definition:
RegularSolutionFreeEnergy.h:37
ExpressionBuilder::EBFunction::substitute
unsigned int substitute(const EBSubstitutionRule &rule)
Definition:
ExpressionBuilder.C:232
RegularSolutionFreeEnergy.h
InputParameters::addParam
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
RegularSolutionFreeEnergy::_c
EBTerm _c
Coupled variable value for the concentration .
Definition:
RegularSolutionFreeEnergy.h:31
RegularSolutionFreeEnergy::_T
EBTerm _T
Coupled temperature variable .
Definition:
RegularSolutionFreeEnergy.h:34
DerivativeParsedMaterialHelperTempl
DerivativeParsedMaterialHelperTempl::isParamValid
bool isParamValid(const std::string &name) const
InputParameters
RegularSolutionFreeEnergy::validParams
static InputParameters validParams()
Definition:
RegularSolutionFreeEnergy.C:15
RegularSolutionFreeEnergy::RegularSolutionFreeEnergy
RegularSolutionFreeEnergy(const InputParameters ¶meters)
Definition:
RegularSolutionFreeEnergy.C:28
log
auto log(const T &)
DerivativeParsedMaterialHelperTempl::validParams
static InputParameters validParams()
RegularSolutionFreeEnergy::_kB
const Real _kB
Boltzmann constant.
Definition:
RegularSolutionFreeEnergy.h:40
InputParameters::addCoupledVar
void addCoupledVar(const std::string &name, const std::string &doc_string)
InputParameters::addRequiredCoupledVar
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
ExpressionBuilder::EBLogPlogSubstitution
Substitution rule to replace all occurences of log(x) with plog(x, epsilon) with a user defined term ...
Definition:
ExpressionBuilder.h:340
RegularSolutionFreeEnergy
Material class that creates regular solution free energy with the expression builder and uses automat...
Definition:
RegularSolutionFreeEnergy.h:22
Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ExpressionBuilder::EBFunction
User facing host object for a function. This combines a term with an argument list.
Definition:
ExpressionBuilder.h:524
InputParameters::addClassDescription
void addClassDescription(const std::string &doc_string)
registerMooseObject
registerMooseObject("PhaseFieldApp", RegularSolutionFreeEnergy)
DerivativeParsedMaterialHelperTempl::functionParse
void functionParse(const std::string &function_expression)
Generated on Fri Jul 18 2025 11:56:49 for https://mooseframework.inl.gov by
1.8.14