|
[Sponsors] |
Udf mass transfer multiphase access violation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 25, 2014, 06:55 |
Udf mass transfer multiphase access violation
|
#1 |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
the case is a 2 phase vapor-liquid modeled by Eulerian framework and k-e
and there are only 2 species. there is a mass transfer between the phases I have written a UDF for mass transfer but an error occurs when I try to run calculation in parallel mode and when I run in series access violation error occurs The code is written below #include "udf.h" DEFINE_MASS_TRANSFER(liq_gas_source,c,t,from_index ,from_species_index, to_index, to_species_index) { real m_lg,c_meth_l,c_meth_v,k_l,dal,usg,kappa,m,c_sat; dal=1.46*0.000000001; usg=0.294188; kappa=0.000484011/748; m=1.204; k_l=2*sqrt((dal/3.1415)*sqrt(usg*9.8/kappa)); m_lg = k_l*(C_YI(c,from_index,from_species_index)-m*C_YI(c,to_index,to_species_index)); return (m_lg); } the code can be interpreted but during the first calculation the following error occurs: Updating solution at time level N... done. iter continuity u-mixture-li u-mixture-ga v-mixture-li v-mixture-ga w-mixture-li w-mixture-ga k-mixture-li eps-mixture- ch3oh<l>-mix n-propanol-g vf-mixture-g time/iter !417331 solution is converged 417331 7.7100e-04 2.3939e-04 6.4021e-05 5.8865e-04 1.0116e-04 2.8676e-04 8.3530e-05 1.4561e-04 2.6601e-04 0.0000e+00 0.0000e+00 2.7556e-05 0:01:40 100 999999 (..\src\mpsystem.c@1173): mpt_read: failed: errno = 10054 999999: mpt_read: error: read failed trying to read 4 bytes: Invalid argument MPI Application rank 0 exited before MPI_Finalize() with status -1073741819 The Parallel FLUENT process could not be started. |
|
September 25, 2014, 07:18 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
When using parallel, compiling is usually much safer than interpreting. Try that.
|
|
September 25, 2014, 09:26 |
|
#3 |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
||
September 25, 2014, 10:21 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I don't know. Your primary problem is that you try interpret for parallel calculations, where compile is more appropriate.
I could spend the next hour figuring out if your code would give errors if you would compile it, but I am not going to do that, because it is much faster for you if you just compile it and see what the result is. |
|
September 25, 2014, 10:24 |
|
#5 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
Did you read this?
http://www.cfd-online.com/Forums/ans...g-mpi-why.html It seems your problem is not related to the code. |
|
September 25, 2014, 10:31 |
|
#6 |
Member
le hoang anh
Join Date: Oct 2012
Posts: 96
Rep Power: 14 |
Your code have problem both series and parallel simulation?
I think the problem is C_YI(cell,thread,i) but your code C_YI(cell, index,i) So I think it may cause error |
|
September 25, 2014, 12:23 |
|
#7 |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
Yes I have already read that
my RAM is 8 Gb and my mesh is about 200,000 Cells so I dont think the problem is with the RAM |
|
September 26, 2014, 04:29 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Is there a reason why you don't take 2 minutes to compile it and tell us if that solves the problem?
|
|
September 26, 2014, 05:52 |
|
#9 | |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
Quote:
the UDF library you are trying to load (libudf) is not compiled for parallel use in current platform (win64) as I mentioned earlier I couldnt interpret it even in serial mode I am a new user and I was trying to learn how to compile and thats why I didnt answer quickly thanks in advance |
||
September 26, 2014, 05:54 |
|
#10 | |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
Quote:
I have tried Thread *gas=THREAD_SUB_THREAD(t,to_index); Thread *gas=THREAD_SUB_THREAD(t,to_index); but there are another parse errors in these lines thanks in advance |
||
September 26, 2014, 06:08 |
|
#11 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
But my question was not what happens if you try to load the library, but what happens if you try to compile your file. Apparantly, that gave an error. Look at that error to see what is wrong with your code. |
||
September 26, 2014, 06:22 |
|
#12 | ||
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Example of how I would debug this:
I tried to compile your code, and saw the following error: Quote:
Line 10 is: Code:
m_lg = k_l*(C_YI(c,from_index,from_species_index)-m*C_YI(c,to_index,to_species_index)); Quote:
But, from the definition of DEFINE_MASS_TRANSFER (2.4.6): C is indeed cell_t, from_index is an int, and from_species_index is also an int. So, what is wrong? The second input variable of C_YI. Looking at variable types alone, the following looks more reasonable: Code:
m_lg = k_l*(C_YI(c,t,from_species_index)-m*C_YI(c,t,to_species_index)); |
|||
September 26, 2014, 07:01 |
|
#13 | |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
Quote:
In this code the mass fraction of the gas phase and the liquid phase must be used but in the C_YI(c,t,from_species_index) the mass fraction of the cell is used isnt that right? I have used THREAD_SUB_THREAD for identification of the gas phase and also the liquid phase is it correct?(I have mentioned in the last reply |
||
September 26, 2014, 07:29 |
|
#14 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
The correct syntax depends on what you want your code to do.
Your equation is: Code:
m_lg = k_l*(A-m*B); In "C_YI(c,t,i)", c and t indicate which cell you want to look at, and i indicates which mass fraction you want to use. I am fairly sure about the c and the t, but to know which i you should use (from_index,from_species_index, to_index or to_species_index), you should look at the problem you want to solve. All four are acceptable from a programming point of view, they just give solutions to different physical problems. |
|
September 26, 2014, 08:26 |
|
#15 | |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
Quote:
there are two species ( methanol and propanol) and I want to calculate mass fraction of methanol IN THE LIQUID PHASE and the mass fraction of methanol IN THE VAPOR PHASE so I dont want the mass fraction of the liquid phase or methanol in the cell. as I think t is a mixture thread (super thread) and I think I am making mistake using THREAD_SUB_THREAD |
||
September 26, 2014, 08:43 |
|
#16 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I am not experienced enough in species' udfs to tell you what to use. I can only tell you that from a programming point of view, you select the species phase with the third input, and that should be an int.
|
|
September 26, 2014, 09:22 |
|
#17 |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
Ive got my answer
The macro C_YI(cell, thread, I) should be used in the form of following. thread_loop_c(thread, domain) { if( THREAD_ID(t) == 8 ) { begin_c_loop(cell, thread) { C_YI(cell, thread, I) ; } } } The value "8" specified above is the "thread id" that will be got in Define-Boundary Conditions . And , "I" of C_YI(cell, thread, I) shows species which you want to get the mass fraction. |
|
September 26, 2014, 09:24 |
|
#18 | |
Member
majid kamyab
Join Date: Jul 2014
Posts: 32
Rep Power: 12 |
Quote:
Ive got my answer from another Thread I posted it here too if you are interested |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to access only one phase in multiphase model by UDF | wersoe | Fluent UDF and Scheme Programming | 1 | January 4, 2017 08:11 |
mass transfer coefficient for boundary condition | niek | Main CFD Forum | 0 | March 29, 2011 06:33 |
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT | subhankar_bhandari | FLUENT | 0 | August 19, 2010 04:01 |
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT | subhankar_bhandari | Main CFD Forum | 0 | August 19, 2010 04:01 |
Multiphase flow with mass transfer? | A. Ataki | FLUENT | 1 | November 10, 2003 05:46 |