|
[Sponsors] |
February 12, 2014, 10:54 |
Udf define_linearized_mass_transfer
|
#1 |
New Member
Join Date: Oct 2012
Posts: 8
Rep Power: 14 |
Hi everybody,
I have a question regarding the UDF DEFINE_LINEARIZED_MASS_TRANSFER. I have written a UDF for mass Transfer from liquid to vapor. It calculates the mass source source term in [kg/m³/s] (massflux). Now I have a Problem with the linearization coefficients *lin_from and *lin_to. In the UDF-Manual example the linearization term is simply the mass source divided by the liquid volume fraction. The Ansys Support tells me this coefficient is simply the derivative of massflux regarding the volume fraction. My question, is it appropriate to just divide the source term by the volume fraction, or do I have to calculate the Change in volume fraction due to that mass source term? I am a bit confused, any help or experience with this particular UDF would be appreciated! Thanks |
|
January 25, 2015, 14:44 |
mass change udf
|
#2 |
New Member
mostafa
Join Date: Jun 2013
Posts: 22
Rep Power: 13 |
Hi everybody.
I have a question about the multiphase mass change UDF: I wrote a mass change udf in a 3phase problem and all parts are OK. It was interpreted, but when I want to initialize my problem it starts to do but it can’t complete initialization, means that after some hours that my CPU gets full load it can’t be finish. I think the cell loop has a problem but I don’t know what the problem is. Would you any one help me. My problem is: 3phase VOF Water is the primary phase 2 secondary phases are air My UDF is : #include"udf.h" DEFINE_MASS_TRANSFER(liq_gas_source,cell,thread,fr om_index,from_species_index, to_index, to_species_index) { real CellVelocity, Fr, epsilon, etha, entrainmentFlow, TotalArea; real vof_cuttOff = 0.05; real FirstBinDiameter = 0.001; real LiquidFilmVelocity = 1; real NV_VEC(area); int n; int phase1_domain_index = 0; Thread *ContinuousPhaseThread = THREAD_SUB_THREAD(thread, phase1_domain_index); Thread *LargeBubblesThread = THREAD_SUB_THREAD(thread, from_index); Thread *SmallBubblesThread = THREAD_SUB_THREAD(thread, to_index); cell_t c; face_t f; Thread *tf; begin_c_loop(cell, LargeBubblesThread) { if ((C_VOF(cell,ContinuousPhaseThread)>vof_cuttOff) && (C_VOF(cell,ContinuousPhaseThread)<(1-vof_cuttOff))) { CellVelocity = sqrt(pow(C_U(cell,ContinuousPhaseThread),2) + pow(C_V(cell,ContinuousPhaseThread),2) + pow(C_W(cell,ContinuousPhaseThread),2)); if (CellVelocity>0.22) { Fr=(CellVelocity - LiquidFilmVelocity) / sqrt(9.81 * C_VOLUME(cell,ContinuousPhaseThread) / 8); if ((Fr>2.5) && (Fr<7)) { epsilon=1.245; etha=0.018; } if ((Fr>7) && (Fr<30)) { epsilon=1.4; etha=0.014; } entrainmentFlow = 1.225*(8/6)*(CellVelocity - LiquidFilmVelocity)* etha * pow((Fr-1),epsilon); } } } end_c_loop(cell,ContinuousPhaseThread) return (entrainmentFlow); } |
|
January 26, 2015, 03:11 |
Read the documentation of the macro, first!
|
#3 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
Hello Mostafa,
According to the DEFINE_MASS_TRANSFER macro documentation, you are not supposed to modify any of the input variables that are present in the header, they are delivered by the solver. In other words, you should not perform the cell loop, is the solver that calls the macro for each cell. The fact that you modify the variable "cell" inside your udf should not be a problem, however, the loop that you introduce means that for each cell in your domain you will go through all the cells of the entier computational domain, and this happens for each iteration/time_step. Consequently, the time to compute will increase dramatically (N*N). |
|
January 26, 2015, 12:08 |
|
#4 |
New Member
mostafa
Join Date: Jun 2013
Posts: 22
Rep Power: 13 |
dear dmoroian
I got it. and thank you every much. I really tahnks about your help. |
|
January 26, 2015, 14:07 |
|
#5 |
New Member
mostafa
Join Date: Jun 2013
Posts: 22
Rep Power: 13 |
Hello.
I have another question: I want to compute the surrounding area of a cell in a mass change define macro. I write this UDF but FLUENT doesn’t interpret this UDF. Its error is : line 23: structure reference not implemented I tested 2 ways but both are wrong! Would you help me please? This is my UDF: #include"udf.h" DEFINE_MASS_TRANSFER(LargeBubbles2SmallBubbles, cell, thread, from_index, from_species_index, to_index, to_species_index) { real CellVelocity, Fr, epsilon, etha, entrainmentFlow, TotalArea; real Vof_CutOff = 0.05; real FirstBindiameter = 0.001; real LiquidFilmVelocity = 1; real NV_VEC(area); int n, i; int phase1_domain_index = 0; Thread *ContinuousPhaseThread = THREAD_SUB_THREAD(thread,phase1_domain_index); face_t f; Thread *tf; if (C_VOF(cell,ContinuousPhaseThread)>Vof_CutOff) { CellVelocity = sqrt(pow(C_U(cell,ContinuousPhaseThread),2) + pow(C_V(cell,ContinuousPhaseThread),2) + pow(C_W(cell,ContinuousPhaseThread),2) ); if (CellVelocity > 0.22) { /*first way */ for (i==0 ; i<6 ; i++) { tf = C_FACE_THREAD(cell,ContinuousPhaseThread,i); f = C_FACE(cell,ContinuousPhaseThread,i); F_AREA(area,f,tf); total_area +=NV_MAG(area); } /* /*second way*/ c_face_loop(cell,ContinuousPhaseThread,n) { f = C_FACE(c,t,n); tf = C_FACE_THREAD(c,t,n); } begin_f_loop(f,tf) { F_AREA(area,f,t); total_area +=NV_MAG(area); } end_f_loop(f,t) Fr = (CellVelocity - LiquidFilmVelocity) / sqrt(9.81 * C_VOLUME(cell,ContinuousPhaseThread) if ((Fr > 2.5) && (Fr < 7)) { epsilon = 1.245; etha = 0.018; } entrainmentFlow = (CellVelocity-LiquidFilmVelocity) * etha * pow((Fr - 1),epsilon); } } return (entrainmentFlow); } |
|
|
|
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 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |