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

UDF for multicomponent particle vaporization

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 2 Post By SJSW
  • 1 Post By SJSW
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 8, 2012, 21:55
Default UDF for multicomponent particle vaporization
  #1
Senior Member
 
Mohsin Mukhtar
Join Date: Mar 2010
Location: South Korea
Posts: 249
Rep Power: 17
Mohsin is on a distinguished road
I have coal particles surrounded by liquid water (hence multi-component). As soon as the wet coal will enter into the domain, the liquid water will evaporate into vapors and dry coal will exit the domain.


FLUENT’s inbuilt code only supports droplet (1 component) vaporization. Hence, UDF has to be written for multi-component particles. Fortunately, Fluent has provided a UDF code to solve multi-component vaporization in the following link:
http://hpce.iitm.ac.in/website/Manuals/Fluent_6.3/fluent6.3/help/html/udf/node64.htm


However, when I compile and hook the above UDF in DPM model of FLUENT and run the simulation, I get 0 evaporation of water. I think, there is some problem in the code and modifications have to be done in the code, as there is no mentioning of vaporization that should start when “Tp>=vap-temp”

The following is the same UDF code as was seen in the link above but boiling portion is neglected(as there is no boiling in my case). Could anyone please explain what should be added here to get vaporization of water from coal particles?

/************************************************** *********************
UDF for defining the heat and mass transport for
multicomponent particle vaporization
************************************************** *********************/

#include "udf.h"

DEFINE_DPM_HEAT_MASS(multicomponent_vaporization,p ,Cp,hgas,hvap,cvap_surf,Z,dydt,dzdt)
{int ns;
Material *sp;
real dens_total = 0.0; /* total vapor density*/
real P_total = 0.0; /* vapor pressure */
int nc = TP_N_COMPONENTS(p); /* number of particle components */
Thread *t0 = P_CELL_THREAD(p); /* thread where the particle is in */
Material *gas_mix = THREAD_MATERIAL(DPM_THREAD(t0, p)); /* gas mixture material */
Material *cond_mix = P_MATERIAL(p); /* particle mixture material*/
cphase_state_t *c = &(p->cphase); /* cell information 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[ns] / molwt[ns];
}
/* prevent division by zero */
molwt_bulk = MAX(molwt_bulk,DPM_SMALL);

for (ns = 0; ns < nc; ns++)
{
int gas_index = TP_COMPONENT_INDEX_I(p,ns); /* average molecular weight */
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_diffus ivity, 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 (ideal gas) */
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);

/* no vaporization below vaporization temperature, no condensation*/
if (Tp < vap_temp || vap_rate < 0.0)
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];
}
}
}

Last edited by Mohsin; February 9, 2012 at 03:50.
Mohsin is offline   Reply With Quote

Old   September 27, 2012, 02:16
Default
  #2
New Member
 
Sujala Bhattarai
Join Date: Sep 2012
Posts: 2
Rep Power: 0
Sujala is on a distinguished road
Hi, How did u solve this problem. I am also doing CFD simulation of pneumatic dryer. I followed your thread and used the multicomponent droplet (particles + water). And used the UDF Define_DPM_HEAT_MASS. And couldn't see any evaporation. I am student from KNU, south korea.
Sujala is offline   Reply With Quote

Old   April 10, 2014, 22:16
Default multicompotent
  #3
New Member
 
malong
Join Date: May 2013
Posts: 3
Rep Power: 13
Mark New is on a distinguished road
dear sir ,
i am glad to meet you ,have you solved your problems about the vaporization of water using the UDF? NOW,i also meet the same issue ,canyou help me this <thankyou
Mark New is offline   Reply With Quote

Old   April 11, 2014, 11:37
Default
  #4
Member
 
Join Date: Nov 2011
Posts: 42
Rep Power: 15
Leepox is on a distinguished road
Does anybody know if you can use this DPM to define evaporation of water from coal in a combustion rather than multicomponent particle?
Leepox is offline   Reply With Quote

Old   March 30, 2015, 07:12
Default
  #5
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 12
SJSW is on a distinguished road
Maybe you can try to remove the dydt[FF] whose "FF" !=0 or 1, since dydt[0] is K/s and dydt[1..] is Kg/s.

Test which dydt[FF] using different "FF" is for water.

In this UDF,
"gas_index = TP_COMPONENT_INDEX_I(p,ns)"
......I don't know how to find the index and discover the number of water.
what I can do is to test.
SJSW is offline   Reply With Quote

Old   November 10, 2016, 02:01
Default
  #6
New Member
 
meljuntak
Join Date: Nov 2016
Posts: 7
Rep Power: 10
Melvin is on a distinguished road
Hi Mohsin
Do you have complite your fluent simulation??? Pleas help me.....
My model almost same to your model but in transient. It's very difficult to make UDF to solve that problem
thanks.....
Melvin is offline   Reply With Quote

