https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SwitchingFunctionMaterial.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 "Helper material to provide $h(\\eta)$ and its derivative in one of two "
20 "polynomial forms.\nSIMPLE: $3\\eta^2-2\\eta^3$\nHIGH: "
21 "$\\eta^3(6\\eta^2-15\\eta+10)$");
22 MooseEnum h_order("SIMPLE=0 HIGH", "SIMPLE");
23 params.addParam<MooseEnum>(
24 "h_order", h_order, "Polynomial order of the switching function h(eta)");
25 params.set<std::string>("function_name") = std::string("h");
26 return params;
27}
28
30 : OrderParameterFunctionMaterial(parameters), _h_order(getParam<MooseEnum>("h_order"))
31{
32}
33
34void
36{
37 Real n = _eta[_qp];
38 n = n > 1 ? 1 : (n < 0 ? 0 : n);
39
40 switch (_h_order)
41 {
42 case 0: // SIMPLE
43 _prop_f[_qp] = 3.0 * n * n - 2.0 * n * n * n;
44 _prop_df[_qp] = 6.0 * n - 6.0 * n * n;
45 _prop_d2f[_qp] = 6.0 - 12.0 * n;
46 break;
47
48 case 1: // HIGH
49 _prop_f[_qp] = n * n * n * (6.0 * n * n - 15.0 * n + 10.0);
50 _prop_df[_qp] = 30.0 * n * n * (n * n - 2.0 * n + 1.0);
51 _prop_d2f[_qp] = n * (120.0 * n * n - 180.0 * n + 60.0);
52 break;
53
54 default:
55 mooseError("Internal error");
56 }
57}
void mooseError(Args &&... args)
registerMooseObject("PhaseFieldApp", SwitchingFunctionMaterial)
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 .
Material class to provide the switching function for the KKS system.
MooseEnum _h_order
Polynomial order of the switching function .
static InputParameters validParams()
SwitchingFunctionMaterial(const InputParameters &parameters)