CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Help: UDF problem--How to add bodyfore to the DPM (https://www.cfd-online.com/Forums/fluent/31975-help-udf-problem-how-add-bodyfore-dpm.html)

KE August 13, 2003 15:10

Help: UDF problem--How to add bodyfore to the DPM
 
My model is to build a ultrafine particle injection to laminar flow with the electric field fore. (2D, Steady,DPM). When I want to add the constant electric field as body fore using UDF, I met a compile error and following is my code:

#include "udf.h"

#define ELECTRIC_FORCE=1.0045

DEFINE_DPM_BODY_FORCE(particle_body_electric, p, i) {

real bforce;

if(i==0)

{

bforce=0;

}

else

{

bforce=-ELECTRIC_FORCE; /* electric force Y */

}

return bforce; } I noticed that I didn't use p as a parameter in the micro definition. But I don't know what's wrong with these seemingly simple lines.

I need your help!

Sincerely

Chen Fangzhi August 17, 2003 08:46

Re: Help: UDF problem--How to add bodyfore to the
 
I think the error is due to the define declaration It should be:

#define ELECTRIC_FORCE 1.005

KE August 17, 2003 14:08

Re: Help: UDF problem--How to add bodyfore to the
 
Thank u for your advice. I've already corrected it. But I still have some problems with UDF-sometimes it can compile the file I difined, sometimes it didn't. It's the exact same file. I really don't know what's wrong with the fluent compiler. Usually it needs several times to get it complied and connected to the iretation.

Good luck to U!

Chen Fangzhi August 18, 2003 08:02

Re: Help: UDF problem--How to add bodyfore to the
 
I don't know the detail of your udf, but if you want to use some advanced features of UDF, you'd better to use compiled rather than interpreted.


All times are GMT -4. The time now is 18:39.