kfouladi
Subscriber

#include "udf.h"


DEFINE_EXECUTE_AT_END(gen)


{


  Domain *d; /* declare domain pointer since it is not passed as an  


                 argument to the DEFINE macro  */


   real temp = 293.15;


   real dudx, dudy;


   real rho = 1000.0;


   real sum_e;


   sum_e=0.;


   Thread *t;


   cell_t c;


   d = Get_Domain(1);     /* Get the domain using Fluent utility */


     /*(location index 0)                                            */


    /* Loop over all cell threads in the domain */


   thread_loop_c(t,d)


     {


     begin_c_loop(c,t)


       {


dudx = C_U_G(c,t)[0];


dudy = C_U_G(c,t)[1];


         C_UDMI(c,t,0) = 1.0/temp*(2*(pow(dudx,2) + pow(dvdy,2) ));


C_UDMI(c,t,1) = rho;


C_UDMI(c,t,2) = C_UDMI(c,t,0) + C_UDMI(c,t,1);


       sum_e += C_UDMI(c,t,2) * C_VOLUME(c,t);


       }


     end_c_loop(c,t)


        }


printf("Volume integral e: %gn", sum_e);


FILE *fp;    


  fp = fopen("edata.txt","w+"); 


 fprintf(fp, "Volume integral e: %gn", sum_e);


fclose(fp); 


fflush(stdout);


}