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

Annotation of /MITgcm/model/src/convective_adjustment_ini.F

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


Revision 1.22 - (hide annotations) (download)
Mon Aug 11 22:25:52 2008 UTC (15 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62c, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint63g, checkpoint64, checkpoint62, checkpoint63, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint62b, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint61f, checkpoint61n, checkpoint61q, checkpoint61e, checkpoint61g, checkpoint61d, checkpoint61c, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.21: +14 -12 lines
replace calls to "FIND_RHO" with recent version "FIND_RHO_2D"

1 jmc 1.22 C $Header: /u/gcmpack/MITgcm/model/src/convective_adjustment_ini.F,v 1.21 2008/06/19 17:21:24 heimbach Exp $
2 cnh 1.3 C $Name: $
3 heimbach 1.1
4 edhill 1.13 #include "PACKAGES_CONFIG.h"
5 heimbach 1.1 #include "CPP_OPTIONS.h"
6    
7 cnh 1.3 CBOP
8     C !ROUTINE: CONVECTIVE_ADJUSTMENT_INI
9     C !INTERFACE:
10 heimbach 1.1 SUBROUTINE CONVECTIVE_ADJUSTMENT_INI(
11 jmc 1.20 I bi, bj, myTime, myIter, myThid )
12 cnh 1.3 C !DESCRIPTION: \bv
13     C *==========================================================*
14 jmc 1.20 C | SUBROUTINE CONVECTIVE_ADJUSTMENT_INI
15     C | o Driver for vertical mixing or similar parameterization
16 cnh 1.3 C *==========================================================*
17 jmc 1.20 C | Same prognostic code logic as S/R CONVECTIVE_ADJUSTMENT,
18 cnh 1.3 C | but different time history behavior in forward-reverse
19     C | adjoint operation.
20     C *==========================================================*
21     C \ev
22    
23     C !USES:
24 heimbach 1.1 IMPLICIT NONE
25     C == Global data ==
26     #include "SIZE.h"
27     #include "EEPARAMS.h"
28     #include "PARAMS.h"
29     #include "DYNVARS.h"
30     #include "GRID.h"
31     #ifdef ALLOW_TIMEAVE
32     #include "TIMEAVE_STATV.h"
33 jmc 1.20 #endif
34 heimbach 1.1 #ifdef ALLOW_AUTODIFF_TAMC
35     #include "tamc.h"
36     #include "tamc_keys.h"
37     #endif /* ALLOW_AUTODIFF_TAMC */
38 jmc 1.18 EXTERNAL DIFFERENT_MULTIPLE
39     LOGICAL DIFFERENT_MULTIPLE
40 heimbach 1.1
41 cnh 1.3 C !INPUT/OUTPUT PARAMETERS:
42 heimbach 1.1 C == Routine arguments ==
43 jmc 1.20 C bi,bj :: tile indices
44     C myTime :: Current time in simulation
45     C myIter :: Current iteration in simulation
46     C myThid :: Thread number of this instance of S/R CONVECT
47     INTEGER bi,bj
48     _RL myTime
49 heimbach 1.1 INTEGER myIter
50     INTEGER myThid
51    
52     #ifdef INCLUDE_CONVECT_CALL
53    
54 cnh 1.3 C !LOCAL VARIABLES:
55 heimbach 1.1 C == Local variables ==
56 jmc 1.20 C iMin,iMax,jMin,jMax :: computation domain
57 cnh 1.3 C i,j,k :: Loop counters
58     C rhoKm1, rhoK :: Density at adjacent levels (ref. to same level)
59     C ConvectCount :: Convection freq. counter
60 jmc 1.20 INTEGER iMin,iMax,jMin,jMax
61 heimbach 1.11 INTEGER i, j, K, kTop, kBottom, kDir, deltaK
62 heimbach 1.1 _RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
63     _RL rhoK (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
64 mlosch 1.10 _RL ConvectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
65 adcroft 1.4 _RL weightA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
66     _RL weightB(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
67 cnh 1.3 CEOP
68 heimbach 1.1
69     C-- Check to see if should convect now
70 jmc 1.18 IF ( DIFFERENT_MULTIPLE(cAdjFreq,myTime,deltaTClock)
71 jmc 1.17 & ) THEN
72 heimbach 1.1
73 jmc 1.20 C-- Define computation domain
74     iMin=1-Olx
75     iMax=sNx+Olx
76     jMin=1-Oly
77     jMax=sNy+Oly
78    
79 heimbach 1.11 C-- Initialise counters
80     kTop = 0
81     kBottom = 0
82     kDir = 0
83     deltaK = 0
84    
85 heimbach 1.1 C- Initialisation of Convection Counter
86     DO K=1,Nr
87     DO j=1-OLy,sNy+OLy
88     DO i=1-OLx,sNx+OLx
89     ConvectCount(i,j,k) = 0.
90     ENDDO
91     ENDDO
92     ENDDO
93    
94     #ifdef ALLOW_AUTODIFF_TAMC
95     act1 = bi - myBxLo(myThid)
96     max1 = myBxHi(myThid) - myBxLo(myThid) + 1
97     act2 = bj - myByLo(myThid)
98     max2 = myByHi(myThid) - myByLo(myThid) + 1
99     act3 = myThid - 1
100     max3 = nTx*nTy
101     act4 = 0
102     ikey = (act1 + 1) + act2*max1
103     & + act3*max1*max2
104     & + act4*max1*max2*max3
105     #endif /* ALLOW_AUTODIFF_TAMC */
106    
107 jmc 1.19 IF ( rkSign*gravitySign .GT. 0. ) THEN
108 jmc 1.16 C- <=> usingZCoords:
109 heimbach 1.11 kTop = 2
110 mlosch 1.10 kBottom = Nr
111 heimbach 1.11 kDir = 1
112     deltaK = -1
113 jmc 1.16 ELSE
114     C- <=> usingPCoords:
115 mlosch 1.10 kTop = Nr
116     kBottom = 2
117     kDir = -1
118 heimbach 1.11 deltaK = 0
119 jmc 1.22 ENDIF
120 mlosch 1.10
121 heimbach 1.21 #ifdef ALLOW_AUTODIFF_TAMC
122     CADJ STORE theta(:,:,:,bi,bj) = tapelev_ini_bibj,
123     CADJ & key=ikey, byte=isbyte
124 jmc 1.22 CADJ STORE salt (:,:,:,bi,bj) = tapelev_ini_bibj,
125 heimbach 1.21 CADJ & key=ikey, byte=isbyte
126 jmc 1.22 CADJ STORE convectcount(:,:,:) = tapelev_ini_bibj,
127 heimbach 1.21 CADJ & key=ikey, byte=isbyte
128     #endif
129    
130 heimbach 1.1 C-- Loop over all *interior* layers
131 mlosch 1.10 DO K=kTop,kBottom,kDir
132    
133 heimbach 1.1 #ifdef ALLOW_AUTODIFF_TAMC
134 heimbach 1.2 kkey = (ikey-1)*Nr + k
135 jmc 1.20 CADJ STORE theta(:,:,k-1,bi,bj) = tapelev_ini_bibj_k,
136 heimbach 1.2 CADJ & key=kkey, byte=isbyte
137 jmc 1.20 CADJ STORE salt (:,:,k-1,bi,bj) = tapelev_ini_bibj_k,
138 heimbach 1.2 CADJ & key=kkey, byte=isbyte
139 heimbach 1.21 CADJ STORE convectcount(:,:,k-1) = tapelev_ini_bibj_k,
140     CADJ & key=kkey, byte=isbyte
141 heimbach 1.1 #endif /* ALLOW_AUTODIFF_TAMC */
142     C- Density of K-1 layer (above W(K)) reference to K-1 T-level
143 jmc 1.22 CALL FIND_RHO_2D(
144     I iMin, iMax, jMin, jMax, K+deltaK,
145     I theta(1-OLx,1-OLy,K-1,bi,bj),
146     I salt (1-OLx,1-OLy,K-1,bi,bj),
147 heimbach 1.1 O rhoKm1,
148 jmc 1.22 I K-1, bi, bj, myThid )
149 heimbach 1.1
150     C- Density of K layer (below W(K)) reference to K-1 T-level.
151     #ifdef ALLOW_AUTODIFF_TAMC
152 jmc 1.20 CADJ STORE theta(:,:,k,bi,bj) = tapelev_ini_bibj_k,
153 heimbach 1.2 CADJ & key = kkey, byte = isbyte
154 jmc 1.20 CADJ STORE salt (:,:,k,bi,bj) = tapelev_ini_bibj_k,
155 heimbach 1.2 CADJ & key = kkey, byte = isbyte
156 heimbach 1.1 #endif /* ALLOW_AUTODIFF_TAMC */
157 jmc 1.22 CALL FIND_RHO_2D(
158     I iMin, iMax, jMin, jMax, K+deltaK,
159     I theta(1-OLx,1-OLy,K,bi,bj),
160     I salt (1-OLx,1-OLy,K,bi,bj),
161 heimbach 1.1 O rhoK,
162 jmc 1.22 I K, bi, bj, myThid )
163 heimbach 1.1
164     #ifdef ALLOW_AUTODIFF_TAMC
165 heimbach 1.2 CADJ STORE rhoKm1(:,:) = tapelev_ini_bibj_k, key=kkey, byte=isbyte
166     CADJ STORE rhoK (:,:) = tapelev_ini_bibj_k, key=kkey, byte=isbyte
167 heimbach 1.1 #endif /* ALLOW_AUTODIFF_TAMC */
168     C- Check static stability with layer below and mix as needed.
169 adcroft 1.4 c CALL CONVECT(
170     c I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoK,
171     c U ConvectCount,
172     c I myTime,myIter,myThid)
173    
174     C- Pre-calculate mixing weights for interface K
175     CALL CONVECTIVE_WEIGHTS(
176     I bi,bj,K,rhoKm1,rhoK,
177     O weightA,weightB,ConvectCount,
178     I myThid)
179    
180     C- Convectively mix heat across interface K
181     CALL CONVECTIVELY_MIXTRACER(
182     I bi,bj,k,weightA,weightB,
183     U theta,
184     I myThid)
185    
186     C- Convectively mix salt across interface K
187     CALL CONVECTIVELY_MIXTRACER(
188     I bi,bj,k,weightA,weightB,
189     U salt,
190     I myThid)
191    
192 adcroft 1.5 #ifdef ALLOW_PTRACERS
193     C- Convectively mix passive tracers across interface K
194     IF ( usePTRACERS ) THEN
195     CALL PTRACERS_CONVECT(
196     I bi,bj,k,weightA,weightB,myThid)
197     ENDIF
198     #endif /* ALLOW_PTRACERS */
199 heimbach 1.1
200     C-- End DO K=1,Nr
201     ENDDO
202 jmc 1.20
203 jmc 1.18 C-- End IF (DIFFERENT_MULTIPLE)
204 heimbach 1.1 ENDIF
205    
206     #endif /* INCLUDE_CONVECT_CALL */
207    
208     RETURN
209     END

  ViewVC Help
Powered by ViewVC 1.1.22