/[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.24 - (show annotations) (download)
Sun Nov 5 18:36:06 2006 UTC (17 years, 6 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint59, checkpoint58y_post, checkpoint58t_post, checkpoint60, checkpoint61, checkpoint58w_post, mitgcm_mapl_00, checkpoint58r_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint58v_post, checkpoint61f, checkpoint58x_post, checkpoint59j, checkpoint61e, checkpoint58u_post, checkpoint58s_post, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61l, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i
Changes since 1.23: +20 -4 lines
add ability to read bathy, salt, and theta using MNC (off by def)
  -- and this can be readily extended to most of the other files
  in PARM05 of the main "data" namelist file

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_theta.F,v 1.23 2005/11/08 23:01:10 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 #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 _BARRIER
67
68 IF ( hydrogThetaFile .NE. ' ' ) THEN
69 #ifdef ALLOW_MNC
70 IF (useMNC .AND. mnc_read_theta) THEN
71 CALL MNC_FILE_CLOSE_ALL_MATCHING(hydrogThetaFile, myThid)
72 CALL MNC_CW_SET_UDIM(hydrogThetaFile, 1, myThid)
73 CALL MNC_CW_SET_CITER(hydrogThetaFile, 2, -1, -1, -1, myThid)
74 CALL MNC_CW_SET_UDIM(hydrogThetaFile, 1, myThid)
75 CALL MNC_CW_RL_R('D',hydrogThetaFile,0,0,'Temp',theta,myThid)
76 CALL MNC_FILE_CLOSE_ALL_MATCHING(hydrogThetaFile, myThid)
77 ELSE
78 #endif /* ALLOW_MNC */
79 C _BEGIN_MASTER( myThid )
80 CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid )
81 C _END_MASTER(myThid)
82 #ifdef ALLOW_MNC
83 ENDIF
84 #endif /* ALLOW_MNC */
85 _EXCH_XYZ_R8(theta,myThid)
86 ENDIF
87
88 C-- Apply mask and test consistency
89 localWarnings=0
90 DO bj = myByLo(myThid), myByHi(myThid)
91 DO bi = myBxLo(myThid), myBxHi(myThid)
92 DO K=1,Nr
93 DO J=1-Oly,sNy+Oly
94 DO I=1-Olx,sNx+Olx
95 IF (maskC(I,J,K,bi,bj).EQ.0.) theta(I,J,K,bi,bj) = 0.
96 ENDDO
97 ENDDO
98 IF ( tRef(k).NE.0. ) THEN
99 DO J=1,sNy
100 DO I=1,sNx
101 IF ( maskC(I,J,K,bi,bj).NE.0.
102 & .AND. theta(I,J,K,bi,bj).EQ.0. ) THEN
103 localWarnings=localWarnings+1
104 ENDIF
105 ENDDO
106 ENDDO
107 ENDIF
108 ENDDO
109 ENDDO
110 ENDDO
111 IF (localWarnings.NE.0) THEN
112 WRITE(msgBuf,'(A,A)')
113 & 'S/R INI_THETA: theta = 0 identically. If this is intentional',
114 & 'you will need to edit ini_theta.F to avoid this safety check'
115 CALL PRINT_ERROR( msgBuf , myThid)
116 STOP 'ABNORMAL END: S/R INI_THETA'
117 ENDIF
118
119 C-- Check that there are no values of temperature below freezing point.
120 Tfreezing=-1.9 _d 0
121 IF ( allowFreezing ) THEN
122 DO bj = myByLo(myThid), myByHi(myThid)
123 DO bi = myBxLo(myThid), myBxHi(myThid)
124 DO K=1,Nr
125 DO J=1-Oly,sNy+Oly
126 DO I=1-Olx,sNx+Olx
127 IF (theta(I,J,k,bi,bj) .LT. Tfreezing) THEN
128 theta(I,J,K,bi,bj) = Tfreezing
129 ENDIF
130 ENDDO
131 ENDDO
132 ENDDO
133 ENDDO
134 ENDDO
135 ENDIF
136
137 CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' ,
138 & Nr, 1, myThid )
139
140 RETURN
141 END

  ViewVC Help
Powered by ViewVC 1.1.22