CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Error just after calculation (VOF model) while using UDF (https://www.cfd-online.com/Forums/fluent-udf/223738-error-just-after-calculation-vof-model-while-using-udf.html)

rupak504 January 24, 2020 01:56

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

rupak504 January 25, 2020 12:18

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

AlexanderZ January 27, 2020 05:58

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);
}


rupak504 January 27, 2020 23:51

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

AlexanderZ January 28, 2020 03:30

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.)

rupak504 January 28, 2020 12:23

Quote:

Originally Posted by AlexanderZ (Post 755810)
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.)




Thanks, it worked.


All times are GMT -4. The time now is 02:11.