Error just after calculation (VOF model) while using UDF
Hello,
I am using ANSYS VOF multiphase model. The error I am getting while running # Error [node 0] [time 1/24/20 11:54:1] Abnormal Exit! .................................................. ............ #include "udf.h" DEFINE_EXECUTE_AT_END(N2_Vol) { Domain *d; /* d is declared as a variable */ Thread *t; /* mixture level thread */ Thread *pt; /* phase level thread */ real sum_vol=0.; /* add volume */ cell_t c; int zone_ID=8; /* Fluid Zone */ int phase_domain_index =2; /* 1st secondary phase */ t = Lookup_Thread(d,zone_ID); /* mixture-level thread pointer */ pt = THREAD_SUB_THREAD(t,phase_domain_index); /* phase level thread pointer */ d = Get_Domain(1); /* mixture domain if multiphase */ thread_loop_c(t,d) { { begin_c_loop(c,t) sum_vol += C_VOF(c,pt[2]) * C_VOLUME(c,t); end_c_loop(c,t) } } printf("N2_Volume: %g\n", sum_diss); fflush(stdout); } .................................................. .................. I want to extract data after every time step for the volume of a secondary phase (2). please help regards |
There were so many mistakes. I modified the code and was able to run it successfully.
Here is the working code. ................................................ UDF for data extraction in multi-phase model .................................................. ........... #include "udf.h" DEFINE_EXECUTE_AT_END(execute_at_end) { real sum_ln2vol=0.; real sum_n2vol=0.; cell_t cell; Thread **pt; Thread *cell_threads; Domain *mixture_domain; mixture_domain=Get_Domain(1); mp_thread_loop_c(cell_threads,mixture_domain,pt) { begin_c_loop(cell,cell_threads) { sum_ln2vol += C_VOF(cell,pt[0]) * C_VOLUME(cell,cell_threads); sum_n2vol += C_VOF(cell,pt[1]) * C_VOLUME(cell,cell_threads); end_c_loop(cell,cell_threads) } } printf("Volume of ln2: %g\n", sum_ln2vol); printf("Volume of n2: %g\n", sum_n2vol); fflush(stdout); } .................................................. ...................... I am still facing one issue. Per time step, It should print only once the value of volumes, but it prints 5 times. I don't understand this. In my problem, i have 4 different phases. Any help would be appreciated Regards |
Compile code
Code:
................................................ |
Thanks Alex for prompt reply
Now i am getting only one value for these sums, but now the problem is, it is giving a value of "0" after every time-step throughout the simulation, although i can see the vapor formation in animation and formation of N2 in other plots. Code works fine when used in series calculation. regards |
my bad
change everywhere PRF_GISUM1(Returns sum of integer x over all compute nodes.) to PRF_GRSUM1 (Returns sum of x over all compute nodes; float if single precision, double if double precision.) |
Quote:
Thanks, it worked. |
All times are GMT -4. The time now is 02:11. |