File indexing completed on 2024-03-02 06:10:08 UTC
view on githubraw file Latest commit 5cf43646 on 2024-03-01 18:50:49 UTC
6d54cf9ca1 Ed H*0001 #include "AUTODIFF_OPTIONS.h"
bead363026 Jean*0002 #ifdef ALLOW_CTRL
0003 # include "CTRL_OPTIONS.h"
0004 #endif
4158fdaabc Patr*0005
50d8204771 Jean*0006
0007
0008
0009
0010
0011
0012
04904a066e Timo*0013
0014
50d8204771 Jean*0015
0016
04904a066e Timo*0017
0018
50d8204771 Jean*0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 SUBROUTINE ACTIVE_READ_3D_RL(
0030 I activeVar_file,
0031 O active_var,
0032 I globalFile,
0033 I useCurrentDir,
0034 I lAdInit,
0035 I iRec,
0036 I myNr,
0037 I theSimulationMode,
0038 I myOptimIter,
0039 I myThid )
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
4158fdaabc Patr*0053
50d8204771 Jean*0054
0055 IMPLICIT NONE
4158fdaabc Patr*0056
50d8204771 Jean*0057
0058 #include "EEPARAMS.h"
0059 #include "SIZE.h"
0060 #include "PARAMS.h"
5cf4364659 Mart*0061 #include "CTRL_SIZE.h"
4d72283393 Mart*0062 #include "CTRL.h"
50d8204771 Jean*0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 CHARACTER*(*) activeVar_file
0078 INTEGER myNr
0079 _RL active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
0080 LOGICAL globalFile
0081 LOGICAL useCurrentDir
0082 LOGICAL lAdInit
0083 INTEGER iRec
0084 INTEGER theSimulationMode
0085 INTEGER myOptimIter
0086 INTEGER myThid
0087
0088
0089 CHARACTER*(2) adpref
de57a2ec4b Mart*0090 CHARACTER*(MAX_LEN_FNAM) adfname
50d8204771 Jean*0091 INTEGER bi,bj
0092 INTEGER i,j,k
32ce3e9e96 Mart*0093 INTEGER jRec
50d8204771 Jean*0094 INTEGER prec
0095 LOGICAL w_globFile
0096 _RS dummyRS(1)
a1572bcee2 Gael*0097 _RL active_data_t(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
50d8204771 Jean*0098
0099
0100
0101 prec = ctrlprec
32ce3e9e96 Mart*0102 jRec = -ABS(iRec)
50d8204771 Jean*0103
0104
0105 IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
0106
0107
0108 CALL MDS_READ_FIELD(
0109 I activeVar_file, prec, useCurrentDir,
0110 I 'RL', myNr, 1, myNr,
0111 O active_var, dummyRS,
0112 I iRec, myThid )
0113
0114 IF ( lAdInit ) THEN
0115
0116
0117
0118 DO bj = myByLo(myThid), myByHi(myThid)
0119 DO bi = myBxLo(myThid), myBxHi(myThid)
0120 DO k = 1, myNr
0121 DO j=1,sNy
0122 DO i=1,sNx
0123 active_data_t(i,j,k,bi,bj) = 0. _d 0
0124 ENDDO
0125 ENDDO
0126 ENDDO
0127 ENDDO
0128 ENDDO
0129
f9d7cbfb72 Ou W*0130 adpref = 'ad'
0131 CALL ADD_PREFIX( adpref, activeVar_file, adfname )
50d8204771 Jean*0132 CALL MDS_WRITE_FIELD(
0133 I adfname, prec, globalFile, useCurrentDir,
a1572bcee2 Gael*0134 I 'RL', Nr, 1, myNr,
50d8204771 Jean*0135 I active_data_t, dummyRS,
0136 I iRec, myOptimIter, myThid )
0137
0138 ENDIF
0139
0140 ENDIF
0141
0142
0143 IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
0144
0145 CALL MDS_READ_FIELD(
0146 I activeVar_file, prec, useCurrentDir,
a1572bcee2 Gael*0147 I 'RL', Nr, 1, myNr,
50d8204771 Jean*0148 O active_data_t, dummyRS,
0149 I iRec, myThid )
0150
0151
0152 DO bj = myByLo(myThid), myByHi(myThid)
0153 DO bi = myBxLo(myThid), myBxHi(myThid)
0154 DO k = 1, myNr
0155 DO j=1,sNy
0156 DO i=1,sNx
0157 active_data_t(i,j,k,bi,bj) = active_data_t(i,j,k,bi,bj)
0158 & + active_var(i,j,k,bi,bj)
0159 ENDDO
0160 ENDDO
0161 ENDDO
0162 ENDDO
0163 ENDDO
0164
0165
0166 w_globFile = .FALSE.
0167 CALL MDS_WRITE_FIELD(
0168 I activeVar_file, prec, w_globFile, useCurrentDir,
a1572bcee2 Gael*0169 I 'RL', Nr, 1, myNr,
50d8204771 Jean*0170 I active_data_t, dummyRS,
32ce3e9e96 Mart*0171 I jRec, myOptimIter, myThid )
50d8204771 Jean*0172
0173
0174 DO bj = myByLo(myThid), myByHi(myThid)
0175 DO bi = myBxLo(myThid), myBxHi(myThid)
0176 DO k = 1, myNr
0177 DO j=1,sNy
0178 DO i=1,sNx
0179 active_var(i,j,k,bi,bj) = 0 _d 0
0180 ENDDO
0181 ENDDO
0182 ENDDO
0183 ENDDO
0184 ENDDO
0185
0186 ENDIF
0187
0188
0189 IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
0190
0191 CALL MDS_READ_FIELD(
0192 I activeVar_file, prec, useCurrentDir,
0193 I 'RL', myNr, 1, myNr,
0194 O active_var, dummyRS,
0195 I iRec, myThid )
0196 ENDIF
0197
0198 RETURN
0199 END
0200
0201
4158fdaabc Patr*0202
50d8204771 Jean*0203
4158fdaabc Patr*0204
50d8204771 Jean*0205 SUBROUTINE ACTIVE_READ_3D_RS(
0206 I activeVar_file,
0207 O active_var,
0208 I globalFile,
0209 I useCurrentDir,
0210 I lAdInit,
0211 I iRec,
0212 I myNr,
0213 I theSimulationMode,
0214 I myOptimIter,
0215 I myThid )
4158fdaabc Patr*0216
0217
50d8204771 Jean*0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
4158fdaabc Patr*0229
0230
0231
50d8204771 Jean*0232 IMPLICIT NONE
4158fdaabc Patr*0233
50d8204771 Jean*0234
4158fdaabc Patr*0235 #include "EEPARAMS.h"
0236 #include "SIZE.h"
0237 #include "PARAMS.h"
5cf4364659 Mart*0238 #include "CTRL_SIZE.h"
4d72283393 Mart*0239 #include "CTRL.h"
4158fdaabc Patr*0240
0241
50d8204771 Jean*0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254 CHARACTER*(*) activeVar_file
0255 INTEGER myNr
0256 _RS active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
0257 LOGICAL globalFile
0258 LOGICAL useCurrentDir
0259 LOGICAL lAdInit
0260 INTEGER iRec
0261 INTEGER theSimulationMode
0262 INTEGER myOptimIter
0263 INTEGER myThid
0264
4158fdaabc Patr*0265
50d8204771 Jean*0266 CHARACTER*(2) adpref
de57a2ec4b Mart*0267 CHARACTER*(MAX_LEN_FNAM) adfname
50d8204771 Jean*0268 INTEGER bi,bj
0269 INTEGER i,j,k
32ce3e9e96 Mart*0270 INTEGER jRec
50d8204771 Jean*0271 INTEGER prec
0272 LOGICAL w_globFile
a1572bcee2 Gael*0273 _RS active_data_t(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
50d8204771 Jean*0274 _RL dummyRL(1)
4158fdaabc Patr*0275
0276
50d8204771 Jean*0277
0278 prec = ctrlprec
32ce3e9e96 Mart*0279 jRec = -ABS(iRec)
4158fdaabc Patr*0280
50d8204771 Jean*0281
0282 IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
0283
0284
0285 CALL MDS_READ_FIELD(
0286 I activeVar_file, prec, useCurrentDir,
0287 I 'RS', myNr, 1, myNr,
0288 O dummyRL, active_var,
0289 I iRec, myThid )
0290
0291 IF ( lAdInit ) THEN
0292
0293
0294
0295 DO bj = myByLo(myThid), myByHi(myThid)
0296 DO bi = myBxLo(myThid), myBxHi(myThid)
0297 DO k = 1, myNr
0298 DO j=1,sNy
0299 DO i=1,sNx
0300 active_data_t(i,j,k,bi,bj) = 0. _d 0
0301 ENDDO
0302 ENDDO
0303 ENDDO
0304 ENDDO
0305 ENDDO
0306
f9d7cbfb72 Ou W*0307 adpref = 'ad'
0308 CALL ADD_PREFIX( adpref, activeVar_file, adfname )
50d8204771 Jean*0309 CALL MDS_WRITE_FIELD(
0310 I adfname, prec, globalFile, useCurrentDir,
a1572bcee2 Gael*0311 I 'RS', Nr, 1, myNr,
50d8204771 Jean*0312 I dummyRL, active_data_t,
0313 I iRec, myOptimIter, myThid )
0314
0315 ENDIF
0316
0317 ENDIF
0318
0319
0320 IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
0321
0322 CALL MDS_READ_FIELD(
0323 I activeVar_file, prec, useCurrentDir,
a1572bcee2 Gael*0324 I 'RS', Nr, 1, myNr,
50d8204771 Jean*0325 O dummyRL, active_data_t,
0326 I iRec, myThid )
0327
0328
0329 DO bj = myByLo(myThid), myByHi(myThid)
0330 DO bi = myBxLo(myThid), myBxHi(myThid)
0331 DO k = 1, myNr
0332 DO j=1,sNy
0333 DO i=1,sNx
0334 active_data_t(i,j,k,bi,bj) = active_data_t(i,j,k,bi,bj)
0335 & + active_var(i,j,k,bi,bj)
0336 ENDDO
0337 ENDDO
0338 ENDDO
0339 ENDDO
0340 ENDDO
0341
0342
0343 w_globFile = .FALSE.
0344 CALL MDS_WRITE_FIELD(
0345 I activeVar_file, prec, w_globFile, useCurrentDir,
a1572bcee2 Gael*0346 I 'RS', Nr, 1, myNr,
50d8204771 Jean*0347 I dummyRL, active_data_t,
32ce3e9e96 Mart*0348 I jRec, myOptimIter, myThid )
50d8204771 Jean*0349
0350
0351 DO bj = myByLo(myThid), myByHi(myThid)
0352 DO bi = myBxLo(myThid), myBxHi(myThid)
0353 DO k = 1, myNr
0354 DO j=1,sNy
0355 DO i=1,sNx
0356 active_var(i,j,k,bi,bj) = 0 _d 0
0357 ENDDO
0358 ENDDO
0359 ENDDO
0360 ENDDO
0361 ENDDO
0362
0363 ENDIF
0364
0365
0366 IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
0367
0368 CALL MDS_READ_FIELD(
0369 I activeVar_file, prec, useCurrentDir,
0370 I 'RS', myNr, 1, myNr,
0371 O dummyRL, active_var,
0372 I iRec, myThid )
0373 ENDIF
0374
0375 RETURN
0376 END
0377
0378
0379
04904a066e Timo*0380
0381
0382 SUBROUTINE ACTIVE_READ_1D_RL(
0383 I activeVar_file,
0384 O active_var,
0385 I active_var_length,
0386 I lAdInit,
0387 I iRec,
0388 I theSimulationMode,
0389 I myOptimIter,
0390 I myThid )
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407 IMPLICIT NONE
0408
0409
0410 #include "EEPARAMS.h"
0411 #include "SIZE.h"
0412 #include "PARAMS.h"
5cf4364659 Mart*0413 #include "CTRL_SIZE.h"
4d72283393 Mart*0414 #include "CTRL.h"
04904a066e Timo*0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427 CHARACTER*(*) activeVar_file
0428 _RL active_var(*)
0429 INTEGER active_var_length
0430 LOGICAL lAdInit
0431 INTEGER iRec
0432 INTEGER theSimulationMode
0433 INTEGER myOptimIter
0434 INTEGER myThid
0435
0436
0437 INTEGER ILNBLNK
0438 EXTERNAL ILNBLNK
0439
0440
0441 CHARACTER*(2) adpref
de57a2ec4b Mart*0442 CHARACTER*(MAX_LEN_FNAM) adfname
04904a066e Timo*0443 INTEGER i, bi, bj
32ce3e9e96 Mart*0444 INTEGER jRec
04904a066e Timo*0445 INTEGER prec
0446 INTEGER il
0447 INTEGER ioUnit
0448 _RS dummyRS(1)
0449 _RL active_data_t(active_var_length)
0450
0451
0452
0453 prec = ctrlprec
32ce3e9e96 Mart*0454 jRec = -ABS(iRec)
04904a066e Timo*0455
0456
0457 bi=0
0458 bj=0
0459
0460
0461 ioUnit = 0
0462
0463
0464 IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
0465
0466
0467 CALL MDS_READVEC_LOC(
0468 I activeVar_file, prec, ioUnit,
0469 I 'RL', active_var_length,
0470 O active_var, dummyRS,
0471 I bi, bj,
0472 I iRec, myThid )
0473
0474 IF ( lAdInit ) THEN
0475
0476
0477
0478 DO i = 1, active_var_length
0479 active_data_t(i) = 0. _d 0
0480 ENDDO
f9d7cbfb72 Ou W*0481
0482 adpref = 'ad'
0483 il = ILNBLNK( activeVar_file )
0484 WRITE(adfname,'(2A)') adpref, activeVar_file(1:il)
04904a066e Timo*0485 IF ( myProcId.EQ.0 ) THEN
0486 CALL MDS_WRITEVEC_LOC(
0487 I adfname, prec, ioUnit,
0488 I 'RL', active_var_length,
0489 O active_data_t, dummyRS,
0490 I bi, bj,
0491 I iRec, myOptimIter, myThid )
0492
0493 ENDIF
0494 ENDIF
0495
0496 ENDIF
0497
0498
0499 IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
0500
0501 CALL MDS_READVEC_LOC(
0502 I activeVar_file, prec, ioUnit,
0503 I 'RL', active_var_length,
0504 O active_data_t, dummyRS,
0505 I bi, bj,
0506 I iRec, myThid )
0507
0508
0509 DO i = 1, active_var_length
0510 active_data_t(i) = active_data_t(i) + active_var(i)
0511 ENDDO
0512
0513
0514 IF ( myProcId.EQ.0 ) THEN
0515 CALL MDS_WRITEVEC_LOC(
0516 I activeVar_file, prec, ioUnit,
0517 I 'RL', active_var_length,
0518 O active_data_t, dummyRS,
0519 I bi, bj,
32ce3e9e96 Mart*0520 I jRec, myOptimIter, myThid )
04904a066e Timo*0521 ENDIF
0522
0523
0524 DO i = 1, active_var_length
0525 active_data_t(i) = 0. _d 0
0526 ENDDO
0527
0528 ENDIF
0529
0530
0531 IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
0532
0533 CALL MDS_READVEC_LOC(
0534 I activeVar_file, prec, ioUnit,
0535 I 'RL', active_var_length,
0536 O active_var, dummyRS,
0537 I bi, bj,
0538 I iRec, myThid )
0539 ENDIF
0540
0541 RETURN
0542 END
0543
0544
0545
0546
0547
0548 SUBROUTINE ACTIVE_READ_1D_RS(
0549 I activeVar_file,
0550 O active_var,
0551 I active_var_length,
0552 I lAdInit,
0553 I iRec,
0554 I theSimulationMode,
0555 I myOptimIter,
0556 I myThid )
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573 IMPLICIT NONE
0574
0575
0576 #include "EEPARAMS.h"
0577 #include "SIZE.h"
0578 #include "PARAMS.h"
5cf4364659 Mart*0579 #include "CTRL_SIZE.h"
4d72283393 Mart*0580 #include "CTRL.h"
04904a066e Timo*0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593 CHARACTER*(*) activeVar_file
0594 _RS active_var(*)
0595 INTEGER active_var_length
0596 LOGICAL lAdInit
0597 INTEGER iRec
0598 INTEGER theSimulationMode
0599 INTEGER myOptimIter
0600 INTEGER myThid
0601
0602
0603 INTEGER ILNBLNK
0604 EXTERNAL ILNBLNK
0605
0606
0607 CHARACTER*(2) adpref
de57a2ec4b Mart*0608 CHARACTER*(MAX_LEN_FNAM) adfname
04904a066e Timo*0609 INTEGER i, bi, bj
32ce3e9e96 Mart*0610 INTEGER jRec
04904a066e Timo*0611 INTEGER prec
0612 INTEGER il
0613 INTEGER ioUnit
0614 _RS active_data_t(active_var_length)
0615 _RL dummyRL(1)
0616
0617
0618
0619 prec = ctrlprec
32ce3e9e96 Mart*0620 jRec = -ABS(iRec)
04904a066e Timo*0621
0622
0623 bi=0
0624 bj=0
0625
0626
0627 ioUnit = 0
0628
0629
0630 IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
0631
0632
0633 CALL MDS_READVEC_LOC(
0634 I activeVar_file, prec, ioUnit,
0635 I 'RS', active_var_length,
0636 O dummyRL, active_var,
0637 I bi, bj,
0638 I iRec, myThid )
0639
0640 IF ( lAdInit ) THEN
0641
0642
0643
0644 DO i = 1, active_var_length
0645 active_data_t(i) = 0. _d 0
0646 ENDDO
f9d7cbfb72 Ou W*0647
0648 adpref = 'ad'
0649 il = ILNBLNK( activeVar_file )
0650 WRITE(adfname,'(2A)') adpref, activeVar_file(1:il)
04904a066e Timo*0651 IF ( myProcId.EQ.0 ) THEN
0652 CALL MDS_WRITEVEC_LOC(
0653 I adfname, prec, ioUnit,
0654 I 'RS', active_var_length,
0655 O dummyRL, active_data_t,
0656 I bi, bj,
0657 I iRec, myOptimIter, myThid )
0658
0659 ENDIF
0660 ENDIF
0661
0662 ENDIF
0663
0664
0665 IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
0666
0667 CALL MDS_READVEC_LOC(
0668 I activeVar_file, prec, ioUnit,
0669 I 'RS', active_var_length,
0670 O dummyRL, active_data_t,
0671 I bi, bj,
0672 I iRec, myThid )
0673
0674
0675 DO i = 1, active_var_length
0676 active_data_t(i) = active_data_t(i) + active_var(i)
0677 ENDDO
0678
0679
0680 IF ( myProcId.EQ.0 ) THEN
0681 CALL MDS_WRITEVEC_LOC(
0682 I activeVar_file, prec, ioUnit,
0683 I 'RS', active_var_length,
0684 O dummyRL, active_data_t,
0685 I bi, bj,
32ce3e9e96 Mart*0686 I jRec, myOptimIter, myThid )
04904a066e Timo*0687
0688 ENDIF
0689
0690 DO i = 1, active_var_length
0691 active_data_t(i) = 0. _d 0
0692 ENDDO
0693
0694 ENDIF
0695
0696
0697 IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
0698
0699 CALL MDS_READVEC_LOC(
0700 I activeVar_file, prec, ioUnit,
0701 I 'RS', active_var_length,
0702 O dummyRL, active_var,
0703 I bi, bj,
0704 I iRec, myThid )
0705 ENDIF
0706
0707 RETURN
0708 END
0709
0710
0711
50d8204771 Jean*0712
0713
0714 SUBROUTINE ACTIVE_WRITE_3D_RL(
0715 I activeVar_file,
0716 I active_var,
0717 I globalFile,
0718 I useCurrentDir,
0719 I iRec,
0720 I myNr,
0721 I theSimulationMode,
0722 I myOptimIter,
0723 I myThid )
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737 IMPLICIT NONE
0738
0739
0740 #include "EEPARAMS.h"
0741 #include "SIZE.h"
0742 #include "PARAMS.h"
5cf4364659 Mart*0743 #include "CTRL_SIZE.h"
4d72283393 Mart*0744 #include "CTRL.h"
4158fdaabc Patr*0745
50d8204771 Jean*0746
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757 CHARACTER*(*) activeVar_file
0758 INTEGER myNr
0759 _RL active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
0760 LOGICAL globalFile
0761 LOGICAL useCurrentDir
0762 INTEGER iRec
0763 INTEGER theSimulationMode
0764 INTEGER myOptimIter
0765 INTEGER myThid
0766
0767
0768 INTEGER i,j,k
0769 INTEGER bi,bj
32ce3e9e96 Mart*0770 INTEGER jRec
50d8204771 Jean*0771 INTEGER prec
0772 _RS dummyRS(1)
a1572bcee2 Gael*0773 _RL active_data_t(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
50d8204771 Jean*0774
4158fdaabc Patr*0775
50d8204771 Jean*0776
0777 prec = ctrlprec
32ce3e9e96 Mart*0778 jRec = -ABS(iRec)
50d8204771 Jean*0779
0780
0781 IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
0782 CALL MDS_WRITE_FIELD(
0783 I activeVar_file, prec, globalFile, useCurrentDir,
0784 I 'RL', myNr, 1, myNr,
0785 I active_var, dummyRS,
0786 I iRec, myOptimIter, myThid )
0787 ENDIF
0788
0789
0790 IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
0791
0792 CALL MDS_READ_FIELD(
0793 I activeVar_file, prec, useCurrentDir,
a1572bcee2 Gael*0794 I 'RL', Nr, 1, myNr,
50d8204771 Jean*0795 O active_data_t, dummyRS,
0796 I iRec, myThid )
0797
0798
0799 DO bj = myByLo(myThid), myByHi(myThid)
0800 DO bi = myBxLo(myThid), myBxHi(myThid)
0801 DO k = 1, myNr
0802 DO j=1,sNy
0803 DO i=1,sNx
0804 active_var(i,j,k,bi,bj) = active_var(i,j,k,bi,bj)
0805 & + active_data_t(i,j,k,bi,bj)
0806 active_data_t(i,j,k,bi,bj) = 0. _d 0
0807 ENDDO
0808 ENDDO
0809 ENDDO
0810 ENDDO
0811 ENDDO
0812 CALL MDS_WRITE_FIELD(
0813 I activeVar_file, prec, globalFile, useCurrentDir,
a1572bcee2 Gael*0814 I 'RL', Nr, 1, myNr,
50d8204771 Jean*0815 I active_data_t, dummyRS,
32ce3e9e96 Mart*0816 I jRec, myOptimIter, myThid )
50d8204771 Jean*0817
0818 ENDIF
0819
0820
0821 IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
0822 CALL MDS_WRITE_FIELD(
0823 I activeVar_file, prec, globalFile, useCurrentDir,
0824 I 'RL', myNr, 1, myNr,
0825 I active_var, dummyRS,
0826 I iRec, myOptimIter, myThid )
0827 ENDIF
0828
0829 RETURN
0830 END
0831
0832
4158fdaabc Patr*0833
50d8204771 Jean*0834
4158fdaabc Patr*0835
50d8204771 Jean*0836 SUBROUTINE ACTIVE_WRITE_3D_RS(
0837 I activeVar_file,
0838 I active_var,
0839 I globalFile,
0840 I useCurrentDir,
0841 I iRec,
0842 I myNr,
0843 I theSimulationMode,
0844 I myOptimIter,
0845 I myThid )
4158fdaabc Patr*0846
0847
50d8204771 Jean*0848
0849
0850
0851
0852
0853
0854
0855
4158fdaabc Patr*0856
0857
0858
50d8204771 Jean*0859 IMPLICIT NONE
4158fdaabc Patr*0860
50d8204771 Jean*0861
4158fdaabc Patr*0862 #include "EEPARAMS.h"
0863 #include "SIZE.h"
0864 #include "PARAMS.h"
5cf4364659 Mart*0865 #include "CTRL_SIZE.h"
4d72283393 Mart*0866 #include "CTRL.h"
4158fdaabc Patr*0867
0868
50d8204771 Jean*0869
0870
0871
0872
0873
0874
0875
0876
0877
0878
0879 CHARACTER*(*) activeVar_file
0880 INTEGER myNr
0881 _RS active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
0882 LOGICAL globalFile
0883 LOGICAL useCurrentDir
0884 INTEGER iRec
0885 INTEGER theSimulationMode
0886 INTEGER myOptimIter
0887 INTEGER myThid
4158fdaabc Patr*0888
0889
50d8204771 Jean*0890 INTEGER i,j,k
0891 INTEGER bi,bj
32ce3e9e96 Mart*0892 INTEGER jRec
50d8204771 Jean*0893 INTEGER prec
a1572bcee2 Gael*0894 _RS active_data_t(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
50d8204771 Jean*0895 _RL dummyRL(1)
4158fdaabc Patr*0896
0897
50d8204771 Jean*0898
0899 prec = ctrlprec
32ce3e9e96 Mart*0900 jRec = -ABS(iRec)
50d8204771 Jean*0901
0902
0903 IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
0904 CALL MDS_WRITE_FIELD(
0905 I activeVar_file, prec, globalFile, useCurrentDir,
0906 I 'RS', myNr, 1, myNr,
0907 I dummyRL, active_var,
0908 I iRec, myOptimIter, myThid )
0909 ENDIF
0910
0911
0912 IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
0913
0914 CALL MDS_READ_FIELD(
0915 I activeVar_file, prec, useCurrentDir,
a1572bcee2 Gael*0916 I 'RS', Nr, 1, myNr,
50d8204771 Jean*0917 O dummyRL, active_data_t,
0918 I iRec, myThid )
0919
0920
0921 DO bj = myByLo(myThid), myByHi(myThid)
0922 DO bi = myBxLo(myThid), myBxHi(myThid)
0923 DO k = 1, myNr
0924 DO j=1,sNy
0925 DO i=1,sNx
0926 active_var(i,j,k,bi,bj) = active_var(i,j,k,bi,bj)
0927 & + active_data_t(i,j,k,bi,bj)
0928 active_data_t(i,j,k,bi,bj) = 0. _d 0
0929 ENDDO
0930 ENDDO
0931 ENDDO
0932 ENDDO
0933 ENDDO
0934 CALL MDS_WRITE_FIELD(
0935 I activeVar_file, prec, globalFile, useCurrentDir,
a1572bcee2 Gael*0936 I 'RS', Nr, 1, myNr,
50d8204771 Jean*0937 I dummyRL, active_data_t,
32ce3e9e96 Mart*0938 I jRec, myOptimIter, myThid )
50d8204771 Jean*0939
0940 ENDIF
0941
0942
0943 IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
0944 CALL MDS_WRITE_FIELD(
0945 I activeVar_file, prec, globalFile, useCurrentDir,
0946 I 'RS', myNr, 1, myNr,
0947 I dummyRL, active_var,
0948 I iRec, myOptimIter, myThid )
0949 ENDIF
0950
0951 RETURN
0952 END
04904a066e Timo*0953
0954
0955
0956
0957
0958 SUBROUTINE ACTIVE_WRITE_1D_RL(
0959 I activeVar_file,
0960 O active_var,
0961 I active_var_length,
0962 I iRec,
0963 I theSimulationMode,
0964 I myOptimIter,
0965 I myThid )
0966
0967
0968
0969
0970
0971
0972
0973
0974
0975
0976
0977
0978
0979
0980 IMPLICIT NONE
0981
0982
0983 #include "EEPARAMS.h"
0984 #include "SIZE.h"
0985 #include "PARAMS.h"
5cf4364659 Mart*0986 #include "CTRL_SIZE.h"
4d72283393 Mart*0987 #include "CTRL.h"
04904a066e Timo*0988
0989
0990
0991
0992
0993
0994
0995
0996
0997
0998 CHARACTER*(*) activeVar_file
0999 _RL active_var(*)
1000 INTEGER active_var_length
1001 INTEGER iRec
1002 INTEGER theSimulationMode
1003 INTEGER myOptimIter
1004 INTEGER myThid
1005
1006
1007 INTEGER i, bi, bj
32ce3e9e96 Mart*1008 INTEGER jRec
04904a066e Timo*1009 INTEGER prec
1010 INTEGER ioUnit
1011 _RS dummyRS(1)
1012 _RL active_data_t(active_var_length)
1013
1014
1015
1016 prec = ctrlprec
32ce3e9e96 Mart*1017 jRec = -ABS(iRec)
04904a066e Timo*1018
1019
1020 bi=0
1021 bj=0
1022
1023
1024 ioUnit = 0
1025
1026
1027 IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
1028
1029
1030 IF ( myProcId.EQ.0 ) THEN
1031 CALL MDS_WRITEVEC_LOC(
1032 I activeVar_file, prec, ioUnit,
1033 I 'RL', active_var_length,
1034 O active_var, dummyRS,
1035 I bi, bj,
1036 I iRec, myOptimIter, myThid )
1037
1038 ENDIF
1039 ENDIF
1040
1041
1042 IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
1043
1044 CALL MDS_READVEC_LOC(
1045 I activeVar_file, prec, ioUnit,
1046 I 'RL', active_var_length,
1047 O active_data_t, dummyRS,
1048 I bi, bj,
1049 I iRec, myThid )
1050
1051
1052 DO i = 1, active_var_length
1053 active_var(i) = active_var(i) + active_data_t(i)
1054 active_data_t(i) = 0. _d 0
1055 ENDDO
1056
1057
1058 IF ( myProcId.EQ.0 ) THEN
1059 CALL MDS_WRITEVEC_LOC(
1060 I activeVar_file, prec, ioUnit,
1061 I 'RL', active_var_length,
1062 O active_data_t, dummyRS,
1063 I bi, bj,
32ce3e9e96 Mart*1064 I jRec, myOptimIter, myThid )
04904a066e Timo*1065 ENDIF
1066 ENDIF
1067
1068
1069 IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
1070
1071 IF ( myProcId.EQ.0 ) THEN
1072 CALL MDS_WRITEVEC_LOC(
1073 I activeVar_file, prec, ioUnit,
1074 I 'RL', active_var_length,
1075 O active_var, dummyRS,
1076 I bi, bj,
1077 I iRec, myOptimIter, myThid )
1078 ENDIF
1079 ENDIF
1080
1081 RETURN
1082 END
1083
1084
1085
1086
1087
1088 SUBROUTINE ACTIVE_WRITE_1D_RS(
1089 I activeVar_file,
1090 O active_var,
1091 I active_var_length,
1092 I iRec,
1093 I theSimulationMode,
1094 I myOptimIter,
1095 I myThid )
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110 IMPLICIT NONE
1111
1112
1113 #include "EEPARAMS.h"
1114 #include "SIZE.h"
1115 #include "PARAMS.h"
5cf4364659 Mart*1116 #include "CTRL_SIZE.h"
4d72283393 Mart*1117 #include "CTRL.h"
04904a066e Timo*1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128 CHARACTER*(*) activeVar_file
1129 _RS active_var(*)
1130 INTEGER active_var_length
1131 INTEGER iRec
1132 INTEGER theSimulationMode
1133 INTEGER myOptimIter
1134 INTEGER myThid
1135
1136
1137 INTEGER i, bi, bj
32ce3e9e96 Mart*1138 INTEGER jRec
04904a066e Timo*1139 INTEGER prec
1140 INTEGER ioUnit
1141 _RS active_data_t(active_var_length)
1142 _RL dummyRL(1)
1143
1144
1145
1146 prec = ctrlprec
32ce3e9e96 Mart*1147 jRec = -ABS(iRec)
04904a066e Timo*1148
1149
1150 bi=0
1151 bj=0
1152
1153
1154 ioUnit = 0
1155
1156
1157 IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
1158
1159
1160 IF ( myProcId.EQ.0 ) THEN
1161 CALL MDS_WRITEVEC_LOC(
1162 I activeVar_file, prec, ioUnit,
1163 I 'RS', active_var_length,
1164 O dummyRL, active_var,
1165 I bi, bj,
1166 I iRec, myOptimIter, myThid )
1167
1168 ENDIF
1169 ENDIF
1170
1171
1172 IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
1173
1174 CALL MDS_READVEC_LOC(
1175 I activeVar_file, prec, ioUnit,
1176 I 'RL', active_var_length,
1177 O dummyRL, active_data_t,
1178 I bi, bj,
1179 I iRec, myThid )
1180
1181
1182 DO i = 1, active_var_length
1183 active_var(i) = active_var(i) + active_data_t(i)
1184 active_data_t(i) = 0. _d 0
1185 ENDDO
1186
1187
1188 IF ( myProcId.EQ.0 ) THEN
1189 CALL MDS_WRITEVEC_LOC(
1190 I activeVar_file, prec, ioUnit,
1191 I 'RL', active_var_length,
1192 O dummyRL, active_data_t,
1193 I bi, bj,
32ce3e9e96 Mart*1194 I jRec, myOptimIter, myThid )
04904a066e Timo*1195
1196 ENDIF
1197 ENDIF
1198
1199
1200 IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
1201
1202 IF ( myProcId.EQ.0 ) THEN
1203 CALL MDS_WRITEVEC_LOC(
1204 I activeVar_file, prec, ioUnit,
1205 I 'RL', active_var_length,
1206 O dummyRL, active_var,
1207 I bi, bj,
1208 I iRec, myOptimIter, myThid )
1209 ENDIF
1210 ENDIF
1211
1212 RETURN
1213 END