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