UDF for body force in DPM
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? |
first you should specify the cell index that contains particle, then you can use:
du=C_U(c,t)-C_U_M1(c,t) |
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?
|
Quote:
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; |
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:) |
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 |
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; } |
Hi Iman,
I'm not sure that P_VEL_M1(p) exists in dpm.h library! if it exist, that's true else you can implement user scalars for particles. |
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? |
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 |
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 |
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" |
Hi amir,
Thanks for your help, when I interpret your code there is a error: line 5: P_CELL_THREAD: undeclared variable |
Hi Iman,
I checked that as a compiled one, it didn't have any error! compile your UDF instead. |
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? |
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. |
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. |
Hi,
you don't have linked FLUENT with VC++. for more information refer to: http://www.cfd-online.com/Forums/flu...iling-udf.html |
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. |
Quote:
|
hi amir
when I launched fluent from visual studio x64 win64 command prompt (2010) the above problem was solved! thank you for your honesty supporting |
I proposed you to check the UDF for a simple case(validate it). I didn't check it's accuracy before.:)
|
Dear Amir
I compiled this udf without any error. but when I run the program I get this error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: #f do you know what should I do? |
Hi Iman,
before running your problem with this UDF, you have to set the number of user variables in DPM panel. (you have used one user variable) Define->models->DPM->UDF-> set the No. of scalars to 1 |
hi amir
I did it, but it doesn't work!again I got this error. |
Hi,
in addition to above settings, try this code: Quote:
|
hi amir
did you compile this udf?when I build it, it's ok,but when I load this udf I have this error: open_udf_library: The system cannot find the file specified. I tried to consider all above things. |
Hi,
yes of course; I also track particles with it !!! when this error appears, it means that the libudf file is not created, so notice your compiling procedure or check that in different case files. |
hi amir
this udf works for steady particle tracking, but when I want to apply it for unsteady particle tracking, after 2 or 3 iteration,I have this error again.do you know what's wrong? |
Hey Iman,
I've checked that for 10 time step and it worked ! ensure that you've done this: Define->models->DPM->UDF-> set the No. of scalars to 1 |
Dear amir
thanks for your support I am concerned with new case that I need to write a new UDF for Drag force, but I received several errors. Please compile this udf to see what can we do with these errors. I enclosed my udf. thank you so much. #include "udf.h" #define dp 50e-9 #define sigma_square 1.35305239e-19 #define ambpress 101325 #define Boltzmann 1.3806505e-23 #define PI 3.14159265358979323846 #define SQRT_2 1.414213566237309504880 DEFINE_DPM_DRAG(particle_drag_force,Re,p) { real drag_force,MeanFreePath,Nu,W; face_t face; cell_t cell; Thread *c_thread; Thread *f_thread; MeanFreePath=Boltzmann*F_T(face,f_thread)/( sigma_square*(F_P(face,f_thread)+ambpress)* PI*SQRT_2); Nu=MeanFreePath/dp; W=-0.1695-0.3881*(double log (double Re))+1.1722/(double sqrt (double Re))+(-0.1389)/Re+1.7637*(double exp (double (-Nu)); particle_drag_force=(double exp (double W)); return (drag_force); } |
Hi,
you were trying to set real value to string one! try this: Code:
#include "udf.h" |
Hi Amir
I compiled this code, it has no error but it has two warnings: uninitialized local variable 'f_thread' used uninitialized local variable 'face' used but when I want to initialize my case I have ACCESS_VIOLATION error. does it relate to initialize them? thank you for your help |
Quote:
Anyway, you have used some unreferenced parameters such as: Code:
face_t face; If it's true to use cell values physically, first assign cell index and it's thread via these commands (and omit 2 face references): Code:
c=P_CELL(p) Bests, |
Dear Amir
thank you very much for your supporting every time:) I have two questions: 1. have you ever worked with mixture model in fluent. Can I use it for solid-liquid mixture? according to fluent tutorial, I defined a case but my results in heat transfer is overstimate. I guess maybe second phase volume fraction affect results. my total volume fraction is 1%, so, should I insert 0.01 for second phase volume fraction? 2. in DPM model, I don't get the meaning of particle flow rate, in injection tab. when we insert the number of particles, diameter and velocity of particles, what is particle flow rate?I remember one time you told me that it express the different between real particle and computational particle, when we have lots of particles. but I don't know, how compute particle flow rate. sorry for long text:( |
Quote:
Note, this is eulerian multi-phase model used for larger volume fractions. As you know, brownian motion of particles play role of diffusion; so, if you want to use eulerian method instead of lagrangian one, I recommend you to use UDS instead of mixture model which is much more simpler and without restriction of volume fraction! Here, you just need to choose proper diffusion coefficient which obtained from brownian motion concepts. But, before switching to eulerian method, note whether this model is proper for your case or not. Indeed, eulerian method is better for nano particle modelling. Quote:
|
[QUOTE=Amir;320324]I recommend you not to use mixture model for your case; it's more than that you really need:D
Note, this is eulerian multi-phase model used for larger volume fractions. As you know, brownian motion of particles play role of diffusion; so, if you want to use eulerian method instead of lagrangian one, I recommend you to use UDS instead of mixture model which is much more simpler and without restriction of volume fraction! Here, you just need to choose proper diffusion coefficient which obtained from brownian motion concepts. But, before switching to eulerian method, note whether this model is proper for your case or not. Indeed, eulerian method is better for nano particle modelling. Hi Amir this model is part of my project.because low volume fraction, lagrange approach is best for nano particles, but I have to use mixture model for comparison with lagrange model. I read different tutorials and it doesn't seem to be complicated!but my results are over estimate. is there any special point that I should consider?or do you think my flow is granular? Also, I didn't hear anything about UDS model. is it a part of multiphase modeling? thanks alot |
also, I know about real and computational particles in DPM. I want to know how calculate flow rate in injection particle inlet?
thank you very much. |
Quote:
I've done many projects concerning nano particle distribution and confidently say that UDS is the best way of modelling it because it's applicable to both low and high volume fraction; i.e., I don't agree with you that lagrangian approach is the best tool for nano particle cases! :eek: contrarily, it's the worst tool because of its bugs in computing deposition and dispersion! Note that UDS (user defined scalar) is just a scalar conservation equation which can be used to evaluate particle concentration in your case (more info in user manual), so if you want to implement eulerian method as a part of your project, you can also use UDS instead of multiphase models. Quote:
Bests, |
Dear Amir
I read the help of fluent for UDS and unfortunately I didn't get what should I do. do I have to solve the flow for multiphase flow or single phase flow? is just enough to consider coefficient of diffusion in material tab? if you have a simple case file, it would be great if you can send me that until I know what should I do. because I didn't find a proper tutorial for this concept. thanks for your support:) |
All times are GMT -4. The time now is 11:12. |