CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Help with UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 30, 2012, 18:02
Default Help with UDF
  #1
Member
 
Abhijeet Shrawage
Join Date: Feb 2012
Posts: 31
Rep Power: 14
ashrawage is on a distinguished road
Hello everyone,
i have compiled the following UDF for density, thermal conductivity and viscosity.
But i am getting the access violation error.
Now I know what it is but i am not sure how to best deal with it.

the UDF for density is given below as an example. It compiled without a hitch. but the minute i initialize i get that error. Do you guys see any flaws or can give any tips regarding this issue??

Sincere thanks

#include "udf.h"

/* Date: 11/15/2012
Density of supercritcal water at pressure line of 24MPa*/

DEFINE_PROPERTY(density, c, t)
{
real rho;
int i;
int N1 = 8;
real aa[8]={9.057256850332234e+011, -1.004223127586313e+010, 4.771729301474036e+007,
-1.259615031360143e+005, 1.994987699191794e+002, -0.189575891223812,
1.000789828768001e-004, -2.264203358260640e-008};
int N3 = 8;
real cc[8]={1.213009600498309e+010, -1.184275708420463e+008, 4.952997273974567e+005,
-1.150308037299205e+003, 1.602192564936295, -0.001338350280787,
6.208057950195209e-007, -1.233583438752835e-10};

real Temp = C_T(c, t);

/* Inorder to prevent the solution to collapse in case the temperature of the system goes below the ranges provided
the following steps were taken to limit the values to a constant quantity*/

if ( Temp < 618.0)
rho = 640.0;
else if (Temp > 773.0)
rho = 84.0;

/* curve fits are put together below */
/* ********************************************* */
if (Temp >= 618.0 && Temp <= 650.0)
{
rho = aa[7];
for ( i=N1-2; i >=0; i--)
rho = rho*Temp + aa[i];
}
else if ( Temp > 650.0 && Temp <= 654.0 )
rho = (-5.3517 * Temp + 6949.9 )* Temp -2.2559e+006;
else if ( Temp > 654.0 && Temp <= 773.0 )
{
rho = cc[7];
for ( i=N3-2; i >=0; i--)
rho = rho*Temp + cc[i];
}

/* return density calculated by the curve fits */
return rho;

}

ashrawage is offline   Reply With Quote

Reply


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
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 07:12
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 22:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 17:55.