CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   error message about using DEFINE_SOURCE (https://www.cfd-online.com/Forums/fluent/33354-error-message-about-using-define_source.html)

emma March 30, 2004 10:09

error message about using DEFINE_SOURCE
 
Hi, there,

I wrote one UDF using the macro DEFINE_SOURCE, the return data type is real as in fluent documentation. But when I initialized the solution, I got the following error message:

chip-exec: SW_Kompressibel: 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: ()

Note: SW_Kompressibel is the function name.

I would be greatly appreciated for any suggestions or comments.

Regards,

Emma

ap March 31, 2004 14:24

Re: error message about using DEFINE_SOURCE
 
It seems you're returning a value in a function which doesn't want anything in return.

Can you post the source code?

Hi :)

ap

emma April 1, 2004 07:04

Re: error message about using DEFINE_SOURCE
 
Hi,

I'd like to post my source code. Any suggestions?

Regards

Emma ------------------------------------ #include "udf.h" #include "sg_mphase.h"

DEFINE_SOURCE(SW_Kompressibel, c, thread, dS, eqn) {

real alpha;

real druck;

real vapor_vol;

real liquid_vol;

real source = 0.;

real C = 0.99499;

druck = C_P(c,thread);

alpha=(1.0-C)/8000000.0*druck+C;

if (alpha>=1.0)

{

alpha = 1.0;

}

if (alpha<=0.0)

{

alpha = 0.0;

}

C_VOF(c, thread) = alpha;

liquid_vol = C_VOF(c, thread);

vapor_vol = 1 - C_VOF(c, thread);

source = vapor_vol;

return source;

}


thomas April 1, 2004 08:07

Re: error message about using DEFINE_SOURCE
 
Where did you hook your source term ?

ap April 1, 2004 14:20

Re: error message about using DEFINE_SOURCE
 
The code is ok. Probably you're hooking it in the wrong place.

Hi :)

ap

emma April 2, 2004 04:18

Re: error message about using DEFINE_SOURCE
 
Hi, ap and thomas,

Thank you both for the quick reply! I want to get the vapor volume fraction in my model through UDF. I defined it as UDS by clicking define-> user-defined->scalars,gave "1" to the number of USD, and keeping the default setting of flux funfction and unsteady function. Then in the velocity inlet panel, I chose "specified value" for the UDS boundary condition, and "udf SW_Kompressibrel" for UDS boundary value.

Any comment or suggestion is greatly welcome.

Regards,

Emma


All times are GMT -4. The time now is 22:32.