Old   November 15, 2016, 02:35
Default
  #7
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 12
SJSW is on a distinguished road
I always hope that someone who get the solution could share their method in the forum.
--
"dydt[0]" is the temperature of the particle.(Unit:K/s)
You can figure this out by this line "dydt[0] += dh_dt / (mp * Cp);".

"dydt[1]~dydt[aa]" is the mass fraction of the components in a particle. (Unit:Kg/s)
dydt[0] is for temperature, so the value range of "aa" starts from 1.

"dzdt->energy" is the enthalpy changing rate of the gas mixture in the cell where the particle is located.. (Unit:J/s)
You can figure this out by the line "dzdt->energy += hgas[gas_index] * vap_rate;".

"dzdt->species[gas_index]" is the mass changing rate of the component gas in the cell where the particle is located.(Unit: kg/s)
The value of "gas_index" starts from 0.

So what are the meanings of "[gas_index]" and "[aa]" ?

For example,
dydt[1]~dydt[3] = h2, o2, n2
dzdt->species[0]~dzdt->species[10] = c2h2, ch4, c3h8, h2o, n2o, n2 ...
This means 3 components in a particle mixture and 11 component in the gas mixture.
First, check your material list in "Mixture Species→Edit→Elected Species", and make sure the order is correct.
Secondly, make sure "injection→Components→Evaporating Species" is correct.

For example, you want that h2 and o2 become h2o.
dydt[1] and dydt[2] will decrease as depicted in this line "dydt[1+ns] -= vap_rate".
dzdt->species[3], that is the fourth component h2o, will increase as depected in this line "dzdt->species[gas_index] += vap_rate;".
SJSW is offline   Reply With Quote

Old   November 20, 2016, 04:26
Default
  #8
New Member
 
meljuntak
Join Date: Nov 2016
Posts: 7
Rep Power: 10
Melvin is on a distinguished road
Quote:
Originally Posted by SJSW View Post
I always hope that someone who get the solution could share their method in the forum.
--
"dydt[0]" is the temperature of the particle.(Unit:K/s)
You can figure this out by this line "dydt[0] += dh_dt / (mp * Cp);".

"dydt[1]~dydt[aa]" is the mass fraction of the components in a particle. (Unit:Kg/s)
dydt[0] is for temperature, so the value range of "aa" starts from 1.

"dzdt->energy" is the enthalpy changing rate of the gas mixture in the cell where the particle is located.. (Unit:J/s)
You can figure this out by the line "dzdt->energy += hgas[gas_index] * vap_rate;".

"dzdt->species[gas_index]" is the mass changing rate of the component gas in the cell where the particle is located.(Unit: kg/s)
The value of "gas_index" starts from 0.

So what are the meanings of "[gas_index]" and "[aa]" ?

For example,
dydt[1]~dydt[3] = h2, o2, n2
dzdt->species[0]~dzdt->species[10] = c2h2, ch4, c3h8, h2o, n2o, n2 ...
This means 3 components in a particle mixture and 11 component in the gas mixture.
First, check your material list in "Mixture Species→Edit→Elected Species", and make sure the order is correct.
Secondly, make sure "injection→Components→Evaporating Species" is correct.

For example, you want that h2 and o2 become h2o.
dydt[1] and dydt[2] will decrease as depicted in this line "dydt[1+ns] -= vap_rate".
dzdt->species[3], that is the fourth component h2o, will increase as depected in this line "dzdt->species[gas_index] += vap_rate;".
Thanks SJSW
After I modified the UDF as your suggestion where gas index changed based on the number of particle component or species of gas. The Simulation still get an error. The errors are:
1. Simulation still gets access violation and the simulation stop, or
2. Sometimes simulation can run normally but after I check the total mass of Particle, there is no vaporization occur (total mass not reduce) .
Can you give other suggestion to solve my problem???
Thanks for your response before ??

Last edited by Melvin; November 20, 2016 at 22:30.
Melvin is offline   Reply With Quote

Old   November 28, 2016, 04:10
Default
  #9
New Member
 
JUNCAI LI
Join Date: Oct 2016
Posts: 7
Rep Power: 10
vincentl1 is on a distinguished road
Hi,Melvin
I am studying this official udf case too,while,i get confused by two macros listed below.
real Dp = DPM_DIAM_FROM_VOL(mp / P_RHO(p)); /* particle diameter */
real Ap = DPM_AREA(Dp); /* particle surface */
i can not find "DPM_DIAM_FROM_VOL" and "DPM_AREA" from the udf manual(version 14.5).Are they custom functions that didn't posted along with the main code? Actually,there are many macros like that in the code.can you tell why? thanks....
vincentl1 is offline   Reply With Quote

