https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Closures1PhaseSimple.C
Go to the documentation of this file.
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
12#include "FlowChannel1Phase.h"
14
16
19{
21
22 params.addClassDescription("Simple 1-phase closures");
23
24 return params;
25}
26
31
32void
34{
35 if (!flow_channel.isParamValid("f"))
36 logComponentError(flow_channel.cname(),
37 "When using simple closures, the parameter 'f' must be provided.");
38}
39
40void
42 const FlowChannelBase & /*flow_channel*/) const
43{
44 if (!heat_transfer.isParamValid("Hw"))
45 logComponentError(heat_transfer.cname(),
46 "The parameter 'Hw' must be provided when using simple closures.");
47}
48
49void
51{
52 const FlowChannel1Phase & flow_channel_1phase =
53 dynamic_cast<const FlowChannel1Phase &>(flow_channel);
54
55 // wall friction material
56 addWallFrictionFunctionMaterial(flow_channel_1phase);
57
58 const unsigned int n_ht_connections = flow_channel_1phase.getNumberOfHeatTransferConnections();
59 if (n_ht_connections > 0)
60 {
61 // wall heat transfer coefficient material
62 if (n_ht_connections > 1)
63 addWeightedAverageMaterial(flow_channel_1phase,
64 flow_channel_1phase.getWallHTCNames1Phase(),
65 flow_channel_1phase.getHeatedPerimeterNames(),
67
68 // wall temperature material
69 if (flow_channel_1phase.getTemperatureMode())
70 {
71 if (n_ht_connections > 1)
72 addAverageWallTemperatureMaterial(flow_channel_1phase);
73 else
74 addWallTemperatureFromAuxMaterial(flow_channel_1phase);
75 }
76 else
77 {
78 if (n_ht_connections > 1)
79 addWallTemperatureFromHeatFluxMaterial(flow_channel_1phase);
80 }
81 }
82}
83
84void
86 const FlowChannelBase & flow_channel)
87{
88 const HeatTransfer1PhaseBase & heat_transfer_1phase =
89 dynamic_cast<const HeatTransfer1PhaseBase &>(heat_transfer);
90 const FunctionName & Hw_fn_name = heat_transfer.getParam<FunctionName>("Hw");
91
92 {
93 const std::string class_name = "ADGenericFunctionMaterial";
94 InputParameters params = _factory.getValidParams(class_name);
95 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
96 params.set<std::vector<std::string>>("prop_names") = {
97 heat_transfer_1phase.getWallHeatTransferCoefficient1PhaseName()};
98 params.set<std::vector<FunctionName>>("prop_values") = {Hw_fn_name};
100 class_name, genName(heat_transfer.name(), "Hw_material", flow_channel.name()), params);
101 }
102}
103
104void
106 const FlowChannel1Phase & flow_channel) const
107{
108 const std::string class_name = "ADTemperatureWall3EqnMaterial";
109 InputParameters params = _factory.getValidParams(class_name);
110 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
111 params.set<MaterialPropertyName>("T") = FlowModelSinglePhase::TEMPERATURE;
112 params.set<MaterialPropertyName>("q_wall") = FlowModel::HEAT_FLUX_WALL;
113 params.set<MaterialPropertyName>("Hw") = FlowModelSinglePhase::HEAT_TRANSFER_COEFFICIENT_WALL;
114 _sim.addMaterial(class_name, genName(flow_channel.name(), "T_wall_mat"), params);
115}
registerMooseObject("ThermalHydraulicsApp", Closures1PhaseSimple)
Base class for 1-phase closures.
static InputParameters validParams()
void addAverageWallTemperatureMaterial(const FlowChannel1Phase &flow_channel) const
Adds average wall temperature material.
void addWallFrictionFunctionMaterial(const FlowChannel1Phase &flow_channel) const
Adds material that computes wall friction factor from a specified function.
Simple 1-phase closures.
Closures1PhaseSimple(const InputParameters &params)
virtual void checkHeatTransfer(const HeatTransferBase &heat_transfer, const FlowChannelBase &flow_channel) const override
Checks for errors associated with a heat transfer component.
void addWallTemperatureFromHeatFluxMaterial(const FlowChannel1Phase &flow_channel) const
Adds material to compute wall temperature from heat flux.
virtual void addMooseObjectsHeatTransfer(const HeatTransferBase &heat_transfer, const FlowChannelBase &flow_channel) override
Adds MOOSE objects associated with a heat transfer component.
static InputParameters validParams()
virtual void checkFlowChannel(const FlowChannelBase &flow_channel) const override
Checks for errors associated with a flow channel component.
virtual void addMooseObjectsFlowChannel(const FlowChannelBase &flow_channel) override
Adds MOOSE objects associated with a flow channel component.
Factory & _factory
Factory associated with the MooseApp.
void addWallTemperatureFromAuxMaterial(const FlowChannelBase &flow_channel, unsigned int i=0) const
Adds a material for wall temperature from an aux variable.
void addWeightedAverageMaterial(const FlowChannelBase &flow_channel, const std::vector< MaterialPropertyName > &values, const std::vector< VariableName > &weights, const MaterialPropertyName &property_name) const
Adds a weighted average material.
THMProblem & _sim
Simulation.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition Component.C:345
const std::string & cname() const
Get the component name.
Definition Component.C:51
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
std::vector< MaterialPropertyName > getWallHTCNames1Phase() const
Gets 1-phase wall heat transfer coefficient names for connected heat transfers.
Single-component, single-phase flow channel.
A base class for flow channels.
std::vector< VariableName > getHeatedPerimeterNames() const
Gets heated perimeter names for connected heat transfers.
unsigned int getNumberOfHeatTransferConnections() const
Gets the number of heat transfer connections.
bool getTemperatureMode() const
Gets temperature mode flag.
static const std::string HEAT_TRANSFER_COEFFICIENT_WALL
static const std::string TEMPERATURE
static const std::string HEAT_FLUX_WALL
Definition FlowModel.h:104
Base class for heat transfer connections to 1-phase flow channels.
const MaterialPropertyName & getWallHeatTransferCoefficient1PhaseName() const
Returns 1-phase wall heat transfer coefficient name.
Base class for heat transfer connections.
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void logComponentError(const std::string &component_name, Args &&... args) const
Logs an error for a component.
const std::string & name() const
const T & getParam(const std::string &name) const
bool isParamValid(const std::string &name) const
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.