/[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.4 - (show annotations) (download)
Tue Apr 17 23:42:33 2007 UTC (17 years, 1 month ago) by heimbach
Branch: MAIN
Changes since 1.3: +17 -1 lines
2nd set of modifs for thsice adjoint.

1 C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_step_temp.F,v 1.3 2007/04/16 22:38:24 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 INTEGER i,j
71 _RL tFrzOce(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
72 c _RL dTsrf (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
73 _RL tmpflx(1:2), tmpdTs(1:2)
74 #ifdef SHORTWAVE_HEATING
75 _RL opFrac, icFrac
76 #endif
77 LOGICAL dBugFlag
78
79 C- define grid-point location where to print debugging values
80 #include "THSICE_DEBUG.h"
81
82 1010 FORMAT(A,1P4E14.6)
83
84 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
85
86 #ifdef ALLOW_AUTODIFF_TAMC
87 act1 = bi - myBxLo(myThid)
88 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
89 act2 = bj - myByLo(myThid)
90 max2 = myByHi(myThid) - myByLo(myThid) + 1
91 act3 = myThid - 1
92 max3 = nTx*nTy
93 act4 = ikey_dynamics - 1
94 iicekey = (act1 + 1) + act2*max1
95 & + act3*max1*max2
96 & + act4*max1*max2*max3
97 #endif /* ALLOW_AUTODIFF_TAMC */
98
99 dBugFlag = debugLevel.GE.debLevB
100 C- Initialise flxAtm,evpAtm
101 DO j = 1-OLy, sNy+OLy
102 DO i = 1-OLx, sNx+OLx
103 icFlxAtm(i,j,bi,bj) = 0.
104 icFrwAtm(i,j,bi,bj) = 0.
105 ENDDO
106 ENDDO
107
108 cph(
109 print *, 'ph-thsice-3a in thsice_main'
110 cph)
111 #ifdef ALLOW_AUTODIFF_TAMC
112 CADJ STORE tsrf(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte
113 #endif
114 c IF ( fluidIsWater ) THEN
115 CALL THSICE_ALBEDO(
116 I bi, bj, siLo, siHi, sjLo, sjHi,
117 I iMin,iMax, jMin,jMax,
118 I iceMask(siLo,sjLo,bi,bj), iceHeight(siLo,sjLo,bi,bj),
119 I snowHeight(siLo,sjLo,bi,bj), Tsrf(siLo,sjLo,bi,bj),
120 I snowAge(siLo,sjLo,bi,bj),
121 O siceAlb(siLo,sjLo,bi,bj),
122 I myTime, myIter, myThid )
123
124 cph(
125 print *, 'ph-thsice-3b in thsice_main'
126 cph)
127 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
128 C part.1 : ice-covered fraction ;
129 C Solve for surface and ice temperature (implicitly) ; compute surf. fluxes
130 C-------
131
132 #ifdef ALLOW_AUTODIFF_TAMC
133 CADJ STORE icflxsw(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte
134 #endif
135
136 DO j = jMin, jMax
137 DO i = iMin, iMax
138 IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN
139 #ifdef ALLOW_DBUG_THSICE
140 IF ( dBug(i,j,bi,bj) ) THEN
141 WRITE(6,'(A,2I4,2I2)') 'ThSI_STEP_T: i,j=',i,j,bi,bj
142 WRITE(6,1010) 'ThSI_STEP_T: iceMask, hIc, hSn, Tsf =',
143 & iceMask(i,j,bi,bj), iceHeight(i,j,bi,bj),
144 & snowHeight(i,j,bi,bj), Tsrf(i,j,bi,bj)
145 ENDIF
146 #endif
147 C- surface net SW flux:
148 icFlxSW(i,j,bi,bj) = icFlxSW(i,j,bi,bj)
149 & *(1. _d 0 - siceAlb(i,j,bi,bj))
150 tFrzOce(i,j) = -mu_Tf*sOceMxL(i,j,bi,bj)
151 ELSE
152 tFrzOce(i,j) = 0. _d 0
153 ENDIF
154 ENDDO
155 ENDDO
156
157 cph(
158 print *, 'ph-thsice-3c in thsice_main'
159 cph)
160 #ifdef ALLOW_AUTODIFF_TAMC
161 CADJ STORE qice1(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte
162 CADJ STORE qice2(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte
163 #endif
164 CALL THSICE_SOLVE4TEMP(
165 I bi, bj, siLo, siHi, sjLo, sjHi,
166 I iMin,iMax, jMin,jMax, dBugFlag,
167 I useBulkForce, useEXF,
168 I iceMask(siLo,sjLo,bi,bj), iceHeight(siLo,sjLo,bi,bj),
169 I snowHeight(siLo,sjLo,bi,bj), tFrzOce, tmpflx,
170 U icFlxSW(siLo,sjLo,bi,bj), Tsrf(siLo,sjLo,bi,bj),
171 U Qice1(siLo,sjLo,bi,bj), Qice2(siLo,sjLo,bi,bj),
172 O Tice1(siLo,sjLo,bi,bj), Tice2(siLo,sjLo,bi,bj), tmpdTs,
173 O sHeating(siLo,sjLo,bi,bj), flxCndBt(siLo,sjLo,bi,bj),
174 O icFlxAtm(siLo,sjLo,bi,bj), icFrwAtm(siLo,sjLo,bi,bj),
175 I myTime, myIter, myThid )
176 cph(
177 print *, 'ph-thsice-3d in thsice_main'
178 cph)
179
180 #ifdef SHORTWAVE_HEATING
181 DO j = jMin, jMax
182 DO i = iMin, iMax
183 IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN
184 icFrac = iceMask(i,j,bi,bj)
185 opFrac = 1. _d 0 - icFrac
186 C-- Update Fluxes :
187 Qsw(i,j,bi,bj) = opFrac*Qsw(i,j,bi,bj)
188 & - icFrac*icFlxSW(i,j,bi,bj)
189 ENDIF
190 ENDDO
191 ENDDO
192 #endif /* SHORTWAVE_HEATING */
193 c ENDIF
194
195 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
196 #endif /* ALLOW_THSICE */
197
198 RETURN
199 END

  ViewVC Help
Powered by ViewVC 1.1.22