/********************************************************************** UDF to Look at the distribution of the energy dissipation rate ***********************************************************************/ #include "udf.h" DEFINE_ON_DEMAND(on_demand_calc) { Domain *d; real velocity; Thread *t; cell_t c; Node *nod; int n; double pos_x; double pos_y; double xvel; double yvel; double xprev=0; double yprev=0; double MeshArea=0; double cell_area=0; //bin analysis double checkmax = 0; // check max energy dissipation int binlength = 20; int binsize = 20; double bin[20]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int i = 0; int j = 0; int nondimensionE = 1; // should be 100 if normalize double area[20]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; double start = 0.001; double end = 0.01; d = Get_Domain(1); /* Get the domain using Fluent utility */ /* Loop over all cell threads in the domain */ thread_loop_c(t,d) { begin_c_loop(c,t) { double delta_x = 0; double delta_y = 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_x0) { if(delta_x0) { if(delta_x