CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   access wall velocities using UDFs in Fluent (https://www.cfd-online.com/Forums/fluent/203642-access-wall-velocities-using-udfs-fluent.html)

robboflea July 3, 2018 04:50

access wall velocities using UDFs in Fluent
 
Hi,

I need to access the velocity components in some boundary faces belonging to a moving wall.
I am trying to do this using a define on demand UDF, using the macros F_U, F_V and F_W. The results, however seem to be wrong.

The wall I am interested in is rotating aroung the z axis. I would expect then all the w velocities to be zero as it is an inviscid wall! From my macro the results are instead wrong, and w velocities obtained using F_W are not zero. Also the u and v components seem to be wrong. The solution itself, however, makes sense as I can plot those variables as contour plot and they make sense (w=0 everywhere and u and v have trends consistent with rigid rotation around the z axis). If I apply the same macro on another viscous wall, stationary this time, it does not work either! In this case I'd expect all three components of velocity to be 0 but they are not.

Below a code snippet of my UDF:

Code:

DEFINE_ON_DEMAND(write_omega_15)
{
#if !RP_HOST
    Domain *domain=Get_Domain(1);
    Thread *thread;
    face_t c;

    thread=Lookup_Thread(domain, 15);
    real *xyz;
    xyz=(real *)malloc(ND_ND * sizeof(real));
    real u, v, w, x, y, z, omega, r, abs_v;

    x = 10.0;
    y = 10.0;
    z = 10.0;
    u = 0.0;
    v = 0.0;
    w = 0.0;

    begin_f_loop(c,thread)
        F_CENTROID(xyz,c,thread);
        u = F_U(c,thread);
        v = F_V(c,thread);
        w = F_W(c,thread);
        x = xyz[0];
        y = xyz[1];
        z = xyz[2];
        r = sqrt(pow(y, 2.0) + pow(x, 2.0));
        abs_v = sqrt(pow(v, 2.0) + pow(u, 2.0));
        Message("\n r %f, u %f, v %f, w %f, abs_v %f, omega %f:\n",r,u,v,w,abs_v,abs_v/r);
    end_f_loop(c,thread)
#endif
}

The question is: am I doing something wrong to access the wall velocities or is there an inherent limitation of the face velocity access macros? I have been banging my head on this since a couple of days now and I cannot seem to understand where the bug is, if any.

Any help is appreciated!

Rob


All times are GMT -4. The time now is 10:44.