Old   November 28, 2016, 04:22
Default
  #10
New Member
 
JUNCAI LI
Join Date: Oct 2016
Posts: 7
Rep Power: 10
vincentl1 is on a distinguished road
Hi,SJSW
I am studying this official udf case too,while,i get confused by two macros listed below.
real Dp = DPM_DIAM_FROM_VOL(mp / P_RHO(p)); /* particle diameter */
real Ap = DPM_AREA(Dp); /* particle surface */
i can not find "DPM_DIAM_FROM_VOL" and "DPM_AREA" from the udf manual(version 14.5).Are they custom functions that didn't posted along with the main code? Actually,there are many macros like that in the code.can you tell why? thanks....
vincentl1 is offline   Reply With Quote

Old   November 28, 2016, 04:30
Default
  #11
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 12
SJSW is on a distinguished road
"DPM_DIAM_FROM_VOL" and "DPM_AREA" are pre-defined macro.
You can find them in udf.h or other h file.

The manual did not show all the macroes and definitions.
Maybe there is a complete manual about UDF.
However, In most conditions, you have to ask for the support from ANSYS.

The UDF must be modified to match the settings of the case.
Maybe material properties, boundary conditions, Zone ID, ...and how they are defined in the codes...so I suggest that one could try to realize the meaning of the code.
vincentl1 and souza.emer like this.
SJSW is offline   Reply With Quote

Old   November 28, 2016, 06:00
Default
  #12
New Member
 
JUNCAI LI
Join Date: Oct 2016
Posts: 7
Rep Power: 10
vincentl1 is on a distinguished road
ha!,I find their definitions in dpm_tools.h.Thank you so much!
vincentl1 is offline   Reply With Quote

Old   November 29, 2016, 21:32
Default
  #13
New Member
 
JUNCAI LI
Join Date: Oct 2016
Posts: 7
Rep Power: 10
vincentl1 is on a distinguished road
Hi,SJSW
i've compiled the udf file sucessfully in my case.however,i didn't know where to hook. There are two UDF options in decrete phase model.One is under the main dialog board of DPM and the other is under the injection board. My problem is that nothing seemd to have happened in the two places after i complied correctly.My version is 14.5.can you give me an advice?Thank you!
vincentl1 is offline   Reply With Quote

Old   November 29, 2016, 22:36
Default
  #14
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 12
SJSW is on a distinguished road
You can go to ANSYS Help→Fluent→Customization Manual→Creating and Using User Defined Functions→Hooking UDFs to ANSYS Fluent→ Hooking Discrete Phase Model (DPM) UDFs.
There are descriptions there.
vincentl1 likes this.
SJSW is offline   Reply With Quote

Old   December 17, 2016, 22:58
Default
  #15
New Member
 
JUNCAI LI
Join Date: Oct 2016
Posts: 7
Rep Power: 10
vincentl1 is on a distinguished road
Hi,SJSW
In my case , i found vaporation didn't happen cause the returned value of gas_index = TP_COMPONENT_INDEX_I(p,ns) is -1.I don't know why the value is negative.Do you know the reason? Thanks
vincentl1 is offline   Reply With Quote

Old   January 26, 2021, 04:50
Default heat and mass transfer
  #16
New Member
 
Sara
Join Date: Apr 2020
Posts: 19
Rep Power: 6
sara moradi is on a distinguished road
hi all,

I'm simulating a spray dryer and i need to simulate the heat and mass transfer. when i interpret the UDF, I encounter an error.
the error is: structure reference not implemented
this error is about this line of code
int nc = TP_N_COMPONENTS(p); /* number of particle components */

does anyone know how can I fix this error?
thanks
sara moradi is offline   Reply With Quote

Old   January 27, 2021, 02:33
Default
  #17
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
compile code
sara moradi likes this.
__________________
best regards


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

Old   January 27, 2021, 03:57
Default
  #18
New Member
 
Sara
Join Date: Apr 2020
Posts: 19
Rep Power: 6
sara moradi is on a distinguished road
thanks. I will check it
sara moradi 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
vaporization pressure UDF Komon Fluent UDF and Scheme Programming 0 September 20, 2011 20:33
Problem with a simple UDF to calculate cell-averaged particle values kmayank FLUENT 1 January 18, 2011 02:40
UDF for Particle reaction and DPM_Property saifulraju ANSYS 0 September 22, 2010 08:24
DPM UDF particle position using the macro P_POS(p)[i] dm2747 FLUENT 0 April 17, 2009 02:29
udf about particle concentration--who can help me? zhaoh FLUENT 1 January 17, 2007 12:46


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