|
[Sponsors] |
August 10, 2022, 14:26 |
UDF for gas dissolution in DPM droplets
|
#1 |
New Member
Aijuan Wang
Join Date: Jun 2022
Location: Sweden
Posts: 2
Rep Power: 0 |
Hello everyone,
I am new to Ansys fluent and UDF programming. So, I have been confused with the UDF which can deal with the gas dissolution in DPM droplets for a long time. For my case, I want to calculate CO2 dissolution ( mass transfer rate, total mass transfer of CO2) in the water droplets, of which water droplets were modeled with DPM, CO2 and air are continuous phases. I have read the user guide documents and almost all the examples on the forum, but I still have not solved my problem. Maybe my question is foolish, but I still hope you can kindly answer me. I have done my best. (1) DEFINE_DPM_HEAT_MASS, or DEFINE_DPM_SOURCE, which one is more suitable for my case? (2) I have spent a lot of time on DEFINE_DPM_HEAT_MASS, but fluent crashed when runs with this UDF. #include "udf.h" #include "dpm.h" #include "dpm_mem.h" #define R 8.314; /* gas constant [J/K/mol] */ DEFINE_DPM_HEAT_MASS(absorp, tp, Cp, hgas, hvap, cvap_surf, Z, dydt, dzdt) { int CO2_index = 3; /* index of CO2 species in mixture material*/ real MW_CO2 = 44.01e-3; /* Molecular mass of CO2 [kg/mol] */ int ns; // species index Material *sp; // speices pointer real dens_total = 0.0; /* total vapor density*/ real P_total = 0.0; /* vapor pressure */ int nc = TP_N_COMPONENTS(tp); /* number of particle components */ Thread *t0 = TP_CELL_THREAD(tp); /* thread where the particle is in*/ Material *gas_mix = THREAD_MATERIAL(DPM_THREAD(t0, tp)); /* gas mixture material */ Material *cond_mix = TP_MATERIAL(tp); /* particle mixture material*/ cphase_state_t *c = &(tp->cphase[0]); /* cell information of particle location*/ cell_t c0 = P_CELL(tp); /*cell where the particle is in*/ real molwt[MAX_SPE_EQNS]; /* molecular weight of gas species */ real Tp = TP_T(tp); /* particle temperature */ real mp = TP_MASS(tp); /* particle mass */ real molwt_bulk = 0.; /* average molecular weight in bulk gas */ real Dp = DPM_DIAM_FROM_VOL(mp / TP_RHO(tp)); /* 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(tp->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); // particle temperature [K/s] C_UDMI(TP_CELL(tp), TP_CELL_THREAD(tp), 0) = dydt[0]; dzdt->energy -= dh_dt; // gas phase enthalpy [J/s] C_UDMI(TP_CELL(tp), TP_CELL_THREAD(tp), 1) = dzdt->energy; // Loop over all of the species for the given mixture material 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]; /* average molecular weight */ } /* prevent division by zero */ molwt_bulk = MAX(molwt_bulk, DPM_SMALL); C_UDMI(TP_CELL(tp), TP_CELL_THREAD(tp), 2) = molwt_bulk; real yi_CO2_L; // for (ns = 0; ns < nc; ns++) /* CO2 dissolved in the water droplets */ for (yi_CO2_L = 0; yi_CO2_L < 1; ++TP_COMPONENT_I(tp, ns)) { real Tm = C_T(TP_CELL(tp), TP_CELL_THREAD(tp)); /* mean Temperature [K] */ real yi_CO2_g = C_YI(TP_CELL(tp), TP_CELL_THREAD(tp), CO2_index); /* CO2 mass fraction in gas phase */ real dens_g = C_R(TP_CELL(tp), TP_CELL_THREAD(tp)); /* density of mixture or gas phase */ real C_CO2_g = yi_CO2_g * dens_g / MW_CO2; /* Molar concentration of CO2 in gas phase [mol/m3] */ real P_CO2_g = C_CO2_g * 8.314 * Tm; /* partial pressure of CO2 in gas phase */ real dens_L = P_RHO(tp); /* denisty of droplets */ real C_CO2_L = yi_CO2_L * dens_L / MW_CO2; /* molar concentration of CO2 in droplet [mol/m3] */ real He = 3.54e-7 * exp(2044 / Tm); /*Henry Constant for CO2 in the pure water, [mol/(m3*Pa)], Versteeg et al, 1988*/ real V = NV_MAG(P_VEL(tp)); /* water droplet velocity*/ real vg = 15.69e-6; /* kninematic viscosity of air [m2/s] */ real Re = Dp * V / vg; real Df = 2.35e-6 * exp(-2119 / Tm); /* CO2 molecular diffisivity in water */ real Sc = vg / Df; real kL = 2.0 + 0.6 * sqrt(Re) * pow(Sc, 1. / 3.); /*mass transfer coefficient in liquid phase*/ real NA = kL * (P_CO2_g - He * C_CO2_L); /*Mass transfer flux of CO2, [mol/m2/s] */ /* concentration difference * mass transfer coefficient */ real NA_rate = NA * MW_CO2 * Ap; // [kg/s] dydt[2] += NA_rate; dzdt->species[CO2_index] -= NA_rate; } return; } (3) More detailly, how can I iterate or calculate the CO2 concentration dissolved in water droplets in each time step? I am not sure about this. Any help or suggestion, I will be appreciated it. Thanks a lot |
|
January 22, 2024, 11:34 |
|
#2 |
Member
Min Zhang
Join Date: Mar 2017
Posts: 81
Rep Power: 9 |
Hi Aijuan, I am wondering whether you have solved your problem and whether you can share with me some learnings. I want to do HCl (in the continuum gas phase) dissolution in the water droplets. Thanks a lot!!
|
|
Tags |
udf; dpm; fluent |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for DPM property | ksgr | FLUENT | 2 | July 12, 2017 04:51 |
DPM Segmentation Fault in UDF | jhlee9622 | FLUENT | 0 | July 1, 2016 04:21 |
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT | subhankar_bhandari | Main CFD Forum | 0 | August 19, 2010 04:01 |
DPM: using UDF for creating and deleting Particles | Markus Alzon | FLUENT | 0 | July 4, 2007 02:18 |
DPM - UDF for fluctuating bubble size | Jaroslav Kotara | FLUENT | 1 | April 19, 2006 10:02 |