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

Reading table file

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 20, 2002, 14:19
Default Reading table file
  #1
MON
Guest
 
Posts: n/a
Hi Shital

First, i write a program on C++(((EssaiC.cpp))using some standard C-language attributes(fscan...).this program can read the data from table_file to an array called table[i] [j]. this program run and can read the array table[i][j] ********* ********* /********EssaiC.cpp*****/ #include<iostream.h> #include<fstream.h> #include<stdio.h> main(void)

{

int i,j;

float table[10][20];

FILE *fichier;

float temp;

fichier = fopen("Meteo.txt","r");

for (i=0;i<3 ;i++)

{ for (j=0;j<1;j++)

{

fscanf(fichier,"%f", &temp);

table[i][j] =temp;

cout << "\nla valeur de i\t" << i;

cout << "\nle valeur j\t" << j;

cout << "\n\nla valeur de table est:\t" << table[i][j];

}

}

fclose(fichier); return 0;

******* ******* Where Meteo.txt is the data file **** **** **** "Meteo.txt"( array [3,3]) 1 2 3 4 5 6 7 8 9 ***** ***** i complie the EssaiC an i can read the values of the arrayarray [3,3]: ***** ***** I write a UDF (UDf profille)(((EssaiFluent.cpp)))using the same standard C-language attributes as EssaiC.i can compile with success but i can't read the array: ***** ***** Essai Fluent #include"udf.h" DEFINE_PROFILE(PERTE_ATM,thread,position) {

face_t f;

FILE *fichier;

real x[ND_ND];

int i,j;

float table[10][20];

fichier = fopen("Meteo.txt","r");

for (i = 0 ; i<1 ;i++)

{

for (j = 0;j<2;j++)

{

fscanf(fichier,"%f \t",&table[i][j]);

printf("\\n\n %f \n",table[i][j]);

fclose(fichier);

begin_f_loop (f,thread)

{

F_PROFILE (f,thread,position)=100*table[i][j]+table[i+1][j]+;;

}

}

}

end_f_loop(f,thread) }

i compile the UDF witout error but when i will print the value of the array .(look the UDF Define profile)but the UDF (Define profile ) can't read correctly the value from data file(Meteo.txt).

What the error in my own UDF? Thanks in advance.

Ridha
  Reply With Quote

Reply

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
OpenFOAM Install Script ljsh OpenFOAM Installation 82 October 12, 2009 11:47
[OpenFOAM] Paraview command not found hardy ParaView 7 September 18, 2008 04:59
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise mbeaudoin OpenFOAM Installation 20 June 17, 2008 06:43
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 20:51


All times are GMT -4. The time now is 12:33.