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/)
-   -   Divergence detected in AMG solver: k when udf loaded (https://www.cfd-online.com/Forums/fluent-udf/151921-divergence-detected-amg-solver-k-when-udf-loaded.html)

google9002 April 20, 2015 07:30

Divergence detected in AMG solver: k when udf loaded
 
Hi,everyone
I wanna use a udf to define the wall shear on the boundary, this udf could be loaded and initialized right, but when I begin to calculate, Fluent tells me that Divergence detected in AMG solver: k -> Increasing relaxation sweeps!
When this udf unloaded, it works well, the solution is not so good though.
By the way, i use VOF model here.
And my code is below here, is there any problem with it?
I need your help...:(


#include <stdio.h>
#include "udf.h"
#include "mem.h"
#include <math.h>
DEFINE_PROFILE(wall_shear_x, thread, position)
{
real u, v, w, segm, dens,text,velo,bata;
face_t f;
cell_t c;
Thread *t0;
Domain *d;
d = Get_Domain(3);
int Zone_ID = 4;
thread = Lookup_Thread(d, Zone_ID);
begin_f_loop(f, thread)
{
u = F_U(f, thread);
v = F_V(f, thread);
w = F_W(f, thread);
segm = F_P(f, thread);
if (NNULLP(THREAD_STORAGE(thread, SV_DENSITY)))
dens = F_R(f, thread);
else
{
c = F_C0(f, thread);
t0 = F_C0_THREAD(f, thread);
dens = C_R(c, t0);
}
velo = sqrt(u*u + v*v + w*w);
bata = -u / velo;
text = segm*0.2 + 0.037731222*dens*velo*velo;
F_PROFILE(f, thread, position) = text*bata;
}
end_f_loop(f, thread)
}
DEFINE_PROFILE(wall_shear_y, thread, position)
{
real u, v, w, segm, dens, text, velo, bata;
face_t f;
cell_t c;
Thread *t0;
Domain *d;
d = Get_Domain(3);
int Zone_ID = 4;
thread = Lookup_Thread(d, Zone_ID);
begin_f_loop(f, thread)
{
u = F_U(f, thread);
v = F_V(f, thread);
w = F_W(f, thread);
segm = F_P(f, thread);
if (NNULLP(THREAD_STORAGE(thread, SV_DENSITY)))
dens = F_R(f, thread);
else
{
c = F_C0(f, thread);
t0 = F_C0_THREAD(f, thread);
dens = C_R(c, t0);
}
velo = sqrt(u*u + v*v + w*w);
bata = -v / velo;
text = segm*0.2 + 0.037731222*dens*velo*velo;
F_PROFILE(f, thread, position) = text*bata;
}
end_f_loop(f, thread)
}
DEFINE_PROFILE(wall_shear_z, thread, position)
{
real u, v, w, segm, dens, text, velo, bata;
face_t f;
cell_t c;
Thread *t0;
Domain *d;
d = Get_Domain(3);
int Zone_ID = 4;
thread = Lookup_Thread(d, Zone_ID);
begin_f_loop(f, thread)
{
u = F_U(f, thread);
v = F_V(f, thread);
w = F_W(f, thread);
segm = F_P(f, thread);
if (NNULLP(THREAD_STORAGE(thread, SV_DENSITY)))
dens = F_R(f, thread);
else
{
c = F_C0(f, thread);
t0 = F_C0_THREAD(f, thread);
dens = C_R(c, t0);
}
velo = sqrt(u*u + v*v + w*w);
bata = -w / velo;
text = segm*0.2 + 0.037731222*dens*velo*velo;
F_PROFILE(f, thread, position) = text*bata;
}
end_f_loop(f, thread)
}

google9002 April 20, 2015 22:27

well, i'm so stupid, u=v=w=0 at the starting moment, how could it be calculated with a 0 denominator? :eek:

rahulmule797@gmail.com November 6, 2019 07:43

Quote:

Originally Posted by google9002 (Post 542849)
well, i'm so stupid, u=v=w=0 at the starting moment, how could it be calculated with a 0 denominator? :eek:

What changes you have made then?
I also get same type of error.

AlexanderZ November 7, 2019 23:34

if the problem is starting point, load UDF after 1st timestep


All times are GMT -4. The time now is 22:30.