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 "HeatStructureInterface.h" 11 : #include "HeatConductionModel.h" 12 : #include "GeometricalComponent.h" 13 : 14 : InputParameters 15 2160 : HeatStructureInterface::validParams() 16 : { 17 2160 : InputParameters params = emptyInputParameters(); 18 : 19 4320 : params.addParam<FunctionName>("initial_T", "Initial temperature [K]"); 20 4320 : params.addParam<Real>( 21 4320 : "scaling_factor_temperature", 1.0, "Scaling factor for solid temperature variable."); 22 : 23 4320 : params.addPrivateParam<std::string>("component_type", "heat_struct"); 24 : 25 2160 : return params; 26 0 : } 27 : 28 1079 : HeatStructureInterface::HeatStructureInterface(GeometricalComponent * geometrical_component) 29 1079 : : _geometrical_component_hsi(*geometrical_component) 30 : { 31 1079 : } 32 : 33 : std::shared_ptr<HeatConductionModel> 34 1058 : HeatStructureInterface::buildModel() 35 : { 36 1058 : auto & factory = _geometrical_component_hsi.getMooseApp().getFactory(); 37 : 38 1058 : const std::string class_name = "HeatConductionModel"; 39 1058 : InputParameters params = factory.getValidParams(class_name); 40 1058 : params.set<THMProblem *>("_thm_problem") = &_geometrical_component_hsi.getTHMProblem(); 41 1058 : params.set<HeatStructureInterface *>("_hs") = this; 42 1058 : params.applyParameters(_geometrical_component_hsi.parameters()); 43 : return factory.create<HeatConductionModel>( 44 2116 : class_name, _geometrical_component_hsi.name(), params, 0); 45 1058 : } 46 : 47 : void 48 1058 : HeatStructureInterface::init() 49 : { 50 1058 : _hc_model = buildModel(); 51 1058 : } 52 : 53 : void 54 1043 : HeatStructureInterface::check() const 55 : { 56 1043 : auto & moose_app = _geometrical_component_hsi.getMooseApp(); 57 1043 : bool ics_set = _geometrical_component_hsi.getTHMProblem().hasInitialConditionsFromFile() || 58 2058 : _geometrical_component_hsi.isParamValid("initial_T"); 59 1043 : if (!ics_set && !moose_app.isRestarting()) 60 8 : _geometrical_component_hsi.logError("Missing initial condition for temperature."); 61 1043 : } 62 : 63 : void 64 908 : HeatStructureInterface::addVariables() 65 : { 66 908 : _hc_model->addVariables(); 67 1816 : if (_geometrical_component_hsi.isParamValid("initial_T")) 68 868 : _hc_model->addInitialConditions(); 69 908 : } 70 : 71 : void 72 908 : HeatStructureInterface::addMooseObjects() 73 : { 74 908 : if (useCylindricalTransformation()) 75 616 : _hc_model->addHeatEquationRZ(); 76 : else 77 292 : _hc_model->addHeatEquationXYZ(); 78 908 : } 79 : 80 : FunctionName 81 1034 : HeatStructureInterface::getInitialT() const 82 : { 83 2068 : if (_geometrical_component_hsi.isParamValid("initial_T")) 84 2068 : return _geometrical_component_hsi.getParam<FunctionName>("initial_T"); 85 : else 86 0 : _geometrical_component_hsi.mooseError( 87 : _geometrical_component_hsi.name(), 88 : ": The parameter 'initial_T' was requested but not supplied"); 89 : }