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

Evaporating Multicomponent Spray

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 13, 2016, 05:54
Default Evaporating Multicomponent Spray
  #1
New Member
 
Simon
Join Date: May 2016
Posts: 2
Rep Power: 0
Sqnderby is on a distinguished road
Dear all,

I have looked thoroughly at forums to try and find a solution for my problem, but sadly it failed.

I am trying to simulate an evaporating ammonia/water spray. I have a long rectangular duct with 970 C hot flue gas flowing upwards (approx 5 m/s) in the Y-direction. The particles are injected in the Z direction and is supposed to evaporate into both ammonia and water. The initial conditions for the spray is specified by a particle file from previous simulation. A compressed air stream(2,5bar) directly behind the injection point accelerates the particles. Radiation is included with the DO-model and the k-e standard model is used to account for turbulence. I am using the multicomponent law for the particles, which doesnt seem to take the change of particle mass and diameter into consideration (atleast when i plot the particle trajectories after reaching convergence).

In order to calculate the evaporation rate of both species, I implemented an UDF using the DEFINE_DPM_HEAT_MASS function. I use the same code as the example from the UDF folder. In order to change the diameter of the particle as it evaporates, i implemented another UDF using the DEFINE_DPM_LAW. Both codes are compiled without issues (using Visual Studio Express).

However, after convergence I notice:
  • The particle temperatures exceeds the boiling point of the components even though the 1st UDF should prevent it from doing so by invoking constant temperature during boiling
  • The mass and diameter of the particles remains unchanged along the trajectories, even though I can see both ammonia and water evaporating into the continous phase

I would greatly appreciate any suggestion as to why the UDF's don't have the desired impact on my simulation.

Best Regards
Simon

The two UDF's are as follows:

/************************************************** *****************
UDF the models a custom law for evaporation of species
************************************************** *****************/

#include "udf.h"
#define REMOVE_PARTICLES FALSE

DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_ surf,dydt,dzdt)
{
int ns;
Material *sp;

real dens_total =0.0;
real P_total =0.0;

int nc = TP_N_COMPONENTS( p ); /* number of particle components */
cell_t c0 = RP_CELL(&(p->cCell)); /* cell and thread */
Thread *t0 = RP_THREAD( &(p->cCell) ); /* where the particle is in */
Material *gas_mix = THREAD_MATERIAL( t0 ); /* gas mixture material */
Material *cond_mix = p->injection->material;/* particle mixture material */
cphase_state_t *c = &(p->cphase); /* cell info of particle location */
real molwt[MAX_SPE_EQNS]; /* molecular weight of gas species */
real Tp = P_T(p); /* particle temperature */
real mp = P_MASS(p); /* particle mass */
real molwt_bulk = 0.; /* average molecular weight in bulk gas */
real Dp = DPM_DIAM_FROM_VOL( mp / P_RHO(p) ); /* particle diameter */
real Ap = DPM_AREA(Dp); /* particle surface */
real Pr = c->sHeat * c->mu / c->tCond; /* Prandtl number */
real Nu = 2.0 + 0.6 * sqrt( p->Re ) * pow( Pr, 1./3. ); /* Nusselt number */
real h = Nu * c->tCond / Dp; /* Heat transfer coefficient */
real dh_dt = h * ( c->temp - Tp ) * Ap; /* heat source term */
dydt[0] += dh_dt / ( mp * Cp );
dzdt->energy -= dh_dt;

mixture_species_loop(gas_mix,sp,ns)
{
molwt[ns] = MATERIAL_PROP(sp,PROP_mwi); /* molecular weight of gas species */
molwt_bulk += C_YI(c0,t0,ns) / molwt[ns]; /* average molecular weight */
}


/* prevent division by zero */
molwt_bulk = MAX(molwt_bulk,DPM_SMALL);

for( ns = 0; ns < nc; ns++ )
{
/* gas species index of vaporization */
int gas_index = TP_COMPONENT_INDEX_I(p,ns);
if( gas_index >= 0 )
{
/* condensed material */
Material * cond_c = MIXTURE_COMPONENT(cond_mix, ns );
/* vaporization temperature */
real vap_temp = MATERIAL_PROP(cond_c,PROP_vap_temp);
/* diffusion coefficient */
real D = MATERIAL_PROP_POLYNOMIAL( cond_c, PROP_binary_diffusivity, c->temp);
/* Schmidt number */
real Sc = c->mu / ( c->rho * D );
/* mass transfer coefficient */
real k = ( 2. + 0.6 * sqrt(p->Re) * pow( Sc, 1./3. ) ) * D / Dp;
/* bulk gas concentration */
real cvap_bulk = c->pressure / UNIVERSAL_GAS_CONSTANT / c->temp
* c->yi[gas_index] / molwt_bulk / solver_par.molWeight[gas_index];
/* vaporization rate */
real vap_rate = k * molwt[gas_index] * Ap * ( cvap_surf[ns] - cvap_bulk );
/* only condensation below vaporization temperature */
if( 0. < vap_rate && Tp < vap_temp )
vap_rate = 0.;

dydt[1+ns] -= vap_rate;
dzdt->species[gas_index] += vap_rate;
/* dT/dt = dh/dt / (m Cp)*/
dydt[0] -= hvap[gas_index] * vap_rate / ( mp * Cp );
/* gas enthalpy source term */
dzdt->energy += hgas[gas_index] * vap_rate;

P_total += cvap_surf[ns];
dens_total += cvap_surf[ns]*molwt[gas_index];
}
}
/*multicomponent boiling*/
P_total *= UNIVERSAL_GAS_CONSTANT * Tp;

if (P_total > c->pressure && dydt[0] > 0.)
{
real h_boil = dydt[0] *mp *Cp;
dydt[0] = 0.;
for(ns=0; ns < nc; ns++)
{
int gas_index = TP_COMPONENT_INDEX_I(p,ns);
if (gas_index >=0)
{
real boil_rate = h_boil / hvap[gas_index] * cvap_surf[ns] * molwt[gas_index] / dens_total;
dydt[1+ns] -= boil_rate;
dzdt->species[gas_index] += boil_rate;
dzdt->energy += hgas[gas_index]*boil_rate;
}
}
}

}

