CFD Online Logo CFD Online URL
Home > Forums > FLUENT

Access violation error pointer to a file

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

LinkBack Thread Tools Display Modes
Old   February 8, 2011, 11:18
Default Access violation error pointer to a file
New Member
Join Date: Sep 2009
Location: UK
Posts: 19
Rep Power: 8
salihovic is on a distinguished road

Here is my UDF:

#include "udf.h"
#include "random.h"

DEFINE_CG_MOTION(airfoil, dt, vel, omega, time, dtime)

FILE *pf;

real plungeampl, pitchampl, w, pi;

pi = 3.14159265;

/* define motion variables */
plungeampl = 0*0.000254; /* 1-inch plunge amplitude */
pitchampl = 1 * pi / 180; /* 45-degree pitch amplitude */
w = 2 * pi * 25; /* 25 Hz frequency */

/* define airfoil motion */
vel[1] = w * plungeampl * cos(w * time); /* y-component of velocity */
omega[2] = w * pitchampl * rand()/RAND_MAX;/* z-component of angular velocity */
Message("time=%f omega=%f\n",time,omega[2]*180.0/3.1415926) ;

if(NULL == (pf = fopen("bubu.txt","a")))
Error("Could not open file for append!\n");


My problem is:

When I remove the pointer to the file pf and only use Message it works fine. But I want to store the values on the screen to a file. When I use the above UDF, I got Access violation error.

Any suggestions?

Thanks in advance,
salihovic is offline   Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ libraries and solver compiling vaina74 OpenFOAM Installation 13 February 3, 2012 18:43
tecio compilation errors in latest 1.6.x rsamuel OpenFOAM Bugs 1 December 22, 2009 04:34
ParaView 33 canbt open OpenFoam file hariya03 OpenFOAM Paraview & paraFoam 7 September 25, 2008 17:33
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00
PHI file structure Eugene Phoenics 9 November 2, 2001 23:00

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