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

UDF-Divergence detected in AMG solver: bin-0-fraction

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 18, 2021, 15:56
Question UDF-Divergence detected in AMG solver: bin-0-fraction
  #1
New Member
 
Amin
Join Date: Dec 2021
Posts: 20
Rep Power: 5
maba is on a distinguished road
Hi to all.
I am simulating separation of water from oil by population balance method. The simulation works well, when I use default aggregation model(luo-model) or even user defined aggregation model introduced by documentation. But when I use my user defined function(It compiled without error), at first time step without any iteration, it gives the error


"Divergence detected in AMG solver: bin-0-fraction
Error at host: floating point exception
Error at Node 0: floating point exception
Error: floating point exception
Error Object: #f "

What is the source of this error?


The user defined function is as follows:




/************************************************** **********************
UDF that computes the particle aggregation rate
************************************************** ***********************/
#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"

DEFINE_PB_COALESCENCE_RATE(aggregation_kernel,cell ,thread,d_1,thread_2,d_2)
{
real agg_kernel, mu, delta, e_ij, V_ij;
real rho_o=850, rho_w=1000, mu_o=0.013, mu_w=0.001, g=9.81, eps=2.5; /* vaccum perimittivity =8.85e-12 */
real E_0=0.5e5;
real K0 = M_PI/4.; /* aggregation rate constant */
mu=0.077;
delta=(d_2/d_1);
e_ij=1.8e-10*pow(((2.*delta*(rho_w-rho_o)*(1.-delta)*g*d_1)/(3.*eps*pow((1.+delta),2.)*pow(E_0,2.))),-0.55);
V_ij=2.*(mu+1.)*(rho_w-rho_o)*pow(d_1,2.)*(1.-pow(delta,2.))*g/(3.*(3.*mu+2.)*mu_o);
agg_kernel = K0*pow((d_1+d_2),2.0)*V_ij*e_ij;
return agg_kernel;
}
Attached Images
File Type: jpg error.JPG (91.1 KB, 10 views)
maba is offline   Reply With Quote

Old   December 19, 2021, 06:26
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Print some results to the screen. Maybe you made a mistake in typing the equations, and your rate is billions times too high or too low.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   December 20, 2021, 11:21
Default
  #3
New Member
 
Amin
Join Date: Dec 2021
Posts: 20
Rep Power: 5
maba is on a distinguished road
Quote:
Originally Posted by pakk View Post
Print some results to the screen. Maybe you made a mistake in typing the equations, and your rate is billions times too high or too low.
The solution didn't start and iterate. What is the appropriate range of aggregation rate for the model? I know the unit of every parameter, except the
diameter. I assumed that the unit is meter. Is that correct?
maba is offline   Reply With Quote

Old   December 20, 2021, 15:29
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I understand that you did not get a result, that's why I tell you to print the value to the screen.
Change your UDF so that it prints the value to the screen, using Message(). Then compare that value to the value that you used in the models that did work.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   December 25, 2021, 05:06
Default
  #5
New Member
 
Amin
Join Date: Dec 2021
Posts: 20
Rep Power: 5
maba is on a distinguished road
Quote:
Originally Posted by pakk View Post
I understand that you did not get a result, that's why I tell you to print the value to the screen.
Change your UDF so that it prints the value to the screen, using Message(). Then compare that value to the value that you used in the models that did work.
I printed the udf values, it is as follows:
.
.
.
a=...e-16
.
.
.
a=-nan(ind)
.
.
.
a=...e-17
.
.
.
a=-nan(ind)

What does the "-nan(ind)" mean?
maba is offline   Reply With Quote

Old   December 25, 2021, 08:09
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
It means a problem happened, like dividing be zero, and the result is not a number (nan=Not A Number).

To find out where it went wrong, print more intermediate results. Vij and Eij are good choices.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   December 25, 2021, 08:26
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Ignoring the Nan, your values are very low, numerically. I really don't know which values you expect, so I can not say that they are wrong, but I would surely verify that if I were you.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   December 27, 2021, 05:58
Default
  #8
New Member
 
Amin
Join Date: Dec 2021
Posts: 20
Rep Power: 5
maba is on a distinguished road
Quote:
Originally Posted by pakk View Post
It means a problem happened, like dividing be zero, and the result is not a number (nan=Not A Number).

To find out where it went wrong, print more intermediate results. Vij and Eij are good choices.
Thank you very much pakk. The problem solved. It was duo to dividing by zero in Eij. Because in some cases, the ratio of diameter(delta) became one.
maba is offline   Reply With Quote

Reply

Tags
population balance method, udf converge


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
Two Phase Flow In Vertical Pipe stonepreston FLUENT 2 October 31, 2017 09:35
Fluidized Bed: Error: Divergence detected in AMG solver: pressure correction Error Ob Mole89 FLUENT 5 April 12, 2014 10:32
Divergence problem Smaras FLUENT 13 February 21, 2013 06:03
Quarter Burner mesh with periosic condition SamCanuck FLUENT 2 August 31, 2011 12:34
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 22:14


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