CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   how to store wall shear in udm (http://www.cfd-online.com/Forums/fluent-udf/102043-how-store-wall-shear-udm.html)

tsi07 May 21, 2012 06:37

how to store wall shear in udm
 
Hello,
I try to make a udf which store the wall shear. But it gives zero as value. I don't understand why.

I have a 2D system.
Can anyone helps me ?

Here is the code :
Code:

# include "mem.h"
# include "udf.h"


DEFINE_ON_DEMAND(store_wall_shear)
{
        Domain *domain;
        Thread *t;
        face_t f;
        domain = Get_Domain(1);
        t=Lookup_Thread(domain,5); /* 5 is the wall in my case */
        begin_f_loop(f,t)
        {
                F_UDMI(f,t,0)=F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[0];
                F_UDMI(f,t,1)=F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[1];
        }
        end_f_loop(f,t)
}

Thanks

Daniel Tanner May 21, 2012 08:08

Search the site for this, it has been detailed before.
If memory serves you cannot use F_UDMI() you need to use C_UDMI(). You will need to update the UDF to loop over cells.

tsi07 May 21, 2012 08:56

Thank you Daniel Tanner,

I have seen your previous post on the subject (here) but I had thought that it could be different with the wall shear, because it's a face data.

But finally it's the same thing.

Code:

# include "mem.h"
# include "udf.h"


DEFINE_ON_DEMAND(store_wall_shear)
{
        Domain *domain;
        Thread *t, *ct, *t0;
        face_t f;
        cell_t c, c0;
        domain = Get_Domain(1);
        t=Lookup_Thread(domain,5);
        thread_loop_c(ct, domain)
        {
                begin_c_loop(c,ct)
                {
                        C_UDMI(c,ct,0) = 0.0;
                        C_UDMI(c,ct,1) = 0.0;
                }
        end_c_loop(c,ct)
        }
        begin_f_loop(f,t)
        {
                c0 = F_C0(f, t);
                t0 = THREAD_T0(t);
                C_UDMI(c0,t0,0)=F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[0];
                C_UDMI(c0,t0,1)=F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[1];
        }
        end_f_loop(f,t)
}



All times are GMT -4. The time now is 04:00.