-
Notifications
You must be signed in to change notification settings - Fork 1
/
ini_forcing.F
executable file
·284 lines (267 loc) · 9.21 KB
/
ini_forcing.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
C $Header: /u/gcmpack/MITgcm/model/src/ini_forcing.F,v 1.53 2014/08/07 18:43:33 heimbach Exp $
C $Name: checkpoint65g $
#include "PACKAGES_CONFIG.h"
#include "CPP_OPTIONS.h"
CBOP
C !ROUTINE: INI_FORCING
C !INTERFACE:
SUBROUTINE INI_FORCING( myThid )
C !DESCRIPTION: \bv
C *==========================================================*
C | SUBROUTINE INI_FORCING
C | o Set model initial forcing fields.
C *==========================================================*
C \ev
C !USES:
IMPLICIT NONE
C === Global variables ===
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GRID.h"
#include "SURFACE.h"
#include "FFIELDS.h"
C !INPUT/OUTPUT PARAMETERS:
C == Routine arguments ==
C myThid :: my Thread Id number
INTEGER myThid
C !LOCAL VARIABLES:
C == Local variables ==
C bi,bj :: Tile indices
C i, j :: Loop counters
INTEGER bi, bj
INTEGER i, j
INTEGER k
#if (defined ALLOW_ADDFLUID) || (defined ALLOW_FRICTION_HEATING)
INTEGER k
#endif
CEOP
C- Initialise all arrays in common blocks
DO bj = myByLo(myThid), myByHi(myThid)
DO bi = myBxLo(myThid), myBxHi(myThid)
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
fu (i,j,bi,bj) = 0. _d 0
fv (i,j,bi,bj) = 0. _d 0
Qnet (i,j,bi,bj) = 0. _d 0
EmPmR (i,j,bi,bj) = 0. _d 0
saltFlux (i,j,bi,bj) = 0. _d 0
SST (i,j,bi,bj) = 0. _d 0
SSS (i,j,bi,bj) = 0. _d 0
Qsw (i,j,bi,bj) = 0. _d 0
pLoad (i,j,bi,bj) = 0. _d 0
sIceLoad (i,j,bi,bj) = 0. _d 0
surfaceForcingU (i,j,bi,bj) = 0. _d 0
surfaceForcingV (i,j,bi,bj) = 0. _d 0
surfaceForcingT (i,j,bi,bj) = 0. _d 0
surfaceForcingS (i,j,bi,bj) = 0. _d 0
surfaceForcingTice(i,j,bi,bj) = 0. _d 0
#ifdef ALLOW_GEOTHERMAL_FLUX
geothermalFlux (i,j,bi,bj) = 0. _d 0
#endif
#ifndef EXCLUDE_FFIELDS_LOAD
taux0 (i,j,bi,bj) = 0. _d 0
taux1 (i,j,bi,bj) = 0. _d 0
tauy0 (i,j,bi,bj) = 0. _d 0
tauy1 (i,j,bi,bj) = 0. _d 0
Qnet0 (i,j,bi,bj) = 0. _d 0
Qnet1 (i,j,bi,bj) = 0. _d 0
EmPmR0 (i,j,bi,bj) = 0. _d 0
EmPmR1 (i,j,bi,bj) = 0. _d 0
saltFlux0 (i,j,bi,bj) = 0. _d 0
saltFlux1 (i,j,bi,bj) = 0. _d 0
SST0 (i,j,bi,bj) = 0. _d 0
SST1 (i,j,bi,bj) = 0. _d 0
SSS0 (i,j,bi,bj) = 0. _d 0
SSS1 (i,j,bi,bj) = 0. _d 0
#ifdef SHORTWAVE_HEATING
Qsw0 (i,j,bi,bj) = 0. _d 0
Qsw1 (i,j,bi,bj) = 0. _d 0
#endif
#ifdef ATMOSPHERIC_LOADING
pLoad0 (i,j,bi,bj) = 0. _d 0
pLoad1 (i,j,bi,bj) = 0. _d 0
#endif
#endif /* EXCLUDE_FFIELDS_LOAD */
ENDDO
ENDDO
#ifndef EXCLUDE_FFIELDS_LOAD
loadedRec(bi,bj) = 0
#endif /* EXCLUDE_FFIELDS_LOAD */
#ifdef ALLOW_ADDFLUID
DO k=1,Nr
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
addMass(i,j,k,bi,bj) = 0. _d 0
ENDDO
ENDDO
ENDDO
#endif /* ALLOW_ADDFLUID */
DO k=1,Nr
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
tauLDmask(i,j,k,bi,bj) = 0. _d 0
ENDDO
ENDDO
ENDDO
#ifdef ALLOW_FRICTION_HEATING
DO k=1,Nr
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
frictionHeating(i,j,k,bi,bj) = 0. _d 0
ENDDO
ENDDO
ENDDO
#endif /* ALLOW_FRICTION_HEATING */
ENDDO
ENDDO
DO bj = myByLo(myThid), myByHi(myThid)
DO bi = myBxLo(myThid), myBxHi(myThid)
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
IF ( doThetaClimRelax .AND.
& ABS(yC(i,j,bi,bj)).LE.latBandClimRelax ) THEN
lambdaThetaClimRelax(i,j,bi,bj) = 1. _d 0/tauThetaClimRelax
ELSE
lambdaThetaClimRelax(i,j,bi,bj) = 0. _d 0
ENDIF
IF ( doSaltClimRelax .AND.
& ABS(yC(i,j,bi,bj)).LE.latBandClimRelax ) THEN
lambdaSaltClimRelax(i,j,bi,bj) = 1. _d 0/tauSaltClimRelax
ELSE
lambdaSaltClimRelax(i,j,bi,bj) = 0. _d 0
ENDIF
ENDDO
ENDDO
ENDDO
ENDDO
C- every-one waits before master thread loads from file
C this is done within IO routines => no longer needed
c _BARRIER
IF ( tauLDmaskFile .NE. ' ' ) THEN
CALL READ_FLD_XYZ_RL( tauLDmaskFile, ' ', tauLDmask, 0, myThid )
CALL EXCH_XYZ_RL( tauLDmask, myThid )
ENDIF
IF ( zonalWindFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( zonalWindFile, ' ', fu, 0, myThid )
ENDIF
IF ( meridWindFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( meridWindFile, ' ', fv, 0, myThid )
ENDIF
C IF ( tauLDmaskFile .NE. ' ' ) THEN
C CALL READ_FLD_XY_RS( tauLDmaskFile, ' ', tauLDmask, 0, myThid )
C ENDIF
IF ( surfQFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( surfQFile, ' ', Qnet, 0, myThid )
ELSEIF ( surfQnetFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( surfQnetFile, ' ', Qnet, 0, myThid )
ENDIF
IF ( EmPmRfile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( EmPmRfile, ' ', EmPmR, 0, myThid )
c IF ( convertEmP2rUnit.EQ.mass2rUnit ) THEN
C- EmPmR is now (after c59h) expressed in kg/m2/s (fresh water mass flux)
DO bj = myByLo(myThid), myByHi(myThid)
DO bi = myBxLo(myThid), myBxHi(myThid)
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
EmPmR(i,j,bi,bj) = EmPmR(i,j,bi,bj)*rhoConstFresh
ENDDO
ENDDO
ENDDO
ENDDO
c ENDIF
ENDIF
IF ( saltFluxFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( saltFluxFile, ' ', saltFlux, 0, myThid )
ENDIF
IF ( thetaClimFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( thetaClimFile, ' ', SST, 0, myThid )
ENDIF
IF ( saltClimFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( saltClimFile, ' ', SSS, 0, myThid )
ENDIF
IF ( lambdaThetaFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( lambdaThetaFile, ' ',
& lambdaThetaClimRelax, 0, myThid )
ENDIF
IF ( lambdaSaltFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( lambdaSaltFile, ' ',
& lambdaSaltClimRelax, 0, myThid )
ENDIF
#ifdef SHORTWAVE_HEATING
IF ( surfQswFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( surfQswFile, ' ', Qsw, 0, myThid )
IF ( surfQFile .NE. ' ' ) THEN
C- Qnet is now (after c54) the net Heat Flux (including SW)
DO bj = myByLo(myThid), myByHi(myThid)
DO bi = myBxLo(myThid), myBxHi(myThid)
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
Qnet(i,j,bi,bj) = Qnet(i,j,bi,bj) + Qsw(i,j,bi,bj)
ENDDO
ENDDO
ENDDO
ENDDO
ENDIF
ENDIF
#endif
#ifdef ATMOSPHERIC_LOADING
IF ( pLoadFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( pLoadFile, ' ', pLoad, 0, myThid )
ENDIF
#endif
#ifdef ALLOW_ADDFLUID
IF ( addMassFile .NE. ' ' ) THEN
CALL READ_FLD_XYZ_RL( addMassFile, ' ', addMass, 0, myThid )
CALL EXCH_XYZ_RL( addMass, myThid )
ENDIF
#endif /* ALLOW_ADDFLUID */
#ifdef ALLOW_GEOTHERMAL_FLUX
IF ( geothermalFile .NE. ' ' ) THEN
CALL READ_FLD_XY_RS( geothermalFile, ' ',
& geothermalFlux, 0, myThid )
CALL EXCH_XY_RS( geothermalFlux, myThid )
# ifdef ALLOW_MONITOR
CALL MON_PRINTSTATS_RS(
& 1,geothermalFlux,'geothermalFlux',myThid)
# endif
ENDIF
#endif /* ALLOW_GEOTHERMAL_FLUX */
CALL EXCH_UV_XY_RS( fu,fv, .TRUE., myThid )
CALL EXCH_XY_RS( Qnet , myThid )
CALL EXCH_XY_RS( EmPmR, myThid )
CALL EXCH_XY_RS( saltFlux, myThid )
CALL EXCH_XY_RS( SST , myThid )
CALL EXCH_XY_RS( SSS , myThid )
CALL EXCH_XY_RS( lambdaThetaClimRelax, myThid )
CALL EXCH_XY_RS( lambdaSaltClimRelax , myThid )
#ifdef SHORTWAVE_HEATING
CALL EXCH_XY_RS(Qsw , myThid )
#endif
#ifdef ATMOSPHERIC_LOADING
CALL EXCH_XY_RS(pLoad , myThid )
C CALL PLOT_FIELD_XYRS( pLoad, 'S/R INI_FORCING pLoad',1,myThid)
#endif
C CALL PLOT_FIELD_XYRS( fu, 'S/R INI_FORCING FU',1,myThid)
C CALL PLOT_FIELD_XYRS( fv, 'S/R INI_FORCING FV',1,myThid)
#ifdef ATMOSPHERIC_LOADING
IF ( pLoadFile .NE. ' ' .AND. usingPCoords ) THEN
C-- This is a hack used to read phi0surf from a file (pLoadFile)
C instead of computing it from bathymetry & density ref. profile.
C- Ocean: The true atmospheric P-loading is not yet implemented for P-coord
C (requires time varying dP(Nr) like dP(k-bottom) with NonLin FS).
C- Atmos: sometime usefull to overwrite phi0surf with fixed-in-time field
C read from file (and anyway, pressure loading is meaningless here)
DO bj = myByLo(myThid), myByHi(myThid)
DO bi = myBxLo(myThid), myBxHi(myThid)
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
phi0surf(i,j,bi,bj) = pLoad(i,j,bi,bj)
ENDDO
ENDDO
ENDDO
ENDDO
ENDIF
#endif /* ATMOSPHERIC_LOADING */
RETURN
END