https://mooseframework.inl.gov
Loading...
Searching...
No Matches
BarrierFunctionMaterial.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("Helper material to provide $g(\\eta)$ and its derivative in a "
19 "polynomial.\nSIMPLE: $\\eta^2(1-\\eta)^2$\nLOW: $\\eta(1-\\eta)$"
20 "\nHIGH: $\\eta^2(1-\\eta^2)^2$");
21 MooseEnum g_order("SIMPLE=0 LOW HIGH", "SIMPLE");
22 params.addParam<MooseEnum>("g_order", g_order, "Polynomial order of the barrier function g(eta)");
23 params.addParam<bool>("well_only",
24 false,
25 "Make the g zero in [0:1] so it only contributes to "
26 "enforcing the eta range and not to the phase "
27 "transformation barrier.");
28 params.set<std::string>("function_name") = std::string("g");
29 return params;
30}
31
34 _g_order(getParam<MooseEnum>("g_order")),
35 _well_only(getParam<bool>("well_only"))
36{
37}
38
39void
41{
42 const Real n = _eta[_qp];
43
44 if (_well_only && n >= 0.0 && n <= 1.0)
45 {
46 _prop_f[_qp] = 0.0;
47 _prop_df[_qp] = 0.0;
48 _prop_d2f[_qp] = 0.0;
49 return;
50 }
51
52 switch (_g_order)
53 {
54 case 0: // SIMPLE
55 _prop_f[_qp] = n * n * (1.0 - n) * (1.0 - n);
56 _prop_df[_qp] = 2.0 * n * (n - 1.0) * (2.0 * n - 1.0);
57 _prop_d2f[_qp] = 12.0 * (n * n - n) + 2.0;
58 break;
59
60 case 1: // LOW
61 _prop_f[_qp] = n * (1.0 - n);
62 _prop_df[_qp] = 1.0 - 2.0 * n;
63 _prop_d2f[_qp] = -2.0;
64 break;
65
66 case 2: // HIGH
67 _prop_f[_qp] = n * n * (1.0 - n * n) * (1.0 - n * n);
68 _prop_df[_qp] = n * (2.0 - n * n * (8.0 + 6.0 * n * n));
69 _prop_d2f[_qp] = 2.0 - n * n * (24.0 + 30.0 * n * n);
70 break;
71
72 default:
73 mooseError("Internal error");
74 }
75}
registerMooseObject("PhaseFieldApp", BarrierFunctionMaterial)
void mooseError(Args &&... args)
Material class to provide the double well function for the KKS system.
static InputParameters validParams()
BarrierFunctionMaterial(const InputParameters &parameters)
bool _well_only
zero out g contribution in the eta interval [0:1]
MooseEnum _g_order
Polynomial order of the switching function .
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)
T & set(const std::string &name, bool quiet_mode=false)
Material base class for materials that provide the switching function or the double well function .
MaterialProperty< Real > & _prop_df
Material property to store the derivative .
MaterialProperty< Real > & _prop_f
Material property to store .
MaterialProperty< Real > & _prop_d2f
Material property to store the second derivative .
const VariableValue & _eta
Coupled variable value for the order parameter .