https://mooseframework.inl.gov
Loading...
Searching...
No Matches
HeatTransferBase.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
10#include "HeatTransferBase.h"
12#include "FlowChannelBase.h"
13#include "ClosuresBase.h"
14#include "MooseUtils.h"
15
18{
20 params.addRequiredParam<std::string>("flow_channel",
21 "Name of flow channel component to connect to");
22 params.addParam<bool>(
23 "P_hf_transferred", false, "Is heat flux perimeter transferred from an external source?");
24 params.addParam<FunctionName>("P_hf", "Heat flux perimeter [m]");
25 return params;
26}
27
29 : ConnectorBase(parameters),
30 _flow_channel_name(getParam<std::string>("flow_channel")),
31 _P_hf_transferred(getParam<bool>("P_hf_transferred")),
32 _P_hf_provided(isParamValid("P_hf"))
33{
35}
36
37void
39{
41
42 checkComponentOfTypeExistsByName<FlowChannelBase>(_flow_channel_name);
43
44 if (hasComponentByName<FlowChannelBase>(_flow_channel_name))
45 {
46 const FlowChannelBase & flow_channel = getComponentByName<FlowChannelBase>(_flow_channel_name);
47
48 // add the name of this heat transfer component to list for flow channel
49 flow_channel.addHeatTransferName(name());
50
51 // get various data from flow channel
53 _model_type = flow_channel.getFlowModelID();
54 _fp_name = flow_channel.getFluidPropertiesName();
55 _A_fn_name = flow_channel.getAreaFunctionName();
57 }
58}
59
60void
62{
64
65 // determine names of heat transfer variables
66 if (hasComponentByName<FlowChannelBase>(_flow_channel_name))
67 {
68 const FlowChannelBase & flow_channel = getComponentByName<FlowChannelBase>(_flow_channel_name);
69
70 const std::string suffix = flow_channel.getHeatTransferNamesSuffix(name());
71
76 }
77}
78
79void
84
85void
87{
88 // heat flux perimeter variable
91}
92
93void
95{
96 // create heat flux perimeter aux if not transferred from external app
98 {
99 const std::string class_name = "FunctionAux";
100 InputParameters params = _factory.getValidParams(class_name);
101 params.set<AuxVariableName>("variable") = {_P_hf_name};
102 params.set<std::vector<SubdomainName>>("block") = _flow_channel_subdomains;
103 params.set<FunctionName>("function") = _P_hf_fn_name;
104
106 execute_on = {EXEC_TIMESTEP_BEGIN, EXEC_INITIAL};
107 params.set<ExecFlagEnum>("execute_on") = execute_on;
108
109 getTHMProblem().addAuxKernel(class_name, genName(name(), "P_hf_auxkernel"), params);
110 }
111}
112
113void
115{
117 false, _P_hf_name, getTHMProblem().getFlowFEType(), _flow_channel_subdomains);
118
119 // create heat flux perimeter variable if not transferred from external app
121 {
122 if (_P_hf_provided)
123 {
124 _P_hf_fn_name = getParam<FunctionName>("P_hf");
125 }
126 // create heat flux perimeter function if not provided; assume circular flow channel
127 else
128 {
129 _P_hf_fn_name = genName(name(), "P_hf_fn");
130
131 const std::string class_name = "GeneralizedCircumference";
132 InputParameters params = _factory.getValidParams(class_name);
133 params.set<FunctionName>("area_function") = _A_fn_name;
134 getTHMProblem().addFunction(class_name, _P_hf_fn_name, params);
135 }
136
137 if (!_app.isRestarting())
139 }
140}
141
142const VariableName &
149
150const VariableName &
157
158const MaterialPropertyName &
165
166const MaterialPropertyName &
171
172const UserObjectName &
const ExecFlagType EXEC_TIMESTEP_BEGIN
const ExecFlagType EXEC_INITIAL
const std::string name
Definition Setup.h:21
virtual void init()
Initializes the component.
Definition Component.h:405
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition Component.C:345
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
Definition Component.C:129
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition Component.C:135
Factory & _factory
The Factory associated with the MooseApp.
Definition Component.h:497
virtual void check() const
Check the component integrity.
Definition Component.h:416
@ INITIALIZED_PRIMARY
mesh set up, called primary init
Definition Component.h:41
@ INITIALIZED_SECONDARY
mesh set up, called both inits
Definition Component.h:42
virtual void initSecondary()
Perform secondary initialization, which relies on init() being called for all components.
Definition Component.h:411
void checkSetupStatus(const EComponentSetupStatus &status) const
Throws an error if the supplied setup status of this component has not been reached.
Definition Component.C:117
Base class for creating component that connect other components together (e.g.
static InputParameters validParams()
virtual void addFunction(const std::string &type, const std::string &name, InputParameters &parameters)
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
A base class for flow channels.
std::vector< std::shared_ptr< ClosuresBase > > getClosuresObjects() const
Get the used closures object(s)
const FunctionName & getAreaFunctionName() const
Get the name of the function describing the flow channel area.
const UserObjectName & getFluidPropertiesName() const
Gets the name of the fluid properties user object for this component.
void addHeatTransferName(const std::string &ht_name) const
Adds the name of a heat transfer component to the flow channel's list.
std::string getHeatTransferNamesSuffix(const std::string &ht_name) const
Gets suffix to add to heat-transfer-related names in a heat transfer component.
virtual const THM::FlowModelID & getFlowModelID() const =0
Gets the flow model ID.
static const std::string HEAT_FLUX_WALL
Definition FlowModel.h:104
static const std::string TEMPERATURE_WALL
Definition FlowModel.h:108
static const std::string HEAT_FLUX_PERIMETER
Definition FlowModel.h:105
const bool _P_hf_transferred
flag that heated perimeter is transferred from another application
virtual void initSecondary() override
Perform secondary initialization, which relies on init() being called for all components.
const MaterialPropertyName & getWallHeatFluxName() const
Returns wall heat flux name.
void addHeatedPerimeter()
Adds heated perimeter variable and objects.
FunctionName _A_fn_name
area function name for the connected flow channel
const VariableName & getWallTemperatureName() const
Returns wall temperature name.
virtual void addMooseObjects() override
virtual void check() const override
Check the component integrity.
std::vector< std::shared_ptr< ClosuresBase > > _closures_objects
Used closures object(s)
const VariableName & getHeatedPerimeterName() const
Returns heated perimeter name.
UserObjectName _fp_name
fluid properties object name
MaterialPropertyName _q_wall_name
wall heat flux name
VariableName _P_hf_name
heated perimeter name
MaterialPropertyName _T_wall_mat_name
wall temperature material name
VariableName _T_wall_name
wall temperature name
static InputParameters validParams()
FunctionName _P_hf_fn_name
heated perimeter function name
const UserObjectName & getFluidPropertiesName() const
HeatTransferBase(const InputParameters &parameters)
const std::string _flow_channel_name
name of the connected flow channel
virtual void addVariables() override
std::vector< SubdomainName > _flow_channel_subdomains
Subdomains corresponding to the connected flow channel.
THM::FlowModelID _model_type
flow model type
virtual void init() override
Initializes the component.
const bool _P_hf_provided
flag that the heated perimeter was specified via an input parameter
const MaterialPropertyName & getWallTemperatureMatName() const
Returns wall temperature name.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
bool isRestarting() const
MooseApp & _app
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.
void addFunctionIC(const VariableName &var_name, const std::string &func_name, const std::vector< SubdomainName > &block_names)
Definition Simulation.C:532
void addSimVariable(bool nl, const VariableName &name, libMesh::FEType fe_type, Real scaling_factor=1.0)
Queues a variable of type MooseVariableScalar to be added to the nonlinear or aux system.
Definition Simulation.C:271
ExecFlagEnum getDefaultExecFlagEnum()