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/)
-   -   need help for parallelize a serial UDF (http://www.cfd-online.com/Forums/fluent-udf/102102-need-help-parallelize-serial-udf.html)

sandeep_tu May 22, 2012 08:01

need help for parallelize a serial UDF
 
I'm trig to run a UDF that should do the followings:
1-reading some values from a text file in HOST
2-transfering these values to the NODES
3-seting as the boundary condition in NODES

the codes is this.


DEFINE_PROFILE (Temperature_profile,t,j)
{


int node_zero = 0;
int node_host = 999999;
int node_one = 1;
int node_serial = 1000000;



int zone_ID;
int names[48];
int ID[48];
double temp[48];
double emiss[48];
double tempp;
int i,ii,iii,pe;
ii=0;
iii=329;
pe=0;
for (i=0; i<48; i++)
{

names[i]=20;

ID[i]=0;

temp[i]=0;

emiss[i]=0;
}

#if !RP_NODE
FILE *fi=fopen("input.txt","r");
if(fi==NULL)
return 1;
#endif

#if RP_HOST
for (i=0; i<48; i++)
{

fscanf(fi, "%d",&names[i]);

fscanf(fi, "%d",&ID[i]);

fscanf(fi, "%lf",&temp[i]);

fscanf(fi, "%lf",&emiss[i]);
}
#endif



/*????????????????????????????????????????????????? ???????????????????????


I don't know how to make the communication between host and nodes,
I also used host_to_nodes but it didn't work



************************************************** *******************************************/




#if !RP_HOST
zone_ID=THREAD_ID(t);
face_t f;

for(i=0;i<48;i++)
{
ii=5;
if(zone_ID==ID[i])
{
ii=i;
tempp=temp[i];
}
}



/*????????????????????????????????????????????????? ???????????????????????



I don't know whether it's right to use "compute_node_loop_not_zero (pe)"
here!!!!!



************************************************** *********************************************/


compute_node_loop_not_zero (pe)
{
begin_f_loop(f,t)
{
if PRINCIPAL_FACE_P(f,t)
{
F_PROFILE(f,t,j)=temp[ii]
}
}
end_f_loop(f,t)
}
#endif

#if !RP_NODE
fclose(fi);
#endif


}


All times are GMT -4. The time now is 06:48.