File indexing completed on 2018-03-02 18:37:20 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
65007c221b Jean*0001 #include "AIM_OPTIONS.h"
f9646b12d5 Jean*0002
65007c221b Jean*0003
f9646b12d5 Jean*0004 SUBROUTINE AIM_FIELDS_LOAD(
0005 I myTime, myIter, myThid )
65007c221b Jean*0006
0007
0008
0009
0010
0011
0012
0013
f9646b12d5 Jean*0014
65007c221b Jean*0015
0016
0017
0018
40eed150a6 Jean*0019
0020
65007c221b Jean*0021
0022 IMPLICIT NONE
f9646b12d5 Jean*0023
65007c221b Jean*0024
0025 #include "SIZE.h"
0026 #include "EEPARAMS.h"
0027 #include "PARAMS.h"
0028 #include "GRID.h"
0029 #include "AIM_PARAMS.h"
0030
0031 #include "AIM_FFIELDS.h"
f9646b12d5 Jean*0032
65007c221b Jean*0033
e71a2c0f64 Jean*0034
0035
0036
65007c221b Jean*0037 _RL myTime
0038 INTEGER myIter
e71a2c0f64 Jean*0039 INTEGER myThid
65007c221b Jean*0040
f9646b12d5 Jean*0041
65007c221b Jean*0042
0043
0044 #ifdef ALLOW_AIM
0045
d0a9461855 Jean*0046
0047
0048
65007c221b Jean*0049
d0a9461855 Jean*0050
65007c221b Jean*0051
d0a9461855 Jean*0052
0053
65007c221b Jean*0054 INTEGER bi,bj, i, j
d0a9461855 Jean*0055 INTEGER mnthIndex
65007c221b Jean*0056 INTEGER prevMnthIndex
f9646b12d5 Jean*0057 COMMON / LOCAL_AIM_FIELDS_LOAD / prevMnthIndex
d0a9461855 Jean*0058
0059 LOGICAL loadNewData
65007c221b Jean*0060
0061 CHARACTER*(MAX_LEN_FNAM) fNam
0062 CHARACTER*3 mnthNam(12)
0063 DATA mnthNam /
0064 & 'jan', 'feb', 'mar', 'apr', 'may', 'jun',
0065 & 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' /
0066 SAVE mnthNam
0067
d0a9461855 Jean*0068 INTEGER nm0, nm1, nm2, nm3
0069 _RL t0prd, tNcyc, tmprd
0070
0071
0072
0073
0074
0075
0076 t0prd = myTime / aim_surfForc_TimePeriod
0077 tNcyc = aim_surfForc_NppCycle
0078
0079 IF (aim_useMMsurfFc) THEN
0080
0081 tmprd = MOD(t0prd,tNcyc)
0082 mnthIndex = 1 + INT(tmprd)
0083 ELSEIF (aim_useFMsurfBC) THEN
0084 tmprd = t0prd - 0.5 _d 0 + tNcyc
0085 tmprd = MOD(tmprd,tNcyc)
0086
0087 nm0 = 1 + INT(tmprd)
0088 nm1 = 1 + MOD(nm0,aim_surfForc_NppCycle)
0089 mnthIndex = nm0
0090 ELSE
0091 RETURN
0092 ENDIF
65007c221b Jean*0093
d0a9461855 Jean*0094
0095 IF ( myIter.EQ.nIter0 ) THEN
0096 loadNewData = .TRUE.
0097 ELSE
0098 IF ( mnthIndex .NE. prevMnthIndex ) THEN
0099
0100 loadNewData = .TRUE.
0101 ELSE
0102 loadNewData = .FALSE.
0103 ENDIF
0104 ENDIF
f9646b12d5 Jean*0105
40eed150a6 Jean*0106
0107
0108
65007c221b Jean*0109 IF (aim_useMMsurfFc) THEN
0110
0111
0112
d0a9461855 Jean*0113 IF ( loadNewData ) THEN
65007c221b Jean*0114
0115
40eed150a6 Jean*0116
0117
0118 _BARRIER
65007c221b Jean*0119 _BEGIN_MASTER( myThid )
0120 prevMnthIndex = mnthIndex
f9646b12d5 Jean*0121 _END_MASTER( myThid )
0122
65007c221b Jean*0123
0124 WRITE(fNam,'(A,A,A)' ) 'salb.',
0125 & mnthNam(mnthIndex), aim_MMsufx(1:aim_MMsufxLength)
d0a9461855 Jean*0126 CALL READ_REC_XY_RS( fNam, aim_albedo, 1, myIter, myThid )
65007c221b Jean*0127
0128
f9646b12d5 Jean*0129 IF (aim_surfPotTemp) THEN
0130 WRITE(fNam,'(A,A,A)' )'stheta.',
65007c221b Jean*0131 & mnthNam(mnthIndex), aim_MMsufx(1:aim_MMsufxLength)
f9646b12d5 Jean*0132 ELSE
0133 WRITE(fNam,'(A,A,A)' )'sTemp.',
65007c221b Jean*0134 & mnthNam(mnthIndex), aim_MMsufx(1:aim_MMsufxLength)
f9646b12d5 Jean*0135 ENDIF
d0a9461855 Jean*0136 CALL READ_REC_XY_RS( fNam, aim_sst0, 1, myIter, myThid )
65007c221b Jean*0137
f9646b12d5 Jean*0138
65007c221b Jean*0139 WRITE(fNam,'(A,A,A)' ) 'smoist.',
0140 & mnthNam(mnthIndex), aim_MMsufx(1:aim_MMsufxLength)
d0a9461855 Jean*0141 CALL READ_REC_XY_RS( fNam, aim_sw10, 1, myIter, myThid )
f9646b12d5 Jean*0142
65007c221b Jean*0143
0144
0145
0146
0147
f9646b12d5 Jean*0148
65007c221b Jean*0149
0150
f9646b12d5 Jean*0151 DO bj = myByLo(myThid), myByHi(myThid)
0152 DO bi = myBxLo(myThid), myBxHi(myThid)
65007c221b Jean*0153
0154
60bdc7bf26 Alis*0155
65007c221b Jean*0156 DO j=1,sNy
0157 DO i=1,sNx
0158 aim_albedo(I,J,bi,bj) = aim_albedo(I,J,bi,bj)/100.
0159 ENDDO
0160 ENDDO
0161
0162
0163
0164
d0a9461855 Jean*0165
65007c221b Jean*0166
0167
0168
f9646b12d5 Jean*0169
0170
65007c221b Jean*0171
0172 DO j=1,sNy
0173 DO i=1,sNx
0174
d0a9461855 Jean*0175 aim_sst0(i,j,bi,bj) = aim_sst0(i,j,bi,bj)
0176 & * truncSurfP(i,j,bi,bj)
65007c221b Jean*0177 ENDDO
0178 ENDDO
0179
0180
0181 ENDDO
0182 ENDDO
0183
f9646b12d5 Jean*0184 IF (myIter.EQ.nIter0) THEN
e71a2c0f64 Jean*0185 CALL WRITE_FLD_XY_RS( 'aim_Tsurf',' ', aim_sst0, 0, myThid )
f9646b12d5 Jean*0186 ENDIF
65007c221b Jean*0187
0188
0189 ENDIF
0190
0191 ELSEIF (aim_useFMsurfBC) THEN
0192
0193
f9646b12d5 Jean*0194
65007c221b Jean*0195
0196
f9646b12d5 Jean*0197 IF ( myIter.EQ.nIter0 ) THEN
65007c221b Jean*0198 DO bj = myByLo(myThid), myByHi(myThid)
f9646b12d5 Jean*0199 DO bi = myBxLo(myThid), myBxHi(myThid)
65007c221b Jean*0200 DO j=1-Oly,sNy+Oly
0201 DO i=1-Olx,sNx+Olx
f9646b12d5 Jean*0202
0203 aim_albedo(i,j,bi,bj)= 0.
0204 aim_veget(i,j,bi,bj) = 0.
65007c221b Jean*0205 aim_sst0(i,j,bi,bj) =300.
0206 aim_lst0(i,j,bi,bj) =300.
0207 aim_oic0(i,j,bi,bj) = 0.
0208 aim_snw0(i,j,bi,bj) = 0.
0209 aim_sw10(i,j,bi,bj) = 0.
0210 aim_sw20(i,j,bi,bj) = 0.
5e328a6c4a Davi*0211 aim_qfx0(i,j,bi,bj) = 0.
65007c221b Jean*0212 aim_sst1(i,j,bi,bj) =300.
0213 aim_lst1(i,j,bi,bj) =300.
0214 aim_oic1(i,j,bi,bj) = 0.
0215 aim_snw1(i,j,bi,bj) = 0.
0216 aim_sw11(i,j,bi,bj) = 0.
0217 aim_sw21(i,j,bi,bj) = 0.
5e328a6c4a Davi*0218 aim_qfx1(i,j,bi,bj) = 0.
65007c221b Jean*0219 ENDDO
0220 ENDDO
0221 ENDDO
0222 ENDDO
0223 ENDIF
0224
40eed150a6 Jean*0225
0226
d0a9461855 Jean*0227 IF ( loadNewData ) THEN
65007c221b Jean*0228
0229
40eed150a6 Jean*0230
0231
0232 _BARRIER
d0a9461855 Jean*0233 _BEGIN_MASTER( myThid )
0234 prevMnthIndex = mnthIndex
f9646b12d5 Jean*0235 _END_MASTER( myThid )
65007c221b Jean*0236
f9646b12d5 Jean*0237 IF ( myIter.EQ.nIter0 ) THEN
0238
65007c221b Jean*0239
f9646b12d5 Jean*0240
4b996cbf32 Jean*0241
0242
f9646b12d5 Jean*0243 IF ( aim_albFile .NE. ' ' ) THEN
65007c221b Jean*0244 CALL READ_REC_XY_RS(aim_albFile,aim_albedo, 1,myIter,myThid)
0245 ENDIF
0246
f9646b12d5 Jean*0247 IF ( aim_vegFile .NE. ' ' ) THEN
65007c221b Jean*0248 CALL READ_REC_XY_RS(aim_vegFile,aim_veget,1,myIter,myThid)
0249 ENDIF
0250
f9646b12d5 Jean*0251
65007c221b Jean*0252 ENDIF
0253
f9646b12d5 Jean*0254 IF ( aim_sstFile .NE. ' ' ) THEN
65007c221b Jean*0255 CALL READ_REC_XY_RS(aim_sstFile,aim_sst0,nm0,myIter,myThid)
0256 CALL READ_REC_XY_RS(aim_sstFile,aim_sst1,nm1,myIter,myThid)
f9646b12d5 Jean*0257 ENDIF
0258 IF ( aim_lstFile .NE. ' ' ) THEN
65007c221b Jean*0259 CALL READ_REC_XY_RS(aim_lstFile,aim_lst0,nm0,myIter,myThid)
0260 CALL READ_REC_XY_RS(aim_lstFile,aim_lst1,nm1,myIter,myThid)
f9646b12d5 Jean*0261 ENDIF
0262 IF ( aim_oiceFile .NE. ' ' ) THEN
65007c221b Jean*0263 CALL READ_REC_XY_RS(aim_oiceFile,aim_oic0,nm0,myIter,myThid)
0264 CALL READ_REC_XY_RS(aim_oiceFile,aim_oic1,nm1,myIter,myThid)
f9646b12d5 Jean*0265 ENDIF
0266 IF ( aim_snowFile .NE. ' ' ) THEN
65007c221b Jean*0267 CALL READ_REC_XY_RS(aim_snowFile,aim_snw0,nm0,myIter,myThid)
0268 CALL READ_REC_XY_RS(aim_snowFile,aim_snw1,nm1,myIter,myThid)
f9646b12d5 Jean*0269 ENDIF
0270 IF ( aim_swcFile .NE. ' ' ) THEN
65007c221b Jean*0271 CALL READ_REC_XY_RS(aim_swcFile,aim_sw10,nm0,myIter,myThid)
0272 CALL READ_REC_XY_RS(aim_swcFile,aim_sw11,nm1,myIter,myThid)
0273 nm2 = nm0 + aim_surfForc_NppCycle
0274 nm3 = nm1 + aim_surfForc_NppCycle
0275 CALL READ_REC_XY_RS(aim_swcFile,aim_sw20,nm2,myIter,myThid)
0276 CALL READ_REC_XY_RS(aim_swcFile,aim_sw21,nm3,myIter,myThid)
f9646b12d5 Jean*0277 ENDIF
5e328a6c4a Davi*0278 IF ( aim_qfxFile .NE. ' ' ) THEN
0279 CALL READ_REC_XY_RS(aim_qfxFile,aim_qfx0,nm0,myIter,myThid)
0280 CALL READ_REC_XY_RS(aim_qfxFile,aim_qfx1,nm1,myIter,myThid)
0281 ENDIF
f9646b12d5 Jean*0282
65007c221b Jean*0283
0284
f9646b12d5 Jean*0285 DO bj = myByLo(myThid), myByHi(myThid)
0286 DO bi = myBxLo(myThid), myBxHi(myThid)
65007c221b Jean*0287
f9646b12d5 Jean*0288 IF ( myIter.EQ.nIter0 ) THEN
0289
0290
0291 DO j=1,sNy
0292 DO i=1,sNx
0293 aim_albedo(i,j,bi,bj) = aim_albedo(I,J,bi,bj)/100. _d 0
0294 ENDDO
0295 ENDDO
0296
0297
0298
65007c221b Jean*0299 DO j=1,sNy
0300 DO i=1,sNx
f9646b12d5 Jean*0301 aim_veget(i,j,bi,bj) =
0302 & MAX(0. _d 0, aim_veget(i,j,bi,bj)/100. _d 0)
0303 ENDDO
0304 ENDDO
0305
0306 ENDIF
0307
0308
0309
0310 DO j=1,sNy
0311 DO i=1,sNx
65007c221b Jean*0312
0313 aim_lst0(i,j,bi,bj) = aim_lst0(i,j,bi,bj)
d0a9461855 Jean*0314 & * truncSurfP(i,j,bi,bj)
65007c221b Jean*0315 aim_lst1(i,j,bi,bj) = aim_lst1(i,j,bi,bj)
d0a9461855 Jean*0316 & * truncSurfP(i,j,bi,bj)
65007c221b Jean*0317 ENDDO
0318 ENDDO
f9646b12d5 Jean*0319
0320
65007c221b Jean*0321 ENDDO
f9646b12d5 Jean*0322 ENDDO
65007c221b Jean*0323
f9646b12d5 Jean*0324
65007c221b Jean*0325 ENDIF
0326
0327 ENDIF
0328
0329 #endif /* ALLOW_AIM */
0330
f9646b12d5 Jean*0331 RETURN
65007c221b Jean*0332 END