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

When I use the following phase change code, the fluent give the following errors, who

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 5, 2020, 12:57
Default When I use the following phase change code, the fluent give the following errors, who
  #1
Senior Member
 
Join Date: Dec 2017
Posts: 382
Rep Power: 9
hitzhwan is on a distinguished road
When I use the following phase change code,I use a gradient of the volume fraction, I do not know whether it is right. When I import it into the fluent, it does not have any error. But when it run, the fluent give the following errors, who can help me find the problem and revise it, thank you.

The below is the error note:

Divergence detected in AMG solver: pressure correction
Error at host: floating point exception
Error at Node 0: floating point exception

Error: floating point exception


The codes:

#include "udf.h"
#include"sg_mphase.h"
#define LAT_HT 193260
#define C1 0.1
#define MW 0.018
#define RR 8.314
#define PI 3.1415926
#define T_SAT 293.15


DEFINE_SOURCE(liq_src, cell, sec_th, dS, eqn)
{
Thread *mix_th, *pri_th;
real m_dot_l;
real pp;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);



if(C_T(cell, mix_th)>=T_SAT)
{

m_dot_l = -2*C1/(2-C1)*sqrt(MW/2/PI/RR)*(C_R(cell, pri_th)*LAT_HT*fabs(T_SAT-C_T(cell,sec_th)))/pow(T_SAT,1.5)*abs(C_VOF_G(cell, pri_th));

dS[eqn] = -2*C1/(2-C1)*sqrt(MW/2/PI/RR)*(C_R(cell, pri_th)*LAT_HT*fabs(T_SAT-C_T(cell,sec_th)))/pow(T_SAT,1.5);
}
else
{
m_dot_l = 2*C1/(2-C1)*sqrt(MW/2/PI/RR)*(C_R(cell, pri_th)*LAT_HT*fabs(T_SAT-C_T(cell,mix_th)))/pow(T_SAT,1.5)*abs(C_VOF_G(cell, pri_th));
dS[eqn] = 0.;
}
return m_dot_l;
}

DEFINE_SOURCE(vap_src, cell, pri_th, dS, eqn)
{
Thread * mix_th, *sec_th;
real m_dot_v;
real pp;

mix_th = THREAD_SUPER_THREAD(pri_th);
sec_th = THREAD_SUB_THREAD(mix_th, 1);


if(C_T(cell, mix_th)>=T_SAT)
{
m_dot_v = 2*C1/(2-C1)*sqrt(MW/2/PI/RR)*(C_R(cell, pri_th)*LAT_HT*fabs(T_SAT-C_T(cell,mix_th)))/pow(T_SAT,1.5)*abs(C_VOF_G(cell, pri_th));
dS[eqn] = 0.;
}
else
{
m_dot_v = -2*C1/(2-C1)*sqrt(MW/2/PI/RR)*(C_R(cell, pri_th)*LAT_HT*fabs(T_SAT-C_T(cell,mix_th)))/pow(T_SAT,1.5)*abs(C_VOF_G(cell, pri_th));
dS[eqn] = -2*C1/(2-C1)*sqrt(MW/2/PI/RR)*(C_R(cell, pri_th)*LAT_HT*fabs(T_SAT-C_T(cell,mix_th)))/pow(T_SAT,1.5);
}
return m_dot_v;
}


DEFINE_SOURCE(enrg_src, cell, mix_th, dS, eqn)
{
Thread *pri_th, *sec_th;
real m_dot;
real pp;

pri_th = THREAD_SUB_THREAD(mix_th, 0);
sec_th = THREAD_SUB_THREAD(mix_th, 1);


if(C_T(cell, mix_th)>=T_SAT)
{

m_dot= -2*C1/(2-C1)*sqrt(MW/2/PI/RR)*(C_R(cell, pri_th)*LAT_HT*fabs(T_SAT-C_T(cell,sec_th)))/pow(T_SAT,1.5)*abs(C_VOF_G(cell, pri_th));

dS[eqn] = -2*C1/(2-C1)*sqrt(MW/2/PI/RR)*C_R(cell, pri_th)*LAT_HT/pow(T_SAT,1.5)*abs(C_VOF_G(cell, pri_th));

}
else
{
m_dot = 2*C1/(2-C1)*sqrt(MW/2/PI/RR)*(C_R(cell, pri_th)*LAT_HT*fabs(T_SAT-C_T(cell,mix_th)))/pow(T_SAT,1.5)*abs(C_VOF_G(cell, pri_th));
dS[eqn] =-2*C1/(2-C1)*sqrt(MW/2/PI/RR)*C_R(cell, pri_th)*LAT_HT/pow(T_SAT,1.5);
}
return LAT_HT*m_dot;
}
hitzhwan is offline   Reply With Quote

Old   December 6, 2020, 23:39
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
most likely you have division by zero somewhere in your code

also C_VOF_G is a vector, it has C_VOF_G[0], C_VOF_G[1], C_VOF_G[2] components
to get ist's magnitude you wanna use NV_MAG(C_VOF_G()) macro
__________________
best regards


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

Old   December 7, 2020, 09:11
Default Hi,Alexander, thank you so much for your help. You mean I should use NV_MAG(C_VOF_G(c
  #3
Senior Member
 
Join Date: Dec 2017
Posts: 382
Rep Power: 9
hitzhwan is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
most likely you have division by zero somewhere in your code

also C_VOF_G is a vector, it has C_VOF_G[0], C_VOF_G[1], C_VOF_G[2] components
to get ist's magnitude you wanna use NV_MAG(C_VOF_G()) macro
Hi,Alexander, thank you so much for your help. You mean I should use
NV_MAG(C_VOF_G(c,0)) to replace C_VOF_G(cell, pri_th),and use
NV_MAG(C_VOF_G(c,1)) to replace C_VOF_G(cell, sec_th).Is that right? Thank you so much for you help. Hope you have a good weekday.
hitzhwan is offline   Reply With Quote

Old   December 8, 2020, 00:39
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
yes, I think so. But you should test it
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ 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
courant number increases to rather large values 6863523 OpenFOAM Running, Solving & CFD 22 July 5, 2023 23:48
When the fluent runs, it abruptly give the errors below, and I cannot run afterwards, hitzhwan FLUENT 7 March 4, 2020 03:34
Multiple floating objects CKH OpenFOAM Running, Solving & CFD 14 February 20, 2019 09:08
p_rgh initial residual no change with different settings manuc OpenFOAM Running, Solving & CFD 3 June 26, 2018 15:53
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 07:09


All times are GMT -4. The time now is 03:27.