| 1 | cnh | 1.1 | C $Header: /u/gcmpack/MITgcm_contrib/ESMF/global_ocean.128x64x15/code/driver_run.F,v 1.4 2004/03/29 16:19:43 cnh Exp $ | 
| 2 |  |  | C $Name:  $ | 
| 3 |  |  |  | 
| 4 |  |  | #include "CPP_OPTIONS.h" | 
| 5 |  |  |  | 
| 6 |  |  | CBOP | 
| 7 |  |  | C     !ROUTINE: DRIVER_RUN | 
| 8 |  |  | C     !INTERFACE: | 
| 9 |  |  | SUBROUTINE DRIVER_RUN( | 
| 10 |  |  | I              atm_HeatFlux, atm_TauX, atm_TauY, | 
| 11 |  |  | I              atm_Qlatent, atm_Qsensible, atm_Qlongwave, | 
| 12 |  |  | I              atm_Qshortwave, | 
| 13 |  |  | I              atm_uVelGround, atm_vVelGround, | 
| 14 |  |  | I              atm_FWFlux, | 
| 15 |  |  | I              atm_Hatm, | 
| 16 |  |  | O              ocn_SSTocn, ocn_Hocn, | 
| 17 |  |  | U              myCurrentTime, myCurrentIter, | 
| 18 |  |  | U              iLoop, | 
| 19 |  |  | I              nTimeS, myThid) | 
| 20 |  |  |  | 
| 21 |  |  | C     !DESCRIPTION: \bv | 
| 22 |  |  | C     *================================================================== | 
| 23 |  |  | C     | SUBROUTINE driver_run | 
| 24 |  |  | C     | o External driver control routine for MITgcm forward step | 
| 25 |  |  | C     |   execution phase. | 
| 26 |  |  | C     *================================================================== | 
| 27 |  |  | C     | | 
| 28 |  |  | C     | DRIVER routines are used to control the MITgcm code from an external | 
| 29 |  |  | C     | driver. This routine invokes the forward phase of code execution. | 
| 30 |  |  | C     | The driver here is written for an ocean configuration and is designed | 
| 31 |  |  | C     | for use with either an argument based call/return interface or with a | 
| 32 |  |  | C     | messaging based "event loop" interface. | 
| 33 |  |  | C     | | 
| 34 |  |  | C     *================================================================== | 
| 35 |  |  | C     \ev | 
| 36 |  |  |  | 
| 37 |  |  | C     !USES: | 
| 38 |  |  | IMPLICIT NONE | 
| 39 |  |  | C     == Global variables == | 
| 40 |  |  | #include "SIZE.h" | 
| 41 |  |  | #include "EEPARAMS.h" | 
| 42 |  |  | #include "EESUPPORT.h" | 
| 43 |  |  | #include "PARAMS.h" | 
| 44 |  |  | #include "GRID.h" | 
| 45 |  |  | #include "OCNCPL.h" | 
| 46 |  |  |  | 
| 47 |  |  | C     == Routine arguments == | 
| 48 |  |  | _RL atm_HeatFlux(   1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 49 |  |  | _RL atm_TauX(       1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 50 |  |  | _RL atm_TauY(       1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 51 |  |  | _RL atm_Qlatent(    1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 52 |  |  | _RL atm_Qsensible(  1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 53 |  |  | _RL atm_Qlongwave(  1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 54 |  |  | _RL atm_Qshortwave( 1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 55 |  |  | _RL atm_uVelGround( 1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 56 |  |  | _RL atm_vVelGround( 1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 57 |  |  | _RL atm_FWFlux(     1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 58 |  |  | _RL atm_Hatm(       1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 59 |  |  | _RL ocn_SSTocn(     1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 60 |  |  | _RL ocn_Hocn(       1-OLx:sNx+OLx,1-OLy:sNy+OLy) | 
| 61 |  |  | C      myThid :: Thread number for this instance of the routine | 
| 62 |  |  | INTEGER myThid | 
| 63 |  |  | INTEGER myCurrentIter | 
| 64 |  |  | _RL     myCurrentTime | 
| 65 |  |  | INTEGER nTimeS | 
| 66 |  |  | INTEGER iLoop | 
| 67 |  |  | C     == Local variables == | 
| 68 |  |  | INTEGER i,j,bi,bj | 
| 69 |  |  | CHARACTER*(MAX_LEN_MBUF) msgBuf | 
| 70 |  |  | CHARACTER*13 fNam | 
| 71 |  |  | INTEGER iStep | 
| 72 |  |  | CEOP | 
| 73 |  |  |  | 
| 74 |  |  | CALL COMP_OCN_PUSH_CONTEXT(1) | 
| 75 |  |  |  | 
| 76 |  |  | myThid = 1 | 
| 77 |  |  | !cnhdbg      CLOSE(errorMessageUnit) | 
| 78 |  |  | !cnhdbg      CLOSE(standardMessageUnit) | 
| 79 |  |  | !     myProcessStr  = '0000' | 
| 80 |  |  | !cnhdbg      WRITE(fNam,'(A,A)') 'STDOUT.', myProcessStr(1:4) | 
| 81 |  |  | !cnhdbg      OPEN(standardMessageUnit,FILE=fNam,STATUS='old',POSITION='append') | 
| 82 |  |  | !cnhdbg      WRITE(fNam,'(A,A)') 'STDERR.', myProcessStr(1:4) | 
| 83 |  |  | !cnhdbg      OPEN(errorMessageUnit,FILE=fNam,STATUS='old',POSITION='append') | 
| 84 |  |  | !cnhdbg      WRITE(msgBuf,*) 'Entering OCN driver_run' | 
| 85 |  |  | !cnhdbg      CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, | 
| 86 |  |  | !cnhdbg     &                    SQUEEZE_RIGHT , 1) | 
| 87 |  |  |  | 
| 88 |  |  | C     Extract the import fields | 
| 89 |  |  | DO bj=myByLo(myThid),myByHi(myThid) | 
| 90 |  |  | DO bi=myBxLo(myThid),myBxHi(myThid) | 
| 91 |  |  | DO j=1-OLy,sNy+OLy | 
| 92 |  |  | DO i=1-OLx,sNx+OLx | 
| 93 |  |  | HeatFlux(   i,j,bi,bj)=atm_HeatFlux(  i,j) | 
| 94 |  |  | TauX(       i,j,bi,bj)=atm_tauX(      i,j) | 
| 95 |  |  | TauY(       i,j,bi,bj)=atm_tauY(      i,j) | 
| 96 |  |  | Qlatent(    i,j,bi,bj)=atm_qLatent(   i,j) | 
| 97 |  |  | Qsensible(  i,j,bi,bj)=atm_qSensible( i,j) | 
| 98 |  |  | Qlongwave(  i,j,bi,bj)=atm_qLongwave( i,j) | 
| 99 |  |  | Qshortwave( i,j,bi,bj)=atm_qShortwave(i,j) | 
| 100 |  |  | uVelGround( i,j,bi,bj)=atm_uVelGround(i,j) | 
| 101 |  |  | vVelGround( i,j,bi,bj)=atm_vVelGround(i,j) | 
| 102 |  |  | FWFlux(     i,j,bi,bj)=atm_FWFlux(    i,j) | 
| 103 |  |  | Hatm(       i,j,bi,bj)=atm_Hatm(      i,j) | 
| 104 |  |  | ENDDO | 
| 105 |  |  | ENDDO | 
| 106 |  |  | ENDDO | 
| 107 |  |  | ENDDO | 
| 108 |  |  |  | 
| 109 |  |  |  | 
| 110 |  |  | C     myThid = 1 | 
| 111 |  |  | myCurrentTime = startTime | 
| 112 |  |  | myCurrentIter = nIter0 | 
| 113 |  |  | C     myThid        = 1 | 
| 114 |  |  | C     nTimesteps    = 1 | 
| 115 |  |  |  | 
| 116 |  |  | CALL MONITOR( myCurrentIter, myCurrentTime, myThid ) | 
| 117 |  |  |  | 
| 118 |  |  | DO iStep = 1, nTimeS | 
| 119 |  |  | CALL FORWARD_STEP_EXECUTE( iLoop, myCurrentTime, | 
| 120 |  |  | &                            myCurrentIter, myThid ) | 
| 121 |  |  | iLoop = iLoop+1 | 
| 122 |  |  | CALL FORWARD_STEP_SETUP(   iLoop, myCurrentTime, | 
| 123 |  |  | &                            myCurrentIter, myThid ) | 
| 124 |  |  | ENDDO | 
| 125 |  |  |  | 
| 126 |  |  | CALL FORWARD_STEP_EXECUTE( iLoop, myCurrentTime, | 
| 127 |  |  | &                            myCurrentIter, myThid  ) | 
| 128 |  |  | iLoop = iLoop+1 | 
| 129 |  |  | CALL FORWARD_STEP_SETUP(    iLoop, myCurrentTime, | 
| 130 |  |  | &                            myCurrentIter, myThid ) | 
| 131 |  |  |  | 
| 132 |  |  | WRITE(41,*) 'MAXVAL SSTocn2cpl = ', MAXVAL(SSTocn2cpl(1:snx,1:sny,:,:)) | 
| 133 |  |  | WRITE(41,*) 'MINVAL SSTocn2cpl = ', MINVAL(SSTocn2cpl(1:snx,1:sny,:,:)) | 
| 134 |  |  |  | 
| 135 |  |  | C     Fill the export fields | 
| 136 |  |  | DO bj=myByLo(myThid),myByHi(myThid) | 
| 137 |  |  | DO bi=myBxLo(myThid),myBxHi(myThid) | 
| 138 |  |  | DO j=1,sNy | 
| 139 |  |  | DO i=1,sNx | 
| 140 |  |  | ocn_SSTocn(i,j) = SSTocn2cpl(i,j,bi,bj) | 
| 141 |  |  | ocn_Hocn(  i,j) = R_low(     i,j,bi,bj) | 
| 142 |  |  | ENDDO | 
| 143 |  |  | ENDDO | 
| 144 |  |  | ENDDO | 
| 145 |  |  | ENDDO | 
| 146 |  |  |  | 
| 147 |  |  | WRITE(41,*) 'D_RUN MAXVAL ocn_SSTocn = ', MAXVAL(ocn_SSTocn(1:snx,1:sny)) | 
| 148 |  |  | WRITE(41,*) 'D_RUN MINVAL ocn_SSTocn = ', MINVAL(ocn_SSTocn(1:snx,1:sny)) | 
| 149 |  |  |  | 
| 150 |  |  | !cnhdbg      CLOSE(errorMessageUnit) | 
| 151 |  |  | !cnhdbg      CLOSE(standardMessageUnit) | 
| 152 |  |  | CALL COMP_OCN_POP_CONTEXT(1) | 
| 153 |  |  |  | 
| 154 |  |  | RETURN | 
| 155 |  |  | END |