| 1 | cnh | 1.1 | C $Header: /u/u0/gcmpack/MITgcm/model/src/ini_theta.F,v 1.16 2001/09/26 18:09:15 cnh Exp $ | 
| 2 |  |  | C $Name:  $ | 
| 3 |  |  |  | 
| 4 |  |  | #include "CPP_OPTIONS.h" | 
| 5 |  |  |  | 
| 6 |  |  | CBOP | 
| 7 |  |  | C     !ROUTINE: INI_THETA | 
| 8 |  |  | C     !INTERFACE: | 
| 9 |  |  | SUBROUTINE INI_THETA( myThid ) | 
| 10 |  |  | C     !DESCRIPTION: \bv | 
| 11 |  |  | C     *==========================================================* | 
| 12 |  |  | C     | SUBROUTINE INI_THETA | 
| 13 |  |  | C     | o Set model initial temperature field. | 
| 14 |  |  | C     *==========================================================* | 
| 15 |  |  | C     | There are several options for setting the initial | 
| 16 |  |  | C     | temperature file | 
| 17 |  |  | C     |  1. Inline code | 
| 18 |  |  | C     |  2. Vertical profile ( uniform T in X and Y ) | 
| 19 |  |  | C     |  3. Three-dimensional data from a file. For example from | 
| 20 |  |  | C     |     Levitus or from a checkpoint file from a previous | 
| 21 |  |  | C     |     integration. | 
| 22 |  |  | C     | In addition to setting the temperature field we also | 
| 23 |  |  | C     | set the initial temperature tendency term here. | 
| 24 |  |  | C     *==========================================================* | 
| 25 |  |  | C     \ev | 
| 26 |  |  |  | 
| 27 |  |  | C     !USES: | 
| 28 |  |  | IMPLICIT NONE | 
| 29 |  |  | C     === Global variables === | 
| 30 |  |  | #include "SIZE.h" | 
| 31 |  |  | #include "EEPARAMS.h" | 
| 32 |  |  | #include "PARAMS.h" | 
| 33 |  |  | #include "GRID.h" | 
| 34 |  |  | #include "DYNVARS.h" | 
| 35 |  |  | #include "FFIELDS.h" | 
| 36 |  |  |  | 
| 37 |  |  | C     !INPUT/OUTPUT PARAMETERS: | 
| 38 |  |  | C     == Routine arguments == | 
| 39 |  |  | C     myThid -  Number of this instance of INI_THETA | 
| 40 |  |  | INTEGER myThid | 
| 41 |  |  |  | 
| 42 |  |  | C     !LOCAL VARIABLES: | 
| 43 |  |  | C     == Local variables == | 
| 44 |  |  | C     iC, jC - Center of domain | 
| 45 |  |  | C     iD, jD - Disitance from domain center. | 
| 46 |  |  | C     rad    - Radius of initial patch | 
| 47 |  |  | C     rD     - Radial displacement of point I,J | 
| 48 |  |  | C     iG, jG - Global coordinate index | 
| 49 |  |  | C     bi,bj  - Loop counters | 
| 50 |  |  | C     I,J,K | 
| 51 |  |  | INTEGER iC, jC, iD, jD | 
| 52 |  |  | INTEGER iG, jG | 
| 53 |  |  | INTEGER bi, bj | 
| 54 |  |  | INTEGER I, J, K, localWarnings | 
| 55 |  |  | _RL     rad, rD | 
| 56 |  |  | CHARACTER*(MAX_LEN_MBUF) msgBuf | 
| 57 |  |  | CEOP | 
| 58 |  |  |  | 
| 59 |  |  | C--   Initialise temperature field to the vertical reference profile | 
| 60 |  |  | DO bj = myByLo(myThid), myByHi(myThid) | 
| 61 |  |  | DO bi = myBxLo(myThid), myBxHi(myThid) | 
| 62 |  |  | DO K=1,Nr | 
| 63 |  |  | DO J=1-Oly,sNy+Oly | 
| 64 |  |  | DO I=1-Olx,sNx+Olx | 
| 65 |  |  | theta(I,J,K,bi,bj) = tRef(K) | 
| 66 |  |  | ENDDO | 
| 67 |  |  | ENDDO | 
| 68 |  |  | ENDDO | 
| 69 |  |  | ENDDO | 
| 70 |  |  | ENDDO | 
| 71 |  |  |  | 
| 72 |  |  | IF ( hydrogThetaFile .NE. ' ' ) THEN | 
| 73 |  |  | _BEGIN_MASTER( myThid ) | 
| 74 |  |  | CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid ) | 
| 75 |  |  | _END_MASTER(myThid) | 
| 76 |  |  | _EXCH_XYZ_R8(theta,myThid) | 
| 77 |  |  | ENDIF | 
| 78 |  |  |  | 
| 79 |  |  | C     Apply mask and test consistancy | 
| 80 |  |  | localWarnings=0 | 
| 81 |  |  | DO bj = myByLo(myThid), myByHi(myThid) | 
| 82 |  |  | DO bi = myBxLo(myThid), myBxHi(myThid) | 
| 83 |  |  | DO K=1,Nr | 
| 84 |  |  | DO J=1,sNy | 
| 85 |  |  | DO I=1,sNx | 
| 86 |  |  | IF (hFacC(I,J,K,bi,bj).EQ.0) theta(I,J,K,bi,bj) = 0. | 
| 87 |  |  | IF (hFacC(I,J,K,bi,bj).NE.0.AND.theta(I,J,K,bi,bj).EQ.0. | 
| 88 |  |  | &      .AND. tRef(k).NE.0.) THEN | 
| 89 |  |  | localWarnings=localWarnings+1 | 
| 90 |  |  | WRITE(6,*) I,J,K,bi,bj | 
| 91 |  |  | ENDIF | 
| 92 |  |  | thetaRef(i,j,k,bi,bj) = theta(i,j,k,bi,bj) | 
| 93 |  |  | ENDDO | 
| 94 |  |  | ENDDO | 
| 95 |  |  | ENDDO | 
| 96 |  |  | ENDDO | 
| 97 |  |  | ENDDO | 
| 98 |  |  | _EXCH_XYZ_R8(thetaRef,myThid) | 
| 99 |  |  | IF (localWarnings.NE.0) THEN | 
| 100 |  |  | WRITE(msgBuf,'(A,A)') | 
| 101 |  |  | &  'S/R INI_THETA: theta = 0 identically. If this is intentional', | 
| 102 |  |  | &  'you will need to edit ini_theta.F to avoid this safety check' | 
| 103 |  |  | CALL PRINT_ERROR( msgBuf , myThid) | 
| 104 |  |  | STOP 'ABNORMAL END: S/R INI_THETA' | 
| 105 |  |  | ENDIF | 
| 106 |  |  |  | 
| 107 |  |  | CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' , | 
| 108 |  |  | &                       Nr, 1, myThid ) | 
| 109 |  |  |  | 
| 110 |  |  | RETURN | 
| 111 |  |  | END |