Fluids

Fluids

How to plot velocity with respect to z-coordinate of centroid of each face in a thread ( for a udf)?

    • Vaiju1997
      Subscriber

      I wrote the following snippet in order to obtain a power law velocity profile for my inlet BC. The z is the z co-ordinate and while I was able to interpret and hook the UDF, as soon as start calculating the velocity, the continuity and all 3 velocities remain zero in residuals and only k & w are iterating.

      My main aim is to do for transient k-w SST simulations but I also switched to steady just to check but it didn't work (velocity remains zero). Pls enlighten me as I am new to UDF.

      Another I would want to know is how to plot velocity vs z-coordinate while calculating solution

      pls see the attachments. The attachment shows the plots that I am getting for c_d and values for x-velocity, y - velocity and z - velocity



      #include "udf.h"


      DEFINE_PROFILE(x_velocity,thread,index)

      {

      real coord[ND_ND]; /* this will hold the position vector */

      real z;

      face_t f;


      begin_f_loop(f,thread) /* loops over all faces in the thread passed

      in the DEFINE macro argument */

      {

      F_CENTROID(coord,f,thread);

      coord[2]=z;

      F_PROFILE(f,thread,index)= 80.6715 * pow(z/323, 0.3584);

      }

      end_f_loop(f,thread)

      }

      Please help me out where I am going wrong.

    • Karthik R
      Administrator
      Hello,nWere you able to compile the UDF without any errors?nAlso, are you seeing the correct values if you use the fprintf statement? Could you please use these statement to see if the code is working as it is supposed to be?nThanks.nKarthikn
Viewing 1 reply thread
  • You must be logged in to reply to this topic.