2525Conjugate Heat transfer- Pipe flow
2626-----------------------------------
2727
28- This example illustrates a two way conjugate heat transfer case for *flow in a pipe* that is used as
29- a tutorial for System Coupling. This Fluid-Structure interaction (FSI) is based on a steady case fluid flow
30- in a pipe with surface data transfers.
28+ This example illustrates a two way conjugate heat transfer case for
29+ *flow in a pipe* that is used as a tutorial for System Coupling. This Fluid-Structure
30+ interaction (FSI) is based on a steady case fluid flow in a pipe with surface data transfers.
3131
3232- Ansys Mechanical APDL (MAPDL) is used to perform a structural analysis.
3333- Ansys Fluent is used to perform a steady fluid-flow analysis.
34- - System Coupling coordinates the coupled sloution involving the above prodcuts to
34+ - System Coupling coordinates the coupled sloution involving the above products to
3535 solve the multiphysics problem via co-simulation.
36-
37- **Problem description**
3836
39- A fluid at a certain temperature flows into a pipe of known diameter and length. As it flows, the heated wall
40- of the pipe conducts heat to the inner wall, which in turns heats the fluid and cools down the walls of the pipe.
37+ **Problem description**
38+
39+ A fluid at a certain temperature flows into a pipe of known diameter and length. As it flows,
40+ the heated wall of the pipe conducts heat to the inner wall, which in turns heats the fluid and
41+ cools down the walls of the pipe.
42+
4143#image
4244
43- The flow is smooth inside the pipe and the outer wall of the pipe is adiabatic. Fluid enters at an initial
44- temperature of 300K while the outside pipe of the wall is at some higher temperature. The setup is simulated for
45- a few iterations to allow the examination of the temperature field in the pipe.
45+ The flow is smooth inside the pipe and the outer wall of the pipe is adiabatic. Fluid enters
46+ at an initial temperature of 300K while the outside pipe of the wall is at some higher
47+ temperature. The setup is simulated for a few iterations to allow the examination
48+ of the temperature field in the pipe.
4649
47- """
50+ """
4851# %%
4952# Import modules, download files, launch products
5053# -----------------------------------------------
5659# Import ``ansys-systemcoupling-core``, ``ansys-fluent-core``
5760
5861import ansys .fluent .core as pyfluent
62+
5963import ansys .systemcoupling .core as pysyc
6064
61- #===
65+ # ===
6266
6367# launch Fluent session and read in mesh file
6468pipe_fluid_session = pyfluent .launch_fluent (start_transcript = False )
6973pipe_fluid_session .setup .models .energy .enabled = True
7074
7175# add water material
72- pipe_fluid_session .setup .materials .database .copy_by_name (type = "fluid" , name = "water-liquid" )
76+ pipe_fluid_session .setup .materials .database .copy_by_name (
77+ type = "fluid" , name = "water-liquid"
78+ )
7379
7480# set up cell zone conditions
7581pipe_fluid_session .setup .cell_zone_conditions .fluid ["fluid" ].material = "water-liquid"
7682
7783# set up boundary conditions
78- pipe_fluid_session .setup .boundary_conditions .velocity_inlet ["inlet" ].momentum .velocity = 0.1
79- pipe_fluid_session .setup .boundary_conditions .wall ["wall" ].thermal .thermal_bc = "via System Coupling"
84+ pipe_fluid_session .setup .boundary_conditions .velocity_inlet [
85+ "inlet"
86+ ].momentum .velocity = 0.1
87+ pipe_fluid_session .setup .boundary_conditions .wall ["wall" ].thermal .thermal_bc = (
88+ "via System Coupling"
89+ )
8090
8191# set up solver settings - 1 fluent iteration per 1 coupling iteration
8292pipe_fluid_session .solution .run_calculation .iter_count = 1
8393
84- #===
94+ # ===
8595
8696# launch another Fluent session and read in mesh file
8797pipe_solid_session = pyfluent .launch_fluent (start_transcript = False )
98108pipe_solid_session .setup .cell_zone_conditions .solid ["solid" ].material = "copper"
99109
100110# set up boundary conditions
101- pipe_solid_session .setup .boundary_conditions .wall ["outer_wall" ].thermal .thermal_bc = "Temperature"
111+ pipe_solid_session .setup .boundary_conditions .wall ["outer_wall" ].thermal .thermal_bc = (
112+ "Temperature"
113+ )
102114pipe_solid_session .setup .boundary_conditions .wall ["outer_wall" ].thermal .t .value = 350
103115
104- pipe_solid_session .setup .boundary_conditions .wall ["inner_wall" ].thermal .thermal_bc = "via System Coupling"
116+ pipe_solid_session .setup .boundary_conditions .wall ["inner_wall" ].thermal .thermal_bc = (
117+ "via System Coupling"
118+ )
105119
106- pipe_solid_session .setup .boundary_conditions .wall ["insulated1" ].thermal .thermal_bc = "Heat Flux"
120+ pipe_solid_session .setup .boundary_conditions .wall ["insulated1" ].thermal .thermal_bc = (
121+ "Heat Flux"
122+ )
107123pipe_solid_session .setup .boundary_conditions .wall ["insulated1" ].thermal .q .value = 0
108124
109- pipe_solid_session .setup .boundary_conditions .wall ["insulated2" ].thermal .thermal_bc = "Heat Flux"
125+ pipe_solid_session .setup .boundary_conditions .wall ["insulated2" ].thermal .thermal_bc = (
126+ "Heat Flux"
127+ )
110128pipe_solid_session .setup .boundary_conditions .wall ["insulated2" ].thermal .q .value = 0
111129
112130# set up solver settings - 1 fluent iteration per 1 coupling iteration
113131pipe_solid_session .solution .run_calculation .iter_count = 1
114132
115- import numpy as np
116133
134+ rho_water = 998.2
135+ mu_water = 1.002e-3
136+ k_water = 0.6
137+ Pr_water = 7.0
117138
118- rho_water = 998.2
119- mu_water = 1.002e-3
120- k_water = 0.6
121- Pr_water = 7.0
122-
123- rho_al = 2700
124- k_al = 237
125- cp_al = 900
139+ rho_al = 2700
140+ k_al = 237
141+ cp_al = 900
126142
127143
128144# Flow and Geometry
129145
130- u = 0.5 # velocity [m/s]
131- L = 0.5 # pipe length [m]
132- D = 0.1 # inner diameter [m] → characteristic length for fluid
133- t_wall = 0.12 # wall thickness [m] → characteristic length for solid conduction
146+ u = 0.5 # velocity [m/s]
147+ L = 0.5 # pipe length [m]
148+ D = 0.1 # inner diameter [m] → characteristic length for fluid
149+ t_wall = 0.12 # wall thickness [m] → characteristic length for solid conduction
134150
135151
136152# Functions
137153
154+
138155def getReynoldsNumber (rho , u , D , mu ):
139156 return rho * u * D / mu
140157
158+
141159def getPrandtlNumber (mu , cp , k ):
142160 return mu * cp / k
143161
162+
144163def getNusseltNumber (Re , Pr , L_over_D ):
145-
164+
146165 if Re < 2300 :
147166 Nu = 3.66 # laminar, fully developed
148167 elif Re < 10000 :
@@ -151,9 +170,11 @@ def getNusseltNumber(Re, Pr, L_over_D):
151170 Nu = 0.023 * Re ** 0.8 * Pr ** 0.4 # fully turbulent
152171 return Nu
153172
173+
154174def getConvectionCoefficient (Nu , k_fluid , D ):
155175 return Nu * k_fluid / D
156176
177+
157178def getBiotNumber (h , k_solid , t_wall ):
158179 return h * t_wall / k_solid
159180
@@ -163,7 +184,7 @@ def getBiotNumber(h, k_solid, t_wall):
163184L_over_D = L / D
164185
165186Nu = getNusseltNumber (Re , Pr , L_over_D )
166- h = getConvectionCoefficient (Nu , k_water , D )
187+ h = getConvectionCoefficient (Nu , k_water , D )
167188Bi = getBiotNumber (h , k_al , t_wall )
168189
169190
@@ -184,39 +205,42 @@ def getBiotNumber(h, k_solid, t_wall):
184205 print ("→ Bi > 10 → Significant temperature gradient in wall" )
185206else :
186207 print ("→ 0.1 < Bi < 10 → Moderate internal resistance" )
187- #===
208+ # ===
188209
189210# launch System Coupling session
190211syc = pysyc .launch ()
191212syc .start_output ()
192213
193214# add two Fluent sessions above as participants
194- fluid_name = syc .setup .add_participant (participant_session = pipe_fluid_session )
195- solid_name = syc .setup .add_participant (participant_session = pipe_solid_session )
215+ fluid_name = syc .setup .add_participant (participant_session = pipe_fluid_session )
216+ solid_name = syc .setup .add_participant (participant_session = pipe_solid_session )
196217syc .setup .coupling_participant [fluid_name ].display_name = "Fluid"
197218syc .setup .coupling_participant [solid_name ].display_name = "Solid"
198219
199220# add a coupling interface
200221interface = syc .setup .add_interface (
201- side_one_participant = fluid_name , side_one_regions = ["wall" ],
202- side_two_participant = solid_name , side_two_regions = ["inner_wall" ])
222+ side_one_participant = fluid_name ,
223+ side_one_regions = ["wall" ],
224+ side_two_participant = solid_name ,
225+ side_two_regions = ["inner_wall" ],
226+ )
203227
204228# set up 2-way coupling - add temperature and heat flow data transfers
205- syc .setup .add_thermal_data_transfers (interface = interface )
229+ syc .setup .add_thermal_data_transfers (interface = interface )
206230
207231# set up coupled analysis settings
208232# it should take about 80 iterations to converge
209233syc .setup .solution_control .maximum_iterations = 100
210234
211- #===
235+ # ===
212236
213237# solve the coupled analysis
214238syc .solution .solve ()
215239
216- #===
240+ # ===
217241
218242# clean up at the end
219243syc .end_output ()
220244pipe_fluid_session .exit ()
221245pipe_solid_session .exit ()
222- syc .exit ()
246+ syc .exit ()
0 commit comments