4343
4444
4545The 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 400K.
46+ at an initial temperature of 300K while the outside pipe of the wall is at 400K.
4747The setup is simulated for a few iterations to allow the examination
4848of the temperature field in the pipe.
4949
5858# ~~~~~~~~~~~~~~~~~~~~~~~~
5959# Import ``ansys-systemcoupling-core``, ``ansys-fluent-core``
6060
61- import ansys .mapdl .core as pymapdl
6261import ansys .fluent .core as pyfluent
62+ import ansys .mapdl .core as pymapdl
63+
6364import ansys .systemcoupling .core as pysyc
6465from ansys .systemcoupling .core import examples
6566
6970 "fluid_domain.msh" , "pysystem-coupling/cht_pipe"
7071)
7172
72- mapdl = pymapdl .launch_mapdl ()
73+ mapdl = pymapdl .launch_mapdl ()
7374mapdl .clear ()
7475mapdl .prep7 ()
7576
76- #%%
77- #Define material properties
77+ # %%
78+ # Define material properties
7879mapdl .mp ("EX" , 1 , 69e9 )
7980mapdl .mp ("NUXY" , 1 , 0.33 )
8081mapdl .mp ("DENS" , 1 , 2700 )
8182mapdl .mp ("ALPX" , 1 , 23.6e-6 )
8283mapdl .mp ("KXX" , 1 , 237 )
83- mapdl .mp ("C" , 1 , 900 )
84+ mapdl .mp ("C" , 1 , 900 )
8485
85- #%%
86- #Set element type to SOLID279
86+ # %%
87+ # Set element type to SOLID279
8788mapdl .et (1 , 279 )
8889mapdl .keyopt (1 , 2 , 1 )
8990print (mapdl )
9091
91- #%%
92- #Parameter of the pipe
93- r_in = 0.025
94- r_out = 0.035
95- l = 0.2
92+ # %%
93+ # Parameter of the pipe
94+ r_in = 0.025
95+ r_out = 0.035
96+ l = 0.2
9697
97- #%%
98- #Create hollow pipe
99- mapdl .cyl4 (0 , 0 , rad1 = r_in , rad2 = r_out , depth = l )
98+ # %%
99+ # Create hollow pipe
100+ mapdl .cyl4 (0 , 0 , rad1 = r_in , rad2 = r_out , depth = l )
100101mapdl .esize (0.002 )
101102mapdl .vsweep (1 )
102103print (mapdl .geometry .anum )
103104
105+
104106# %%
105107# Biot number prediction
106- def biot_number (
107- rho = 1000 ,
108- mu = 1e-3 ,
109- cp = 4180 ,
110- k_f = 0.6 ,
111- k_s = 237 ,
112- L_c = r_out - r_in ,
113- U = 0.1
114- ):
115- Re = (rho * U * L_c )/ mu
116- Pr = (mu * cp )/ k_f
117- Nu = 0.023 * Re ** 0.8 * Pr ** 0.4
118- h = Nu * k_f / L_c
119- Bi = h * L_c / k_s
108+ def biot_number (rho = 1000 , mu = 1e-3 , cp = 4180 , k_f = 0.6 , k_s = 237 , L_c = r_out - r_in , U = 0.1 ):
109+ Re = (rho * U * L_c ) / mu
110+ Pr = (mu * cp ) / k_f
111+ Nu = 0.023 * Re ** 0.8 * Pr ** 0.4
112+ h = Nu * k_f / L_c
113+ Bi = h * L_c / k_s
120114 return Bi
121- Bi = biot_number ()
115+
116+
117+ Bi = biot_number ()
122118print ("The Biot number is " , Bi )
123119
124120# %%
125121# Creating the regions from the geometry for named selections
126- #Inner wall NS
127- mapdl .asel ('S' , ' AREA' , '' , 5 , 6 )
128- mapdl .nsla ('S' , 1 )
122+ # Inner wall NS
123+ mapdl .asel ("S" , " AREA" , "" , 5 , 6 )
124+ mapdl .nsla ("S" , 1 )
129125mapdl .cm ("FSIN_1" , "NODE" )
130126mapdl .allsel ()
131127
132- #Outer wall NS
133- mapdl .asel ('S' , ' AREA' , '' , 3 , 4 )
128+ # Outer wall NS
129+ mapdl .asel ("S" , " AREA" , "" , 3 , 4 )
134130mapdl .cm ("Outer_wall" , "AREA" )
135131mapdl .allsel ()
136132
137- #Outlet NS
138- mapdl .asel ('S' , ' AREA' , '' , 2 )
133+ # Outlet NS
134+ mapdl .asel ("S" , " AREA" , "" , 2 )
139135mapdl .cm ("Outlet" , "AREA" )
140136mapdl .allsel ()
141137
142- #Inlet NS
143- mapdl .asel ('S' , ' AREA' , '' , 1 )
138+ # Inlet NS
139+ mapdl .asel ("S" , " AREA" , "" , 1 )
144140mapdl .cm ("Inlet" , "AREA" )
145141mapdl .allsel ()
146142
147- #%%
148- #Boundary conditions
149- mapdl .cmsel ('S' , ' Outer_wall' )
150- mapdl .d (' Outer_wall' , ' TEMP' , 77 )
143+ # %%
144+ # Boundary conditions
145+ mapdl .cmsel ("S" , " Outer_wall" )
146+ mapdl .d (" Outer_wall" , " TEMP" , 77 )
151147mapdl .allsel ()
152148
153- mapdl .cmsel ('S' , ' Inlet' )
154- mapdl .sf (' ALL' , ' HFLUX' , 0 )
149+ mapdl .cmsel ("S" , " Inlet" )
150+ mapdl .sf (" ALL" , " HFLUX" , 0 )
155151mapdl .allsel ()
156152
157- mapdl .cmsel ('S' , ' Outlet' )
158- mapdl .sf (' ALL' , ' HFLUX' , 0 )
153+ mapdl .cmsel ("S" , " Outlet" )
154+ mapdl .sf (" ALL" , " HFLUX" , 0 )
159155mapdl .allsel ()
160156
161- mapdl .cmsel ('S' , ' FSIN_1' )
162- mapdl .sf (' FSIN_1' , ' FSIN' , 1 )
157+ mapdl .cmsel ("S" , " FSIN_1" )
158+ mapdl .sf (" FSIN_1" , " FSIN" , 1 )
163159mapdl .allsel ()
164160
165- #%%
166- #Setup the rest of the analysis
161+ # %%
162+ # Setup the rest of the analysis
167163mapdl .run ("/SOLU" )
168164mapdl .antype (0 )
169165
@@ -174,24 +170,26 @@ def biot_number(
174170# %%
175171# Read the pre-created mesh file
176172
177- fluent = pyfluent .launch_fluent (start_transcript = False )
173+ fluent = pyfluent .launch_fluent (start_transcript = False )
178174fluent .file .read (file_type = "mesh" , file_name = fluent_msh_file )
179175
180- #%%
181- #Define the fluid solver settings
182- fluent .setup .models .energy .enabled = True
176+ # %%
177+ # Define the fluid solver settings
178+ fluent .setup .models .energy .enabled = True
183179
184- #%%
185- #Add the material
180+ # %%
181+ # Add the material
186182fluent .setup .materials .database .copy_by_name (type = "fluid" , name = "water-liquid" )
187183
188184fluent .setup .cell_zone_conditions .fluid ["fff_fluiddomain" ].material = "water-liquid"
189185
190- #%%
191- #Define boundary conditions
186+ # %%
187+ # Define boundary conditions
192188fluent .setup .boundary_conditions .velocity_inlet ["inlet" ].momentum .velocity = 0.1
193189fluent .setup .boundary_conditions .velocity_inlet ["inlet" ].thermal .temperature = 300
194- fluent .setup .boundary_conditions .wall ["inner_wall" ].thermal .thermal_bc = "via System Coupling"
190+ fluent .setup .boundary_conditions .wall ["inner_wall" ].thermal .thermal_bc = (
191+ "via System Coupling"
192+ )
195193
196194fluent .solution .run_calculation .iter_count = 20
197195
@@ -201,33 +199,35 @@ def biot_number(
201199# System Coupling setup involves adding the structural and fluid
202200# participants, adding coupled interfaces and data transfers,
203201# and setting other coupled analysis properties.
204- syc = pysyc .launch (start_output = True )
202+ syc = pysyc .launch (start_output = True )
205203
206- #%%
204+ # %%
207205# Add participants by passing session handles to System Coupling.
208- fluid_name = syc .setup .add_participant (participant_session = fluent )
209- solid_name = syc .setup .add_participant (participant_session = mapdl )
206+ fluid_name = syc .setup .add_participant (participant_session = fluent )
207+ solid_name = syc .setup .add_participant (participant_session = mapdl )
210208
211- syc .setup .coupling_participant [fluid_name ].display_name = "Fluid"
212- syc .setup .coupling_participant [solid_name ].display_name = "Solid"
209+ syc .setup .coupling_participant [fluid_name ].display_name = "Fluid"
210+ syc .setup .coupling_participant [solid_name ].display_name = "Solid"
213211
214- #%%
215- #Add coupling face and data transfers
216- interface_name = syc .setup .add_interface (
217- side_one_participant = fluid_name , side_one_regions = ["inner_wall" ],
218- side_two_participant = solid_name , side_two_regions = ["FSIN_1" ]
212+ # %%
213+ # Add coupling face and data transfers
214+ interface_name = syc .setup .add_interface (
215+ side_one_participant = fluid_name ,
216+ side_one_regions = ["inner_wall" ],
217+ side_two_participant = solid_name ,
218+ side_two_regions = ["FSIN_1" ],
219219)
220220
221- #%%
222- #Set up 2-way thermal FSI coupling
223- syc .setup .add_thermal_data_transfers (interface = interface_name )
221+ # %%
222+ # Set up 2-way thermal FSI coupling
223+ syc .setup .add_thermal_data_transfers (interface = interface_name )
224224
225225# %%
226226# Time step size, end time, output controls
227227syc .setup .solution_control .time_step_size = "0.1 [s]" # time step is 0.1 [s]
228228syc .setup .solution_control .end_time = 10 # end time is 10.0 [s]
229229
230- syc .setup .solution_control .maximum_iterations = 100
230+ syc .setup .solution_control .maximum_iterations = 100
231231
232232# %%
233233# Solution
@@ -239,4 +239,3 @@ def biot_number(
239239# ----
240240syc .end_output ()
241241syc .exit ()
242-
0 commit comments