-
-
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.
-
3467
-
1057
-
1051
-
929
-
896
© 2025 Copyright ANSYS, Inc. All rights reserved.