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

Excessive condensation UDF causes temperature field and pressure field disorder

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 22, 2020, 00:12
Unhappy Excessive condensation UDF causes temperature field and pressure field disorder
  #1
New Member
 
Sumz
Join Date: Jun 2020
Posts: 5
Rep Power: 5
Su M Z is on a distinguished road
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;
}
Su M Z is offline   Reply With Quote

Old   June 22, 2020, 10:56
Default Source
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm 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
Pressure fields in FOAM, p field, total pressure, etc. Tobi OpenFOAM Post-Processing 9 March 25, 2022 01:33
Same pressure gradient but different velocity field TurbJet Main CFD Forum 22 April 28, 2018 03:35
buoyantPimpleFoam - pressure field Fabf OpenFOAM Running, Solving & CFD 2 February 17, 2015 04:02
Strange temperature field in Laval nozzle EvgenyMogilevskiy OpenFOAM Running, Solving & CFD 0 August 14, 2014 09:59
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15


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