/[MITgcm]/MITgcm/model/src/ini_theta.F
ViewVC logotype

Contents of /MITgcm/model/src/ini_theta.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.26 - (show annotations) (download)
Sun Jun 14 21:45:12 2009 UTC (14 years, 11 months ago) by jmc
Branch: MAIN
Changes since 1.25: +2 -5 lines
remove unnecessary BARRIER

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_theta.F,v 1.25 2009/04/28 18:01:14 jmc 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 #ifdef ALLOW_MNC
36 #include "MNC_PARAMS.h"
37 #endif
38
39 C !INPUT/OUTPUT PARAMETERS:
40 C == Routine arguments ==
41 C myThid - Number of this instance of INI_THETA
42 INTEGER myThid
43
44 C !LOCAL VARIABLES:
45 C == Local variables ==
46 C bi,bj - Loop counters
47 C I,J,K
48 INTEGER bi, bj
49 INTEGER I, J, K, localWarnings
50 _RL Tfreezing
51 CHARACTER*(MAX_LEN_MBUF) msgBuf
52 CEOP
53
54 C-- Initialise temperature field to the vertical reference profile
55 DO bj = myByLo(myThid), myByHi(myThid)
56 DO bi = myBxLo(myThid), myBxHi(myThid)
57 DO K=1,Nr
58 DO J=1-Oly,sNy+Oly
59 DO I=1-Olx,sNx+Olx
60 theta(I,J,K,bi,bj) = tRef(K)
61 ENDDO
62 ENDDO
63 ENDDO
64 ENDDO
65 ENDDO
66
67 IF ( hydrogThetaFile .NE. ' ' ) THEN
68 #ifdef ALLOW_MNC
69 IF (useMNC .AND. mnc_read_theta) THEN
70 CALL MNC_FILE_CLOSE_ALL_MATCHING(hydrogThetaFile, myThid)
71 CALL MNC_CW_SET_UDIM(hydrogThetaFile, 1, myThid)
72 CALL MNC_CW_SET_CITER(hydrogThetaFile, 2, -1, -1, -1, myThid)
73 CALL MNC_CW_SET_UDIM(hydrogThetaFile, 1, myThid)
74 CALL MNC_CW_RL_R('D',hydrogThetaFile,0,0,'Temp',theta,myThid)
75 CALL MNC_FILE_CLOSE_ALL_MATCHING(hydrogThetaFile, myThid)
76 ELSE
77 #endif /* ALLOW_MNC */
78 CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid )
79 #ifdef ALLOW_MNC
80 ENDIF
81 #endif /* ALLOW_MNC */
82 _EXCH_XYZ_RL(theta,myThid)
83 ENDIF
84
85 C-- Apply mask and test consistency
86 localWarnings=0
87 DO bj = myByLo(myThid), myByHi(myThid)
88 DO bi = myBxLo(myThid), myBxHi(myThid)
89 DO K=1,Nr
90 DO J=1-Oly,sNy+Oly
91 DO I=1-Olx,sNx+Olx
92 IF (maskC(I,J,K,bi,bj).EQ.0.) theta(I,J,K,bi,bj) = 0.
93 ENDDO
94 ENDDO
95 IF ( tRef(k).NE.0. ) THEN
96 DO J=1,sNy
97 DO I=1,sNx
98 IF ( maskC(I,J,K,bi,bj).NE.0.
99 & .AND. theta(I,J,K,bi,bj).EQ.0. ) THEN
100 localWarnings=localWarnings+1
101 ENDIF
102 ENDDO
103 ENDDO
104 ENDIF
105 ENDDO
106 ENDDO
107 ENDDO
108 IF (localWarnings.NE.0) THEN
109 WRITE(msgBuf,'(A,A)')
110 & 'S/R INI_THETA: theta = 0 identically. If this is intentional',
111 & 'you will need to edit ini_theta.F to avoid this safety check'
112 CALL PRINT_ERROR( msgBuf , myThid)
113 STOP 'ABNORMAL END: S/R INI_THETA'
114 ENDIF
115
116 C-- Check that there are no values of temperature below freezing point.
117 Tfreezing=-1.9 _d 0
118 IF ( allowFreezing ) THEN
119 DO bj = myByLo(myThid), myByHi(myThid)
120 DO bi = myBxLo(myThid), myBxHi(myThid)
121 DO K=1,Nr
122 DO J=1-Oly,sNy+Oly
123 DO I=1-Olx,sNx+Olx
124 IF (theta(I,J,k,bi,bj) .LT. Tfreezing) THEN
125 theta(I,J,K,bi,bj) = Tfreezing
126 ENDIF
127 ENDDO
128 ENDDO
129 ENDDO
130 ENDDO
131 ENDDO
132 ENDIF
133
134 CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' ,
135 & Nr, 1, myThid )
136
137 RETURN
138 END

  ViewVC Help
Powered by ViewVC 1.1.22