|
[Sponsors] |
Error just after calculation (VOF model) while using UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 24, 2020, 02:56 |
Error just after calculation (VOF model) while using UDF
|
#1 |
Senior Member
Lolita
Join Date: Aug 2016
Posts: 118
Rep Power: 10 |
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 |
|
January 25, 2020, 13:18 |
|
#2 |
Senior Member
Lolita
Join Date: Aug 2016
Posts: 118
Rep Power: 10 |
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 |
|
January 27, 2020, 06:58 |
|
#3 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Compile code
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) } } #if RP_NODE sum_ln2vol = PRF_GISUM1(sum_ln2vol); sum_n2vol = PRF_GISUM1(sum_n2vol ); #endif Message0("Volume of ln2: %g\n", sum_ln2vol); Message0("Volume of n2: %g\n", sum_n2vol); fflush(stdout); }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
January 28, 2020, 00:51 |
|
#4 |
Senior Member
Lolita
Join Date: Aug 2016
Posts: 118
Rep Power: 10 |
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 Last edited by rupak504; January 28, 2020 at 02:37. |
|
January 28, 2020, 04:30 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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.)
__________________
best regards ****************************** press LIKE if this message was helpful |
|
January 28, 2020, 13:23 |
|
#6 |
Senior Member
Lolita
Join Date: Aug 2016
Posts: 118
Rep Power: 10 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I write Eddy-dissipation model in DEFINE_VR_RATE udf? | swtbkim | FLUENT | 3 | February 25, 2020 18:31 |
VOF model + mixture model + RAS or LES model | ebtedaei | OpenFOAM Running, Solving & CFD | 23 | May 12, 2018 04:36 |
How to use the degassing UDF for VOF model in Fluent? | qingyang | Fluent UDF and Scheme Programming | 0 | July 11, 2016 13:42 |
Overflow Error in Multiphase Modelling with Two Continuous Fluids | ashtonJ | CFX | 6 | August 11, 2014 15:32 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 05:41 |