/********************************************************************** UDF to calculate temperature field function and store in user-defined memory. Also print min, max, avg temperatures. ***********************************************************************/ #include "udf.h" DEFINE_ON_DEMAND(on_demand2_calc) { Domain *d; /* declare domain pointer since it is not passed as an //argument to the DEFINE macro */ 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 G_theta = 0; double G_theta2 = 0; double viz; //water = 1.00481e-6; double viz2 = 1.00481e-6; double Cu = 1.9; //ke = 0.09 double G = 0; double theta = 0; double cellNo = 0; double maxViz = 0; d = Get_Domain(1); /* Get the domain using Fluent utility */ /* Loop over all cell threads in the domain */ thread_loop_c(t,d) { /* Compute max, min, volume-averaged temperature */ /* 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++) //c_node_loop(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