|
[Sponsors] |
July 10, 2009, 09:07 |
UDF Getting data from file
|
#1 |
New Member
Jordi
Join Date: Jul 2009
Posts: 3
Rep Power: 17 |
Hi everybody!!
I am trying to get some data from an input file to use it as an Energy source. When interpreting the udf appears this message: Error: FLUENT received fatal signal (ACCESS_VIOLATION) The error comes when trying to close the file, or to scan the file to get the data. If I comment the lines "fscanf" and "fclose" no error message appears. Maybe the error is caused by a wrong oppening of the file. Here is the code: ************************** #include "udf.h" DEFINE_SOURCE(source,c,t) { real xc[ND_ND]; real q; FILE *fp; float data[108]; int i; i=0; fp = fopen("out.txt","r"); while (i<108){ fscanf(fp,"%f",&data[i]); i++; } fclose(fp); C_CENTROID(xc,c,t); if (xc[0]>0.5) q=10000; else q=0; return q; } ************************** Can anyone help me please?? |
|
Tags |
file, source, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
I/O of a real value by "DEFINE_RW_FILE" (UDF) | Pietro Asinari | Fluent UDF and Scheme Programming | 1 | August 15, 2015 20:08 |
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh | gschaider | OpenFOAM Community Contributions | 300 | October 29, 2014 19:00 |
Regarding FoamX running Kindly help out | hariya03 | OpenFOAM Pre-Processing | 0 | April 18, 2008 05:26 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |
how to handel transient data with less file space | steven | CFX | 2 | October 27, 2006 18:01 |