-
-
May 16, 2023 at 7:19 am
anhvu lee
SubscriberHi everyone,
I used the UDF file for the Wind direction and speed in transient mode. But the result looks not true while the upper wind speed is much slower than the building surrounding. Below is my script for the UDF.
Looking forward for your suggestions.
Thanks a lot
#include "udf.h"DEFINE_PROFILE(velocity,t,i){Â face_t f;Â real flow_time;Â flow_time=RP_Get_Real("flow-time");Â real x[ND_ND];Â real z;Â if(flow_time >=0 && flow_time < 3600){Â Â begin_f_loop(f,t)Â Â {Â Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1+(1-1)*flow_time/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >=3600 && flow_time < 7200){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1+(1-1)*(flow_time-3600)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 7200 && flow_time < 10800){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1+(1-1)*(flow_time-7200)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 10800 && flow_time < 14400){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1+(1.6-1)*(flow_time-10800)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 14400 && flow_time < 18000){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1.6+(1.9-1)*(flow_time-14400)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 18000 && flow_time < 21600){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1.9+(1-1.9)*(flow_time-18000)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 21600 && flow_time < 25200){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1+(2.5-1)*(flow_time-21600)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 25200 && flow_time < 28800){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (2.5+(4.1-2.5)*(flow_time-25200)/3600)*pow(270/10,0.14)*pow(z/370,0.14);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 28800 && flow_time < 32400){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (4.1+(3.1-4.1)*(flow_time-28800)/3600)*pow(270/10,0.22)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 32400 && flow_time < 36000){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (3.1+(1.8-3.1)*(flow_time-32400)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 36000 && flow_time < 39600){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1.8+(1-1.8)*(flow_time-36000)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 39600 && flow_time < 43200){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1+(1.6-1)*(flow_time-39600)/3600)*pow(270/10,0.14)*pow(z/370,0.14);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 43200 && flow_time < 46800){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1.6+(1-1)*(flow_time-43200)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 46800 && flow_time < 50400){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1+(1-1)*(flow_time-46800)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â if(flow_time >= 50400 && flow_time < 54000){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = (1+(1-1)*(flow_time-50400)/3600)*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â Â if(flow_time == 54000){ Â ÂÂ Â begin_f_loop(f,t)Â Â {Â F_CENTROID(x,f,t);Â Â z=x[2];Â Â F_PROFILE(f,t,i) = 1*pow(270/10,0.14)*pow(z/370,0.22);Â Â }Â Â end_f_loop(f,t)Â }Â} -
May 16, 2023 at 10:47 am
Rob
Forum ModeratorPlot the profile(s) that you've specificied above: do they make sense? What z coordinate is the ground in the Fluent model?Â
-
May 16, 2023 at 1:18 pm
anhvu lee
SubscriberHi,
Please explain more to me, I followed the Ansys manual for UDF so there're might be something wrong.
Thanks
-
-
May 16, 2023 at 1:47 pm
Rob
Forum ModeratorPossibly. Starting point is to see if the profiles you used are correct: plot in Excel to see if they're giving the values you expect. Use the equations from the UDF and not what you wrote to create the curves in the first instance.Â
-
May 17, 2023 at 12:48 pm
anhvu lee
SubscriberDear Rob,
It's true with this equations when tested on excel or the expression function of Ansys. I really dont know whyÂ
-
-
May 17, 2023 at 1:07 pm
Rob
Forum ModeratorThe profiles are correct? I didn't follow your statement.
What z-value is the ground, and what z-value is the sky? Use the surface reports in Fluent to find the values. Â
-
- The topic ‘Wind profiles’ is closed to new replies.
- air flow in and out of computer case
- Varying Bond model parameters to mimic soil particle cohesion/stiction
- Eroded Mass due to Erosion of Soil Particles by Fluids
- Centrifugal Fan Analysis for Determination of Characteristic Curve
- Guidance needed for Conjugate Heat Transfer Analysis for a 3s3p Li-ion Battery
- I am doing a corona simulation. But particles are not spreading.
- Issue to compile a UDF in ANSYS Fluent
- JACOBI Convergence Issue in ANSYS AQWA
- affinity not set
- Resuming SAG Mill Simulation with New Particle Batch in Rocky
-
3912
-
1414
-
1256
-
1118
-
1015
© 2025 Copyright ANSYS, Inc. All rights reserved.