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/)
-   -   UDF Parallizing.....!! (https://www.cfd-online.com/Forums/fluent-udf/80136-udf-parallizing.html)

sri31049 September 16, 2010 07:41

UDF Parallizing.....!!
 
I have serial UDF for surface reaction kinetics (applied only at the wall). It does not include any operations like averaging etc. I need to parallelize the serial UDF in order to submit in clusters. The serial UDF is as follows

#include "udf.h"
#define R 8314
#define p 1013250
#define pi 3.14159

DEFINE_SR_RATE(my_rate,f,t,r,mw,yi,rr)
{
Thread *t0 = t -> t0;
cell_t c0=F_C0(f,t);
real c3h8 = yi[0];
real o2 = yi[1];
real co2 = yi[2];
real h2o = yi[3];
real n2 = yi[4];

real rho_w = 1.0, sd = 2.49e-8, T_w;
real o_s,o_vac;
real xc3h8 = 1.0, xo2 = 1.0;
real tn,Tg,Ea3, Ea4, Ea5;
real rA3, rA4, rA5,rk3, rk4, rk5;
real ro,rate;

T_w = F_T(f,t);
rho_w = C_R(c0,t0)*C_T(c0,t0)/T_w;

c3h8 *= rho_w/mw[0];
o2 *= rho_w/mw[1];
co2 *= rho_w/mw[2];
h2o *= rho_w/mw[3];
n2 *= rho_w/mw[4];


/* Mole fraction of CH4 and O2 */

xc3h8 = c3h8/(c3h8+o2+co2 +h2o+n2);
xo2 = o2/(c3h8+o2+co2 +h2o+n2);

Tg = C_T(c0,t0);
tn = T_w/300;

Ea3 = 0.0;
Ea4 = 0.126*tn*tn*tn*tn - 1.849*tn*tn*tn + 9.124*tn*tn - 13.253*tn + 23.903;
Ea5 = 4.0;
Ea3 *= 4184e7;
Ea4 *= 4184e7;
Ea5 *= 4184e7;

rA3 = (0.0542)*pow(tn,0.766);
rA4 = (8.41e12)*pow(tn,-0.796);
rA5 = (0.06)*pow(tn,0.154);

rk3 = (rA3/(sd*sd))*sqrt(R*T_w/(2*pi*mw[1]))*(p/(R*T_w));
rk4 = (rA4/sd)*exp(-Ea4/(R*T_w));
rk5 = (rA5/(sd*sd))*sqrt(R*T_w/(2*pi*mw[0]))*(p/(R*T_w))*exp(-Ea5/(R*T_w));

ro = sqrt(rk3*xo2/rk4);
o_s = ro/(1+ro);
o_vac = 1-o_s;
rate = rk5*xc3h8*(sd*sd)*pow(o_vac,2);

if (STREQ(r->name, "reaction-1"))
*rr = rate*pow(10,1);
}

I tried by putting the if PARALLEL command but it does not work. Can any one suggest where to put the proper commands such that udf will be shared for all the nodes. I am trying from 3 months but i could not solve theis problem. I am waiting for your valuable reply.

Thanks in Advance
sridhar


All times are GMT -4. The time now is 09:47.