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

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

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


Revision 1.7 - (show annotations) (download)
Fri Aug 9 22:55:35 2002 UTC (21 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint47e_post, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, checkpoint46f_post, checkpoint48e_post, checkpoint48i_post, checkpoint46l_pre, checkpoint50, checkpoint48b_post, checkpoint48c_pre, checkpoint47d_pre, checkpoint47a_post, checkpoint48d_pre, checkpoint47i_post, checkpoint47d_post, checkpoint46d_pre, checkpoint48d_post, checkpoint48f_post, checkpoint46j_pre, checkpoint48h_post, checkpoint47g_post, checkpoint46j_post, checkpoint46k_post, checkpoint48a_post, checkpoint50a_post, checkpoint47j_post, branch-exfmods-tag, checkpoint46e_pre, checkpoint48c_post, checkpoint46c_pre, checkpoint47b_post, checkpoint46h_pre, checkpoint46m_post, checkpoint46g_post, checkpoint47f_post, checkpoint46i_post, checkpoint46c_post, checkpoint46e_post, checkpoint47, checkpoint48, checkpoint49, checkpoint46h_post, checkpoint48g_post, checkpoint47h_post, checkpoint46d_post
Branch point for: branch-exfmods-curt
Changes since 1.6: +28 -16 lines
Limit the number of warning messages written on STD-ERR file

1 C $Header: /u/gcmpack/MITgcm/model/src/calc_surf_dr.F,v 1.6 2002/02/10 20:04:11 jmc Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: CALC_SURF_DR
8 C !INTERFACE:
9 SUBROUTINE CALC_SURF_DR(etaFld,
10 I myTime, myIter, myThid )
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE CALC_SURF_DR
14 C | o Calculate the new surface level thickness according to
15 C | the surface r-position (Non-Linear Free-Surf)
16 C | o take decision if grid box becomes too thin or too thick
17 C *==========================================================*
18 C \ev
19
20 C !USES:
21 IMPLICIT NONE
22 C == Global variables
23 #include "SIZE.h"
24 #include "EEPARAMS.h"
25 #include "PARAMS.h"
26 #include "GRID.h"
27 #include "SURFACE.h"
28
29 C !INPUT/OUTPUT PARAMETERS:
30 C == Routine arguments ==
31 C myTime :: Current time in simulation
32 C myIter :: Current iteration number in simulation
33 C myThid :: Thread number for this instance of the routine.
34 C etaFld :: current eta field used to update the hFactor
35 _RL myTime
36 INTEGER myIter
37 INTEGER myThid
38 _RL etaFld(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
39
40 #ifdef NONLIN_FRSURF
41
42 C !LOCAL VARIABLES:
43 C Local variables in common block
44 C Rmin_surf :: minimum r_value of the free surface position
45 C that satisfy the hFacInf criteria
46 COMMON /LOCAL_CALC_SURF_DR/ Rmin_surf
47 _RL Rmin_surf(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
48 C Local variables
49 C i,j,k,bi,bj :: loop counter
50 C rSurftmp :: free surface r-position that is used to compute hFac_surf
51 C adjust_nb_pt :: Nb of grid points where rSurf is adjusted (hFactInf)
52 C adjust_volum :: adjustment effect on the volume (domain size)
53 C numbWrite :: count the Number of warning written on STD-ERR file
54 C numbWrMax :: maximum Number of warning written on STD-ERR file
55 INTEGER i,j,bi,bj
56 INTEGER ks, numbWrite, numbWrMax
57 _RL hFacInfMOM, Rmin_tmp, hFactmp, adjust_nb_pt, adjust_volum
58 _RL rSurftmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
59 _RS hhm, hhp
60 CHARACTER*(MAX_LEN_MBUF) suff
61 CEOP
62 DATA numbWrite / 0 /
63 numbWrMax = Nx*Ny
64
65 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
66
67 IF (myIter.EQ.-1) THEN
68
69 hFacInfMOM = hFacInf
70
71 DO bj=myByLo(myThid), myByHi(myThid)
72 DO bi=myBxLo(myThid), myBxHi(myThid)
73
74 C-- Initialise arrays :
75 DO j=1-Oly,sNy+Oly
76 DO i=1-Olx,sNx+Olx
77 hFac_surfC(i,j,bi,bj) = 0.
78 hFac_surfW(i,j,bi,bj) = 0.
79 hFac_surfS(i,j,bi,bj) = 0.
80 PmEpR(i,j,bi,bj) = 0.
81 Rmin_surf(i,j,bi,bj) = Ro_surf(i,j,bi,bj)
82 ENDDO
83 ENDDO
84
85 C-- Compute the mimimum value of r_surf (used for computing hFac_surfC)
86 DO j=1,sNy
87 DO i=1,sNx
88 ks = ksurfC(i,j,bi,bj)
89 IF (ks.LE.Nr) THEN
90 Rmin_tmp = rF(ks+1)
91 IF ( ks.EQ.ksurfW(i,j,bi,bj))
92 & Rmin_tmp = MAX(Rmin_tmp, R_low(i-1,j,bi,bj))
93 IF ( ks.EQ.ksurfW(i+1,j,bi,bj))
94 & Rmin_tmp = MAX(Rmin_tmp, R_low(i+1,j,bi,bj))
95 IF ( ks.EQ.ksurfS(i,j,bi,bj))
96 & Rmin_tmp = MAX(Rmin_tmp, R_low(i,j-1,bi,bj))
97 IF ( ks.EQ.ksurfS(i,j+1,bi,bj))
98 & Rmin_tmp = MAX(Rmin_tmp, R_low(i,j+1,bi,bj))
99
100 Rmin_surf(i,j,bi,bj) =
101 & MAX( MAX(rF(ks+1),R_low(i,j,bi,bj)) + hFacInf*drF(ks),
102 & Rmin_tmp + hFacInfMOM*drF(ks)
103 & )
104 ENDIF
105 ENDDO
106 ENDDO
107
108 C- end bi,bj loop.
109 ENDDO
110 ENDDO
111
112 _EXCH_XY_R8( Rmin_surf, myThid )
113
114 C- end of initialization block
115 ENDIF
116
117 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
118
119 adjust_nb_pt = 0.
120 adjust_volum = 0.
121
122 DO bj=myByLo(myThid), myByHi(myThid)
123 DO bi=myBxLo(myThid), myBxHi(myThid)
124
125 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
126 C-- Compute the new fractional thickness of surface level (ksurfC):
127
128 DO j=0,sNy+1
129 DO i=0,sNx+1
130 rSurftmp(i,j) = Ro_surf(i,j,bi,bj)+etaFld(i,j,bi,bj)
131 ks = ksurfC(i,j,bi,bj)
132 IF (ks.LE.Nr) THEN
133 IF (rSurftmp(i,j) .LT. Rmin_surf(i,j,bi,bj)) THEN
134 C-- Needs to do something :
135 IF (numbWrite.LE.numbWrMax) THEN
136 numbWrite = numbWrite + 1
137 hFactmp = ( rSurftmp(i,j)-MAX(rF(ks+1),R_low(i,j,bi,bj))
138 & )*recip_drF(ks)
139 IF (hFactmp.LT.hFacInf) THEN
140 WRITE(errorMessageUnit,'(2A,6I4,I10)')
141 & 'WARNING: hFacC < hFacInf at:',
142 & ' i,j,k,bi,bj,Thid,Iter=',i,j,ks,bi,bj,myThid,myIter
143 ELSE
144 WRITE(errorMessageUnit,'(2A,6I4,I10)')
145 & 'WARNING: hFac < hFacInf near:',
146 & ' i,j,k,bi,bj,Thid,Iter=',i,j,ks,bi,bj,myThid,myIter
147 ENDIF
148 WRITE(errorMessageUnit,'(A,2F10.6,1PE14.6)')
149 & 'hFac_n-1,hFac_n,eta =',
150 & hfacC(i,j,ks,bi,bj), hFactmp, etaFld(i,j,bi,bj)
151 ENDIF
152 C-- Decide to STOP :
153 c WRITE(errorMessageUnit,'(A)')
154 c & 'STOP in CALC_SURF_DR : too SMALL hFac !'
155 c STOP 'ABNORMAL END: S/R CALC_SURF_DR'
156 C----------
157
158 C-- Continue with Rmin_surf:
159 IF ( i.GE.1.AND.i.LE.sNx .AND.
160 & j.GE.1.AND.j.LE.sNy ) THEN
161 adjust_nb_pt = adjust_nb_pt + 1.
162 adjust_volum = adjust_volum
163 & + rA(i,j,bi,bj)*(Rmin_surf(i,j,bi,bj)-rSurftmp(i,j))
164 ENDIF
165 rSurftmp(i,j) = Rmin_surf(i,j,bi,bj)
166 C----------
167 ENDIF
168
169 C-- Set hFac_surfC :
170 hFac_surfC(i,j,bi,bj) =
171 & ( rSurftmp(i,j) - MAX(rF(ks+1), R_low(i,j,bi,bj))
172 & )*recip_drF(ks)*maskC(i,j,ks,bi,bj)
173
174 IF (hFac_surfC(i,j,bi,bj).GT.hFacSup) THEN
175 C-- Usefull warning when hFac becomes very large:
176 WRITE(errorMessageUnit,'(2A,6I4,I10)')
177 & 'WARNING: hFacC > hFacSup at:',
178 & ' i,j,k,bi,bj,Thid,Iter=',i,j,ks,bi,bj,myThid,myIter
179 WRITE(errorMessageUnit,'(A,2F10.6,1PE14.6)')
180 & 'hFac_n-1,hFac_n,eta =', hfacC(i,j,ks,bi,bj),
181 & hFac_surfC(i,j,bi,bj), etaFld(i,j,bi,bj)
182 C-- Decide to STOP :
183 c WRITE(errorMessageUnit,'(A)')
184 c & 'STOP in CALC_SURF_DR : too LARGE hFac !'
185 c STOP 'ABNORMAL END: S/R CALC_SURF_DR'
186 C----------
187 ENDIF
188 ENDIF
189
190 ENDDO
191 ENDDO
192
193 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
194 C-- Compute fractional thickness of surface level, for U & V point:
195
196 DO j=1,sNy
197 DO i=1,sNx+1
198 ks = ksurfW(i,j,bi,bj)
199 IF (ks.LE.Nr) THEN
200 hhm = rF(ks)
201 IF(ks.EQ.ksurfC(i-1,j,bi,bj)) hhm = rSurftmp(i-1,j)
202 hhp = rF(ks)
203 IF(ks.EQ.ksurfC(i,j,bi,bj)) hhp = rSurftmp(i,j)
204 hFac_surfW(i,j,bi,bj) =
205 & ( MIN(hhm,hhp)
206 & - MAX(rF(ks+1),R_low(i-1,j,bi,bj),R_low(i,j,bi,bj))
207 & )*recip_drF(ks)*maskW(i,j,ks,bi,bj)
208 ENDIF
209 ENDDO
210 ENDDO
211
212 DO j=1,sNy+1
213 DO i=1,sNx
214 ks = ksurfS(i,j,bi,bj)
215 IF (ks.LE.Nr) THEN
216 hhm = rF(ks)
217 IF(ks.EQ.ksurfC(i,j-1,bi,bj)) hhm = rSurftmp(i,j-1)
218 hhp = rF(ks)
219 IF(ks.EQ.ksurfC(i,j,bi,bj)) hhp = rSurftmp(i,j)
220 hFac_surfS(i,j,bi,bj) =
221 & ( MIN(hhm,hhp)
222 & - MAX(rF(ks+1),R_low(i,j-1,bi,bj),R_low(i,j,bi,bj))
223 & )*recip_drF(ks)*maskS(i,j,ks,bi,bj)
224 ENDIF
225 ENDDO
226 ENDDO
227
228 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
229
230 C- end bi,bj loop.
231 ENDDO
232 ENDDO
233
234 C-- Global diagnostic :
235 _GLOBAL_SUM_R8( adjust_nb_pt , myThid )
236 _GLOBAL_SUM_R8( adjust_volum , myThid )
237 IF (adjust_nb_pt .GE.1.) THEN
238 _BEGIN_MASTER( myThid )
239 WRITE(standardMessageUnit,'(2(A,I10),1PE16.8)')
240 & ' SURF_ADJUSTMENT: Iter=', myIter,
241 & ' Nb_pts,Vol=', nint(adjust_nb_pt), adjust_volum
242 _END_MASTER( myThid )
243 ENDIF
244
245 _EXCH_XY_R4(hFac_surfC, myThid )
246 CALL EXCH_UV_XY_RS(hFac_surfW,hFac_surfS,.FALSE.,myThid)
247
248 IF (useRealFreshWaterFlux .AND. myTime.EQ.startTime)
249 & _EXCH_XY_R4( PmEpR, myThid )
250
251 C-----
252 C Note: testing ksurfW,S is equivalent to a full height mask
253 C ==> no need for applying the mask here.
254 C and with "partial thin wall" ==> mask could be applied in S/R UPDATE_SURF_DR
255 C-----
256
257 WRITE(suff,'(I10.10)') myIter
258 c CALL WRITE_FLD_XY_RS('hFac_surfC.',suff,hFac_surfC,
259 c & myIter,myThid)
260
261 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
262 #endif /* NONLIN_FRSURF */
263
264 RETURN
265 END

  ViewVC Help
Powered by ViewVC 1.1.22