C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/hs94.1x64x5/code_ad/ini_theta.F,v 1.1 2003/10/26 01:58:09 heimbach Exp $ C $Name: checkpoint53a_post $ #include "CPP_OPTIONS.h" CStartOfInterface SUBROUTINE INI_THETA( myThid ) C /==========================================================\ C | SUBROUTINE INI_THETA | C | o Set model initial temperature field. | C |==========================================================| C | There are several options for setting the initial | C | temperature file | C | 1. Inline code | C | 2. Vertical profile ( uniform T in X and Y ) | C | 3. Three-dimensional data from a file. For example from | C | Levitus or from a checkpoint file from a previous | C | integration. | C | In addition to setting the temperature field we also | C | set the initial temperature tendency term here. | C \==========================================================/ IMPLICIT NONE C === Global variables === #include "SIZE.h" #include "EEPARAMS.h" #include "PARAMS.h" #include "GRID.h" #include "DYNVARS.h" C == Routine arguments == C myThid - Number of this instance of INI_THETA INTEGER myThid CEndOfInterface C == Local variables == C bi,bj - Loop counters C I,J,K INTEGER bi, bj INTEGER I, J, K, localWarnings _RL term1,term2,thetaLim,thetaEq _RL thKappa,rSurf CHARACTER*(MAX_LEN_MBUF) msgBuf _BARRIER IF ( hydrogThetaFile .EQ. ' ' ) THEN C-- Initialise temperature field to Held & Saurez equilibrium theta DO bj = myByLo(myThid), myByHi(myThid) DO bi = myBxLo(myThid), myBxHi(myThid) DO K=1,Nr rSurf=1. _d 5 thKappa = 2. _d 0/7. _d 0 thetaLim = 200. _d 0 / ((rC(K)/rSurf)**thKappa) C thetaLim = 170. _d 0 / ((rC(K)/rSurf)**thKappa) DO J=1,sNy term1=60. _d 0*(sin(yC(1,J,bi,bj)*deg2rad)**2) term2=10. _d 0*log((rC(K)/rSurf)) & *(cos(yC(1,J,bi,bj)*deg2rad)**2) thetaEq=315. _d 0-term1-term2 DO I=1,sNx theta(I,J,K,bi,bj) = MAX( thetaLim, thetaEq ) C theta(I,J,K,bi,bj) = tRef(K) ENDDO ENDDO ENDDO ENDDO ENDDO ELSE _BEGIN_MASTER( myThid ) CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid ) _END_MASTER(myThid) ENDIF C Set initial tendency terms localWarnings=0 DO bj = myByLo(myThid), myByHi(myThid) DO bi = myBxLo(myThid), myBxHi(myThid) DO K=1,Nr DO J=1,sNy DO I=1,sNx gt (I,J,K,bi,bj) = 0. _d 0 gtNM1(I,J,K,bi,bj) = 0. _d 0 IF (hFacC(I,J,K,bi,bj).EQ.0) theta(I,J,K,bi,bj) = 0. IF (hFacC(I,J,K,bi,bj).NE.0.AND.theta(I,J,K,bi,bj).EQ.0.) & THEN localWarnings=localWarnings+1 ENDIF ENDDO ENDDO ENDDO ENDDO ENDDO IF (localWarnings.NE.0) THEN WRITE(msgBuf,'(A,A)') & 'S/R INI_THETA: theta = 0 identically. If this is intentional', & 'you will need to edit ini_theta.F to avoid this safety check' CALL PRINT_ERROR( msgBuf , myThid) STOP 'ABNORMAL END: S/R INI_THETA' ENDIF C _EXCH_XYZ_R8(theta , myThid ) _EXCH_XYZ_R8(gt , myThid ) _EXCH_XYZ_R8(gtNM1 , myThid ) CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' , & Nr, 1, myThid ) RETURN END