https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MixedSwitchingFunctionMaterial.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 h(eta) and its derivative in one of two "
19 "polynomial forms. MIX234 and MIX246");
20 MooseEnum h_order("MIX234=0 MIX246", "MIX234");
21 params.addParam<MooseEnum>(
22 "h_order", h_order, "Polynomial order of the switching function h(eta)");
23 params.set<std::string>("function_name") = std::string("h");
24
25 params.addRangeCheckedParam<Real>(
26 "weight", 1.0, "weight <= 1 & weight >= 0", "Weight parameter for MIX type h(eta)");
27
28 return params;
29}
30
33 _h_order(getParam<MooseEnum>("h_order")),
34 _weight(getParam<Real>("weight"))
35{
36}
37
38void
40{
41 Real n = _eta[_qp];
42 n = n > 1 ? 1 : (n < 0 ? 0 : n);
43
44 switch (_h_order)
45 {
46 case 0: // MIX234
47 _prop_f[_qp] =
48 n * n * (3.0 * _weight + (4.0 - 6.0 * _weight) * n + (3.0 * _weight - 3.0) * n * n);
49 _prop_df[_qp] =
50 n * (6.0 * _weight + (12.0 - 18.0 * _weight) * n + (12.0 * _weight - 12.0) * n * n);
51 _prop_d2f[_qp] = 6.0 * _weight + ((24.0 - 36.0 * _weight) + (36.0 * _weight - 36.0) * n) * n;
52 break;
53
54 case 1: // MIX246
55 _prop_f[_qp] =
56 n * n * (2.0 * _weight + n * n * ((3.0 - 4.0 * _weight) + (2.0 * _weight - 2.0) * n * n));
57 _prop_df[_qp] =
58 n * (4.0 * _weight + n * n * ((12.0 - 16.0 * _weight) + (12.0 * _weight - 12.0) * n * n));
59 _prop_d2f[_qp] =
60 4.0 * _weight + n * n * ((36.0 - 48.0 * _weight) + (60.0 * _weight - 60.0) * n * n);
61 break;
62
63 default:
64 mooseError("Internal error");
65 }
66}
registerMooseObject("PhaseFieldApp", MixedSwitchingFunctionMaterial)
void mooseError(Args &&... args)
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)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
Material class to provide the switching function for the KKS system.
Real _weight
Weight parameter of mixed-type h(eta)
MooseEnum _h_order
Polynomial order of the switching function .
MixedSwitchingFunctionMaterial(const InputParameters &parameters)
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 .