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/)
-   -   Excessive condensation UDF causes temperature field and pressure field disorder (https://www.cfd-online.com/Forums/fluent-udf/228161-excessive-condensation-udf-causes-temperature-field-pressure-field-disorder.html)

Su M Z June 22, 2020 00:12

Excessive condensation UDF causes temperature field and pressure field disorder
 
Hello Everyone,
I am trying to use the udf code to simulate in-tube condensation of the steam and air mixture.The VOF model and the species transport model were enabled in Fluent. A liquid phase mass source term, a gas phase mass source term, and an energy source term are defined. My idea is to judge whether it is a vapor-liquid interface firstly, if it is, then assign a value to the source term, if not, then continue to judge whether it is a wall surface. The thickness of the first layer of my adherent mesh is 0.03mm. When the The value of the source term is small , 2.56e-4 for example , temperature field and pressure field are normal , but when the value is high , 4000 for example, the temperature field and pressure field are strange . My wall temper is 300K, and inlet gas temper is 373.5K,but after running for several steps , the static temper is as high as 590K. My initial static pressure is 0, after running , the pressure is 2.69e9 . Anybody know why that is?


#include "udf.h"
#include "sg.h"
#include "sg_mphase.h"
#include "flow.h"
#include "mem.h"
#define air_molecular 28.966
#define vapor_molecular 18.0152
#define lam 0.8
#define standard_temper 298.15
#define standard_pressure 101325
#define standard_diffusivity 2.56e-5
#define SYMMETRY 13

#define WALL_NUMBER1 12
#define prim_index 0
#define index_evap_primary 1
#define p_op 101325
int phase_domain_index;
real face_center[ND_ND], cell_center[ND_ND], a[ND_ND], b[ND_ND];
real p, diffusivity, Wvol;
real cell_vapor_pressure, wall_temper, wall_pressure;
real NV_VEC(A),j,i;
real area, area_density, mass_transfer_coeff, B1, area1;
real water_temper, water_satpressure;
real vapor_density,u,v;
int n;
Domain *domain1;
cell_t c;
Thread *t;
Thread *tp;
Thread *ts;
Thread *tf,*tb;
face_t fa;
face_t fb ;
real source;
double latent_heat(double Tsat)
{
double sum;
sum=2501.7-2.4114*(Tsat-273.15);
return sum;
}


DEFINE_SOURCE(vap_src,cell,first,dS,eqn)
{
Thread *mixer, *sec_th;
Thread *sym;
face_t f;
real m_dot_first;
real mass_dot;
mixer = THREAD_SUPER_THREAD(first);
sec_th = THREAD_SUB_THREAD(mixer,1);

if (C_VOF(cell, first) > 0&&C_VOF(cell, first) < 1)
{

mass_dot = -2.56e-4;
dS[eqn] =0;
}
else
{
mass_dot =0;
dS[eqn]=0;

c_face_loop(cell, mixer, n)
{
fa = C_FACE(cell, mixer, n);
tf = C_FACE_THREAD(cell, mixer, n);
F_CENTROID(face_center, fa, tf);
if (face_center[0] < 1e-5)
{
mass_dot = -2.56e-4;
dS[eqn] =0;


}
}
}
source = mass_dot;
return source;
}



DEFINE_SOURCE(liq_src, cell, sec_th, dS, eqn)
{
Thread *mixer, *first;
Thread *sym;
face_t f;
real mass_dot;
mixer = THREAD_SUPER_THREAD(sec_th);
first = THREAD_SUB_THREAD(mixer, 0);
if (C_VOF(cell, sec_th) > 0&&C_VOF(cell, sec_th) < 1)
{

mass_dot = 2.56e-4;
dS[eqn] =0;
}
else
{
mass_dot =0;
dS[eqn]=0;
c_face_loop(cell, mixer, n)
{
fa = C_FACE(cell, mixer, n);
tf = C_FACE_THREAD(cell, mixer, n);
F_CENTROID(face_center, fa, tf);
if (face_center[0]< 1e-5)
{
mass_dot = 2.56e-4;
dS[eqn] =0;



}
}
}
source = mass_dot;
return source;
}



DEFINE_SOURCE(enrg_src, cell, mixer, dS, eqn)
{
Thread *first, *sec_th;
Thread *sym;
face_t f ;
real m_dot, latentheat;
real mass_dot;
first = THREAD_SUB_THREAD(mixer, 0);
sec_th = THREAD_SUB_THREAD(mixer, 1);
/************************************************/

if (C_VOF(cell, sec_th) > 0&&C_VOF(cell, sec_th) < 1)
{
mass_dot = -2.56e-4;
dS[eqn] =0;

}
else
{
latentheat = latent_heat(C_T(cell, first));
mass_dot =0;
dS[eqn]=0;
c_face_loop(cell, mixer, n)
{
fa = C_FACE(cell, mixer, n);
tf = C_FACE_THREAD(cell, mixer, n);
F_CENTROID(face_center, fa, tf);
if (face_center[0] < 1e-5)
{
mass_dot = -2.56e-4;
dS[eqn] =0;



}
}
}

m_dot = -mass_dot;
return latentheat*m_dot;
}

vinerm June 22, 2020 10:56

Source
 
Source values have a limit; larger source values make the coefficient matrix non-diagonal dominant, which leads to convergence issues. If the source values are expected to be high, then use coarser mesh.


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