File indexing completed on 2018-03-02 18:41:46 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
cf336ab6c5 Ryan*0001 #include "LAYERS_OPTIONS.h"
0002
0003
50d8304171 Ryan*0004
0005
4008d662b9 Jean*0006
cf336ab6c5 Ryan*0007
0008
50d8304171 Ryan*0009
0010 SUBROUTINE LAYERS_FILL(
0011 I df, trIdentity, fluxid,
cf336ab6c5 Ryan*0012 I kLev, nLevs, bibjFlg, biArg, bjArg, myThid )
50d8304171 Ryan*0013
0014
0015
0016
0017
0018 IMPLICIT NONE
cf336ab6c5 Ryan*0019 #include "SIZE.h"
0020 #include "EEPARAMS.h"
0021 #include "PARAMS.h"
0022 #include "GRID.h"
0023 #include "LAYERS_SIZE.h"
0024 #include "LAYERS.h"
0025
0026
0027
0028
4008d662b9 Jean*0029
cf336ab6c5 Ryan*0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
50d8304171 Ryan*0051
0052 _RL df(*)
cf336ab6c5 Ryan*0053 INTEGER trIdentity, kLev, nLevs, bibjFlg, biArg, bjArg
0054 INTEGER myThid
50d8304171 Ryan*0055 CHARACTER*(3) fluxid
cf336ab6c5 Ryan*0056
0057 #ifdef LAYERS_THERMODYNAMICS
0058
0059
0060
0061
0062 CHARACTER*(MAX_LEN_MBUF) msgBuf
0063
50d8304171 Ryan*0064 IF ((trIdentity.EQ.1).OR.(trIdentity.EQ.2)) THEN
4008d662b9 Jean*0065
50d8304171 Ryan*0066 IF (fluxid.EQ.'SUR') THEN
0067 CALL LAYERS_FILL_FIELD(df, trIdentity, 1, layers_surfflux,'M',
0068 & klev, nLevs, bibjFlg, biArg, bjArg, myThid)
0069 ELSE IF (fluxid.EQ.'DFX') THEN
0070 CALL LAYERS_FILL_FIELD(df, trIdentity, Nr, layers_dfx,'U',
0071 & kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
0072 ELSE IF (fluxid.EQ.'DFY') THEN
0073 CALL LAYERS_FILL_FIELD(df, trIdentity, Nr, layers_dfy,'V',
0074 & kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
0075 ELSE IF (fluxid.EQ.'DFR') THEN
0076 CALL LAYERS_FILL_FIELD(df, trIdentity, Nr, layers_dfr,'M',
0077 & kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
0078 ELSE IF (fluxid.EQ.'AFX') THEN
0079 CALL LAYERS_FILL_FIELD(df, trIdentity, Nr, layers_afx,'U',
0080 & kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
0081 ELSE IF (fluxid.EQ.'AFY') THEN
0082 CALL LAYERS_FILL_FIELD(df, trIdentity, Nr, layers_afy,'V',
0083 & kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
0084 ELSE IF (fluxid.EQ.'AFR') THEN
0085 CALL LAYERS_FILL_FIELD(df, trIdentity, Nr, layers_afr,'M',
6088c626b1 Jean*0086 & kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
50d8304171 Ryan*0087 ELSE IF (fluxid.EQ.'TOT') THEN
0088 CALL LAYERS_FILL_FIELD(df, trIdentity, Nr, layers_tottend,'M',
0089 & kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
cf336ab6c5 Ryan*0090 ELSE
50d8304171 Ryan*0091 WRITE(msgBuf,'(2A)')
0092 & 'S/R LAYERS_FILL: ',
0093 & 'invalid flux ID'
0094 CALL PRINT_ERROR( msgBuf, myThid )
0095 STOP 'ABNORMAL END: S/R LAYERS_FILL'
cf336ab6c5 Ryan*0096 ENDIF
6088c626b1 Jean*0097
50d8304171 Ryan*0098 ELSE
6088c626b1 Jean*0099
50d8304171 Ryan*0100
0101
6088c626b1 Jean*0102
50d8304171 Ryan*0103
0104
0105
0106
0107
0108
6088c626b1 Jean*0109
50d8304171 Ryan*0110 ENDIF
6088c626b1 Jean*0111
4008d662b9 Jean*0112 #endif /* LAYERS_THERMODYNAMICS */
50d8304171 Ryan*0113
cf336ab6c5 Ryan*0114 RETURN
0115 END
50d8304171 Ryan*0116
4008d662b9 Jean*0117
50d8304171 Ryan*0118 SUBROUTINE LAYERS_FILL_FIELD(
0119 I df, trIdentity, myNr,
0120 U layers_saved_flux,
0121 I fldType,
cf336ab6c5 Ryan*0122 I kLev, nLevs, bibjFlg, biArg, bjArg, myThid )
50d8304171 Ryan*0123
cf336ab6c5 Ryan*0124 IMPLICIT NONE
0125 #include "SIZE.h"
0126 #include "EEPARAMS.h"
0127 #include "PARAMS.h"
0128 #include "GRID.h"
0129 #include "LAYERS_SIZE.h"
0130 #include "LAYERS.h"
0131
50d8304171 Ryan*0132 INTEGER trIdentity, myNr, kLev, nLevs, bibjFlg, biArg, bjArg
0133 CHARACTER fldType
0134 _RL layers_saved_flux(1-OLx:sNx+OLx,1-OLy:sNy+OLy,
0135 & myNr,2,nSx,nSy)
0136
0137 _RL df(*)
cf336ab6c5 Ryan*0138 INTEGER myThid
0139
0140 #ifdef LAYERS_THERMODYNAMICS
0141
0142
0143
0144
50d8304171 Ryan*0145 INTEGER sizI1,sizI2,sizJ1,sizJ2
0146 INTEGER sizTx,sizTy
0147 INTEGER iRun, jRun, k, bi, bj
0148 INTEGER kFirst, kLast
0149 INTEGER kd, kd0, ksgn
0150
6088c626b1 Jean*0151
50d8304171 Ryan*0152
0153
0154 IF ( fldType.EQ.'U' ) THEN
0155 iRun = sNx+1
0156 jRun = sNy
0157 ELSEIF ( fldType.EQ.'V' ) THEN
0158 iRun = sNx
0159 jRun = sNy+1
0160 ELSE
0161 iRun = sNx
0162 jRun = sNy
0163 ENDIF
0164
0165 IF (abs(bibjFlg).EQ.3) THEN
0166 sizI1 = 1
0167 sizI2 = sNx
0168 sizJ1 = 1
0169 sizJ2 = sNy
0170 iRun = sNx
0171 jRun = sNy
0172 ELSE
0173 sizI1 = 1-OLx
0174 sizI2 = sNx+OLx
0175 sizJ1 = 1-OLy
0176 sizJ2 = sNy+OLy
0177 ENDIF
0178 IF (abs(bibjFlg).GE.2) THEN
0179 sizTx = 1
0180 sizTy = 1
0181 ELSE
0182 sizTx = nSx
0183 sizTy = nSy
0184 ENDIF
6088c626b1 Jean*0185
50d8304171 Ryan*0186
0187
0188 IF (kLev.LE.0) THEN
0189 kFirst = 1
0190 kLast = nLevs
0191 ELSEIF ( nLevs.EQ.1 ) THEN
0192 kFirst = 1
0193 kLast = 1
0194 ELSEIF ( kLev.LE.nLevs ) THEN
0195 kFirst = kLev
0196 kLast = kLev
0197 ELSE
0198 STOP 'ABNORMAL END in LAYERS_SAVE: kLev > nLevs >0'
0199 ENDIF
0200
0201
0202 IF ( kLev.EQ.-1 ) THEN
0203 ksgn = -1
0204 kd0 = 1 + nLevs
0205 ELSEIF ( kLev.EQ.0 ) THEN
0206 ksgn = 1
0207 kd0 = 0
0208 ELSE
0209 ksgn = 0
6088c626b1 Jean*0210 kd0 = kLev
50d8304171 Ryan*0211 ENDIF
4008d662b9 Jean*0212
50d8304171 Ryan*0213 IF ( bibjFlg.EQ.0 ) THEN
0214
0215 DO bj=myByLo(myThid), myByHi(myThid)
0216 DO bi=myBxLo(myThid), myBxHi(myThid)
0217 DO k = kFirst,kLast
0218 kd = kd0 + ksgn*k
0219 CALL LAYERS_CUMULATE(
0220 U layers_saved_flux(1-OLx,1-OLy,kd,trIdentity,bi,bj),
0221 I df,
0222 I sizI1,sizI2,sizJ1,sizJ2,nLevs,sizTx,sizTy,
0223 I iRun,jRun,k,bi,bj,
0224 I myThid)
cf336ab6c5 Ryan*0225 ENDDO
0226 ENDDO
50d8304171 Ryan*0227 ENDDO
0228 ELSE
0229 bi = MIN(biArg,sizTx)
0230 bj = MIN(bjArg,sizTy)
0231 DO k = kFirst,kLast
0232 kd = kd0 + ksgn*k
0233 CALL LAYERS_CUMULATE(
0234 U layers_saved_flux(1-OLx,1-OLy,kd,trIdentity,biArg,bjArg),
0235 I df,
0236 I sizI1,sizI2,sizJ1,sizJ2,nLevs,sizTx,sizTy,
0237 I iRun,jRun,k,bi,bj,
0238 I myThid)
0239 ENDDO
cf336ab6c5 Ryan*0240 ENDIF
50d8304171 Ryan*0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
6088c626b1 Jean*0274
50d8304171 Ryan*0275
cf336ab6c5 Ryan*0276 #endif /* LAYERS_THERMODYNAMICS */
0277
0278 RETURN
0279 END
50d8304171 Ryan*0280
cf336ab6c5 Ryan*0281
50d8304171 Ryan*0282 SUBROUTINE LAYERS_CUMULATE(
0283 U cumFld,
0284 I inpFld,
0285 I sizI1,sizI2,sizJ1,sizJ2,sizK,sizTx,sizTy,
0286 I iRun,jRun,k,bi,bj,
0287 I myThid )
cf336ab6c5 Ryan*0288
50d8304171 Ryan*0289
0290
0291
0292
cf336ab6c5 Ryan*0293
50d8304171 Ryan*0294
0295 IMPLICIT NONE
cf336ab6c5 Ryan*0296
50d8304171 Ryan*0297 #include "EEPARAMS.h"
0298 #include "SIZE.h"
cf336ab6c5 Ryan*0299
50d8304171 Ryan*0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311 _RL cumFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0312 INTEGER sizI1,sizI2,sizJ1,sizJ2
0313 INTEGER sizK,sizTx,sizTy
0314 _RL inpFld(sizI1:sizI2,sizJ1:sizJ2,sizK,sizTx,sizTy)
0315 INTEGER iRun, jRun, k, bi, bj
0316 INTEGER myThid
0317
4008d662b9 Jean*0318
50d8304171 Ryan*0319
0320
0321 INTEGER i, j
0322
cf336ab6c5 Ryan*0323
50d8304171 Ryan*0324
cf336ab6c5 Ryan*0325
50d8304171 Ryan*0326 DO j = 1,jRun
0327 DO i = 1,iRun
0328 cumFld(i,j) = cumFld(i,j) + inpFld(i,j,k,bi,bj)
0329 ENDDO
0330 ENDDO
cf336ab6c5 Ryan*0331
0332 RETURN
0333 END
50d8304171 Ryan*0334