|
[Sponsors] |
Adding a user-variable field in gas-solid flow case |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 5, 2012, 18:15 |
Adding a user-variable field in gas-solid flow case
|
#1 |
New Member
Amir Hossein Ahmadi Motlagh
Join Date: Jan 2012
Posts: 5
Rep Power: 14 |
I am a beginner in UDF programming and am simulating a 2D gas-solid fluidized bed and want to add an arbitrary user variable (just for test) which holds : rho_g*rho_s. I want to calculate this variable in every cell and show it in post-processing section to view contours. I also want to print it in console. In this way, I have used DEFINE_ON_DEMAND(on_demand_calc) function the following way:
Code:
/********************************************************************** UDF to Print a new user variable Rho_g*Rho_s in a multiphase flow. ***********************************************************************/ #include "udf.h" DEFINE_ON_DEMAND(on_demand_calc) { Thread *thread_g, *thread_s; real rho_g, rho_s; cell_t c; Domain *g; Domain *mix_domain; Domain *s; g= Get_Domain(2);/* gas phase */ s= Get_Domain(3);/* solid phase*/ mix_domain = Get_Domain(1); Thread *mix_thread = Lookup_Thread(mix_domain,1); thread_g = THREAD_SUB_THREAD(mix_thread, 0);/* gas phase */ thread_s = THREAD_SUB_THREAD(mix_thread, 1);/* solid phase*/ /* Loop over all cells */ begin_c_loop(c,mix_thread) { rho_g = C_R(cell, thread_g); rho_s = C_R(cell, thread_s); printf("\n rho_g*rho_s= %g\n",rho_g*rho_s); C_UDMI(c,mix_thread,0) = rho_g*rho_s; } end_c_loop(c,t) } errors when compiling: Code:
..\..\src\rho_gs.c(18) : error C2275: 'Thread' : illegal use of this type as an expression c:\program files\ansys inc\v130\fluent\fluent13.0.0\src\mem.h(744) : see declaration of 'Thread' ..\..\src\rho_gs.c(18) : error C2065: 'mix_thread' : undeclared identifier ..\..\src\rho_gs.c(20) : error C2065: 'mix_thread' : undeclared identifier ..\..\src\rho_gs.c(20) : error C2223: left of '->sub_threads' must point to struct/union ..\..\src\rho_gs.c(21) : error C2065: 'mix_thread' : undeclared identifier ..\..\src\rho_gs.c(21) : error C2223: left of '->sub_threads' must point to struct/union ..\..\src\rho_gs.c(25) : error C2065: 'mix_thread' : undeclared identifier ..\..\src\rho_gs.c(25) : error C2223: left of '->nelements' must point to struct/union ..\..\src\rho_gs.c(27) : error C2065: 'cell' : undeclared identifier ..\..\src\rho_gs.c(28) : error C2065: 'cell' : undeclared identifier ..\..\src\rho_gs.c(30) : error C2065: 'mix_thread' : undeclared identifier ..\..\src\rho_gs.c(30) : error C2223: left of '->storage' must point to struct/union Code:
Error: C:\Users\ahmadimo\Desktop\FV\Ellis\rho_gs.c: line 18: parse error. Error: C:\Users\ahmadimo\Desktop\FV\Ellis\rho_gs.c: line 20: mix_thread: undeclared variable |
|
January 5, 2012, 19:07 |
|
#2 |
Member
Join Date: Nov 2011
Location: Czech Republic
Posts: 97
Rep Power: 15 |
You declared variable cell_t c, but in your code you are using variable called "cell" (in C_R method). So that is error reported by my compiler (GCC). In addition, variables s and g are not used (that is just two warnings).
|
|
January 5, 2012, 19:13 |
|
#3 | |
New Member
Amir Hossein Ahmadi Motlagh
Join Date: Jan 2012
Posts: 5
Rep Power: 14 |
Quote:
Code:
Thread *mix_thread = Lookup_Thread(mix_domain,1); Thanks Amir |
||
June 1, 2013, 17:33 |
|
#4 |
Member
Shashank
Join Date: Apr 2011
Posts: 74
Rep Power: 15 |
Amir, did you solve it eventually? If yes, then how? I would appreciate the help.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Yplus [y+] value for gas solid two phase flow | P.R.Naren | Main CFD Forum | 0 | September 5, 2006 03:04 |
External flow field. | Moon | FLUENT | 3 | March 5, 2003 11:32 |
Gas pressure question | Dan Moskal | Main CFD Forum | 0 | October 24, 2002 23:02 |
Inviscid Drag at subsonic, subcritical Mach # | Axel Rohde | Main CFD Forum | 1 | November 19, 2001 13:19 |
fluid flow fundas | ram | Main CFD Forum | 5 | June 17, 2000 22:31 |