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

UDF - Read from files

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 13, 2010, 07:35
Default UDF - Read from files
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello world.

Does anybody know if reading from files is possible from within FLUENT?
I have data in OpenOffice Calc format (spreadsheet).

Can I access this data directly or do I have to go through some kind of conversion (to CSV or similar)?

sega
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   March 15, 2010, 07:40
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
If you convert to some data type you can just use fopen, incombination with fscanf or something, you can read the data from this file. Good luck.
Bernhard is offline   Reply With Quote

Old   March 17, 2010, 11:05
Default
  #3
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 19
DoHander is on a distinguished road
Save your data as csv or as a tab delimited ASCII file and you can read the data in Fluent using an UDF (basic C syntax: fopen,fscanf and fclose).

Do
DoHander is offline   Reply With Quote

Old   March 18, 2010, 04:06
Default
  #4
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Thanks. I will give it a try.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   March 31, 2010, 06:50
Default
  #5
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello World.

I'm getting back to this. There are some questions surfacing.

fscanf() looks like the right approach when dealing with data in which every line looks the same.

My data is somehow "blocked".
One "set" contains 8 lines, each with different entries and lengths.

Exactly like this:
Code:
#1;FeS[s];#;#;#;#;#; ===>;Fe[s];0.5 S2[g];#;#;#;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
minflag;0;-1;-1;-1;-1;-1; ===>;0;0;-1;-1;-1;-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FACTSAGE[g]-no;1,00E+000;-1,00E+000;-1,00E+000;-1,00E+000;-1,00E+000;-1,00E+000; ===>;6,35E-001;3,65E-001;-1,00E+000;-1,00E+000;-1,00E+000;-1,00E+000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
stoich;1,000E+00;0,000E+00;0,000E+00;0,000E+00;0,000E+00;0,000E+00; ===>;1,000E+00;5,000E-01;0,000E+00;0,000E+00;0,000E+00;0,000E+00;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"on>=1;off=0";#;order;pol_type;C1;P1;C2;P2;C3;P3;C4;P4;C5;P5;C6;P6;C7;P7;C8;P8;C9;P9;C10;P10;A;T_min[grd.C];T_max[grd.C];pO_min;pO_max;dt_min;dt_max;Medium-0,1,2,3;DiamMIN[Micron];DiamMAX[micron];BetaT0[K/s];PO20[1bar];T0[K];Source;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0;R1;1,0;1;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,600E-04;1,000E+00;5,982E+02;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;0,000E+00;250,0;1100,0;0,000E+00;2,000E-01;1,000E+01;1,000E+02;3;0,000E+00;3,000E+02;1,000E+00;1,000E+00;1,000E+00;Bozic2003;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1;Fn;1,0;1;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,861E-04;1,000E+00;6,539E+02;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;1,000E+00;0,000E+00;0,000E+00;250,0;1100,0;0,000E+00;2,000E-01;1,000E+01;1,000E+02;3;0,000E+00;3,000E+02;1,000E+00;1,000E+00;1,000E+00;Bozic2003;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Looks like a big mess, huh?

I think I can't use the fscanf because each line is formatted differently.

What I need more is a procedure to go from one delimeter ( ; ) to the next and read the contents in between for individual lines (not for the whole file at first).

Any ideas?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   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
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
case files UDF volumetric reaction rate Marie-Anne Main CFD Forum 2 February 24, 2006 09:43
How to read .stl files with gambit 2.0 ? Lio FLUENT 6 July 1, 2004 07:39
UDF to read and write data Mcgregor FLUENT 4 June 9, 2003 13:21
Merging .msh files in TGrid Raza Mirza FLUENT 2 January 18, 2001 18:09


All times are GMT -4. The time now is 01:43.