CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF - Read from files (https://www.cfd-online.com/Forums/fluent-udf/73645-udf-read-files.html)

sega March 13, 2010 07:35

UDF - Read from files
 
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

Bernhard March 15, 2010 07:40

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.

DoHander March 17, 2010 11:05

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

sega March 18, 2010 04:06

Thanks. I will give it a try.

sega March 31, 2010 06:50

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?


All times are GMT -4. The time now is 02:59.