CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Error just after calculation (VOF model) while using UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By AlexanderZ
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 24, 2020, 01:56
Default Error just after calculation (VOF model) while using UDF
  #1
Senior Member
 
rupak504's Avatar
 
Lolita
Join Date: Aug 2016
Posts: 115
Rep Power: 9
rupak504 is on a distinguished road
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 is offline   Reply With Quote

Old   January 25, 2020, 12:18
Default
  #2
Senior Member
 
rupak504's Avatar
 
Lolita
Join Date: Aug 2016
Posts: 115
Rep Power: 9
rupak504 is on a distinguished road
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
rupak504 is offline   Reply With Quote

Old   January 27, 2020, 05:58
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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 and ozgunoglu like this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   January 27, 2020, 23:51
Default
  #4
Senior Member
 
rupak504's Avatar
 
Lolita
Join Date: Aug 2016
Posts: 115
Rep Power: 9
rupak504 is on a distinguished road
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 01:37.
rupak504 is offline   Reply With Quote

Old   January 28, 2020, 03:30
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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 likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   January 28, 2020, 12:23
Default
  #6
Senior Member
 
rupak504's Avatar
 
Lolita
Join Date: Aug 2016
Posts: 115
Rep Power: 9
rupak504 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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.
rupak504 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 17:31
VOF model + mixture model + RAS or LES model ebtedaei OpenFOAM Running, Solving & CFD 23 May 12, 2018 03:36
How to use the degassing UDF for VOF model in Fluent? qingyang Fluent UDF and Scheme Programming 0 July 11, 2016 12:42
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 14:32
Warning 097- AB Siemens 6 November 15, 2004 04:41


All times are GMT -4. The time now is 23:18.