Debian Codegraph @

NASA_CEA_Fortran/misc/oldnew.f

raw
1 PROGRAM OLDNEW
2 C Program converts a file of multiple old form NASA coefficients
3 C to new file of multiple new form NASA coefficients. All gases
4 C are converted to a two-range version of new form (numint=2)
5 C with 1000 as the common temperature (Tcom). Condensed species
6 C in sequence produce a series (phase=1,2,3..) of new form
7 C coefficients in order of increasing temperature.
8 C
9 C The output goes to a file organized as:
10 C Rec 1
11 C col 1-16 name
12 C col 17-24 blank
13 C col 25-80 comments (not available from old form)
14 C Rec 2
15 C col 1 blank
16 C col 2 number of temperature intervals (numint)
17 C col 3 blank
18 C col 4-7 (code)
19 C col 8-9 (date)
20 C col 10 blank
21 C col 11-50 formula ( 5(A2,F6.2) )
22 C (el1,n1,el2,n2,el3,n3,el4,n4,el5,n5)
23 C col 51 blank
24 C col 52 (phase) See below for code.
25 C col 53-65 molecular weight (molwgt).
26 C col 66-80 heat of formation in J/mol (htform)
27 C Rec 3
28 C col 1 blank
29 C col 2-11 low temp of first interval (Tlow)
30 C col 12-21 high temp of first interval (Tcom)
31 C col 22 blank
32 C col 23 Number of Coefficients for Cp
33 C col 24-63 T exponents (ex = 0,1,2,3,4,5,0,0)
34 C col 66-80 H-HO at 298.15 J/mole (rh)
35 C (not available on old form)
36 C Rec 4
37 C col 1-80 first 5 coefficients
38 C (alow, blow, clow, dlow, elow)
39 C Rec 5
40 C col 1-48 last 3 coefficients (xlow, ylow, zlow)
41 C (not available on old form)
42 C col 49-80 Integration constants (flow, glow)
43 C Rec 6
44 C col 1 blank
45 C col 2-11 low temp of second interval (Tcom)
46 C col 12-21 high temp of second interval (Thi)
47 C col 22 blank
48 C col 23 Number of Coefficients for Cp
49 C col 24-63 T exponents (ex = 0,1,2,3,4,5,0,0)
50 C col 66-80 H-HO at 298.15 J/mole (rh)
51 C (not available on old form)
52 C Rec 7
53 C col 1-80 first 5 coefficients
54 C (ahi, bhi, chi, dhi, ehi)
55 C Rec 8
56 C col 1-48 last 3 coefficients (xhi, yhi, zhi)
57 C (not available on old form)
58 C col 49-80 Integration constants (fhi, ghi)
59 C
60 C Data from records beyond 8 are not used in the old form.
61 C
62 C The input comes from a file organized as:
63 C Rec 1
64 C col 1-16 (name)
65 C col 17-18 blank
66 C col 19-22 (code)
67 C col 23-24 (date)
68 C col 25-44 formula ( 4(A2,F3.0) )
69 C (el1,n1,el2,n2,el3,n3,el4,n4)
70 C col 45 (phase) See code below.
71 C col 46-55 low temp of low range (Tlow)
72 C col 56-65 high temp of high range (Thi)
73 C col 66-78 molecular weight (molwgt)
74 C col 79 blank
75 C col 80 blank (might hold integer '1')
76 C Rec 2
77 C col 1-15 coefficient (ahi)
78 C col 16-30 coefficient (bhi)
79 C col 31-45 coefficient (chi)
80 C col 45-60 coefficient (dhi)
81 C col 61-75 coefficient (ehi)
82 C col 76-79 blank
83 C col 80 blank (might hold integer '2')
84 C Rec 3
85 C col 1-15 coefficient (fhi)
86 C col 16-30 coefficient (ghi)
87 C col 31-45 coefficient (alow)
88 C col 46-60 coefficient (blow)
89 C col 61-75 coefficient (clow)
90 C col 76-79 blank
91 C col 80 blank (might hold integer '3')
92 C Rec 4
93 C col 1-15 coefficient (dlow)
94 C col 16-30 coefficient (elow)
95 C col 31-45 coefficient (flow)
96 C col 46-60 coefficient (glow)
97 C col 61-75 heat of formation/R in K (htform)
98 C col 76-79 blank
99 C col 80 blank (might hold integer '4')
100
101 character*1 phase, phaseo
102 character*2 date,el1,el2,el3,el4,el5
103 character*2 el1sav,el2sav,el3sav,el4sav
104 character*4 code
105 character*18 name
106 integer numint
107 real n1,n2,n3,n4,n5
108 real n1sav,n2sav,n3sav,n4sav,ex(8)
109 real*8 molwgt,htform,Tlow,Tcom,Thi, Tprvhi
110 real*8 alow,blow,clow,dlow,elow,flow,glow,xlow
111 real*8 ahi,bhi,chi,dhi,ehi,fhi,ghi,xhi
112 data ex/0,1,2,3,4,5,0,0/
113
114 C****************************************************************
115 C Input data from four old form records.
116
117 5 read(5,50,end=100) name,code,date,el1,n1,el2,n2,el3,n3,el4,n4,
118 + phase,Tlow,Thi,molwgt
119 50 format( A18,A4,A2,4(A2,F3.0),A1,2F10.3,F13.5,1X,1X)
120 C Note: An isotope code might be in col 17-18 of old form.
121 C This item is not used in new form so it is overlooked.
122
123 read(5,60) ahi,bhi,chi,dhi,ehi
124 60 format( 5(E15.8),4X,1X )
125
126 read(5,60) fhi,ghi,alow,blow,clow
127 read(5,60) dlow,elow,flow,glow,htform
128
129 C*****************************************************************
130 C In the new form, the phase is coded 0 => gas (G)
131 C 1 => lowest T condensed phase
132 C 2 => next T condensed phase
133 C 3 => next T condensed phase
134 C etc.
135 C In the old form, the phase is coded G => gas
136 C C => condensed
137 C The following transforms this code
138 if (phase .eq. 'G') then
139 phase = '0'
140 else
141 if ( el1 .EQ. el1sav .AND.
142 + el2 .EQ. el2sav .AND.
143 + el3 .EQ. el3sav .AND.
144 + el4 .EQ. el4sav .AND.
145 + n1 .EQ. n1sav .AND.
146 + n2 .EQ. n2sav .AND.
147 + n3 .EQ. n3sav .AND.
148 + n4 .EQ. n4sav .AND.
149 + Tlow .EQ. Tprvhi ) then
150 if (phaseo .EQ. '6') stop
151 if (phaseo .EQ. '5') phase = '6'
152 if (phaseo .EQ. '4') phase = '5'
153 if (phaseo .EQ. '3') phase = '4'
154 if (phaseo .EQ. '2') phase = '3'
155 if (phaseo .EQ. '1') phase = '2'
156 else
157 phase = '1'
158 endif
159 C Save formula, phase, and Thi for next cycle
160 el1sav = el1
161 el2sav = el2
162 el3sav = el3
163 el4sav = el4
164 n1sav = n1
165 n2sav = n2
166 n3sav = n3
167 n4sav = n4
168 phaseo = phase
169 Tprvhi = Thi
170 endif
171 C***** end of phase conversion **********************************
172
173 if (Thi .LE. 1000) then
174 numint = 1
175 Tcom = Thi
176 endif
177 if (Tlow .GE. 1000) then
178 numint = 1
179 Tcom = Thi
180 alow = ahi
181 blow = bhi
182 clow = chi
183 dlow = dhi
184 elow = ehi
185 flow = fhi
186 glow = ghi
187 endif
188 if ((Tlow .LT. 1000) .AND. (Thi .GT. 1000)) then
189 numint = 2
190 Tcom = 1000
191 endif
192
193 C The values of xlow and xhi never appear in the old form.
194 C They are here set to zero for the new form.
195 xlow = 0.0
196 xhi = 0.0
197
198 C The values of el5 and n5 do not appear in the old form.
199 C They are set to blank and zero for the new form.
200 el5 = ' '
201 n5 = 0
202
203 C Output data to eight (or five) new form records.
204
205 write(6,10) name
206 10 format( A18)
207 htform = htform * 8.31451d0
208
209 write(6,20) numint,code,date,el1,n1,el2,n2,el3,n3,el4,n4,el5,n5,
210 + phase,molwgt,htform
211 20 format( 1X, I1,1X,A4,A2,1X,5(A2,F6.2 ),1X,A1,F13.5,f15.3 )
212
213 write(6,30) Tlow,Tcom,ex,alow,blow,clow,dlow,elow,flow,glow
214 30 format( 1X,2F10.3,' 5',8f5.1,1p/5d16.8/48x,2d16.8)
215
216 if (numint .EQ. 2) then
217 write(6,30) Tcom,Thi,ex,ahi,bhi,chi,dhi,ehi,fhi,ghi
218 endif
219
220 goto 5
221
222 100 stop
223 end