|
[Sponsors] |
March 5, 2011, 04:16 |
UDF for body force in DPM
|
#1 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
I want to write a udf for body force that included (fluid velocity minus particle velocity) in x direction.[du/dt-dv/dt].
can anybody help me how to write du/dt? |
|
March 5, 2011, 08:15 |
|
#3 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
this formula that you wrote,was just for du/dt? I read in help of fluent that the velocity of particle is shown with P_VEL(P)[i] that p is particle tracked and i represnts the coordinate. can you explain the terms that you wrote for that formula?
|
|
March 5, 2011, 08:29 |
|
#4 |
Senior Member
|
Hi iman,
first I think that you mean acceleration difference?am I right? yes it's for the flow field part: Code:
du/dt=(C_U(c,t)-C_U_M1(c,t))/CURRENT_TIMESTEP; |
|
March 5, 2011, 11:51 |
|
#5 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
Hi Amir
thanks for your answering. yes, I mean relative acceleration between fluid and particle. I know that c_u(c,t) is u(cell,thread). but what is U_M1(c,t)? and I have to duplicate exactly "CURRENT_TIMESTEP" to my udf? I owe you lot!!thank you very much Amir |
|
March 5, 2011, 15:07 |
|
#6 | |
Senior Member
|
Quote:
C_U_M1(c,t) : flow x-velocity in previous one time step CURRENT_TIMESTEP : flow time step, you should use that to make your UDF independent of FLUENT changes in time step. regards, Amir |
||
March 8, 2011, 04:07 |
|
#7 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
Hi amir
what is your comment aboat this udf? # include "udf.h" /* this udf insert a body force on particle in DPM model(A(du/dt-dv/dt)),A is a constant that is known*/ DEFINE_DPM_BODY_FORCE(particle_body_fprce,cell,thr ead,p) { real bforce; bforce= A((((C_U(cell,thread)-C_U_M1(cell,thread))/CURRENT_TIMESTEP)-((P_VEL(P)[0]-P_VEL_M1(P)[0])/CURRENT_TIMESTEP))); return bforce; } |
|
March 9, 2011, 07:00 |
|
#9 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
Hi amir
I implemented the udf and fluent took this error: line 7: non-integer subscript expression: pointer to structure. do you know what that means? |
|
March 9, 2011, 08:00 |
|
#10 |
Senior Member
|
Hi,
it means that something is wrong in variables storage. i.e. you have stored a pointer parameter in a structure kind one. in above UDF, use A*(...) syntax, also check the validity of P_VEL_M1 function. regards, Amir |
|
March 9, 2011, 08:36 |
|
#11 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
my udf:
# include "udf.h" /* this udf insert a body force on particle in DPM model(A(du/dt-dv/dt)),A is a constant that is known*/ DEFINE_DPM_BODY_FORCE(particle_body_fprce,cell,thr ead,p) { real bforce; bforce= (0.000000000000000000015)*((((C_U(cell,thread)-C_U_M1(cell,thread))/CURRENT_TIMESTEP)-((P_VEL(p)[0]-P_VEL_M1(p)[0])/CURRENT_TIMESTEP))); return bforce; } how can I check the validity of P_VEL_M1? regards |
|
March 9, 2011, 11:59 |
|
#12 |
Senior Member
|
you can check the validity a function by viewing it's header in src folder, I checked that and it didn't exist so you should use particle scalar array for your purpose as follow:
first you should specify the No. of scalar array in model->discrete phase->UDF tab->user variables -> increase to 1. use this code. I didn't check that before: Code:
# include "udf.h" int n=0; DEFINE_DPM_BODY_FORCE(particle_body_force,p,i) { Thread *t=P_CELL_THREAD(p); cell_t c=P_CELL(p); real bforce; if(n==0) p->user[0]=0.0; bforce= (1.5e-20)*((C_U(c,t)-C_U_M1(c,t))/CURRENT_TIMESTEP-(P_VEL(p)[0]-p->user[0])/CURRENT_TIMESTEP); p->user[0]=P_VEL(p)[0]; n+=1; return bforce; } |
|
March 12, 2011, 04:31 |
|
#13 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
Hi amir,
Thanks for your help, when I interpret your code there is a error: line 5: P_CELL_THREAD: undeclared variable |
|
March 14, 2011, 09:28 |
|
#15 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
Hi amir
I dont know but something is wrong.I couldent compile that code. I use fluent 12. does it affect? I think there shouldnt be many different between interpret & compile a udf?the version of visual studio is important? |
|
March 14, 2011, 10:40 |
|
#16 |
Senior Member
|
Hi Iman,
you can't interpret this UDF because P_CELL and P_CELL_THREAD need FLUENT solution, so you should compile that. for compiling you need visual C++ 2000 or newer(at least ver 6.) installed on your PC. and ensure that VC++ is linked with FLUENT and your file name doesn't have any space... . I've checked that before as compiled one. if you post the errors during compilation, I may help you. |
|
March 15, 2011, 08:15 |
|
#17 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
hi amir
when I compile udf the fluent gives the following error: (chdir "libudf")() (chdir "win64\2ddp")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. Done. |
|
March 15, 2011, 08:41 |
|
#18 |
Senior Member
|
Hi,
you don't have linked FLUENT with VC++. for more information refer to: http://www.cfd-online.com/Forums/flu...iling-udf.html |
|
March 15, 2011, 14:49 |
|
#19 |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
hi amir
I have run fluent from VC command prompt, but again i recieved these errors,I'm totally confused! (system "copy "C:\PROGRA~1\ANSYSI~1\v120\fluent"\fluent12.0.16\s rc\makefile_nt.udf libudf\win64\2ddp\makefile") 1 file(s) copied. (chdir "libudf")() (chdir "win64\2ddp")() # Generating ud_io1.h vmp.c c:\program files\ansys inc\v120\fluent\fluent12.0.16\src\config.h(110) : error C2143: syntax error : missing '{' before ':' c:\program files\ansys inc\v120\fluent\fluent12.0.16\src\config.h(110) : error C2059: syntax error : ':' C:\PROGRA~1\ANSYSI~1\v120\fluent\fluent12.0.16\cor tex\src\dll.h(64) : error C2061: syntax error : identifier 'CX_DLL_GetProc' C:\PROGRA~1\ANSYSI~1\v120\fluent\fluent12.0.16\cor tex\src\dll.h(64) : error C2059: syntax error : ';' C:\PROGRA~1\ANSYSI~1\v120\fluent\fluent12.0.16\cor tex\src\dll.h(64) : error C2059: syntax error : 'type' ..\..\src\vmp.c(6) : warning C4047: 'initializing' : 'Thread *' differs in levels of indirection from 'int' Done. |
|
March 16, 2011, 04:12 |
|
#20 | |
Member
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 16 |
Quote:
|
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for defining a body force in Singel ROtating Reference Frame | teymourj | Fluent UDF and Scheme Programming | 9 | August 18, 2016 15:33 |
UDF force on a face | enry | Fluent UDF and Scheme Programming | 10 | March 23, 2011 10:48 |
DPM UDF particle position using the macro P_POS(p)[i] | dm2747 | FLUENT | 0 | April 17, 2009 01:29 |
DPM with UDF - Step-by-Step Procedure???? | Prashanth | FLUENT | 3 | April 3, 2009 17:45 |
DPM drag force UDF | hedonists | FLUENT | 0 | March 12, 2003 21:10 |