/********************************************************************** UDF to calculate standard deviation and mean of the Monroe Parameter. ***********************************************************************/ #include "udf.h" DEFINE_ON_DEMAND(on_demand2_calc) { Domain *d; real velocity; Thread *t; cell_t c; Node *nod; int n; int density=1000; double visc=1e-6; double temp; double pos_x; double pos_y; double xvel; double yvel; double xprev=0; double yprev=0; double MeshArea=0; double cell_area=0; double magvel=0; double flowtot=0; double Monroe_sum = 0; double Monroe = 0; double theta = 0; double stdev = 0; d = Get_Domain(1); /* Get the domain using Fluent utility */ /* Loop over all cell threads in the domain */ thread_loop_c(t,d) { printf("\n Sum of All Flows = %g\n", flowtot); /* Loop over all cells */ 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_x