CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Creating and implementing UDF for DPM droplet evaporation rate (https://www.cfd-online.com/Forums/fluent-udf/251833-creating-implementing-udf-dpm-droplet-evaporation-rate.html)

fbsims September 10, 2023 05:39

Creating and implementing UDF for DPM droplet evaporation rate
 
Hi,

I am trying to simulate a flash atomizing water spray. I've read that the 'pressure boiling' and 'temperature dependent latent heat' models do not calculate an appropriately fast evaporation rate and I will need to use a UDF. I am currently doing a steady sim with interaction with continuous phase turned on.

I have never used UDF's (or have programming experience beyond matlab) and don't know where/how to start. This is the calculation process (see below) I essentially need to follow (the code is written in Matlab, and I have all the parameters except for each droplet diameter, which I need to take from ansys at each iteration to get the new mass transfer rate (which is the mass removed from the droplet and added as a eulerian vapor phase).

Any help as to how I would turn this into a UDF would be much appreciated.

Thanks


%% flashing mdot component
% get surface area of particle using diameter provided by ansys

D = D_p; % FROM ANSYS
A_p = 4*pi*(D/2)^2;

% using thermo constants and calculated alpha, along with surface
% area calculate mass transfer from flashing

mdot_flash = alpha * A_p * (TSH_act) / liq.hv;

%% condensing mdot component
% calculate Re with that D

Re_star = liq.rho*u_rel_initial*D/mu_ref;

% calculate Pr with known values
Pr_star = mu_ref*cp_ref/k_ref;

% calculate Nu* using Frossling correlation
Nu_star = 2 + 0.552 * Re_star^0.5 * Pr_star^(1/3);

% solve via netwon raphson
% error tolerance

err = 1e-20;

% initial guess
mdot_cond = 1;

% initial diff
diff = 1;

% loop until converged mdot_cond
while diff > err
% coefficient for equation using fluent droplet diameter
c1 = 2*pi*k_ref / cp_ref * D/2;

% set old flow rate for difference calc
m_old = mdot_cond;

% set ratio for evaporation
ratio_fc = mdot_flash/m_old;

% calculate new mdot_cond
mdot_cond = abs(c1 * (Nu_star / (1 + ratio_fc)) * log(1+(1+ratio_fc)*...
((h_ref-liq.h) / liq.hv)));

% check difference from previous guess
diff = abs(m_old-mdot_cond);
i = i+1;
end

%% total
mRES = mdot_cond + mdot_flash;


All times are GMT -4. The time now is 03:44.