|
[Sponsors] |
October 23, 2013, 20:05 |
UDF for evaporation
|
#1 |
Member
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 86
Rep Power: 16 |
Hello,
I am trying to model evaporation from a droplet. So I have to apply my evaporation model at the interface. I have a 2D axisymmetric case set up. But I am not able to get my UDF to work. Could someone take a look and let me know please. Comments are added for convenience. SUmmary of the code: -I have used the DEFINE_MASS_TRANSFER macro and defined all variables and initialized them. -I calculated saturation pressure using a polynomial function of cell temperature. -Then the mass fraction of each species is used to compute the molar fraction of required species. -Then I compute the interfacial area density from the volume fraction gradient. -Then using that, I compute the mass transferred by evaporation. Thanks for any help!!! Temporary solver memory has been turned on from the solve-set-expert menu in Fluent. /************************************************** ********* UDF to apply mass transfer rate from liquid to gas phase at the interface ************************************************** **********/ #include "udf.h" #include "sg_mphase.h" #include "materials.h" #define MW_W 18.0 #define MW_A 29.0 #define R 8.314 #define pi 3.14159 #define a_c 0.04 /*accommodation coefficient*/ DEFINE_MASS_TRANSFER(mass_transfer1, c, mixture_thread, from_phase_index, from_species_index, to_phase_index, to_species_index) { /************ Declare variables *********/ float m_lg, T_cell, P_cell, P_sat; float NV_VEC(G); float X_W, Y_W, Y_A; float cur_ts; Thread *w_liq, *gas_mix, *w_gas; face_t f; Domain *mix_domain, *pdomain; int i, pdomain_index; float area[ND_ND], A, ad, theta, cotan, len; /******** Define variables *********/ mix_domain = Get_Domain(1); /* pdomain = DOMAIN_SUB_DOMAIN(mixture_domain,1); */ /* For gas domain */ pdomain_index = 0; pdomain = DOMAIN_SUB_DOMAIN(mix_domain,pdomain_index); w_liq = THREAD_SUB_THREAD(mixture_thread, from_phase_index); gas_mix = THREAD_SUB_THREAD(mixture_thread, to_phase_index); w_gas = THREAD_SUB_THREAD(mixture_thread, to_species_index); T_cell = C_T(c,mixture_thread); /*cell mixture temperature*/ P_cell = C_P(c,mixture_thread); /*cell mixture pressure*/ m_lg = 0.; cur_ts = CURRENT_TIMESTEP; /* real time step size (in seconds)*/ /* compute saturation pressure for water vapor using polynomial fit */ P_sat = 0.000001*pow(T_cell,5) - 0.001*pow(T_cell,4) + 0.681*pow(T_cell,3) - 203.9*pow(T_cell,2) + 39482*T_cell + 4000000; /* calculate molar fraction X_W from mass fraction Y_W */ Y_W = C_YI(c,gas_mix,0); /* index for water vap = 0, air = 1*/ Y_A = C_YI(c,gas_mix,1); X_W = (Y_W*29)/((29*Y_W) + (18*Y_A)); /**** Compute the interfacial area density ****/ NV_V(G,=,C_VOF_G(c,w_liq)); /* vof gradient vector assignment*/ theta = atan(G[0]/G[1]); /* compute angle of VOF gradient vector, n1/n2 because of how geometry is set up in Fluent */ cotan = cos(theta) / sin(theta); /* compute cotangent of angle*/ A = C_VOLUME(c,mixture_thread)/(2*pi); /* in 2D- axis area computed from volume */ len = sqrt((2*C_VOF(c,w_liq)*A/cotan) + (2*C_VOF(c,w_liq)*A*cotan)); /* compute length of interface in a cell */ ad = len/A; /* calculate interfacial area density*/ /***** Computed the area density ad = length of interface / area of cell ***/ if (C_VOF(c, w_liq) != 0.0 && C_VOF(c, w_liq) != 1.0) { Message("AD = %f, theta = %f\n",ad, theta); /* Compute m_lg only if P_sat > (Pcell*XW) */ if (P_sat - (P_cell*X_W) > 0.0) { m_lg = cur_ts * ad *(2*a_c/(2-a_c)) * sqrt(MW_W/(2*pi*R)) * ((P_sat - (P_cell*X_W)) / sqrt(T_cell)); } else { m_lg = 0.0;} } else { m_lg = 0.0;} return (m_lg); /* return value of mass transfer rate */ } |
|
Tags |
evaporation, multiphase, species |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 07:37 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 06:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 22:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 21:38 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 04:01 |