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 "ADPhaseFieldTwoPhaseMaterial.h" 11 : 12 : registerADMooseObject("PhaseFieldApp", ADPhaseFieldTwoPhaseMaterial); 13 : 14 : InputParameters 15 1680 : ADPhaseFieldTwoPhaseMaterial::validParams() 16 : { 17 1680 : InputParameters params = ADMaterial::validParams(); 18 1680 : params.addClassDescription("Material that assigns properties based on the phase field variable."); 19 3360 : params.addRequiredCoupledVar("pf", "Phase field variable"); 20 3360 : params.addRequiredParam<MaterialPropertyName>("prop_name", "Name of material property."); 21 3360 : params.addRequiredParam<Real>("prop_value_1", "value of phase 1."); 22 3360 : params.addRequiredParam<Real>("prop_value_2", "value of phase 2."); 23 1680 : return params; 24 0 : } 25 : 26 1296 : ADPhaseFieldTwoPhaseMaterial::ADPhaseFieldTwoPhaseMaterial(const InputParameters & parameters) 27 : : ADMaterial(parameters), 28 1296 : _pf(adCoupledValue("pf")), 29 2592 : _prop_value_1(getParam<Real>("prop_value_1")), 30 2592 : _prop_value_2(getParam<Real>("prop_value_2")), 31 3888 : _prop(declareADProperty<Real>(getParam<MaterialPropertyName>("prop_name"))) 32 : { 33 1296 : } 34 : 35 : void 36 0 : ADPhaseFieldTwoPhaseMaterial::computeQpProperties() 37 : { 38 0 : _prop[_qp] = 0.5 * (1 - _pf[_qp]) * _prop_value_1 + 0.5 * (1 + _pf[_qp]) * _prop_value_2; 39 0 : }