CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

A question about DEFINE_DMP_BODY_FORCE !

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 25, 2006, 04:08
Default A question about DEFINE_DMP_BODY_FORCE !
  #1
zhaoh
Guest
 
Posts: n/a
Hi I have a question about DEFINE_DMP_BODY_FORCE want to consult you! The force is fx=2.2x+1.5y; fy=0. It just a body force about two-dimensional space direction. I am trying to write a UDF to include the body force. But it has some problems always. Could you check this UDF for me please? Does it need loop micros in computation according to different position of particles?

#include "udf.h" # include "dpm.h" #define C1 2.2 #define C2 1.5 DEFINE_DPM_BODY_FORCE(p_b_force, p, i) { Thread *t; real xc[ND_ND]; real x,y; real bforce; cell_t c; if(i==1) bforce=0; else if(i==0) C_CENTROID(xc, c, t); x=xc[0]; y=xc[1]; bforce=C1*x+C2*y; return (bforce/P_MASS(p)); }

If I compute the program, there'll be a window to appear go with the information. Updating solution at time level N... done. chip-exec: p_b_force: wrong return type: void udf function expected 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: () Please tell me how to solve this problem. Thanks a lot! My email address is xiaozhaozai@163.com.

  Reply With Quote

Old   December 25, 2006, 10:34
Default Re: A question about DEFINE_DMP_BODY_FORCE !
  #2
Sujith
Guest
 
Posts: n/a
There were some coding errors. Apart from that , you havent provided the cell c and cell thread t for the macro C_CENTROID(xc, c, t);

You have provide the cell and cell thread in which the particle is currently in.

----------------

#include "udf.h" # include "dpm.h" #define C1 2.2 #define C2 1.5 DEFINE_DPM_BODY_FORCE(p_b_force, p, i) {

real xc[ND_ND]; real x,y; real bforce;

cell_t c = RP_CELL(&(p->cCell)); Thread *t = RP_THREAD(&(p->cCell));

if(i==1) bforce=0; else if(i==0) { C_CENTROID(xc, c, t); x=xc[0]; y=xc[1]; bforce=C1*x+C2*y; }

return (bforce/P_MASS(p));

}

/* I havent check the code for any errors*/ ---------

Sujith S Nair
  Reply With Quote

Old   December 25, 2006, 20:59
Default Re: A question about DEFINE_DMP_BODY_FORCE !
  #3
zhaoh
Guest
 
Posts: n/a
Sujith: Thank you very much for response, first. I have been checked the case accorded to your advice, but it also has some problems, such as RP_CELL: undeclared variable and so on. Could you help me solve my problems more clearly? Could you teach me how to compile this UDF? I think I have no idea about it for along time. Thanks again! Expecting for your reply!

#include "udf.h" #include "dpm.h" #include "surf.h" #define C1 2.2 #define C2 1.5 DEFINE_DPM_BODY_FORCE(p_b_force, p, i) { real xc[ND_ND]; real x,y; real bforce; cell_t c = RP_CELL(&(p->cCell)); Thread *t = RP_THREAD(&(p->cCell)); if(i==1) bforce=0; else if(i==0) { C_CENTROID(xc, c, t);

x=xc[0];

y=xc[1];

bforce=C1*x+C2*y; } return (bforce/P_MASS(p)); }

  Reply With Quote

Old   December 26, 2006, 11:48
Default Re: A question about DEFINE_DMP_BODY_FORCE !
  #4
sujith
Guest
 
Posts: n/a
I was able to compile it successfully... Pls make sure u have, the supported compilers n all.

RP_CELL(&(p->cCell)) is used to get the cell in which the particle is in..

You can also use the particles positions directly using the macro P_POS(p)[0],P_POS(p)[1],P_POS(p)[2] for x,y,z coordinates of particle. No need for cell, cell-thread, centroid etc....

  Reply With Quote

Old   January 2, 2007, 08:03
Default Re: A question about DEFINE_DMP_BODY_FORCE !
  #5
HS
Guest
 
Posts: n/a
I would also suggest using the P_POS(p)[i]-commands, but perhaps that's not actually the same thing... I mean, P_POS(p) gives the coordinates for the current particle position, whereas C_CENTROID will return the cell centroid coordinates - i.e. there will be a slight difference depending on exactly where inside the cell the particle is currently positioned. This could perhaps be of either minor or major importance, depending on the mesh and the relative magnitude of the body force to the other forces acting on the particle.

/Henrik
  Reply With Quote

Old   January 2, 2007, 11:30
Default Re: A question about DEFINE_DMP_BODY_FORCE !
  #6
zhaoh
Guest
 
