https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MultiBarrierFunctionMaterial.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("Double well phase transformation barrier free energy contribution.");
19 params.addParam<std::string>("function_name", "g", "actual name for g(eta_i)");
20 MooseEnum h_order("SIMPLE=0", "SIMPLE");
21 params.addParam<MooseEnum>(
22 "g_order", h_order, "Polynomial order of the switching function h(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.addRequiredCoupledVar("etas", "eta_i order parameters, one for each h");
29 return params;
30}
31
34 _function_name(getParam<std::string>("function_name")),
35 _g_order(getParam<MooseEnum>("g_order")),
36 _well_only(getParam<bool>("well_only")),
37 _num_eta(coupledComponents("etas")),
38 _eta(coupledValues("etas")),
39 _prop_g(declareProperty<Real>(_function_name)),
40 _prop_dg(_num_eta),
41 _prop_d2g(_num_eta)
42{
43 // declare derivative properties, fetch eta values
44 for (unsigned int i = 0; i < _num_eta; ++i)
45 {
46 const VariableName & eta_name = coupledName("etas", i);
47 if (!isCoupledConstant(eta_name))
48 {
49 _prop_dg[i] = &declarePropertyDerivative<Real>(_function_name, eta_name);
50 _prop_d2g[i] = &declarePropertyDerivative<Real>(_function_name, eta_name, eta_name);
51 }
52 }
53}
54
55void
57{
58 Real g = 0.0;
59
60 for (unsigned int i = 0; i < _num_eta; ++i)
61 {
62 const Real n = (*_eta[i])[_qp];
63
64 if (_well_only && n >= 0.0 && n <= 1.0 && _prop_dg[i])
65 {
66 (*_prop_dg[i])[_qp] = 0.0;
67 (*_prop_d2g[i])[_qp] = 0.0;
68 continue;
69 }
70
71 switch (_g_order)
72 {
73 case 0: // SIMPLE
74 g += n * n * (1.0 - n) * (1.0 - n);
75 if (_prop_dg[i])
76 {
77 (*_prop_dg[i])[_qp] = 2.0 * n * (n - 1.0) * (2.0 * n - 1.0);
78 (*_prop_d2g[i])[_qp] = 12.0 * (n * n - n) + 2.0;
79 }
80 break;
81 }
82 }
83
84 _prop_g[_qp] = g;
85}
registerMooseObject("PhaseFieldApp", MultiBarrierFunctionMaterial)
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)
static InputParameters validParams()
Double well phase transformation barrier free energy contribution.
const unsigned int _num_eta
order parameters
bool _well_only
zero out g contribution in the eta interval [0:1]
const std::vector< const VariableValue * > _eta
MultiBarrierFunctionMaterial(const InputParameters &parameters)
MaterialProperty< Real > & _prop_g
Barrier functions and their drivatives.
std::vector< MaterialProperty< Real > * > _prop_dg
std::vector< MaterialProperty< Real > * > _prop_d2g
std::string _function_name
name of the function of eta (used to generate the material property names)
MooseEnum _g_order
Polynomial order of the barrier function .