Step 5: Secondary Side
Complete input file for this step: 05_secondary_side.i

Figure 1: Model diagram
In this step, we will add the secondary side of the heat exchanger and set up the inlet mass flow rate boundary condition as a function of time.
Heat Exchanger
We will define the following heat exchanger parameters:
# heat exchanger parameters
hx_dia_inner = ${units 12. cm -> m}
hx_wall_thickness = ${units 5. mm -> m}
hx_dia_outer = ${units 50. cm -> m}
hx_radius_wall = ${fparse hx_dia_inner / 2. + hx_wall_thickness}
hx_length = 1 # m
hx_n_elems = 10
m_dot_sec_in = 1 # kg/s
We also define second fluid that we will be using on the secondary side:
[FluidProperties<<<{"href": "../../../../syntax/FluidProperties/index.html"}>>>]
[water]
type = StiffenedGasFluidProperties<<<{"description": "Fluid properties for a stiffened gas", "href": "../../../../source/fluidproperties/StiffenedGasFluidProperties.html"}>>>
gamma<<<{"description": "Heat capacity ratio"}>>> = 2.35
cv<<<{"description": "Constant volume specific heat"}>>> = 1816.0
q<<<{"description": "Parameter defining zero point of internal energy"}>>> = -1.167e6
p_inf<<<{"description": "Stiffness parameter"}>>> = 1.0e9
q_prime<<<{"description": "Parameter"}>>> = 0
[]
[]
Components
To define the heat exchanger block, we will use the syntax for grouping components together.
The general syntax is:
[group]
[component1]
[]
[component2]
[]
[]
Then, individual components can be referred to as group/component1
and group/component2
.
Note: It is possible to define parameters within the group. Good candidates would be hx_length
and hx_n_elems
.
We will take advantage of this feature and set our heat exchanger as follows:
[Components<<<{"href": "../../../../syntax/Components/index.html"}>>>]
[hx]
[pri]
type = FlowChannel1Phase
position = '1 0 1.75'
orientation = '0 0 -1'
length = ${hx_length}
n_elems = ${hx_n_elems}
roughness = 1e-5
A = '${fparse pi * hx_dia_inner * hx_dia_inner / 4.}'
D_h = ${hx_dia_inner}
[]
[ht_pri]
type = HeatTransferFromHeatStructure1Phase
hs = hx/wall
hs_side = inner
flow_channel = hx/pri
P_hf = '${fparse pi * hx_dia_inner}'
[]
[wall]
type = HeatStructureCylindrical
position = '1 0 1.75'
orientation = '0 0 -1'
length = ${hx_length}
n_elems = ${hx_n_elems}
widths = '${hx_wall_thickness}'
n_part_elems = '3'
solid_properties = 'steel'
solid_properties_T_ref = '300'
names = '0'
inner_radius = '${fparse hx_dia_inner / 2.}'
[]
[ht_sec]
type = HeatTransferFromHeatStructure1Phase
hs = hx/wall
hs_side = outer
flow_channel = hx/sec
P_hf = '${fparse 2 * pi * hx_radius_wall}'
[]
[sec]
type = FlowChannel1Phase
position = '${fparse 1 + hx_wall_thickness} 0 0.25'
orientation = '0 0 1'
length = ${hx_length}
n_elems = ${hx_n_elems}
A = '${fparse pi * (hx_dia_outer * hx_dia_outer / 4. - hx_radius_wall * hx_radius_wall)}'
D_h = '${fparse hx_dia_outer - (2 * hx_radius_wall)}'
fp = water
initial_T = 300
[]
[]
[]
Then, we connect the inlet boundary condition to the secondary side flow channel:
[Components<<<{"href": "../../../../syntax/Components/index.html"}>>>]
[inlet_sec]
type = InletMassFlowRateTemperature1Phase<<<{"description": "Boundary condition with prescribed mass flow rate and temperature for 1-phase flow channels.", "href": "../../../../source/components/InletMassFlowRateTemperature1Phase.html"}>>>
input<<<{"description": "Name of the input"}>>> = 'hx/sec:in'
m_dot<<<{"description": "Prescribed mass flow rate [kg/s]"}>>> = 0
T<<<{"description": "Prescribed temperature [K]"}>>> = 300
[]
[]
And then, the outlet boundary condition for the same channel:
[Components<<<{"href": "../../../../syntax/Components/index.html"}>>>]
[outlet_sec]
type = Outlet1Phase<<<{"description": "Boundary condition with prescribed pressure for 1-phase flow channels.", "href": "../../../../source/components/Outlet1Phase.html"}>>>
input<<<{"description": "Name of the input"}>>> = 'hx/sec:out'
p<<<{"description": "Prescribed pressure [Pa]"}>>> = 1e5
[]
[]
This is the same as what we did in step 1 of this tutorial.
Inlet Mass Flow Rate
To set up the inlet boundary condition as a function of time, we first need to define a time-dependent function in the top-level [Functions]
block:
[Functions<<<{"href": "../../../../syntax/Functions/index.html"}>>>]
[m_dot_sec_fn]
type = PiecewiseLinear<<<{"description": "Linearly interpolates between pairs of x-y data", "href": "../../../../source/functions/PiecewiseLinear.html"}>>>
xy_data<<<{"description": "All function data, supplied in abscissa, ordinate pairs"}>>> = '
0 0
10 ${m_dot_sec_in}'
[]
[]
In the ControlLogic block, we bring the function value in using the GetFunctionValueControl block:
[ControlLogic<<<{"href": "../../../../syntax/ControlLogic/index.html"}>>>]
[m_dot_sec_inlet_ctrl]
type = GetFunctionValueControl<<<{"description": "Sets a ControlData named 'value' with the value of a function", "href": "../../../../source/controllogic/GetFunctionValueControl.html"}>>>
function<<<{"description": "The name of the function prescribing a value."}>>> = m_dot_sec_fn
[]
[]
And then we feed this value back into the system:
[ControlLogic<<<{"href": "../../../../syntax/ControlLogic/index.html"}>>>]
[set_m_dot_sec_ctrl]
type = SetComponentRealValueControl<<<{"description": "Control to set a floating point (Real) value of a component parameter with control data boolean", "href": "../../../../source/controllogic/SetComponentRealValueControl.html"}>>>
component<<<{"description": "The name of the component to be controlled."}>>> = inlet_sec
parameter<<<{"description": "The name of the parameter in the component to be controlled."}>>> = m_dot
value<<<{"description": "The name of control data to be set in the component."}>>> = m_dot_sec_inlet_ctrl:value
[]
[]
Alternative Solution
An alternative solution to this is to use a convenience block called TimeFunctionComponentControl which combines these two ControlLogic
blocks into one. It takes three parameters component
, parameter
, and function
.
The equivalent syntax would look like this:
[set_m_dot_sec_ctrl]
type = TimeFunctionComponentControl
component = inlet_sec
parameter = m_dot
function = m_dot_sec_fn
[]
Note: This should be your preferred setup when you want to use time-dependent component parameters.