File indexing completed on 2018-03-02 18:37:22 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
65007c221b Jean*0001 #include "AIM_OPTIONS.h"
0002
2a80e4d00e Jean*0003
0004
0005
d0a9461855 Jean*0006 SUBROUTINE AIM_SURF_BC(
0007 U tYear,
0008 O aim_sWght0, aim_sWght1,
0009 I bi, bj, myTime, myIter, myThid )
2a80e4d00e Jean*0010
0011
65007c221b Jean*0012
0013
d0a9461855 Jean*0014
65007c221b Jean*0015
0016
0017
0018
0019
d0a9461855 Jean*0020
65007c221b Jean*0021
0022
2a80e4d00e Jean*0023
0024
0025
65007c221b Jean*0026 IMPLICIT NONE
0027
0028
0029
0030 #include "AIM_SIZE.h"
0031
0032
0033 #include "EEPARAMS.h"
0034 #include "PARAMS.h"
72b4e12f25 Dani*0035 #include "GRID.h"
6fb2765f24 Jean*0036
65007c221b Jean*0037
0038
0039
a27dd2281d Jean*0040 #include "AIM_PARAMS.h"
65007c221b Jean*0041 #include "AIM_FFIELDS.h"
0042
0043 #include "com_forcon.h"
0044 #include "com_forcing.h"
0045
4c105e462e Davi*0046 #include "AIM_CO2.h"
65007c221b Jean*0047
e19eef4074 Jean*0048
0049 #ifdef COMPONENT_MODULE
0050 #include "CPL_PARAMS.h"
0051 #include "ATMCPL.h"
0052 #endif
0053
2a80e4d00e Jean*0054
65007c221b Jean*0055
d0a9461855 Jean*0056
0057
0058
0059
0060
0061
0062
0063 _RL tYear
0064 _RL aim_sWght0, aim_sWght1
0065 INTEGER bi, bj
0066 _RL myTime
0067 INTEGER myIter, myThid
2a80e4d00e Jean*0068
65007c221b Jean*0069
0070 #ifdef ALLOW_AIM
2a80e4d00e Jean*0071
0072
0073
0074
0075
0076
0077
0078 _RL oice1(NGP)
0079 _RL snow1(NGP)
0080
65007c221b Jean*0081
d0a9461855 Jean*0082
0083 INTEGER i,j,I2,k, nm0
0084 _RL t0prd, tNcyc, tmprd, dTprd
65007c221b Jean*0085 _RL SDEP1, IDEP2, SDEP2, SWWIL2, RSW, soilw_0, soilw_1
72b4e12f25 Dani*0086 _RL RSD, alb_land, oceTfreez, ALBSEA1, ALPHA, CZEN, CZEN2
972eaa29a0 Dani*0087 _RL RZEN, ZS, ZC, SJ, CJ, TMPA, TMPB, TMPL, hlim
b3097ed02d Jean*0088
2a80e4d00e Jean*0089 #ifdef ALLOW_AIM_CO2
870deba1f6 Davi*0090 #ifdef ALLOW_DIAGNOSTICS
fb7fcd6036 Davi*0091 _RL pCO2scl
870deba1f6 Davi*0092 #endif
2a80e4d00e Jean*0093 #endif /* ALLOW_AIM_CO2 */
65007c221b Jean*0094
4b996cbf32 Jean*0095
0096
0097 DO j=1,sNy
0098 DO i=1,sNx
0099 I2 = i+(j-1)*sNx
0100 fMask1(I2,1,myThid) = aim_landFr(i,j,bi,bj)
0101 ENDDO
0102 ENDDO
0103
65007c221b Jean*0104 IF (aim_useFMsurfBC) THEN
0105
0106
d0a9461855 Jean*0107
0108
0109
0110
0111
0112
0113
0114
0115 t0prd = myTime / aim_surfForc_TimePeriod
0116 tNcyc = aim_surfForc_NppCycle
0117 tmprd = t0prd - 0.5 _d 0 + tNcyc
0118 tmprd = MOD(tmprd,tNcyc)
0119
0120 nm0 = 1 + INT(tmprd)
0121
0122
0123 dTprd = tmprd - (nm0 - 1)
0124 aim_sWght1 = 0.5 _d 0+(dTprd-0.5 _d 0)*aim_surfForc_TransRatio
0125 aim_sWght1 = MAX( 0. _d 0, MIN(1. _d 0, aim_sWght1) )
0126 aim_sWght0 = 1. _d 0 - aim_sWght1
0127
65007c221b Jean*0128
0129
4b996cbf32 Jean*0130
0131
0132
0133
0134
65007c221b Jean*0135
d0a9461855 Jean*0136
65007c221b Jean*0137 DO j=1,sNy
0138 DO i=1,sNx
0139 I2 = i+(j-1)*sNx
d0a9461855 Jean*0140 sst1(I2,myThid) = aim_sWght0*aim_sst0(i,j,bi,bj)
65007c221b Jean*0141 & + aim_sWght1*aim_sst1(i,j,bi,bj)
0142 stl1(I2,myThid) = aim_sWght0*aim_lst0(i,j,bi,bj)
0143 & + aim_sWght1*aim_lst1(i,j,bi,bj)
0144 ENDDO
0145 ENDDO
0146
0147
0148 SDEP1 = 70. _d 0
0149 IDEP2 = 3. _d 0
0150 SDEP2 = IDEP2*SDEP1
0151
0152 SWWIL2= SDEP2*SWWIL
0153 RSW = 1. _d 0/(SDEP1*SWCAP+SDEP2*(SWCAP-SWWIL))
d0a9461855 Jean*0154
65007c221b Jean*0155 DO j=1,sNy
0156 DO i=1,sNx
0157 I2 = i+(j-1)*sNx
d0a9461855 Jean*0158 soilw_0 = ( aim_sw10(i,j,bi,bj)
65007c221b Jean*0159 & +aim_veget(i,j,bi,bj)*
0160 & MAX(IDEP2*aim_sw20(i,j,bi,bj)-SWWIL2, 0. _d 0)
d0a9461855 Jean*0161 & )*RSW
0162 soilw_1 = ( aim_sw11(i,j,bi,bj)
65007c221b Jean*0163 & +aim_veget(i,j,bi,bj)*
0164 & MAX(IDEP2*aim_sw21(i,j,bi,bj)-SWWIL2, 0. _d 0)
d0a9461855 Jean*0165 & )*RSW
0166 soilw1(I2,myThid) = aim_sWght0*soilw_0
65007c221b Jean*0167 & + aim_sWght1*soilw_1
0168 soilw1(I2,myThid) = MIN(1. _d 0, soilw1(I2,myThid) )
0169 ENDDO
0170 ENDDO
0171
0172
0173 DO j=1,sNy
0174 DO i=1,sNx
0175 I2 = i+(j-1)*sNx
0176 snow1(I2) = aim_sWght0*aim_snw0(i,j,bi,bj)
d0a9461855 Jean*0177 & + aim_sWght1*aim_snw1(i,j,bi,bj)
65007c221b Jean*0178 oice1(I2) = aim_sWght0*aim_oic0(i,j,bi,bj)
d0a9461855 Jean*0179 & + aim_sWght1*aim_oic1(i,j,bi,bj)
65007c221b Jean*0180 ENDDO
0181 ENDDO
0182
b3097ed02d Jean*0183 IF (aim_splitSIOsFx) THEN
0184
cdcb187d4c Jean*0185
0186 oceTfreez = celsius2K - 1.9 _d 0
b3097ed02d Jean*0187 DO J=1,NGP
d0a9461855 Jean*0188 sti1(J,myThid) = sst1(J,myThid)
b3097ed02d Jean*0189 IF ( oice1(J) .GT. 1. _d -2 ) THEN
5ef3ea4448 Ed H*0190 sst1(J,myThid) = MAX(sst1(J,myThid),oceTfreez)
d0a9461855 Jean*0191 sti1(J,myThid) = sst1(J,myThid)
b3097ed02d Jean*0192 & +(sti1(J,myThid)-sst1(J,myThid))/oice1(J)
0193 ELSE
0194 oice1(J) = 0. _d 0
0195 ENDIF
0196 ENDDO
0197 ELSE
0198 DO J=1,NGP
d0a9461855 Jean*0199 sti1(J,myThid) = sst1(J,myThid)
b3097ed02d Jean*0200 ENDDO
0201 ENDIF
0202
65007c221b Jean*0203
b3097ed02d Jean*0204
65007c221b Jean*0205 RSD=1. _d 0/SDALB
972eaa29a0 Dani*0206 ALPHA= 2. _d 0*PI*(TYEAR+10. _d 0/365. _d 0)
6fb2765f24 Jean*0207 #ifdef ALLOW_INSOLATION
7f98c35e47 Davi*0208 ZS = - SIN(OBLIQ * deg2rad) * COS(ALPHA)
0209 ZC = ASIN( ZS )
0210 ZC = COS(ZC)
6fb2765f24 Jean*0211 #else /* ALLOW_INSOLATION */
0212 RZEN = COS(ALPHA) * ( -23.45 _d 0 * deg2rad)
0213 ZC = COS(RZEN)
0214 ZS = SIN(RZEN)
0215 #endif /* ALLOW_INSOLATION */
65007c221b Jean*0216 DO j=1,sNy
0217 DO i=1,sNx
0218
0219
0220
0221
0222 I2 = i+(j-1)*sNx
0223 alb_land = aim_albedo(i,j,bi,bj)
0224 & + MAX( 0. _d 0, ALBSN-aim_albedo(i,j,bi,bj) )
0225 & *MIN( 1. _d 0, RSD*snow1(I2))
b3097ed02d Jean*0226
d0a9461855 Jean*0227
b3097ed02d Jean*0228
72b4e12f25 Dani*0229 ALBSEA1 = ALBSEA
0230 IF ( aim_selectOceAlbedo .EQ. 1) THEN
0231 SJ = SIN(yC(i,j,bi,bj) * deg2rad)
972eaa29a0 Dani*0232 CJ = COS(yC(i,j,bi,bj) * deg2rad)
72b4e12f25 Dani*0233 TMPA = SJ*ZS
972eaa29a0 Dani*0234 TMPB = CJ*ZC
72b4e12f25 Dani*0235 TMPL = -TMPA/TMPB
972eaa29a0 Dani*0236 IF (TMPL .GE. 1.0 _d 0) THEN
72b4e12f25 Dani*0237 CZEN = 0.0 _d 0
972eaa29a0 Dani*0238 ELSEIF (TMPL .LE. -1.0 _d 0) THEN
72b4e12f25 Dani*0239 CZEN = (2.0 _d 0)*TMPA*PI
972eaa29a0 Dani*0240 CZEN2= PI*((2.0 _d 0)*TMPA*TMPA + TMPB*TMPB)
72b4e12f25 Dani*0241 CZEN = CZEN2/CZEN
0242 ELSE
972eaa29a0 Dani*0243 hlim = ACOS(TMPL)
0244 CZEN = 2.0 _d 0*(TMPA*hlim + TMPB*SIN(hlim))
0245 CZEN2= 2.0 _d 0*TMPA*TMPA*hlim
0246 & + 4.0 _d 0*TMPA*TMPB*SIN(hlim)
0247 & + TMPB*TMPB*( hlim + 0.5 _d 0*SIN(2.0 _d 0*hlim) )
72b4e12f25 Dani*0248 CZEN = CZEN2/CZEN
0249 ENDIF
0250 ALBSEA1 = ( ( 2.6 _d 0 / (CZEN**(1.7 _d 0) + 0.065 _d 0) )
0251 & + ( 15. _d 0 * (CZEN-0.1 _d 0) * (CZEN-0.5 _d 0)
0252 & * (CZEN-1.0 _d 0) ) ) / 100.0 _d 0
0253 ENDIF
b3097ed02d Jean*0254 alb1(I2,1,myThid) = alb_land
72b4e12f25 Dani*0255
2a80e4d00e Jean*0256 alb1(I2,2,myThid) = 0.5 _d 0 * ALBSEA
72b4e12f25 Dani*0257 & + 0.5 _d 0 * ALBSEA1
b3097ed02d Jean*0258 alb1(I2,3,myThid) = ALBICE
65007c221b Jean*0259 ENDDO
0260 ENDDO
0261
0262
0263 ELSE
0264
0265
d0a9461855 Jean*0266
0267
0268 aim_sWght1 = 0. _d 0
0269 aim_sWght0 = 1. _d 0
0270
65007c221b Jean*0271
0272
0273
0274
0275
d0a9461855 Jean*0276
65007c221b Jean*0277
0278
0279 IF (aim_useMMsurfFc) THEN
0280 DO j=1,sNy
0281 DO i=1,sNx
0282 I2 = i+(j-1)*sNx
b3097ed02d Jean*0283 alb1(I2,1,myThid) = aim_albedo(i,j,bi,bj)
0284 alb1(I2,2,myThid) = aim_albedo(i,j,bi,bj)
0285 alb1(I2,3,myThid) = aim_albedo(i,j,bi,bj)
65007c221b Jean*0286 ENDDO
0287 ENDDO
0288 ELSE
0289 DO j=1,sNy
0290 DO i=1,sNx
0291 I2 = i+(j-1)*sNx
b3097ed02d Jean*0292 alb1(I2,1,myThid) = 0.
0293 alb1(I2,2,myThid) = 0.
0294 alb1(I2,3,myThid) = 0.
65007c221b Jean*0295 ENDDO
0296 ENDDO
0297 ENDIF
0298
0299 IF (aim_useMMsurfFc) THEN
0300 DO j=1,sNy
0301 DO i=1,sNx
0302 I2 = i+(j-1)*sNx
d0a9461855 Jean*0303 sst1(I2,myThid) = aim_sst0(i,j,bi,bj)
0304 stl1(I2,myThid) = aim_sst0(i,j,bi,bj)
0305 sti1(I2,myThid) = aim_sst0(i,j,bi,bj)
65007c221b Jean*0306 ENDDO
0307 ENDDO
0308 ELSE
0309 DO j=1,sNy
0310 DO i=1,sNx
0311 I2 = i+(j-1)*sNx
0312 sst1(I2,myThid) = 300.
0313 stl1(I2,myThid) = 300.
b3097ed02d Jean*0314 sti1(I2,myThid) = 300.
65007c221b Jean*0315 ENDDO
0316 ENDDO
0317 ENDIF
0318
d0a9461855 Jean*0319
65007c221b Jean*0320 IF (aim_useMMsurfFc) THEN
0321 DO j=1,sNy
0322 DO i=1,sNx
0323 I2 = i+(j-1)*sNx
d0a9461855 Jean*0324 soilw1(I2,myThid) = aim_sw10(i,j,bi,bj)
65007c221b Jean*0325 ENDDO
0326 ENDDO
0327 ELSE
0328 DO j=1,sNy
0329 DO i=1,sNx
0330 I2 = i+(j-1)*sNx
0331 soilw1(I2,myThid) = 0.
0332 ENDDO
0333 ENDDO
0334 ENDIF
0335
d0a9461855 Jean*0336
65007c221b Jean*0337
b3097ed02d Jean*0338 DO j=1,sNy
0339 DO i=1,sNx
0340 I2 = i+(j-1)*sNx
0341 oice1(I2) = 0.
0342 snow1(I2) = 0.
0343 ENDDO
0344 ENDDO
65007c221b Jean*0345
0346
0347 ENDIF
0348
e19eef4074 Jean*0349 #ifdef COMPONENT_MODULE
0350 IF ( useCoupler ) THEN
d0a9461855 Jean*0351
97ecf03a3f Jean*0352
0353 CALL ATM_APPLY_IMPORT(
0354 I aim_landFr,
d0a9461855 Jean*0355 U sst1(1,myThid), oice1,
0356 I myTime, myIter, bi, bj, myThid )
e19eef4074 Jean*0357 ENDIF
870deba1f6 Davi*0358 #endif /* COMPONENT_MODULE */
4c105e462e Davi*0359
0360 #ifdef ALLOW_AIM_CO2
2b1795828b Jean*0361 DO j=1-OLy,sNy+OLy
0362 DO i=1-OLx,sNx+OLx
0363 aim_CO2(i,j,bi,bj)= atm_pCO2
4c105e462e Davi*0364 ENDDO
2a80e4d00e Jean*0365 ENDDO
870deba1f6 Davi*0366 #ifdef ALLOW_DIAGNOSTICS
fb7fcd6036 Davi*0367 IF ( useDiagnostics ) THEN
0368 pCO2scl = 1. _d 6
2b1795828b Jean*0369 CALL DIAGNOSTICS_SCALE_FILL( aim_CO2(1-OLx,1-OLy,bi,bj),
0370 & pCO2scl, 1, 'aim_pCO2', 1, 1, 2, bi, bj, myThid )
4c105e462e Davi*0371 ENDIF
870deba1f6 Davi*0372 #endif /* ALLOW_DIAGNOSTICS */
2a80e4d00e Jean*0373 #endif /* ALLOW_AIM_CO2 */
4c105e462e Davi*0374
a27dd2281d Jean*0375 #ifdef ALLOW_LAND
0376 IF (useLand) THEN
0377
d0a9461855 Jean*0378 CALL AIM_LAND2AIM(
b3097ed02d Jean*0379 I aim_landFr, aim_veget, aim_albedo, snow1,
d0a9461855 Jean*0380 U stl1(1,myThid), soilw1(1,myThid), alb1(1,1,myThid),
0381 I myTime, myIter, bi, bj, myThid )
a27dd2281d Jean*0382 ENDIF
0383 #endif /* ALLOW_LAND */
0384
cdcb187d4c Jean*0385 #ifdef ALLOW_THSICE
0386 IF (useThSIce) THEN
0387
d0a9461855 Jean*0388 CALL AIM_SICE2AIM(
97ecf03a3f Jean*0389 I aim_landFr,
d0a9461855 Jean*0390 U sst1(1,myThid), oice1,
0391 O sti1(1,myThid), alb1(1,3,myThid),
0392 I myTime, myIter, bi, bj, myThid )
cdcb187d4c Jean*0393 ENDIF
0394 #endif /* ALLOW_THSICE */
0395
b3097ed02d Jean*0396
0397 DO J=1,NGP
0398 fMask1(J,3,myThid) =(1. _d 0 - fMask1(J,1,myThid))
0399 & *oice1(J)
d0a9461855 Jean*0400 fMask1(J,2,myThid) = 1. _d 0 - fMask1(J,1,myThid)
b3097ed02d Jean*0401 & - fMask1(J,3,myThid)
0402 ENDDO
0403
0404
0405 DO J=1,NGP
0406 alb1(J,0,myThid) = fMask1(J,1,myThid)*alb1(J,1,myThid)
0407 & + fMask1(J,2,myThid)*alb1(J,2,myThid)
0408 & + fMask1(J,3,myThid)*alb1(J,3,myThid)
0409 ENDDO
0410
e749d70ece Jean*0411
0412 DO k=1,3
0413 DO J=1,NGP
0414 dTsurf(J,k,myThid) = 0.
0415 ENDDO
0416 ENDDO
0417
b3097ed02d Jean*0418 IF (.NOT.aim_splitSIOsFx) THEN
0419 DO J=1,NGP
0420 fMask1(J,3,myThid) = 0. _d 0
d0a9461855 Jean*0421 fMask1(J,2,myThid) = 1. _d 0 - fMask1(J,1,myThid)
b3097ed02d Jean*0422 ENDDO
0423 ENDIF
0424
65007c221b Jean*0425 #endif /* ALLOW_AIM */
0426
0427 RETURN
0428 END