CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

UDF for body force in DPM

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   March 16, 2011, 06:05
Default
  #21
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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
elah599 is offline   Reply With Quote

Old   March 16, 2011, 10:04
Default
  #22
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
I proposed you to check the UDF for a simple case(validate it). I didn't check it's accuracy before.

Last edited by Amir; March 16, 2011 at 16:05.
Amir is offline   Reply With Quote

Old   April 30, 2011, 07:02
Default
  #23
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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?
elah599 is offline   Reply With Quote

Old   April 30, 2011, 15:20
Default
  #24
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
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
Amir is offline   Reply With Quote

Old   May 1, 2011, 10:18
Default
  #25
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
hi amir
I did it, but it doesn't work!again I got this error.
elah599 is offline   Reply With Quote

Old   May 2, 2011, 07:25
Default
  #26
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
Hi,
in addition to above settings, try this code:
Quote:
# 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;
if (CURRENT_TIME>1.5*CURRENT_TIMESTEP)
{
bforce= (1.5e-20)*((C_U(c,t)-C_U_M1(c,t))/CURRENT_TIMESTEP-(P_VEL(p)[0]-p->user[0])/CURRENT_TIMESTEP);
}
else
{
bforce=0.0;
}
p->user[0]=P_VEL(p)[0];
n+=1;
return bforce;
}
Amir is offline   Reply With Quote

Old   May 2, 2011, 08:39
Default
  #27
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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.
elah599 is offline   Reply With Quote

Old   May 2, 2011, 15:54
Default
  #28
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
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.
Amir is offline   Reply With Quote

Old   May 14, 2011, 10:11
Default
  #29
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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?
elah599 is offline   Reply With Quote

Old   May 15, 2011, 02:32
Default
  #30
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
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
Amir is offline   Reply With Quote

Old   August 7, 2011, 06:17
Default
  #31
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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);

}
elah599 is offline   Reply With Quote

Old   August 7, 2011, 06:57
Default
  #32
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
Hi,
you were trying to set real value to string one!
try this:
Code:
#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*log(Re)+1.1722/sqrt(Re)+(-0.1389)/Re+1.7637*exp(-Nu);

drag_force=exp(W);

return (drag_force);

}
__________________
Amir
Amir is offline   Reply With Quote

Old   August 14, 2011, 02:17
Default
  #33
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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
elah599 is offline   Reply With Quote

Old   August 14, 2011, 03:26
Default
  #34
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
Quote:
Originally Posted by elah599 View Post
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
No, your algorithm is not right; in your previous post, I just corrected your bad assignment but I didn't notice to other parts.(maybe that's my fault)
Anyway, you have used some unreferenced parameters such as:
Code:
face_t face;
cell_t cell;
Thread *c_thread;
Thread *f_thread;
you have to express how these parameters related to particle pointer (p). Also it's not obvious that why did you use face values instead of cell values?
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) 
c_thread=P_CELL_THREAD(p)

Bests,
__________________
Amir
Amir is offline   Reply With Quote

Old   August 16, 2011, 10:22
Default
  #35
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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
elah599 is offline   Reply With Quote

Old   August 16, 2011, 11:37
Default
  #36
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
Quote:
Originally Posted by elah599 View Post
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?
I recommend you not to use mixture model for your case; it's more than that you really need
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:
Originally Posted by elah599 View Post
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
Look, when you view a particle path in fluent, it's not related to just 1 particle, it assumes that some other particles follow the 1st one but it doesn't have any effect on solver; i.e., you are seeing a chain of particles which pass the same path. Consequently, the computational number of particles are the number of paths, but the number of real particles are (paths*No per path). This parameter is not used in path finding but it is used for fining particle concentration. You have to set it from your physical model.
__________________
Amir
Amir is offline   Reply With Quote

Old   August 21, 2011, 05:31
Default
  #37
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
[QUOTE=Amir;320324]I recommend you not to use mixture model for your case; it's more than that you really need
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
elah599 is offline   Reply With Quote

Old   August 21, 2011, 05:34
Default
  #38
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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.
elah599 is offline   Reply With Quote

Old   August 21, 2011, 09:35
Default
  #39
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Amir is on a distinguished road
Quote:
Originally Posted by elah599 View Post
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
Dear Iman,
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!
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:
Originally Posted by elah599 View Post
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.
You can find particle flow rate form your realistic case; e.g., you may know inlet particle flux or ..... Note that in some lagrangian models, the flow rate which you determined is considered as whole flow rate but in some other considered for each trajectory; I say again that this data won't affect particle trajectories.

Bests,
__________________
Amir
Amir is offline   Reply With Quote

Old   August 23, 2011, 06:21
Default
  #40
Member
 
iman vasefi
Join Date: Aug 2010
Posts: 39
Rep Power: 7
elah599 is on a distinguished road
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
elah599 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF for defining a body force in Singel ROtating Reference Frame teymourj FLUENT 2 July 28, 2011 17:45
UDF force on a face enry Fluent UDF and Scheme Programming 10 March 23, 2011 11: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 22:10


All times are GMT -4. The time now is 21:36.