UDF to monitor minimum pressure on the wall
Hello World!
Can any of you help me debug the UDF appended below. I am trying to identify the minimum pressure on the wall at the end of each time step. It is a 2D flow over a airfoil problem. Thanks. /************************************************** *********************************************** -----USER DEFINED FUNCTION HOOKS Fluent V6.3--------------------- UDF to identify the lowest pressure on the wall at the end of each time step ************************************************** ************************************************/ #include "udf.h" #include "stdio.h" #include "mem.h " #include "threads.h" DEFINE_EXECUTE_AT_END(vapor) { real pmin =0.; real pre; real flow_time = RP_Get_Real("flow-time"); int ID = 7; /* Enter the zone ID of Wall from the Boundary Conditions Panel*/ /* Get the domain using Fluent utility */ Domain *d; d = Get_Domain(1); /* Get the thread ID */ Thread *t = Lookup_Thread(d, ID); face_t f; if (BOUNDARY_FACE_THREAD_P(t)) /* Check the for boundary face thread */ { FILE *fp = NULL; char filename[ ]="wall-minimum-pressure.txt"; fp = fopen(filename, "w"); /* Loop over all faces in the wall face-thread */ begin_f_loop(f, t) { pre = F_P(f,t); /* get face pressure */ if (pre < pmin) pmin = pre; /* Compute minimum face pressure */ } end_f_loop(f,t) Message("\nWriting the lowest pressure on the wall to %s...",filename); fprintf(fp,"%g %f \n",pmin,flow_time); fclose(fp); } else { Error("Please enter the correct Zone ID from the Boundary Conditions Panel"); } } |
All times are GMT -4. The time now is 21:13. |