CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Multiphase Udf code for looping a wall face (https://www.cfd-online.com/Forums/fluent-udf/238783-multiphase-udf-code-looping-wall-face.html)

ustbdynamic October 3, 2021 01:39

Multiphase Udf code for looping a wall face
 
Hello everyone!

During a multiphase flow simulation (air+sand, Eulerian-Eulerian model), I am trying to write an UDF to loop a wall face (its ID is 22). The purpose is to store some values (the secondary phase) of the wall adjacent cell to the UDM.
But after a long attempt, I failed to complete this process. The code is in vain for the wall adjacent cell. Those values that are not in this area are looped and stored instead.

There must be something wrong with my UDF,especially in the looping process.

I have no idea what to do next, so maybe someone here has an idea?

Thank you.

#include "udf.h"
#include "sg.h"
#include "sg_mphase.h"
#include "flow.h"
#include "mem.h"

#define ID 22 //WALL_NUMBER

DEFINE_ADJUST(settingvalue, mixture_domain)
{

Thread *cell_thread;
Thread *tc;
cell_t c;
face_t f;
Thread **pt;
Thread *ti;
Thread *tf;



mixture_domain = Get_Domain(1);


tf= Lookup_Thread(mixture_domain, ID); //getting the wall thread

mp_thread_loop_f(tf, mixture_domain, pt)
{

if (DOMAIN_ID(tf) == 3) // 3 is the secondary phase domain
{

begin_f_loop(f,tf)
{

tc = THREAD_T0(tf); /*adjacent cell thread*/
c = F_C0(f,tf); /*adjacent cell*/

ti = pt[1]; /* 0 pointer for the primary phase, 1 is for the secondary phase*/

C_UDMI(c,ti,0) = - C_R(c, ti)*C_VOF(c,ti)/CURRENT_TIMESTEP ;

}

end_f_loop(f,tf)
}

}

}

pakk October 3, 2021 02:26

Quote:

Those values that are not in this area are looped and stored instead
I'm not sure if I understand this part. Do you mean that your UDF gives results for everything in your domain except the wall that you are interested in?

ustbdynamic October 3, 2021 08:17

Dear pakk.
Thank you for responding.

It may or may not be this. The contours in other areas show changes, but I am not sure whether it works well or not for everything except the wall that I am interested in. It is certain that it has no effect on the interested cells.

thank you.
Xingang

Quote:

Originally Posted by pakk (Post 813462)
I'm not sure if I understand this part. Do you mean that your UDF gives results for everything in your domain except the wall that you are interested in?


pakk October 3, 2021 15:28

C_UDMI(c,ti,0)

Should be

C_UDMI(c,tc,0)

(i think)

ustbdynamic October 3, 2021 21:14

Thank you, I will try.

Quote:

Originally Posted by pakk (Post 813490)
C_UDMI(c,ti,0)

Should be

C_UDMI(c,tc,0)

(i think)



All times are GMT -4. The time now is 03:53.