I am trying to write a program that would simply read a table defining a dependency of a coefficient on temperature (table of 2 columns, 27 lines) and that would use the data in an equation. The rest of the variables defined in the subroutine are provided by a FEM program (t(1) and timinc).
My program seems to loop through the whole table, but I have a suspicion that it reads the last row of the table 27 times. Please can someone explain to me the problem?
subroutine mycode(eqcpnc,t,timinc)
#ifdef _IMPLICITNONE
implicit none
#else
implicit logical (a-z)
#endif
real*8 a, dtdl, eqcpnc, t, timinc
integer iostat, ios, n
dimension t(1), dtdl(1)
c
open (1, file='Coefficient.txt', iostat=ios)
n=0
do
read(1, *, iostat=ios) dtdl(1), a
if (ios/=0) exit
n=n+1
enddo
rewind(1, iostat=ios)
c
eqcpnc=t(1)*a**timinc
c
close(1)
return
end
The original table 'Coefficient.txt' looks like this:
27.85 5.22E-19
77.85 1.47E-18
127.85 4.17E-18
177.85 1.19E-17
227.85 3.44E-17
277.85 1.02E-16
327.85 3.23E-16
377.85 1.12E-15
427.85 4.50E-15
477.85 2.23E-14
527.85 1.42E-13
577.85 1.16E-12
627.85 1.20E-11
677.85 1.44E-10
727.85 1.69E-09
777.85 1.85E-08
827.85 2.31E-07
877.85 5.69E-07
927.85 1.34E-06
977.85 3.04E-06
1027.85 6.64E-06
1077.85 1.40E-05
1127.85 2.84E-05
1177.85 5.61E-05
1227.85 1.08E-04
1277.85 2.01E-04
1327.85 3.65E-04