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