Posts: n/a
SUJITH and HS:

Thank you alot! These day I cannot communicate with you, because the network was cut down by the earthquake.I have been do it according to you advices. My code is:

#include "udf.h" #include "dpm.h" #include "surf.h" #define C1 2.2 #define C2 1.5 DEFINE_DPM_BODY_FORCE(p_b_force,p,i) { cell_t c=RP_CELL(&(p->cCell)); Thread *t = RP_THREAD(&(p->cCell)); Particle *p; real bforce; if(i==1) bforce=0; else if(i==0) { bforce=C1*P_POS(p)[0]+C2*P_POS(p)[1]; } return (bforce/P_MASS(p)); } but it has some problem as follows:

(system "move user_nt.udf libudf\ntx86\2d")0 (system "copy C:\Fluent.Inc\fluent6.1.22\src\makefile_nt.udf libudf\ntx86\2d\makefile") (chdir "libudf")() (chdir "ntx86\2d")() 004.c ..\..\src\004.c(10) : error C2082: redefinition of formal parameter 'p' Done. Opening library "libudf"... Error: open_udf_library: the system can not find the library。 Error Object: ()

what`s wrong with this program? who can tell me? my email address is: zhaohuang-csu@hotmail.com can you leave your email address? We can communicate with each other quickly and conveniently! Thank you!
  Reply With Quote

Old   January 2, 2007, 11:48
Default Re: A question about DEFINE_DMP_BODY_FORCE !
  #7
zhaoh
Guest
 
Posts: n/a
SUJITH and HS:

Thank you alot! These day I cannot communicate with you, because the network was cut down by the earthquake.I have been do it according to you advices. My code is:

#include "udf.h" #include "dpm.h" #include "surf.h" #define C1 2.2 #define C2 1.5 DEFINE_DPM_BODY_FORCE(p_b_force,p,i) { cell_t c=RP_CELL(&(p->cCell)); Thread *t = RP_THREAD(&(p->cCell)); Particle *p; real bforce; if(i==1) bforce=0; else if(i==0) { bforce=C1*P_POS(p)[0]+C2*P_POS(p)[1]; } return (bforce/P_MASS(p)); } but it has some problem as follows:

(system "move user_nt.udf libudf\ntx86\2d")0 (system "copy C:\Fluent.Inc\fluent6.1.22\src\makefile_nt.udf libudf\ntx86\2d\makefile") (chdir "libudf")() (chdir "ntx86\2d")() 004.c ..\..\src\004.c(10) : error C2082: redefinition of formal parameter 'p' Done. Opening library "libudf"... Err
  Reply With Quote

Old   January 2, 2007, 11:48
Default Re: A question about DEFINE_DMP_BODY_FORCE !
  #8
zhaoh
Guest
 
Posts: n/a
SUJITH and HS:

Thank you alot! These day I cannot communicate with you, because the network was cut down by the earthquake.I have been do it according to you advices. My code is:

#include "udf.h" #include "dpm.h" #include "surf.h" #define C1 2.2 #define C2 1.5 DEFINE_DPM_BODY_FORCE(p_b_force,p,i) { cell_t c=RP_CELL(&(p->cCell)); Thread *t = RP_THREAD(&(p->cCell)); Particle *p; real bforce; if(i==1) bforce=0; else if(i==0) { bforce=C1*P_POS(p)[0]+C2*P_POS(p)[1]; } return (bforce/P_MASS(p)); } but it has some problem as follows:

(system "move user_nt.udf libudf\ntx86\2d")0 (system "copy C:\Fluent.Inc\fluent6.1.22\src\makefile_nt.udf libudf\ntx86\2d\makefile") (chdir "libudf")() (chdir "ntx86\2d")() 004.c ..\..\src\004.c(10) : error C2082: redefinition of formal parameter 'p' Done. Opening library "libudf"... Error: open_udf_library: the system can not find the library。 Error Object: ()

what`s wrong with this program? who can tell me? my email address is: zhaohuang-csu@hotmail.com. Can you leave your email address? We can communicate with each other quickly and conveniently by email! Thank you!
  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
Unanswered question niklas OpenFOAM 2 July 31, 2013 16:03
internal field question - PitzDaily Case atareen64 OpenFOAM Running, Solving & CFD 2 January 26, 2011 16:26
Question about Table applicaiton. universez OpenFOAM Running, Solving & CFD 0 January 12, 2010 21:31
CHANNEL FLOW: a question and a request Carlos Main CFD Forum 4 August 23, 2002 05:55
question K.L.Huang CD-adapco 1 March 29, 2000 04:57


All times are GMT -4. The time now is 02:03.