Line data Source code
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 : 10 : #include "BarrierFunctionMaterial.h" 11 : 12 : registerMooseObject("PhaseFieldApp", BarrierFunctionMaterial); 13 : 14 : InputParameters 15 1026 : BarrierFunctionMaterial::validParams() 16 : { 17 1026 : InputParameters params = OrderParameterFunctionMaterial::validParams(); 18 1026 : 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 2052 : MooseEnum g_order("SIMPLE=0 LOW HIGH", "SIMPLE"); 22 2052 : params.addParam<MooseEnum>("g_order", g_order, "Polynomial order of the barrier function g(eta)"); 23 2052 : params.addParam<bool>("well_only", 24 2052 : 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 2052 : params.set<std::string>("function_name") = std::string("g"); 29 1026 : return params; 30 1026 : } 31 : 32 795 : BarrierFunctionMaterial::BarrierFunctionMaterial(const InputParameters & parameters) 33 : : OrderParameterFunctionMaterial(parameters), 34 795 : _g_order(getParam<MooseEnum>("g_order")), 35 2385 : _well_only(getParam<bool>("well_only")) 36 : { 37 795 : } 38 : 39 : void 40 14514436 : BarrierFunctionMaterial::computeQpProperties() 41 : { 42 14514436 : const Real n = _eta[_qp]; 43 : 44 14514436 : if (_well_only && n >= 0.0 && n <= 1.0) 45 : { 46 0 : _prop_f[_qp] = 0.0; 47 0 : _prop_df[_qp] = 0.0; 48 0 : _prop_d2f[_qp] = 0.0; 49 0 : return; 50 : } 51 : 52 14514436 : switch (_g_order) 53 : { 54 14482436 : case 0: // SIMPLE 55 14482436 : _prop_f[_qp] = n * n * (1.0 - n) * (1.0 - n); 56 14482436 : _prop_df[_qp] = 2.0 * n * (n - 1.0) * (2.0 * n - 1.0); 57 14482436 : _prop_d2f[_qp] = 12.0 * (n * n - n) + 2.0; 58 14482436 : break; 59 : 60 8000 : case 1: // LOW 61 8000 : _prop_f[_qp] = n * (1.0 - n); 62 8000 : _prop_df[_qp] = 1.0 - 2.0 * n; 63 8000 : _prop_d2f[_qp] = -2.0; 64 8000 : break; 65 : 66 24000 : case 2: // HIGH 67 24000 : _prop_f[_qp] = n * n * (1.0 - n * n) * (1.0 - n * n); 68 24000 : _prop_df[_qp] = n * (2.0 - n * n * (8.0 + 6.0 * n * n)); 69 24000 : _prop_d2f[_qp] = 2.0 - n * n * (24.0 + 30.0 * n * n); 70 24000 : break; 71 : 72 0 : default: 73 0 : mooseError("Internal error"); 74 : } 75 : }