CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF fatal error (

Srivatsan V. Rajagopalan September 19, 2005 14:56

UDF fatal error
Hello all!

I work with gas particle two phase supersonic flow in nozzle. I wrote a UDF to change the drag coefficient correlation that fluent uses to calculate the drag force on the particles. I could successfully interpret it in Fluent solver, but when I hook it in to Fluent, I get following error. ************************************************** ********** 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: () ************************************************** ********** Can someone pls tell me what is the reason for this error?

This is the udf I have written.... ************************************************** ********** #include "udf.h" #include "mem.h" #define vis 1.663e-05 #define R 296.8 #define g 1.398 DEFINE_DPM_DRAG(test,Re,p) { //Variable Definitions// real a, b, d, mp, rhop, tp, dp, vp, u, v, w, cd, fd; //Defining particle variables real tg; real vg; cell_t c; Thread *t; dp = P_DIAM(p); tp = P_T(p); rhop = P_RHO(p); tg = C_T(c,t); u = C_U(c,t); v = C_V(c,t); w = C_W(c,t); vg = sqrt(u*u+v*v+w*w); vp = sqrt(pow(P_VEL(p)[0],2)+pow(P_VEL(p)[1],2)+pow(P_VEL(p)[2],2)); mp = (vg-vp)/sqrt(g*R*tg); a = (4.33+((3.65-1.53*(tp/tg))/(1+0.353*(tp/tg)))); b = 0.247*sqrt(2/g)*(Re/mp); d = (4.5+0.38*(0.03*Re+0.48*sqrt(Re))/(1+0.03*Re+0.48*sqrt(Re))); //Main Formula Calculation// cd = (24/(Re+sqrt(g/2)*mp*a*exp(-b)))+exp(-0.5*mp/sqrt(Re))*d+0.1*pow(mp,2)+0.2*pow(mp,8)+0.6*sqrt(g/2)*mp*(1-exp(-mp/Re)); fd = (18*vis*cd*Re)/(rhop*dp*dp*24); return(fd); } ************************************************** **********

Podila September 19, 2005 15:29

Re: UDF fatal error
Return Kgl and not Fd. Read manual carefully. In order to customise the drag force u have to return the momentum transfer term and not fd. The UDF u have coded is not appropriate as far as my understanding says..let me now if u have difficulty in understanding this concept.

The drag coefficient is easy to customise and in our lab my fellow colleages* and myself have worked with it. I am sorry we cannot share the codes as they are confidential till we publish them.

But as I said the u have to return Kgl and work the units carefully.

* Names cannot be disclosed due to lack of consent and confidentiality reasons.

Alec Eiffel September 19, 2005 15:40

Re: UDF fatal error
Try compiling the UDF rather than interpreting. Due to the limitations of interpreting there is a lot of problems using DPM macros and trying to interpret them

pUl| October 2, 2005 16:45

Re: UDF fatal error
I think the return function is correct in your case. Since you are using the DPM approach, you are expected to return 'fd' as clearly stated in:

As Alec has suggested, try compiling the UDF instead of interpreting it.

Srivatsan V. R. October 2, 2005 18:06

Re: UDF fatal error
Yeah! Infact! It worked well when I compiled the code...It was does it make difference?

pUl| October 2, 2005 18:23

Re: UDF fatal error
A very quick answer to that would be the following excerpt from the Fluent manual:

"... DEFINE_DPM_DRAG is called at every particle time step in FLUENT, and requires a significant amount of CPU time to execute. For this reason, the UDF should be executed as a compiled UDF..."

This is again clearly stated here:

A UDF example that uses the DEFINE_DPM_DRAG macro to computing particle drag coefficient using the curve as suggested by R. Clift, J. R. Grace and M.E. Weber "Bubbles, Drops, and Particles" (1978) is also given in the same page.

Really, answers to most general questions are provided in the manual. Fluent is rapidly improving.

Srivatsan V. R. October 3, 2005 12:43

Re: UDF fatal error
Yeah I saw the same thing in Manual. But I encountered an error saying "UNDECLARED VARIABLE: P_CELL: LINE 15"...It is something like a syntax error or otehr minor error. But when the same code, when compiled gave a clean chit to my UDF....Anyways I am happy now...

All times are GMT -4. The time now is 05:15.