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 "MixedSwitchingFunctionMaterial.h" 11 : 12 : registerMooseObject("PhaseFieldApp", MixedSwitchingFunctionMaterial); 13 : 14 : InputParameters 15 47 : MixedSwitchingFunctionMaterial::validParams() 16 : { 17 47 : InputParameters params = OrderParameterFunctionMaterial::validParams(); 18 47 : params.addClassDescription("Helper material to provide h(eta) and its derivative in one of two " 19 : "polynomial forms. MIX234 and MIX246"); 20 94 : MooseEnum h_order("MIX234=0 MIX246", "MIX234"); 21 94 : params.addParam<MooseEnum>( 22 : "h_order", h_order, "Polynomial order of the switching function h(eta)"); 23 94 : params.set<std::string>("function_name") = std::string("h"); 24 : 25 141 : params.addRangeCheckedParam<Real>( 26 94 : "weight", 1.0, "weight <= 1 & weight >= 0", "Weight parameter for MIX type h(eta)"); 27 : 28 47 : return params; 29 47 : } 30 : 31 36 : MixedSwitchingFunctionMaterial::MixedSwitchingFunctionMaterial(const InputParameters & parameters) 32 : : OrderParameterFunctionMaterial(parameters), 33 36 : _h_order(getParam<MooseEnum>("h_order")), 34 108 : _weight(getParam<Real>("weight")) 35 : { 36 36 : } 37 : 38 : void 39 1001600 : MixedSwitchingFunctionMaterial::computeQpProperties() 40 : { 41 1001600 : Real n = _eta[_qp]; 42 1001600 : n = n > 1 ? 1 : (n < 0 ? 0 : n); 43 : 44 1001600 : switch (_h_order) 45 : { 46 1001600 : case 0: // MIX234 47 1001600 : _prop_f[_qp] = 48 1001600 : n * n * (3.0 * _weight + (4.0 - 6.0 * _weight) * n + (3.0 * _weight - 3.0) * n * n); 49 1001600 : _prop_df[_qp] = 50 1001600 : n * (6.0 * _weight + (12.0 - 18.0 * _weight) * n + (12.0 * _weight - 12.0) * n * n); 51 1001600 : _prop_d2f[_qp] = 6.0 * _weight + ((24.0 - 36.0 * _weight) + (36.0 * _weight - 36.0) * n) * n; 52 1001600 : break; 53 : 54 0 : case 1: // MIX246 55 0 : _prop_f[_qp] = 56 0 : n * n * (2.0 * _weight + n * n * ((3.0 - 4.0 * _weight) + (2.0 * _weight - 2.0) * n * n)); 57 0 : _prop_df[_qp] = 58 0 : n * (4.0 * _weight + n * n * ((12.0 - 16.0 * _weight) + (12.0 * _weight - 12.0) * n * n)); 59 0 : _prop_d2f[_qp] = 60 0 : 4.0 * _weight + n * n * ((36.0 - 48.0 * _weight) + (60.0 * _weight - 60.0) * n * n); 61 0 : break; 62 : 63 0 : default: 64 0 : mooseError("Internal error"); 65 : } 66 1001600 : }