|
[Sponsors] |
July 26, 2020, 20:59 |
mass transfer udf not working
|
#1 |
Member
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8 |
I'm simulating a mass transfer udf, mass transfer from 'water' to the 'oil' phase at an interface between these 2 phases. but my udf's inequality condition is not working.
my udf: Code:
#include "udf.h" DEFINE_MASS_TRANSFER(interface_transfer, cell, thread, from_index, from_species_index, to_index, to_species_index) { real m_lg; Thread *water = THREAD_SUB_THREAD(thread, from_index); Thread *oil = THREAD_SUB_THREAD(thread, to_index); m_lg = 0.0; if ( C_VOF(cell,water)*C_VOF(cell,oil) >= 0.15) { m_lg = 100; } else m_lg = 0.0; return (m_lg); } I tried displaying the contour for a custom function: (C_VOF(cell,water)*C_VOF(cell,oil) ) Screenshot 2020-07-27 at 5.20.01 AM.jpg But the mass transfer in zero. |
|
July 26, 2020, 23:41 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
your UDF seems to be correct,
are you sure, I've hooked UDF properly? from manual Code:
In order to hook a DEFINE_MASS_TRANSFER UDF to Fluent, you must first issue the TUI command solve/set/expert and enter no at the LinearizedMass Transfer UDF? prompt.
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 27, 2020, 04:35 |
UDF works for code without inequality condition.
|
#3 | |
Member
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8 |
Quote:
It will just not be working as per my requirements, the mass transfer occurs through whole of the water phase rather than happening at the interface between the oil and water phase. |
||
July 29, 2020, 00:44 |
Some modifications in UDF.
|
#4 | ||
Member
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8 |
Quote:
Quote:
The UDF below works and prints the first statement 'hello_fluent 1' but does not print the other statement which is inside the loop. Code:
#include "udf.h" #include "math.h" DEFINE_MASS_TRANSFER(interface_transfer, cell, thread, from_index, from_species_index, to_index, to_species_index) { real m_lg; real c_tg; real k_g; Thread *water = THREAD_SUB_THREAD(thread, from_index); Thread *oil = THREAD_SUB_THREAD(thread, to_index); m_lg = 0.0; c_tg = 0.0; k_g = 0.0; Message("\n \n hello_fluent 1"); if ( ( C_VOF(cell,water)*C_VOF(cell,oil) > 0.21 ) && (C_VOF(cell,water) + C_VOF(cell,oil) > 0.95) ) { k_g = 0.4 * sqrt(C_DIFF_L(cell,water,0,1)) * pow((C_D(cell,water)/ C_MU_T(cell,water)), 0.25) ; c_tg = C_VOF(cell,water) * C_R(cell,water) * C_YI(cell , water , 0) ; m_lg = k_g * (NV_MAG(C_VOF_G(cell,water))) * ( 4e-5 - c_tg ) ; Message("\n \n hello_fluent 2"); } else m_lg = 0.0; return (m_lg); } |
|||
July 29, 2020, 02:08 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
it means, that your condition is not true in the whole domain.
1. you may decrease criteria values 2. may be the problem is your mesh, which could be too course (elements are too huge) C_VOF macro gets value from the center of cell (not from the nodes) so you may try to refine the mesh
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 29, 2020, 03:44 |
changing the mesh does no help
|
#6 | |
Member
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8 |
Quote:
Screenshot 2020-07-29 at 12.11.54 PM.jpg The model is 3 phase model, there is a 3rd phase as well. Is this not working because of that? |
||
July 29, 2020, 03:58 |
segmentation fault
|
#7 | |
Member
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8 |
Quote:
1. This does not happen without UDF. 2. The residual plot is well within 1e-02 for all scalars. Why is this happening? I am running the setup in serial mode. The CPU meter for RAM is also within 40% usage at the time I start. |
||
July 29, 2020, 05:54 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
unfortunately, I have very little experience in multiphase simulations
if you have 3 phases it could be an issue, try following code to check fileds of concentrations distribution: dont forget to allocate 3 UDMI variables in fluent gui Code:
#include "udf.h" #include "math.h" DEFINE_MASS_TRANSFER(interface_transfer, c, t, from_index, from_species_index, to_index, to_species_index) { real m_lg; real c_tg; real k_g; Thread **pt = THREAD_SUB_THREADS(t); real vof_i = C_VOF(c,pt[0]); real vof_j = C_VOF(c,pt[1]); real vof_k = C_VOF(c,pt[2]); m_lg = 0.0; C_UDMI(c,t,0) = vof_i*vof_j; C_UDMI(c,t,1) = vof_i*vof_k; C_UDMI(c,t,2) = vof_k*vof_j; return (m_lg); } I expect C_UDMI(c,t,0) should give you same distribution as (C_VOF(cell,water)*C_VOF(cell,oil) ) if yes, add your condition in this code, modify variables and try to run it.
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 29, 2020, 08:39 |
All shows zero value.
|
#9 | |
Member
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8 |
Quote:
1) All the 3 UDMI's are showing 0 in the value. 2) I want to know how will the UDMI save the values, will it not update for every node? Like some nodes, the UDMI's will be zero and for some others, it may be non zero, but it will only show the last updated value. 3) In such a case should I not export an array for the values of these UDMI's? 4) If so, then how may I construct an array inside the UDF and saw the values of the UDMI inside the array so that I can later see it! |
||
July 30, 2020, 05:34 |
|
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
UDMIs are variables which store values of defined variable in the whole domain for one time moment (last one)
for instance it is temperature, which could be different along the domain to store data for different timesteps you may define monitors and write information to file, or you can write data files and extract information from there for more information read Ansys Fluent Customization manual
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 30, 2020, 07:26 |
|
#11 | |
Member
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8 |
Quote:
|
||
July 30, 2020, 21:40 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
it should be same with C_vof(cell, water)*C_vof(cell, oil)
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 30, 2020, 22:43 |
|
#13 |
Member
Anshuman Sinha
Join Date: Oct 2018
Posts: 70
Rep Power: 8 |
Yes, that's the problem I think.
C_vof(cell, water)*C_vof(cell, oil) : Screenshot 2020-07-31 at 6.54.47 AM.png Screenshot 2020-07-31 at 6.54.59 AM.jpg UDMI : Screenshot 2020-07-31 at 6.56.02 AM.jpg The UDF which I'm using: Code:
#include "udf.h" #include "math.h" DEFINE_MASS_TRANSFER(interface_transfer, c, t, from_index, from_species_index, to_index, to_species_index) { real m_lg; real c_tg; real k_g; Thread **pt = THREAD_SUB_THREADS(t); real vof_i = C_VOF(c,pt[0]); real vof_j = C_VOF(c,pt[1]); real vof_k = C_VOF(c,pt[2]); m_lg = 0.0; C_UDMI(c,t,0) = vof_i*vof_j; C_UDMI(c,t,1) = vof_i*vof_k; C_UDMI(c,t,2) = vof_k*vof_j; return (m_lg); } |
|
Tags |
mass transfer, multi phase flow, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Coupled Heat and Mass Transfer | Mecroob | OpenFOAM Running, Solving & CFD | 1 | July 12, 2020 20:24 |
UDF for mass transfer between phases in two phase ice-slurry pipe flow | devshi | Fluent UDF and Scheme Programming | 5 | November 14, 2016 20:27 |
Problems modelling nucleate boiling using mass transfer udf from tutorial | aayushjain27 | Fluent UDF and Scheme Programming | 0 | February 7, 2015 08:23 |
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT | subhankar_bhandari | Fluent UDF and Scheme Programming | 0 | August 19, 2010 04:09 |
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT | subhankar_bhandari | FLUENT | 0 | August 19, 2010 04:01 |