/[MITgcm]/MITgcm/pkg/thsice/thsice_step_temp.F
ViewVC logotype

Contents of /MITgcm/pkg/thsice/thsice_step_temp.F

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


Revision 1.12 - (show annotations) (download)
Fri Dec 17 04:00:14 2010 UTC (13 years, 4 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62y, checkpoint62x
Changes since 1.11: +9 -9 lines
rename iicekey as ticekey to avoid conflict with pkg/seaice

1 C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_step_temp.F,v 1.11 2010/10/16 19:22:34 heimbach Exp $
2 C $Name: $
3
4 #include "THSICE_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: THSICE_STEP_TEMP
8 C !INTERFACE:
9 SUBROUTINE THSICE_STEP_TEMP(
10 I bi, bj, iMin, iMax, jMin, jMax,
11 I myTime, myIter, myThid )
12 C !DESCRIPTION: \bv
13 C *==========================================================*
14 C | S/R THSICE_STEP_TEMP
15 C | o Step Forward Surface and SeaIce Temperature.
16 C *==========================================================*
17 C \ev
18
19 C !USES:
20 IMPLICIT NONE
21
22 C === Global variables ===
23 #include "SIZE.h"
24 #include "EEPARAMS.h"
25 #include "PARAMS.h"
26 #include "FFIELDS.h"
27 #include "THSICE_SIZE.h"
28 #include "THSICE_PARAMS.h"
29 #include "THSICE_VARS.h"
30 #include "THSICE_TAVE.h"
31 #ifdef ALLOW_AUTODIFF_TAMC
32 # include "tamc.h"
33 # include "tamc_keys.h"
34 #endif
35
36 INTEGER siLo, siHi, sjLo, sjHi
37 PARAMETER ( siLo = 1-OLx , siHi = sNx+OLx )
38 PARAMETER ( sjLo = 1-OLy , sjHi = sNy+OLy )
39
40 C !INPUT/OUTPUT PARAMETERS:
41 C === Routine arguments ===
42 C- input:
43 C bi,bj :: tile indices
44 C iMin,iMax :: computation domain: 1rst index range
45 C jMin,jMax :: computation domain: 2nd index range
46 C myTime :: time counter for this thread
47 C myIter :: iteration counter for this thread
48 C myThid :: thread number for this instance of the routine.
49 C-- Modify fluxes hold in commom blocks
50 C- input:
51 C icFlxSW :: (Inp) short-wave heat flux (+=down): downward comp. only
52 C- output
53 C icFlxSW :: (Out) net SW flux into ocean (+=down)
54 C icFlxAtm:: net flux of energy from the atmosphere [W/m2] (+=down)
55 C icFrwAtm:: evaporation to the atmosphere (kg/m2/s) (>0 if evaporate)
56 C--
57 INTEGER bi,bj
58 INTEGER iMin, iMax
59 INTEGER jMin, jMax
60 _RL myTime
61 INTEGER myIter
62 INTEGER myThid
63 CEOP
64
65 #ifdef ALLOW_THSICE
66 C !LOCAL VARIABLES:
67 C === Local variables ===
68 C tFrzOce :: sea-water freezing temperature [oC] (function of S)
69 C dTsrf :: surf. temp adjusment: Ts^n+1 - Ts^n
70 C tmpFlx :: dummy array for surface fluxes and derivative vs Tsurf
71 C Note: dTsrf & tmpFlx are not used here; just allocate enough space for dTsrf.
72 INTEGER i,j
73 _RL tFrzOce(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
74 _RL dTsrf (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
75 _RL tmpFlx(1:2)
76 #ifdef SHORTWAVE_HEATING
77 _RL opFrac, icFrac
78 #endif
79 LOGICAL dBugFlag
80
81 C- define grid-point location where to print debugging values
82 #include "THSICE_DEBUG.h"
83
84 1010 FORMAT(A,1P4E14.6)
85
86 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
87
88 #ifdef ALLOW_AUTODIFF_TAMC
89 act1 = bi - myBxLo(myThid)
90 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
91 act2 = bj - myByLo(myThid)
92 max2 = myByHi(myThid) - myByLo(myThid) + 1
93 act3 = myThid - 1
94 max3 = nTx*nTy
95 act4 = ikey_dynamics - 1
96 ticekey = (act1 + 1) + act2*max1
97 & + act3*max1*max2
98 & + act4*max1*max2*max3
99 #endif /* ALLOW_AUTODIFF_TAMC */
100
101 dBugFlag = debugLevel.GE.debLevB
102 C- Initialise flxAtm,evpAtm
103 DO j = 1-OLy, sNy+OLy
104 DO i = 1-OLx, sNx+OLx
105 icFlxAtm(i,j,bi,bj) = 0.
106 icFrwAtm(i,j,bi,bj) = 0.
107 ENDDO
108 ENDDO
109
110 #ifdef ALLOW_AUTODIFF_TAMC
111 CADJ STORE tsrf(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte
112 #endif
113 c IF ( fluidIsWater ) THEN
114 CALL THSICE_ALBEDO(
115 I bi, bj, siLo, siHi, sjLo, sjHi,
116 I iMin,iMax, jMin,jMax,
117 I iceMask(siLo,sjLo,bi,bj), iceHeight(siLo,sjLo,bi,bj),
118 I snowHeight(siLo,sjLo,bi,bj), Tsrf(siLo,sjLo,bi,bj),
119 I snowAge(siLo,sjLo,bi,bj),
120 O siceAlb(siLo,sjLo,bi,bj), icAlbNIR(siLo,sjLo,bi,bj),
121 I myTime, myIter, myThid )
122
123 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
124 C part.1 : ice-covered fraction ;
125 C Solve for surface and ice temperature (implicitly) ; compute surf. fluxes
126 C-------
127
128 #ifdef ALLOW_AUTODIFF_TAMC
129 CADJ STORE icflxsw(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte
130 #endif
131
132 #ifdef ALLOW_DBUG_THSICE
133 DO j = jMin, jMax
134 DO i = iMin, iMax
135 IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN
136 IF ( dBug(i,j,bi,bj) ) THEN
137 WRITE(6,'(A,2I4,2I2)') 'ThSI_STEP_T: i,j=',i,j,bi,bj
138 WRITE(6,1010) 'ThSI_STEP_T: iceMask, hIc, hSn, Tsf =',
139 & iceMask(i,j,bi,bj), iceHeight(i,j,bi,bj),
140 & snowHeight(i,j,bi,bj), Tsrf(i,j,bi,bj)
141 ENDIF
142 ENDIF
143 ENDDO
144 ENDDO
145 #endif
146 DO j = jMin, jMax
147 DO i = iMin, iMax
148 IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN
149 C- surface net SW flux:
150 icFlxSW(i,j,bi,bj) = icFlxSW(i,j,bi,bj)
151 & *(1. _d 0 - siceAlb(i,j,bi,bj))
152 tFrzOce(i,j) = -mu_Tf*sOceMxL(i,j,bi,bj)
153 ELSE
154 tFrzOce(i,j) = 0. _d 0
155 ENDIF
156 ENDDO
157 ENDDO
158
159 #ifdef ALLOW_AUTODIFF_TAMC
160 CADJ STORE qice1(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte
161 CADJ STORE qice2(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte
162 CADJ STORE tice1(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte
163 CADJ STORE tice2(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte
164 CADJ STORE sheating(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte
165 #endif
166 CALL THSICE_SOLVE4TEMP(
167 I bi, bj,
168 I iMin,iMax, jMin,jMax, dBugFlag,
169 I useBulkForce, useEXF,
170 I iceMask(siLo,sjLo,bi,bj), iceHeight(siLo,sjLo,bi,bj),
171 I snowHeight(siLo,sjLo,bi,bj), tFrzOce, tmpFlx,
172 U icFlxSW(siLo,sjLo,bi,bj), Tsrf(siLo,sjLo,bi,bj),
173 U Qice1(siLo,sjLo,bi,bj), Qice2(siLo,sjLo,bi,bj),
174 O Tice1(siLo,sjLo,bi,bj), Tice2(siLo,sjLo,bi,bj), dTsrf,
175 O sHeating(siLo,sjLo,bi,bj), flxCndBt(siLo,sjLo,bi,bj),
176 O icFlxAtm(siLo,sjLo,bi,bj), icFrwAtm(siLo,sjLo,bi,bj),
177 I myTime, myIter, myThid )
178
179 #ifdef SHORTWAVE_HEATING
180 DO j = jMin, jMax
181 DO i = iMin, iMax
182 IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN
183 icFrac = iceMask(i,j,bi,bj)
184 opFrac = 1. _d 0 - icFrac
185 C-- Update Fluxes :
186 Qsw(i,j,bi,bj) = opFrac*Qsw(i,j,bi,bj)
187 & - icFrac*icFlxSW(i,j,bi,bj)
188 ENDIF
189 ENDDO
190 ENDDO
191 #endif /* SHORTWAVE_HEATING */
192 c ENDIF
193
194 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
195 #endif /* ALLOW_THSICE */
196
197 RETURN
198 END

  ViewVC Help
Powered by ViewVC 1.1.22