/* Extract data from FLUENT .dat file and calculate performance parameters for flocculation tank with various numbers of baffles and tank heights*/ #include "udf.h" DEFINE_ON_DEMAND(performance) { /* Define variables and parameters*/ Domain *d; real velocity; Thread *t; cell_t c; Node *nod; int n; int j; int density=1000; int turning=5; /* Adjustable according to the geometry*/ double flow=.01; double pos_x; double pos_y; double xvel; double yvel; double xprev=0; double yprev=0; double cell_area=0; double baffle[7] = {0, .1, .2, .3, .4, .5, .6}; double Monroe_sum1[6]={0, 0, 0, 0, 0, 0}; double Monroe_sum2[6]={0, 0, 0, 0, 0, 0}; double Monroe_sum3[6]={0, 0, 0, 0, 0, 0}; double Manroe[6] = {0, 0, 0, 0, 0, 0}; int q=0; d = Get_Domain(1); /* Get the domain using Fluent utility */ /* Loop over all cell threads in the domain */ for (q = 0; q <=turning; q++) { thread_loop_c(t,d) { begin_c_loop(c,t) { double delta_x = 0; double xpos_ave = 0; double delta_y = 0; double ypos_ave =0; int run_number = 0; for (n=0; n < cell_type_nnodes[(int)C_TYPE(c,t)]; n++) { nod = C_NODE(c, t, n); pos_x=NODE_X(nod); pos_y=NODE_Y(nod); if(run_number>0) { if(delta_xbaffle[q] & xpos_ave