Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29254 Discussions

Can someone help me with reading a FORTRAN input file?

daemon_dkm
Beginner
381 Views
I'm trying to write a program that will read an input file, but it is set up in an odd way. I only need the numbers but I'm not sure how to avoid the words. Also, the thrust curve is segmented and I am unsure how to make it read each segment.

Any help would be appreciated.

Estes C6-3 Specifications
diameter 0.018 meters
length 0.070 meters
initial_mass 0.0241 kg
final_mass 0.0094 kg
max_liftoff_mass 0.1132 kg
measured_delay 2.47 s
total_impulse 8.82 N s
thrust_ranges 5
time s thrust N
5
0.000 0.000
0.031 0.946
0.092 4.826
0.139 9.936
0.192 14.090
4
0.192 14.090
0.209 11.446
0.231 7.381
0.248 6.151
4
0.248 6.151
0.292 5.489
0.370 4.921
0.475 4.448
12
0.475 4.448
0.671 4.258
0.702 4.542
0.723 4.164
0.850 4.448
1.063 4.353
1.211 4.353
1.242 4.069
1.303 4.258
1.468 4.353
1.656 4.448
1.821 4.448
4
1.821 4.448
1.834 2.933
1.847 1.325
1.860 0.000
0 Kudos
1 Reply
TimP
Honored Contributor III
381 Views
Quoting - daemon_dkm
I'm trying to write a program that will read an input file, but it is set up in an odd way. I only need the numbers but I'm not sure how to avoid the words. Also, the thrust curve is segmented and I am unsure how to make it read each segment.

Any help would be appreciated.

Estes C6-3 Specifications
diameter 0.018 meters
length 0.070 meters
initial_mass 0.0241 kg
final_mass 0.0094 kg
max_liftoff_mass 0.1132 kg
measured_delay 2.47 s
total_impulse 8.82 N s
thrust_ranges 5
time s thrust N
5
0.000 0.000
0.031 0.946
0.092 4.826
0.139 9.936
0.192 14.090
4
0.192 14.090
0.209 11.446
0.231 7.381
0.248 6.151
4
0.248 6.151
0.292 5.489
0.370 4.921
0.475 4.448
12
0.475 4.448
0.671 4.258
0.702 4.542
0.723 4.164
0.850 4.448
1.063 4.353
1.211 4.353
1.242 4.069
1.303 4.258
1.468 4.353
1.656 4.448
1.821 4.448
4
1.821 4.448
1.834 2.933
1.847 1.325
1.860 0.000
It looks as if it may have been written by a Fortran program, in which case the source code for that would give you a good start. It also looks that there is at most 1 character string preceding any numerical value, and you could likely read those lines by list direction into a character string, a real, and a character string. After that, you can read the integer by list direction, which tells you how many lines with pairs of reals to read before expecting the next integer.
0 Kudos
Reply