https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SwitchingFunction3PhaseMaterial.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{
19 "Material for switching function that prevents formation of a third "
20 "phase at a two-phase interface: $h_i = \\eta_i^2/4 [15 (1-\\eta_i) [1 + "
21 "\\eta_i - (\\eta_k - \\eta_j)^2] + \\eta_i (9\\eta_i^2 - 5)]$");
22 params.addRequiredCoupledVar("eta_i", "Order parameter i");
23 params.addRequiredCoupledVar("eta_j", "Order parameter j");
24 params.addRequiredCoupledVar("eta_k", "Order parameter k");
25 params.addParam<bool>(
26 "constrain_range",
27 false,
28 "Use a formulation that constrains the switching function values to [0:1]. This requires the "
29 "Lagrange multiplier to constrain the sum of the switching function, rather than the etas.");
30 return params;
31}
32
34 : DerivativeParsedMaterialHelper(parameters), _eta_i("eta_i"), _eta_j("eta_j"), _eta_k("eta_k")
35{
36 EBTerm h_i;
37
38 if (getParam<bool>("constrain_range"))
39 {
40 EBFunction h;
41 EBTerm eta("eta");
42
43 h(eta) =
44 conditional(eta < 0, 0, conditional(eta > 1, 1, 3.0 * pow(eta, 2) - 2.0 * pow(eta, 3)));
45
46 h_i = pow(h(_eta_i), 2) / 4.0 *
47 (15.0 * (1.0 - h(_eta_i)) * (1.0 + h(_eta_i) - pow(h(_eta_k) - h(_eta_j), 2)) +
48 h(_eta_i) * (9.0 * pow(h(_eta_i), 2) - 5.0));
49 }
50 else
51 h_i = pow(_eta_i, 2) / 4.0 *
52 (15.0 * (1.0 - _eta_i) * (1.0 + _eta_i - pow(_eta_k - _eta_j, 2)) +
53 _eta_i * (9.0 * pow(_eta_i, 2) - 5.0));
54
55 // Parse function for automatic differentiation
56 functionParse(h_i);
57}
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Point eta
registerMooseObject("PhaseFieldApp", SwitchingFunction3PhaseMaterial)
static InputParameters validParams()
User facing host object for a function. This combines a term with an argument list.
User facing host object for an expression tree.
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 functionParse(const std::string &function_expression)
Material class to provide switching functions that prevent formation of a third phase at a two-phase ...
EBTerm _eta_i
Coupled variable values for order parameters.
SwitchingFunction3PhaseMaterial(const InputParameters &parameters)