www.mooseframework.org
SwitchingFunction3PhaseMaterial.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<DerivativeParsedMaterialHelper>();
19  params.addClassDescription("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 * (9eta_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::EBFunction
User facing host object for a function. This combines a term with an argument list.
Definition: ExpressionBuilder.h:520
registerMooseObject
registerMooseObject("PhaseFieldApp", SwitchingFunction3PhaseMaterial)
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
SwitchingFunction3PhaseMaterial
Material class to provide switching functions that prevent formation of a third phase at a two-phase ...
Definition: SwitchingFunction3PhaseMaterial.h:26
SwitchingFunction3PhaseMaterial::_eta_i
EBTerm _eta_i
Coupled variable values for order parameters.
Definition: SwitchingFunction3PhaseMaterial.h:34
SwitchingFunction3PhaseMaterial::SwitchingFunction3PhaseMaterial
SwitchingFunction3PhaseMaterial(const InputParameters &parameters)
Definition: SwitchingFunction3PhaseMaterial.C:33
SwitchingFunction3PhaseMaterial.h
validParams< SwitchingFunction3PhaseMaterial >
InputParameters validParams< SwitchingFunction3PhaseMaterial >()
Definition: SwitchingFunction3PhaseMaterial.C:16
SwitchingFunction3PhaseMaterial::_eta_j
EBTerm _eta_j
Definition: SwitchingFunction3PhaseMaterial.h:35
SwitchingFunction3PhaseMaterial::_eta_k
EBTerm _eta_k
Definition: SwitchingFunction3PhaseMaterial.h:36
ExpressionBuilder::EBTerm
User facing host object for an expression tree.
Definition: ExpressionBuilder.h:357