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/)
-   -   UDF for laser Keyhole problem (https://www.cfd-online.com/Forums/fluent-udf/223663-udf-laser-keyhole-problem.html)

eddy94 January 21, 2020 09:46

UDF for laser Keyhole problem
 
Hi everyone,
I'm modeling an heat source for laser welding; I'm trying to model the keyhole volumetric distribution in a simple workpiece.
Once I created the UDF I gave it to the source term of the workpiece and I run the simulation but fluent always give me this error message:

"# Divergence detected in AMG solver: temperature -> Increasing relaxation sweeps!
# You may try the enhanced divergence recovery with (rpsetvar 'amg/protective-enhanced? #t)

Error: Divergence detected in AMG solver: temperature

Error: Divergence detected in AMG solver: temperature
Error Object: #f"

I really don't know what is the problem. This is my UDF:

/***** LASER HEAT SOURCE *****/

#include "udf.h"

#define EffL 0.85
#define Flas 3
#define Zkey 1.8
#define Zi 0.45
#define Plas 2000
#define CHIlow 0.5
#define CHIupp 0.5
#define PI 3.141592654
#define X0 15

DEFINE_PROFILE(heatflux_laser,thread, position)

{


real r[ND_ND];
real x, y, qlas,z,d,Rlas,Ri,Re;
cell_t c;


begin_c_loop(c, thread)
{

C_CENTROID(r, c, thread);
x= r[0];
y= r[1];
z= r[2];

if (z>=0 && z<Zi)
{
Rlas = Ri + ((Ri-Re)/Zi)*(z-Zi);
Ri = Rlas;
Re = 2*Rlas;
d = sqrt((x-X0)*(x-X0)+(y*y));
qlas = (CHIupp*EffL*Flas*Flas*Plas)/(PI*(1-exp(-3))*Zi*((Ri*Ri)+(Ri*Re)+(Re*Re)))*exp(-(Flas*d*d)/(Rlas*Rlas));

}

else if (z>=Zi && z<Zkey)
{

qlas = (CHIlow*EffL*Plas)/(PI*Ri*Ri*(Zkey-Zi));

}
else
{
qlas = 0;
}
C_PROFILE(c, thread, position)= qlas;

}
end_c_loop(c, thread)


}


If someone can help me would be awsome! Thanks to everyone in advance

AlexanderZ January 22, 2020 01:12

line 35:
Rlas = Ri + ((Ri-Re)/Zi)*(z-Zi);

Ri and Re are not defined

compile your code an read logs

eddy94 January 22, 2020 09:39

Thank you very much for your fast responce. Now my problem is solved, god bless you!


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