-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bmain.f95
409 lines (379 loc) · 11.1 KB
/
Bmain.f95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
! A fortran95 program for G95
! By WQY
MODULE UTILITARIOS_FLOAT
INTERFACE DIRAPL
MODULE PROCEDURE DIRACOI
MODULE PROCEDURE DIRACOF
END INTERFACE DIRAPL
CONTAINS
SUBROUTINE DIRACOF(NWF,IO,DATA,LENGTH,INDEX)
!
!DIRECT ACCESS TO FILE NWF
!IO = 1/2 WRITE/READ OPTION
!DATA()= MEMORY AREA TO BE WRITTEN OR READ
!LENGTH= AMOUNT OF SINGLE-WORD DATA TO BE TRANSFERRED
!INDEX = START INDEX OF THE !ORRESPONDING AREA ON NWF
!
!USE STANDARD FORTRAN VII STATEMENT WRITE AND READ(NWF,REC=N)
!RECORD LENGTH 128 WORDS (512 BYTES)
!
INTEGER,INTENT(IN) :: NWF
INTEGER,INTENT(IN) :: IO
REAL,DIMENSION(:),INTENT(INOUT) :: DATA
INTEGER,INTENT(IN) :: LENGTH
INTEGER,INTENT(INOUT) :: INDEX
LOGICAL SWPLUS
REAL RECORD(128)
!
DATA LREC / 128 /
WRITE(*,*) SIZE(DATA)
!
SWPLUS=.FALSE.
! GO TO 10
! ======================================
! ENTRY DIRAPL(NWF,IO,DATA,LENGTH,INDEX)
! ======================================
SWPLUS=.TRUE.
! ----------------------- INITIATE
10 NREC =INDEX/LREC
N =INDEX-LREC*NREC
NREC =NREC+1
LMIN =1
LMAX =LREC-N
IOUSED=IOUSED+LENGTH
! GO TO 100
GO TO (40,100),IO
!
!WRITE. (READ FIRST /LAST RECORD) ------------------- WRITE(IO=1)
!
40 IF(N.EQ.0) GO TO 50
LMAX =MIN0(LMAX,LENGTH)
GO TO 60
!!
50 IF(LMAX.LE.LENGTH) GO TO 70
LMAX =LENGTH
60 READ(NWF,REC=NREC,ERR=70) RECORD
!
70 DO 80 L=LMIN,LMAX
N =N+1
80 RECORD(N)=DATA(L)
!---------------------------
WRITE(NWF,REC=NREC) RECORD
!---------------------------
IF(LMAX.EQ.LENGTH) GO TO 140
N =0
NREC =NREC+1
LMIN =LMAX+1
LMAX =LMAX+LREC
GO TO 50
!
!READ-------------------- READ (IO=2)
!
100 LMAX =MIN0(LMAX,LENGTH)
!--------------------------
110 READ(NWF,REC=NREC) RECORD
!--------------------------
DO 120 L=LMIN,LMAX
N =N+1
120 DATA(L)=RECORD(N)
!
IF(LMAX.EQ.LENGTH) GO TO 140
N =0
NREC =NREC+1
LMIN =LMAX+1
LMAX =MIN0(LMAX+LREC,LENGTH)
GO TO 110
!
140 IF(SWPLUS) INDEX=INDEX+LENGTH
RETURN
END SUBROUTINE DIRACOF
SUBROUTINE DIRACOI(NWF,IO,DATA,LENGTH,INDEX)
!
!DIRECT ACCESS TO FILE NWF
!IO = 1/2 WRITE/READ OPTION
!DATA()= MEMORY AREA TO BE WRITTEN OR READ
!LENGTH= AMOUNT OF SINGLE-WORD DATA TO BE TRANSFERRED
!INDEX = START INDEX OF THE !ORRESPONDING AREA ON NWF
!
!USE STANDARD FORTRAN VII STATEMENT WRITE AND READ(NWF,REC=N)
!RECORD LENGTH 128 WORDS (512 BYTES)
!
INTEGER,INTENT(IN) :: NWF
INTEGER,INTENT(IN) :: IO
INTEGER,DIMENSION(:),INTENT(INOUT) :: DATA
INTEGER,INTENT(IN) :: LENGTH
INTEGER,INTENT(INOUT) :: INDEX
LOGICAL SWPLUS
INTEGER RECORD(128)
!
DATA LREC / 128 /
!
SWPLUS=.FALSE.
! GO TO 10
! ======================================
! ENTRY DIRAPL(NWF,IO,DATA,LENGTH,INDEX)
! ======================================
SWPLUS=.TRUE.
! ----------------------- INITIATE
10 NREC =INDEX/LREC
N =INDEX-LREC*NREC
NREC =NREC+1
LMIN =1
LMAX =LREC-N
IOUSED=IOUSED+LENGTH
GO TO 100
! GO TO (40,100),IO
!
!WRITE. (READ FIRST /LAST RECORD) ------------------- WRITE(IO=1)
!
! 40 IF(N.EQ.0) GO TO 50
! LMAX =MIN0(LMAX,LENGTH)
! GO TO 60
!!
! 50 IF(LMAX.LE.LENGTH) GO TO 70
! LMAX =LENGTH
! 60 READ(NWF,REC=NREC,ERR=70) RECORD
!!
! 70 DO 80 L=LMIN,LMAX
! N =N+1
! 80 RECORD(N)=DATA(L)
!!---------------------------
! WRITE(NWF,REC=NREC) RECORD
!!---------------------------
! IF(LMAX.EQ.LENGTH) GO TO 140
! N =0
! NREC =NREC+1
! LMIN =LMAX+1
! LMAX =LMAX+LREC
! GO TO 50
!
!READ-------------------- READ (IO=2)
!
100 LMAX =MIN0(LMAX,LENGTH)
!--------------------------
110 READ(NWF,REC=NREC) RECORD
!--------------------------
DO 120 L=LMIN,LMAX
N =N+1
120 DATA(L)=RECORD(N)
!
IF(LMAX.EQ.LENGTH) GO TO 140
N =0
NREC =NREC+1
LMIN =LMAX+1
LMAX =MIN0(LMAX+LREC,LENGTH)
GO TO 110
!
140 IF(SWPLUS) INDEX=INDEX+LENGTH
RETURN
END SUBROUTINE DIRACOI
END MODULE UTILITARIOS_FLOAT
program xsu_read2
USE UTILITARIOS_FLOAT
integer,dimension(1) :: NEUTIP,NTHIPO,NOGBIB,MATMAX,NCHANEL,NAXIAL,NDEPEN
real,dimension(1):: TIMERST
integer,dimension(1):: ISWREC,ISWCLFD
integer,dimension(8) :: DATXX
integer,allocatable :: INDTYP(:),NEUTYP(:),NTHYP(:),NCLVAR(:),NCTYPE(:),IADOTH(:),NFLOTH(:),IADIN(:),NFLIN(:),IADPOT(:),NFLPOT(:),IADBPI(:),NFLBPI(:),IADTFL(:),NFLTFL(:),IADTCL(:),NFLTCL(:),IADDCL(:),NFLDCL(:)
real,allocatable :: ZONDAT(:,:),OTHER(:),XIN(:),POTDEN(:),BPINT(:),TFUEL(:),TCOOL(:),DCOOL(:)
real,allocatable :: XSS(:,:),BETA(:,:),BU(:)
! real :: XSS(49,55),BETA(49,7),BU(49)
real,allocatable :: VM(:)
integer,dimension(1) :: IADXSO
integer,dimension(1) :: NFLXSO
integer,dimension(1) :: SWHEXA,SWFLAT
integer :: INDICE,I,J,TABLA,ATT
integer :: karg = 1
character(len=32) :: InputXSU
logical :: REFERENCIA = .TRUE.
CALL GETARG(1,InputXSU)
open(unit = 92,access = 'direct', recl = 512 ,file = InputXSU)
INDICE = 0
CALL DIRAPL(92,2,NEUTIP,1,INDICE)
CALL DIRAPL(92,2,NTHIPO,1,INDICE)
CALL DIRAPL(92,2,NOGBIB,1,INDICE)
CALL DIRAPL(92,2,MATMAX,1,INDICE)
CALL DIRAPL(92,2,NCHANEL,1,INDICE)
CALL DIRAPL(92,2,NAXIAL,1,INDICE)
CALL DIRAPL(92,2,NDEPEN,1,INDICE)
CALL DIRAPL(92,2,TIMERST,1,INDICE)
CALL DIRAPL(92,2,ISWREC,1,INDICE)
CALL DIRAPL(92,2,ISWCLFD,1,INDICE)
CALL DIRAPL(92,2,SWHEXA,1,INDICE)
CALL DIRAPL(92,2,SWFLAT,1,INDICE)
CALL DIRAPL(92,2,DATXX,8,INDICE)
ALLOCATE ( INDTYP(NEUTIP(1)))
ALLOCATE ( NEUTYP(MATMAX(1)))
ALLOCATE ( NTHYP(MATMAX(1)))
ALLOCATE ( NCTYPE(MATMAX(1)))
ALLOCATE ( NCLVAR(NDEPEN(1)))
ALLOCATE ( ZONDAT(MATMAX(1),(NDEPEN(1))))
ALLOCATE (VM(1))
CALL DIRAPL(92,2,INDTYP,NEUTIP(1),INDICE)
CALL DIRAPL(92,2,NEUTYP,MATMAX(1),INDICE)
CALL DIRAPL(92,2,NTHYP,MATMAX(1),INDICE)
CALL DIRAPL(92,2,NCTYPE,MATMAX(1),INDICE)
WRITE(*,*) 'NEUTYP',NEUTYP
DO I= 1,(NDEPEN(1))
CALL DIRAPL(92,2,ZONDAT(:,I),MATMAX(1),INDICE)
ENDDO
ALLOCATE ( OTHER(100) )
ALLOCATE ( IADOTH(100) )
ALLOCATE ( NFLOTH(100) )
! ATRIBUTO 1
ALLOCATE ( XIN(100) )
ALLOCATE ( IADIN(100) )
ALLOCATE ( NFLIN(100) )
ALLOCATE ( POTDEN(100) )
ALLOCATE ( IADPOT(100) )
ALLOCATE ( NFLPOT(100) )
ALLOCATE ( BPINT(100) )
ALLOCATE ( IADBPI(100) )
ALLOCATE ( NFLBPI(100) )
! ATRIBUTO 2
ALLOCATE ( TFUEL(100) )
ALLOCATE ( IADTFL(100) )
ALLOCATE ( NFLTFL(100) )
! ATRIBUTO 3
ALLOCATE ( TCOOL(100) )
ALLOCATE ( IADTCL(100) )
ALLOCATE ( NFLTCL(100) )
! ATRIBUTO 4
ALLOCATE ( DCOOL(100) )
ALLOCATE ( IADDCL(100) )
ALLOCATE ( NFLDCL(100) )
! DO TABLA = 1,NEUTIP(1)
TABLA = 2
IF (TABLA .GT. 14) GOTO 170
! TABLA = 1
PRINT*, TABLA,INDTYP(TABLA)
INDICE = INDTYP(TABLA)
CALL DIRAPL(92,2,VM,1,INDICE)
CALL DIRAPL(92,2,NCLVAR,NDEPEN(1),INDICE)
CALL DIRAPL(92,2,IADXSO,1,INDICE)
CALL DIRAPL(92,2,NFLXSO,1,INDICE)
CALL DIRAPL(92,2,OTHER,100,INDICE)
CALL DIRAPL(92,2,IADOTH,100,INDICE)
CALL DIRAPL(92,2,NFLOTH,100,INDICE)
CALL DIRAPL(92,2,XIN,100,INDICE)
CALL DIRAPL(92,2,IADIN,100,INDICE)
CALL DIRAPL(92,2,NFLIN,100,INDICE)
CALL DIRAPL(92,2,POTDEN,100,INDICE)
CALL DIRAPL(92,2,IADPOT,100,INDICE)
CALL DIRAPL(92,2,NFLPOT,100,INDICE)
CALL DIRAPL(92,2,BPINT,100,INDICE)
CALL DIRAPL(92,2,IADBPI,100,INDICE)
CALL DIRAPL(92,2,NFLBPI,100,INDICE)
!se guarda la raíz de la temperatura
CALL DIRAPL(92,2,TFUEL,100,INDICE)
CALL DIRAPL(92,2,IADTFL,100,INDICE)
CALL DIRAPL(92,2,NFLTFL,100,INDICE)
CALL DIRAPL(92,2,TCOOL,100,INDICE)
CALL DIRAPL(92,2,IADTCL,100,INDICE)
CALL DIRAPL(92,2,NFLTCL,100,INDICE)
CALL DIRAPL(92,2,DCOOL,100,INDICE)
CALL DIRAPL(92,2,IADDCL,100,INDICE)
CALL DIRAPL(92,2,NFLDCL,100,INDICE)
ALLOCATE(XSS (NFLXSO(1),(6+NOGBIB(1))*NOGBIB(1)))
ALLOCATE(BU (NFLXSO(1)))
ALLOCATE(BETA(NFLXSO(1),7))
WRITE(*,*) 'IADXSO',IADXSO
WRITE(*,*) TABLA,'XIN'
ATT = 2
DO NCVAR = 1,NCLVAR(ATT)
CALL BETAMAP(TRIM(InputXSU),TABLA,ATT,NCVAR,NFLIN(NCVAR),BETA)
INDICE = IADIN(NCVAR)
CALL DIRAPL(92,2,BU,NFLIN(NCVAR),INDICE)
WRITE(*,*) 'IADIN',IADIN(NCVAR)
DO IQ = 1,NFLIN(NCVAR)
CALL DIRAPL(92,2,XSS(IQ,:),(6+NOGBIB(1))*NOGBIB(1),INDICE)
WRITE(*,*) BETA(IQ,:)
WRITE(*,*) XSS(IQ,:)
XSS(IQ,NOGBIB(1)+1:2*NOGBIB(1)) = (1-BETA(IQ,7))*XSS(IQ,NOGBIB(1)+1:2*NOGBIB(1))
WRITE(*,*) BETA(IQ,:)
WRITE(*,*) XSS(IQ,:)
END DO
INDICE = IADIN(NCVAR)
CALL DIRAPL(92,2,BU,NFLIN(NCVAR),INDICE)
DO IQ = 1,NFLIN(NCVAR)
CALL DIRAPL(92,1,XSS(IQ,:),(6+NOGBIB(1))*NOGBIB(1),INDICE)
END DO
ENDDO
WRITE(*,*) TABLA,'FUEL TEMP'
ATT = 5
DO NCVAR = 1,NCLVAR(ATT)
IF (IADTFL(NCVAR).EQ.IADXSO(1)) CONTINUE
CALL BETAMAP(TRIM(InputXSU),TABLA,ATT,NCVAR,NFLTFL(NCVAR),BETA)
INDICE = IADTFL(NCVAR)
CALL DIRAPL(92,2,BU,NFLTFL(NCVAR),INDICE)
WRITE(*,*) 'QUEMADO',BU
DO IQ = 1,NFLTFL(NCVAR)
CALL DIRAPL(92,2,XSS(IQ,:),(6+NOGBIB(1))*NOGBIB(1),INDICE)
WRITE(*,*) BETA(IQ,:)
WRITE(*,*) XSS(IQ,:)
XSS(IQ,NOGBIB(1)+1:2*NOGBIB(1)) = (1-BETA(IQ,7))*XSS(IQ,NOGBIB(1)+1:2*NOGBIB(1))
WRITE(*,*) BETA(IQ,:)
WRITE(*,*) XSS(IQ,:)
ENDDO
INDICE = IADTFL(NCVAR)
CALL DIRAPL(92,2,BU,NFLTFL(NCVAR),INDICE)
DO IQ = 1,NFLTFL(NCVAR)
CALL DIRAPL(92,1,XSS(I,:),(6+NOGBIB(1))*NOGBIB(1),INDICE)
END DO
ENDDO
WRITE(*,*) TABLA,'COOL TEMP'
ATT = 6
DO NCVAR = 1,NCLVAR(ATT)
IF (IADTCL(NCVAR).EQ.IADXSO(1)) CONTINUE
CALL BETAMAP(TRIM(InputXSU),TABLA,ATT,NCVAR,NFLTCL(NCVAR),BETA)
INDICE = IADTCL(NCVAR)
CALL DIRAPL(92,2,BU,NFLTCL(NCVAR),INDICE)
WRITE(*,*) 'QUEMADO',BU
DO IQ = 1,NFLTCL(NCVAR)
CALL DIRAPL(92,2,XSS(I,:),(6+NOGBIB(1))*NOGBIB(1),INDICE)
WRITE(*,*) BETA(IQ,:)
WRITE(*,*) XSS(IQ,:)
XSS(IQ,NOGBIB(1)+1:2*NOGBIB(1)) = (1-BETA(IQ,7))*XSS(IQ,NOGBIB(1)+1:2*NOGBIB(1))
WRITE(*,*) BETA(IQ,:)
WRITE(*,*) XSS(IQ,:)
END DO
INDICE = IADTCL(NCVAR)
CALL DIRAPL(92,2,BU,NFLTCL(NCVAR),INDICE)
DO IQ = 1,NFLTCL(NCVAR)
CALL DIRAPL(92,1,XSS(I,:),(6+NOGBIB(1))*NOGBIB(1),INDICE)
END DO
ENDDO
WRITE(*,*) TABLA,'COOL DENS'
ATT = 7
DO NCVAR = 1,NCLVAR(ATT)
IF (IADDCL(NCVAR) .EQ. IADXSO(1)) CONTINUE
CALL BETAMAP(TRIM(InputXSU),TABLA,ATT,NCVAR,NFLDCL(NCVAR),BETA)
INDICE = IADDCL(NCVAR)
CALL DIRAPL(92,2,BU,NFLDCL(NCVAR),INDICE)
WRITE(*,*) 'QUEMADO',BU
DO IQ = 1,NFLDCL(NCVAR)
CALL DIRAPL(92,2,XSS(I,:),(6+NOGBIB(1))*NOGBIB(1),INDICE)
WRITE(*,*) BETA(IQ,:)
WRITE(*,*) XSS(IQ,:)
XSS(IQ,NOGBIB(1)+1:2*NOGBIB(1)) = (1-BETA(IQ,7))*XSS(IQ,NOGBIB(1)+1:2*NOGBIB(1))
WRITE(*,*) BETA(IQ,:)
WRITE(*,*) XSS(IQ,:)
ENDDO
INDICE = IADDCL(NCVAR)
CALL DIRAPL(92,2,BU,NFLDCL(NCVAR),INDICE)
DO IQ = 1,NFLDCL(NCVAR)
CALL DIRAPL(92,1,XSS(I,:),(6+NOGBIB(1))*NOGBIB(1),INDICE)
END DO
ENDDO
DEALLOCATE(XSS)
DEALLOCATE(BU)
DEALLOCATE(BETA)
170 CONTINUE
CLOSE(92)
DEALLOCATE (INDTYP)
DEALLOCATE (NEUTYP)
DEALLOCATE (NTHYP)
DEALLOCATE (ZONDAT)
DEALLOCATE (NCLVAR)
DEALLOCATE (VM)
end program xsu_read2