|
[Sponsors] |
October 23, 2013, 21:05 |
UDF for evaporation
|
#1 |
Member
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 86
Rep Power: 17 |
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 */ } |
|
October 25, 2013, 12:32 |
|
#2 |
Member
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 86
Rep Power: 17 |
Just a quick update. The problem has not yet been solved. But if I remove the line
NV_V(G,=,C_VOF_G(c,w_liq)); and related dependents, the code works fine. Although, I have used the option of keeping the solver temporary memory, C_VOF_G is giving me the issue, which is strange. Still working on it. If someone has any suggestions, please do post. Thanks. |
|
December 2, 2013, 09:56 |
|
#3 |
New Member
anonymous
Join Date: Nov 2013
Posts: 9
Rep Power: 13 |
Dear pranab_jha,
Could you please specify the solution if you find one? I am facing exactly the same problem with C_VOF_G. |
|
February 20, 2015, 09:02 |
|
#4 |
New Member
Omar Osama Mohamed
Join Date: Nov 2014
Posts: 26
Rep Power: 12 |
Hi , I am sorry but did no body of you find a solution for that ?
I checked the sg_mphase.h and i found the line #define C_VOF_G(c,t) C_STORAGE_R_NV(c,t,SV_VOF_G) and working with expert mood without freeing my memory i think VOF data should be saved .. Actually it is sent to my udf with zero value all of times despite it has value when i plot it in Fluent Solver .. did anyone find solution for this ? |
|
January 7, 2016, 09:44 |
phase change problem inside heat pipe
|
#5 |
Member
Ram Kumar Pal
Join Date: Apr 2015
Posts: 38
Rep Power: 11 |
Dear friends, I'm doing my project work on heat pipe simulation in fluent software. I have written udf for mass and energy source for phase change inside heat pipe. But condensation is not happening in evaporator section. If anyone have done this type of problem, please help me.
Thanks My udf is paste below: #include "udf.h" #include "sg_mphase.h" #include "mem.h" #include "metric.h" #include "flow.h" #include "sg.h" #define T_SAT 373.15 #define LAT_HT 2455.1345e3 DEFINE_SOURCE(vap_src,cell,pri_th,dS,eqn) /*vapour source udf*/ { real m_dot_v; Thread *mix_th, *sec_th; mix_th = THREAD_SUPER_THREAD(pri_th); sec_th = THREAD_SUB_THREAD(mix_th,1); m_dot_v=0.0; if (C_T(cell,sec_th)>T_SAT) { m_dot_v = 0.1*C_VOF(cell,sec_th)*C_R(cell,sec_th)*(C_T(cell, sec_th)-T_SAT)/T_SAT; dS[eqn] = 0.0; } if (C_T(cell,pri_th)<T_SAT) { m_dot_v = -0.1*C_VOF(cell,pri_th)*C_R(cell,pri_th)*(T_SAT-C_T(cell,pri_th))/T_SAT; dS[eqn] = -0.1*C_R(cell,pri_th)*(T_SAT-C_T(cell,pri_th))/T_SAT; } return m_dot_v; } DEFINE_SOURCE(liq_src,cell,sec_th,dS,eqn) /*liquid source udf*/ { real m_dot_l; Thread *mix_th, *pri_th; mix_th = THREAD_SUPER_THREAD(sec_th); pri_th = THREAD_SUB_THREAD(mix_th,0); m_dot_l=0.0; if (C_T(cell,sec_th)>T_SAT) { m_dot_l = -0.1*C_VOF(cell,sec_th)*C_R(cell,sec_th)*(C_T(cell, sec_th)-T_SAT)/T_SAT; dS[eqn] = -0.1*C_R(cell,sec_th)*(C_T(cell,sec_th)-T_SAT)/T_SAT; } if (C_T(cell,pri_th)<T_SAT) { m_dot_l = 0.1*C_VOF(cell,pri_th)*C_R(cell,pri_th)*(T_SAT-C_T(cell,pri_th))/T_SAT; dS[eqn] =0.0; } return m_dot_l; } DEFINE_SOURCE(enrg_src,cell,mix_th,dS,eqn) /*energy source udf*/ { real enrg_dot; Thread *pri_th, *sec_th; pri_th = THREAD_SUB_THREAD(mix_th,0); sec_th = THREAD_SUB_THREAD(mix_th,1); enrg_dot = 0.0; if (C_T(cell,sec_th)>T_SAT) { enrg_dot = -0.1*C_VOF(cell,sec_th)*C_R(cell,sec_th)*LAT_HT*(C_ T(cell,sec_th)-T_SAT)/T_SAT; dS[eqn] = -0.1*C_VOF(cell,sec_th)*C_R(cell,sec_th)*LAT_HT/T_SAT; } if (C_T(cell,pri_th)<T_SAT) { enrg_dot = 0.1*C_VOF(cell,pri_th)*C_R(cell,pri_th)*LAT_HT*(T_ SAT-C_T(cell,pri_th))/T_SAT; dS[eqn] = -0.1*C_VOF(cell,pri_th)*C_R(cell, pri_th)*LAT_HT/T_SAT; } return enrg_dot; } |
|
October 18, 2016, 14:37 |
Help in simulation of heat pipe (fluent).
|
#6 | |
New Member
Join Date: Oct 2016
Location: Ringkobing, Denmark
Posts: 10
Rep Power: 10 |
Quote:
Anyone succeed to simulate the heat pipe evaporator and condenser? I'm doing my bachelor project on it and i will appreciate any help in this case because, i'm beginner with fluent however, i know the equations of energy and momentum which need to be written in the UDF but i failed to simulate it. My email : Abdelhamidkassem93@gmail.com If anyone have udf or tutorials to help me in this case. |
||
April 21, 2017, 08:29 |
|
#7 |
New Member
Hayder
Join Date: Mar 2016
Posts: 8
Rep Power: 10 |
[QUOTE=pranab_jha;458640]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. Hello Branab, I have a case similar to this case, please, did you manage to run this UDF, if so, please could you send me the correct version of it, I really appreciate. Hayder |
|
November 29, 2018, 02:05 |
storing gradients of VOF in UDMI in VOF method?
|
#8 | |
Senior Member
vidyadhar
Join Date: Jul 2016
Posts: 138
Rep Power: 10 |
Quote:
Hello Pranab, I am working to model evaporation of a liquid into its vapor using VOF. In the UDF that I am writing for this, I want to write an expression for calculating the gradient of volume fraction which represents the interfacial area density. But, I am unable to store the values of gradients of volume fraction i.e., C_VOF_G. I am getting zero value for C_UDMI and source, If I use the code lines: if (C_VOF(cell,cell_thread)!=0.0 && C_VOF(cell,cell_thread)!=1.0) { source=3.2*(C_T(cell,cell_thread)-T_SAT)*(C_VOF_G(cell,cell_thread)[0]); C_UDMI(cell,cell_thread,0) = source; printf("source= %g\n",source); } If you have succeeded in storing the values of C_VOF_G and using them to estimate interfacial area density, I request you to help me how to do it. Thanks in advance! Vidyadhar |
||
January 15, 2019, 07:09 |
|
#9 | ||
New Member
GW
Join Date: Nov 2018
Posts: 6
Rep Power: 8 |
Quote:
Quote:
Last edited by wyldckat; January 20, 2019 at 16:50. Reason: posted a few minutes apart |
|||
September 4, 2021, 00:47 |
|
#10 | |
New Member
Jun
Join Date: Aug 2021
Posts: 3
Rep Power: 5 |
Quote:
|
||
September 4, 2021, 05:30 |
|
#11 |
Member
Guven Nergiz
Join Date: Jul 2020
Location: Turkey
Posts: 52
Rep Power: 6 |
Why do you need an UDF to simulate evaporation in Fluent? I didnt perform this kind of sim. in Fluent before, but I am using Cradle right now and no need to any external function to perform that analysis.
|
|
Tags |
evaporation, multiphase, species |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |