|
[Sponsors] |
Interfacial species transport UDF in Eulerian model |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 18, 2016, 10:32 |
Interfacial species transport UDF in Eulerian model
|
#1 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
I am simulating species transport in a 2 phase vapor-liquid bubble column using the Eulerian framework. This UDF is designed to calculate the mass transfer rate of one species from the primary phase (liquid) to the secondary phase (gas).
The UDF compiles and hooks successfully in fluent, but no mass transfer occurs when the simulation is run. I wasn't sure whether it is necessary to introduce a the "thread_loop_c" loop over all cells (see code below), but when I tried excluding the loop it would produce an error during initialization. Any thoughts on why the UDF does not work? Thank you in advance #include "udf.h" #include "mem.h" #include "sg.h" #include "flow.h" #include "metric.h" DEFINE_MASS_TRANSFER(source,cell,thread,from_index ,from_species_index,to_index,to_species_index) { Domain *mixture_domain=Get_Domain(1); thread_loop_c(thread, mixture_domain) { if( THREAD_ID(thread) == 1) { begin_c_loop(cell, thread) { real m_lg; Thread *liq=THREAD_SUB_THREAD(thread,from_index); Thread *gas=THREAD_SUB_THREAD(thread,to_index); m_lg=0.3*pow(10,-7)*C_R(cell,liq); return (m_lg); } end_c_loop(cell, thread) } } } Notes: - getDomain(1) is the mixture domain (containing both liquid and gas phases). - THREAD_ID(thread)= 1 is the interior zone of the fluid, from define-> boundary conditions . - I have been running serial (not parallel) simulations, and have tried both compiling and interpreting the UDF (results are the same). |
|
May 19, 2016, 06:11 |
|
#2 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
|
||
May 19, 2016, 08:00 |
|
#3 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
Hi Bruno. Yes it looks like you are correct according to the UDF manual. So, I changed it to THREAD_ID(thread)= 2 as the cell zone ID number of the fluid is 2. But this still didn't fix the problem. I also tried removing the IF statement entirely from the code but there was no difference
|
|
May 19, 2016, 08:12 |
|
#4 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
this should be your last line, before closing the DEFINE_MASS_TRANSFER macro. try to change it and see if it works. and according to the manual, there is no need to loop over the cells. |
||
May 20, 2016, 07:18 |
|
#5 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
I tried changing the position of return (m_lg) but it didnt work.
I also tried no loop at all but it didnt work. Without a loop it returns a cortex error at initialisation |
|
May 20, 2016, 18:24 |
|
#6 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The DEFINE_MASS_TRANSFER macro is called for each cell and includes arguments with the cell index and its mixture-level thread. You've then looped over all cells within this thread and since you're always exiting the macro on the first loop, the m_lg of the first cell (index of 0) is returned. Remove the cell loop and check the UDF manual for an example.
|
|
May 23, 2016, 04:38 |
|
#7 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
I've noticed something strange that I hadn't realised before. When trying to compile the UDF, it builds and loads without any errors. However, when I try to hook the UDF in the phase interactions panel, it says "no UDF has been loaded" and I am unable to hook the UDF there. But if I set the phase interactions panel to the "species mass transfer" option, and then try to hook the compiled UDF to the mass transfer coefficient panel, it DOES work. When I interpret the same UDF, it works fine, and there is no problem hooking it to either the mass transfer coefficient panel or the phase interactions panel. This makes me think that there is something wrong with the way my UDF is being compiled . I am launching fluent (ver 16.1) using the Microsoft VS2015 x64 command prompt, with the case files inside the same directory as the UDF file, and when I compile the UDF it seems to load the library without any problems, so I am not sure where the problem lies. Is it completely necessary to compile rather than interpret this type of UDF? Thanks for your help
Last edited by richard222; May 23, 2016 at 05:57. |
|
May 23, 2016, 05:45 |
|
#8 | |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
Quote:
|
||
May 23, 2016, 05:56 |
|
#9 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
To summarise:
In interpreted mode: Interprets UDF fine, but produces a segmentation error when I try to initialise. In compiled mode: Builds and loads fine, but isnt visible on phase interactions panel to hook (is only visible in mass transfer coefficient panel, if "species mass transfer" model is enabled). |
|
May 23, 2016, 08:56 |
|
#10 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
There's no specific instruction to compile DEFINE_MASS_TRANSFER macros in the UDF manual but it's generally best to compile all UDFs to avoid potential issues. Are there any errors or warnings when you're compiling? And check my compiling process for Fluent UDFs with an existing library loaded.
|
|
May 23, 2016, 09:05 |
|
#11 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I guess what you want to have is this:
Code:
#include "udf.h" DEFINE_MASS_TRANSFER(source,cell,thread,from_index, from_species_index,to_index,to_species_index) { Thread *liq=THREAD_SUB_THREAD(thread,from_index); real m_lg=0.3*pow(10,-7)*C_R(cell,liq); return (m_lg); } |
|
May 23, 2016, 09:35 |
|
#12 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
I tried using the simplified code that you suggested, Pak. There are no error messages during building or loading the UDF, until I select "user defined" option from the phase interactions panel and then I get "Error: No user-defined functions have been loaded". I checked to see if I could unload any previous libraries (there weren't any though) before loading the new one and I compiled the UDF library using the recommended steps.I have attached a screenshot of the fluent command prompt.
|
|
May 23, 2016, 09:38 |
|
#13 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
From the manual:
Quote:
|
||
May 23, 2016, 11:52 |
|
#14 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
Thanks pak. That solved the problem of allowing me to hook the compiled UDF to the phase interactions panel. But, when I run the compiled UDF, there is no mass transfer occurring (it appears that ml_g=0). I can't figure out why this is the case
|
|
May 23, 2016, 12:04 |
|
#15 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
And if you print the mass transfer in this way:
Code:
#include "udf.h" DEFINE_MASS_TRANSFER(source,cell,thread,from_index, from_species_index,to_index,to_species_index) { Thread *liq=THREAD_SUB_THREAD(thread,from_index); real m_lg=0.3*pow(10,-7)*C_R(cell,liq); Message("m_lg=%e\n",m_lg); return (m_lg); } Do you see "m_lg=0" many times? Or do you see small but positive values? If it is the latter, then Fluent is exactly calculation what you want, but the mass flow is just too small to notice... |
|
May 23, 2016, 12:25 |
|
#16 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
I get very small values of ml_g being repeated many times. Yes it seems that the UDF is working. It is strange though that I am not observing any transfer from the liquid to the gas phase (it is a bubbly flow column). Normally in CFD-post when viewing the mass fraction profile in the liquid phase of the specie being transferred the scalebar of the y axis can deal with a very large number of decimal points
|
|
May 24, 2016, 13:40 |
|
#17 |
New Member
Richard
Join Date: May 2016
Posts: 16
Rep Power: 10 |
Thank you for your help. The problem has been solved. It appears that the mass transfer rate was so small that the simulation needed to be run for an extremely long time to achieve a measurable level of mass transfer
|
|
Tags |
define_mass_transfer, species transport, user defined functions |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fluent species transport model | lakshmi.bala | FLUENT | 23 | November 2, 2022 02:42 |
Diff in Combustion Modelling By Species Transport Model & Non-Premixed Combustion | bhanuday.sharma | FLUENT | 0 | June 23, 2015 03:50 |
Divergence problem for species transport model | MY | FLUENT | 3 | January 11, 2014 05:46 |
Eulerian Model, UDF Programming | hjel0743 | Fluent UDF and Scheme Programming | 0 | October 16, 2012 17:51 |
Species Transport Model | Sam | FLUENT | 0 | November 12, 2005 22:42 |