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 "ThermalSolidPropertiesMaterial.h" 11 : #include "ThermalSolidProperties.h" 12 : #include "SolidPropertiesNames.h" 13 : 14 : registerMooseObject("SolidPropertiesApp", ThermalSolidPropertiesMaterial); 15 : registerMooseObject("SolidPropertiesApp", ADThermalSolidPropertiesMaterial); 16 : 17 : template <bool is_ad> 18 : InputParameters 19 229 : ThermalSolidPropertiesMaterialTempl<is_ad>::validParams() 20 : { 21 229 : InputParameters params = Material::validParams(); 22 458 : params.addRequiredCoupledVar("temperature", "Temperature"); 23 458 : params.addRequiredParam<UserObjectName>("sp", "The name of the user object for solid properties"); 24 229 : params.addParam<std::string>(SolidPropertiesNames::specific_heat, 25 : SolidPropertiesNames::specific_heat, 26 : "Name to be used for the isobaric specific heat"); 27 229 : params.addParam<std::string>(SolidPropertiesNames::thermal_conductivity, 28 : SolidPropertiesNames::thermal_conductivity, 29 : "Name to be used for the thermal conductivity"); 30 229 : params.addParam<std::string>(SolidPropertiesNames::density, 31 : SolidPropertiesNames::density, 32 : "Name to be used for the density"); 33 229 : params.addClassDescription("Computes solid thermal properties as a function of temperature"); 34 229 : return params; 35 0 : } 36 : 37 : template <bool is_ad> 38 177 : ThermalSolidPropertiesMaterialTempl<is_ad>::ThermalSolidPropertiesMaterialTempl( 39 : const InputParameters & parameters) 40 : : Material(parameters), 41 177 : _temperature(coupledGenericValue<is_ad>("temperature")), 42 : 43 354 : _cp(declareGenericProperty<Real, is_ad>( 44 : getParam<std::string>(SolidPropertiesNames::specific_heat))), 45 177 : _k(declareGenericProperty<Real, is_ad>( 46 : getParam<std::string>(SolidPropertiesNames::thermal_conductivity))), 47 177 : _rho(declareGenericProperty<Real, is_ad>(getParam<std::string>(SolidPropertiesNames::density))), 48 : 49 354 : _sp(getUserObject<ThermalSolidProperties>("sp")) 50 : { 51 177 : } 52 : 53 : template <bool is_ad> 54 : void 55 72500 : ThermalSolidPropertiesMaterialTempl<is_ad>::computeQpProperties() 56 : { 57 72500 : _cp[_qp] = _sp.cp_from_T(_temperature[_qp]); 58 72500 : _k[_qp] = _sp.k_from_T(_temperature[_qp]); 59 72500 : _rho[_qp] = _sp.rho_from_T(_temperature[_qp]); 60 72500 : } 61 : 62 : template class ThermalSolidPropertiesMaterialTempl<false>; 63 : template class ThermalSolidPropertiesMaterialTempl<true>;