#include "udf.h"
#define REMOVE_PARTICLES TRUE;

DEFINE_DPM_LAW(Diam,p,ci)
{
P_CURRENT_LAW(p) = DPM_LAW_MULTICOMPONENT;
{
real dm = P_MASS0(p)-P_MASS(p);
real rho = P_RHO(p);
real vol = rho/dm;
real mp = P_MASS(p);
P_DIAM(p) = P_DIAM0(p) - DPM_DIAM_FROM_VOL(vol);
if (mp <= 0 )
REMOVE_PARTICLES TRUE;
}
}
Sqnderby is offline   Reply With Quote

Old   May 13, 2016, 10:51
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Are you sure the UDFs are compiling correctly? If you're running R17.0 then you're missing an argument (the compressibility, Z); but this variable isn't present in the older versions (including Fluent 6.3).

The other obvious error (before checking your logic and code closely) is that you're defining REMOVE_PARTICLES as FALSE (and then TRUE) using pre-compiler directives. The UDF appears to compile but perhaps executing a line of TRUE TRUE is the cause of your unexpected results. If you're trying to replicate the example from the UDF manual for DEFINE_DPM_OUTPUT then use the MARK_PARTICLE macro as they have employed.

Code:
MARK_PARTICLE(p, P_FL_REMOVED);
`e` is offline   Reply With Quote

Old   May 20, 2016, 08:32
Default
  #3
New Member
 
Simon
Join Date: May 2016
Posts: 2
Rep Power: 0
Sqnderby is on a distinguished road
Hi 'e'

Thanks for your reply!

I'm running Fluent 6.3 so the compressibility factor doesn't need to be specified. I don't get any error messages from the console when compiling the code. I tried removing the REMOVE_PARTICLES from the pre-compiler part, but the result is the same.

I tried replacing the REMOVE_PARTICLES with the MARK_PARTICLE(...) code that you specified, but FLUENT doesn't recognize the macro. I get the error:

Code:
..\..\src\particlediam_2.c(15) : error C2065: 'MARK_PARTICLE' : undeclared identifier
As far as i know that error means the macro MARK_PARTICLE does not exist in FLUENT 6.3. It doesnt seem to be included in the 6.3 version of "dpm.h"
Sqnderby is offline   Reply With Quote

Old   May 20, 2016, 12:16
Default
  #4
New Member
 
Saeid.doosty
Join Date: May 2016
Posts: 6
Rep Power: 9
Saeid.doosty1984 is on a distinguished road
I have udf for initial you can help me
Saeid.doosty1984 is offline   Reply With Quote

Old   May 20, 2016, 16:58
Default
  #5
New Member
 
Saeid.doosty
Join Date: May 2016
Posts: 6
Rep Power: 9
Saeid.doosty1984 is on a distinguished road
Hiiii I am udf for initial can you help me
Saeid.doosty1984 is offline   Reply With Quote

Old   May 20, 2016, 17:37
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by Sqnderby View Post
I tried replacing the REMOVE_PARTICLES with the MARK_PARTICLE(...) code that you specified, but FLUENT doesn't recognize the macro. I get the error:

Code:
..\..\src\particlediam_2.c(15) : error C2065: 'MARK_PARTICLE' : undeclared identifier
As far as i know that error means the macro MARK_PARTICLE does not exist in FLUENT 6.3. It doesnt seem to be included in the 6.3 version of "dpm.h"
Yes, it sounds like this function is unavailable in Fluent 6.3, there's no easy alternative to removing particles outside the DEFINE_DPM_BC macro. Would setting the mass flow rate of the stream to zero be a suitable compromise of "removing" the particle stream? If the "removed" parcels are still interacting with other UDFs you could use a user-defined particle value (a boolean) and conditional statements.

Quote:
Originally Posted by Saeid.doosty1984 View Post
Hiiii I am udf for initial can you help me
?
`e` is offline   Reply With Quote

Old   June 17, 2016, 21:14
Default
  #7
New Member
 
Join Date: Jun 2016
Posts: 2
Rep Power: 0
iloveno is on a distinguished road
Did you found a solution for your problem?

Are you now is the right range with the temperature and do you see change in particle diameter?
iloveno 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
Tutorial: Evaporating Spray Simulation machineengine Main CFD Forum 0 May 7, 2016 02:24
Transient Spray modeling of evaporating particles sgov000ster ANSYS 0 April 9, 2014 11:09
Euler-Euler simulation of evaporating spray Xavier Ponticq CFX 0 July 4, 2007 08:49
Multicomponent fuel spray and combustion usker Siemens 0 May 16, 2007 02:45
temperature fluctuations in an evaporating spray kate Main CFD Forum 0 June 20, 2006 06:35


All times are GMT -4. The time now is 18:58.