CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   assign pressure gradient (https://www.cfd-online.com/Forums/fluent/43147-assign-pressure-gradient.html)

Peter December 16, 2006 09:37

assign pressure gradient
 
Hello guys,

I want to assign C_P_G(c,t) for cells which have a special volume fraction. Therefore I loop over all cells and check if they are achieve the demand of the special volume fraction (for example C_VOF(c,t)==1.0). For cells which fulfill this condition I assign C_P_G(c,t). Does anybody know if this will work? My sourcecode is below.

Thanks for help.

#include <udf.h>

/*Funktionsprototypendekleration*/

void Unterprg_3(double,double,double,double,cell_t,Thre ad *); void Unterprg_2(cell_t,Thread *); double Kapfunkt(void);

/*Hauptprogramm*/

DEFINE_ADJUST(Druckgradient,d) { Domain *mixture_domain=d; Thread *mixture_thread; Thread *c_sub_thread; cell_t c; int phase_domain_index=1;

thread_loop_c(mixture_thread,mixture_domain) { c_sub_thread=THREAD_SUB_THREAD(mixture_thread,phas e_domain_index);

begin_c_loop(c,c_sub_thread)

{

if(C_VOF(c,c_thread)==1.0 || C_VOF(c,c_thread)==0.0)

{

C_P_G(c,c_sub_thread)[1]=0.0;

}

if(C_VOF(c,c_thread)<1.0 && C_VOF(c,c_thread)>0.0)

{

Unterprg_2(cell_t c,Thread *c_sub_thread);

}

}

end_c_loop(c,c_sub_thread) } }

/*Berechnung des Kapillardrucks*/

double Kapfunkt(void) { double r=RP_Get_Real("r_scheme"); double sigma=RP_Get_Real("sigma_scheme"); double theta_Rad=(RP_Get_Real("theta_Grad_scheme")/180)*3.14; double R; double cos_theta; double p;

cos_theta=cos(theta_Rad); R=r/cos_theta; p=((2.0*sigma)/(R/1000.0));

return p; }

/*Unterprogramm 3 zur ...*/

void Unterprg_3(double MP_Face_y3,double MP_Cell_y3,double MP_Face_x3,double MP_Cell_x3,cell_t c3,Thread *c3_sub_thread) { if(MP_Face_y3>MP_Cell_y3) { if(MP_Face_x3==MP_Cell_x3) { double y_Differenz; y_Differenz=MP_Face_y3-MP_Cell_y3; C_P_G(c3,c3_sub_thread)[1]=((-1)*Kapfunkt())/(2*y_Differenz); } } }

/*Unterprogramm 2*/ void Unterprg_2(cell_t c2,Thread *c2_sub_thread) { Thread *f_thread; face_t f; int i; c_face_loop(c2,c2_sub_thread,i) { double MP_Face[2]; double MP_Cell[2]; double MP_Face_y=MP_Face[1]; double MP_Cell_y=MP_Cell[1]; double MP_Face_x=MP_Face[0]; double MP_Cell_x=MP_Cell[0];

f=C_FACE(c2,c2_sub_thread,i); f_thread=C_FACE_THREAD(c2,c2_sub_thread,i);

F_CENTROID(MP_Face,f,f_thread); C_CENTROID(MP_Cell,c2,c2_sub_thread);

Unterprg_3(MP_Face_y,MP_Cell_y,MP_Face_x,MP_Cell_x ,c2,c2_sub_thread); } }


seyed Farid hosseinizadeh December 26, 2006 17:32

Re: assign pressure gradient
 
Hi Buddy: Please send your UDF to my email. I will check it and let you know if I reach to any progress. Thanks/Farid



All times are GMT -4. The time now is 19:35.