|
[Sponsors] |
September 24, 2019, 08:07 |
Fluent UDF for species transport
|
#1 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
Dear all,
I want to write an udf to calculate a temperature that depends on the concentration of my material at the interface. But when I use the macro C_YI(c,t,i) in my code the simulation crashes. Can you help me, how to use this macro, or does anybody know, what is the best way to take the concentration (or mass fraction) into account? I use the model "species transport". And I have a mixture-material consisting of two materials. Thank you for your help! |
|
September 25, 2019, 02:05 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
show your code, describe in details, how do you start your simulation
best regards |
|
September 25, 2019, 07:12 |
|
#3 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
Hello Alexander,
for the test I used a simple 2D Case. The interface motion depends on the temperature and the temperature on the other hand, depends on the concentration at the interface. At the interface I have a "specified mass fraction" boundary condition. My udf: #include "udf.h" #include "sg.h" #include "mem.h" #include "stdio.h" #include "stdlib.h" DEFINE_GRID_MOTION(interface, domain, dt, time, dtime) { Thread *tf = DT_THREAD(dt); face_t f; cell_t c; Node *v; int n, temp; int i; real x[ND_ND]; real T = 1000.; SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); begin_f_loop (f, tf) { F_CENTROID(x,f,tf); T = F_T(f,tf); f_node_loop (f, tf, n) { v=F_NODE (f, tf, n); if (NODE_POS_NEED_UPDATE (v)) { real TT = T + T * F_YI(f,tf,0); dispz=(Tm-TT)/1000.0; NODE_X(v)+=dispz; NODE_POS_UPDATED (v); } } } end_f_loop (f, tf) } If I use this udf without F_YI(f,t,0) then it works fine. Thank you und best regards Ana |
|
September 25, 2019, 23:19 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Did you switched on species model?
by the way you had several errors in your code, so I don't know, how it could work Code:
#include "udf.h" #include "sg.h" #include "mem.h" #include "stdio.h" #include "stdlib.h" DEFINE_GRID_MOTION(interface, domain, dt, time, dtime) { Thread *tf = DT_THREAD(dt); face_t f; cell_t c; Node *v; int n, temp; int i; real x[ND_ND]; real T = 1000.; real TT = 0.0; real dispz = 0.0; real Tm; SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); begin_f_loop (f, tf) { F_CENTROID(x,f,tf); T = F_T(f,tf); f_node_loop (f, tf, n) { v=F_NODE (f, tf, n); if (NODE_POS_NEED_UPDATE (v)) { TT = T + T * F_YI(f,tf,0); dispz=(Tm-TT)/1000.0; NODE_X(v)+=dispz; NODE_POS_UPDATED (v); } } } end_f_loop (f, tf) } best regards Last edited by AlexanderZ; September 29, 2019 at 22:46. |
|
September 26, 2019, 02:56 |
|
#5 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
Yes, I switched on the species model, otherwise I couldn't give a mass fraction boundary condition...
The mistakes in the code (e.g. Tm) occurs, because I had to change the code a bit for the forum. I'm not allowed to show the whole code, so it seems that I didn't check the code correctly. But it works fine without F_YI. I know that I have to set "solve/set/expert" to yes, if I want to use the temperature gradient, maybe there is something equivalent for species transfer? best regards |
|
September 26, 2019, 21:05 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
what kind of error do you have?
best regards |
|
September 27, 2019, 06:44 |
|
#7 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
The error is:
Received signal SIGSEGV After that, fluent automatically closes. |
|
September 29, 2019, 22:51 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you've mentioned about temperature gradient
but in your code there is no temperature gradient. all seems to be correct in code above, check parts of code, which you didn't show best regards |
|
October 1, 2019, 05:05 |
|
#9 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
I run the simulation with this simple code, with defined Tm and without any temperature gradient. The simulation works, when I did not use the Macro F_YI (I just changed the line TT = T + T*F_YI(f,t,0) to TT = T + T), but when I use the macro fluent crashes. So it seems to be a problem of this macro... I also tried with C_YI(c,t,0), but the same problem occurs...
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compiling UDF in FLuent | ekha | FLUENT | 6 | July 3, 2019 04:02 |
A Problem of Fluent Interpreted UDF: parse error | knight | Fluent UDF and Scheme Programming | 25 | August 16, 2018 11:26 |
Two questions on Fluent UDF | Steven | Fluent UDF and Scheme Programming | 7 | March 23, 2018 04:22 |
How does FLUENT process an UDF!!!!???? | Bharadwaj B S | Fluent UDF and Scheme Programming | 31 | March 9, 2015 07:32 |
Transport mesh from ICEM CFD, to Fluent, to Sysnoise | Wieland | FLUENT | 2 | April 15, 2012 07:28 |