Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

Wind profiles

    • anhvu lee
      Subscriber

      Hi 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)
        }
       

      }
    • Rob
      Ansys Employee

      Plot the profile(s) that you've specificied above: do they make sense? What z coordinate is the ground in the Fluent model? 

      • anhvu lee
        Subscriber

        Hi,

        Please explain more to me, I followed the Ansys manual for UDF so there're might be something wrong.

        Thanks

    • Rob
      Ansys Employee

      Possibly. 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. 

      • anhvu lee
        Subscriber

        Dear Rob,

        It's true with this equations when tested on excel or the expression function of Ansys. I really dont know why 

    • Rob
      Ansys Employee

      The 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.  

Viewing 3 reply threads
  • You must be logged in to reply to this topic.