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 "Closures1PhaseSimple.h" 11 : #include "FlowModelSinglePhase.h" 12 : #include "FlowChannel1Phase.h" 13 : #include "HeatTransfer1PhaseBase.h" 14 : 15 : registerMooseObject("ThermalHydraulicsApp", Closures1PhaseSimple); 16 : 17 : InputParameters 18 2537 : Closures1PhaseSimple::validParams() 19 : { 20 2537 : InputParameters params = Closures1PhaseBase::validParams(); 21 : 22 2537 : params.addClassDescription("Simple 1-phase closures"); 23 : 24 2537 : return params; 25 0 : } 26 : 27 1265 : Closures1PhaseSimple::Closures1PhaseSimple(const InputParameters & params) 28 1265 : : Closures1PhaseBase(params) 29 : { 30 1265 : } 31 : 32 : void 33 1964 : Closures1PhaseSimple::checkFlowChannel(const FlowChannelBase & flow_channel) const 34 : { 35 3928 : if (!flow_channel.isParamValid("f")) 36 2 : logComponentError(flow_channel.cname(), 37 : "When using simple closures, the parameter 'f' must be provided."); 38 1964 : } 39 : 40 : void 41 383 : Closures1PhaseSimple::checkHeatTransfer(const HeatTransferBase & heat_transfer, 42 : const FlowChannelBase & /*flow_channel*/) const 43 : { 44 766 : if (!heat_transfer.isParamValid("Hw")) 45 4 : logComponentError(heat_transfer.cname(), 46 : "The parameter 'Hw' must be provided when using simple closures."); 47 383 : } 48 : 49 : void 50 1922 : Closures1PhaseSimple::addMooseObjectsFlowChannel(const FlowChannelBase & flow_channel) 51 : { 52 : const FlowChannel1Phase & flow_channel_1phase = 53 1922 : dynamic_cast<const FlowChannel1Phase &>(flow_channel); 54 : 55 : // wall friction material 56 1922 : addWallFrictionFunctionMaterial(flow_channel_1phase); 57 : 58 : const unsigned int n_ht_connections = flow_channel_1phase.getNumberOfHeatTransferConnections(); 59 1922 : if (n_ht_connections > 0) 60 : { 61 : // wall heat transfer coefficient material 62 338 : if (n_ht_connections > 1) 63 66 : addWeightedAverageMaterial(flow_channel_1phase, 64 22 : flow_channel_1phase.getWallHTCNames1Phase(), 65 22 : flow_channel_1phase.getHeatedPerimeterNames(), 66 : FlowModelSinglePhase::HEAT_TRANSFER_COEFFICIENT_WALL); 67 : 68 : // wall temperature material 69 338 : if (flow_channel_1phase.getTemperatureMode()) 70 : { 71 306 : if (n_ht_connections > 1) 72 6 : addAverageWallTemperatureMaterial(flow_channel_1phase); 73 : else 74 300 : addWallTemperatureFromAuxMaterial(flow_channel_1phase); 75 : } 76 : else 77 : { 78 32 : if (n_ht_connections > 1) 79 16 : addWallTemperatureFromHeatFluxMaterial(flow_channel_1phase); 80 : } 81 : } 82 1922 : } 83 : 84 : void 85 360 : Closures1PhaseSimple::addMooseObjectsHeatTransfer(const HeatTransferBase & heat_transfer, 86 : const FlowChannelBase & flow_channel) 87 : { 88 : const HeatTransfer1PhaseBase & heat_transfer_1phase = 89 360 : dynamic_cast<const HeatTransfer1PhaseBase &>(heat_transfer); 90 360 : const FunctionName & Hw_fn_name = heat_transfer.getParam<FunctionName>("Hw"); 91 : 92 : { 93 360 : const std::string class_name = "ADGenericFunctionMaterial"; 94 360 : InputParameters params = _factory.getValidParams(class_name); 95 360 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames(); 96 720 : params.set<std::vector<std::string>>("prop_names") = { 97 1800 : heat_transfer_1phase.getWallHeatTransferCoefficient1PhaseName()}; 98 1080 : params.set<std::vector<FunctionName>>("prop_values") = {Hw_fn_name}; 99 720 : _sim.addMaterial( 100 360 : class_name, genName(heat_transfer.name(), "Hw_material", flow_channel.name()), params); 101 360 : } 102 720 : } 103 : 104 : void 105 16 : Closures1PhaseSimple::addWallTemperatureFromHeatFluxMaterial( 106 : const FlowChannel1Phase & flow_channel) const 107 : { 108 16 : const std::string class_name = "ADTemperatureWall3EqnMaterial"; 109 16 : InputParameters params = _factory.getValidParams(class_name); 110 32 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames(); 111 32 : params.set<MaterialPropertyName>("T") = FlowModelSinglePhase::TEMPERATURE; 112 32 : params.set<MaterialPropertyName>("q_wall") = FlowModel::HEAT_FLUX_WALL; 113 32 : params.set<MaterialPropertyName>("Hw") = FlowModelSinglePhase::HEAT_TRANSFER_COEFFICIENT_WALL; 114 32 : _sim.addMaterial(class_name, genName(flow_channel.name(), "T_wall_mat"), params); 115 32 : }