CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

Access Density

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

LinkBack Thread Tools Search this Thread Display Modes
Old   September 30, 2005, 12:37
Default Access Density
Allan Walsh
Posts: n/a
I'm trying to use a UDF for a custom reaction rate in Fluent 6.2 under Windows.

I tried the sample version from the manual which wouldn't work - the old ACCESS VIOLATION.... error.

After several rounds of debugging, I found that it crashed when it tried to access the variable for the gas density C_R(c,t). The UDF could access C_T(c,t) or C_P(c,t) for the cell temperature or cell pressure with no problem. (I've included a few lines of code from my crude debugging at the end of this message). If I gave it a gas density, it worked fine. (For the gas material property, in density the ideal gas law was specified).

And, if I included other UDFs in the libudf.dll, such as one to calculate particles, it could access C_R(c,t) in other UDFs with no problems.

I submitted this through Fluent's web help portal but did not get very far - they were waiting for me to send them the code.

Anyone have any ideas what I'm doing wrong?

DEFINE_VR_RATE(cvol_reac_rate,c,t,r,wk,yk,rate,rr_ t) { real ci, prod; int i;

/* Calculate Arrhenius reaction rate */

prod = 1.;

CX_Message("temp: %f\n", C_T(c,t));

CX_Message("dens: %f\n", C_R(c,t));

for(i = 0; i < r->n_reactants; i++)


//CX_Message("mw %f ri %10.6g\n", wk[r->reactant[i]],yk[r->reactant[i]]);

ci = 0.22 * yk[r->reactant[i]] / wk[r->reactant[i]];

//ci = C_R(c,t) * yk[r->reactant[i]] / wk[r->reactant[i]];

//CX_Message("cr %f ci %10.6g\n", C_R(c,t),ci);

prod *= pow(ci, r->exp_reactant[i]);

} *rate = r->A * exp( - r->E / (UNIVERSAL_GAS_CONSTANT * C_T(c,t))) *

pow(C_T(c,t), r->b) * prod;

*rr_t = *rate;

/* No "return..;" value. */ }
  Reply With Quote

Old   October 2, 2005, 05:31
Default Re: Access Density
Posts: n/a
I have tried the VR_RATE macro in fluent 6.1 under windows and it worked well. What models do have activated? I used it together with species transport (finite rate/eddy dissipation), standard k-e, dpm, p1-radiation and incompressible ideal gas law for the mixture. Do you you need compressibility effects? If not try incompressible ideal gas law. If everything failes you can still calculate the cell density from the mixture molecular weight (through yk and wk) and C_T and C_P.

Good Luck

  Reply With Quote

Old   October 3, 2005, 18:43
Default Re: Access Density
Allan Walsh
Posts: n/a
Thanks for the comments. Yes, I should have mentioned I was actually using incompressible ideal gas law. I checked other laws which still crashed when trying to access density.

The density is available in the VR_RATE UDF for other models I've developed. I'm still concerned about compatibility issues between V6.1 and 6.2 other than the obvious problem of V6.2 UDF's needing the lib name as well as udf name. Compatibility problem's I've encountered include pathline display crashes if boundaries are described by udf's and reaction mechanism is not copied for all volumes when doing a read-bc. Didn't have these problems in V6.1. Unfortuately, they all give the same generic ACCESS_VIOLATION... error.

Oh well, Fluent support is now working on my access density problem.
  Reply With Quote

Old   October 4, 2005, 07:55
Default Re: Access Density
Posts: n/a
I tried your udf on my system, no crashes. It sounds strange that you encounter so much problems. I use lots of udf and had no problems with the update from 6.1 to 6.2 . Did you update your INCLUDE system var? Maybe the compiler still uses the old header files.


  Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
A problem about density in liquid air definition alloveyou CFX 2 June 14, 2012 14:20
Variable Density Function ryzd FLUENT 1 August 25, 2011 14:16
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23
Warning 097- AB Siemens 6 November 15, 2004 04:41
variable density water Atit Koonsrisuk CFX 2 July 24, 2003 03:07

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