File indexing completed on 2023-09-21 05:10:47 UTC
view on githubraw file Latest commit 96b00645 on 2023-09-20 15:15:14 UTC
5ca83cd8f7 Dani*0001 #include "STREAMICE_OPTIONS.h"
9d8b0af494 Jean*0002 #ifdef ALLOW_AUTODIFF
0003 # include "AUTODIFF_OPTIONS.h"
0004 #endif
5ca83cd8f7 Dani*0005
0006
0007
0008
73e21ff944 Jean*0009 SUBROUTINE STREAMICE_ADVECT_2DTRACER (
5ca83cd8f7 Dani*0010 & myThid,
73e21ff944 Jean*0011 & myIter,
5ca83cd8f7 Dani*0012 & time_step,
0013 & uTrans,
0014 & vTrans,
0015 & bcMaskx,
0016 & bcMasky)
0017
73e21ff944 Jean*0018
0019
5ca83cd8f7 Dani*0020
73e21ff944 Jean*0021
5ca83cd8f7 Dani*0022
73e21ff944 Jean*0023
5ca83cd8f7 Dani*0024 IMPLICIT NONE
0025
0026
0027 #include "SIZE.h"
0028 #include "GRID.h"
0029 #include "EEPARAMS.h"
0030 #include "PARAMS.h"
0031 #include "STREAMICE.h"
0032 #include "STREAMICE_ADV.h"
0033 #ifdef ALLOW_AUTODIFF_TAMC
0034 # include "tamc.h"
0035 #endif
0036
96b006450c dngo*0037 INTEGER myThid, myIter
5ca83cd8f7 Dani*0038 _RL time_step
0039 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0040 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
73e21ff944 Jean*0041 _RS bcMaskx(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0042 _RS bcMasky(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
96b006450c dngo*0043
5ca83cd8f7 Dani*0044
0045 #ifdef ALLOW_STREAMICE
0046 #ifdef ALLOW_STREAMICE_2DTRACER
0047
96b006450c dngo*0048 INTEGER i, j, bi, bj, Gi, Gj
5ca83cd8f7 Dani*0049 _RL thick_bd
0050 _RL sec_per_year, time_step_loc, MR, SMB, TMB
0051 _RL BCVALX(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0052 _RL BCVALY(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0053 _RL xtracflux(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0054 _RL ytracflux(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0055 #ifdef STREAMICE_TRACER_AB
0056 _RL GAD_trac_2dNm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0057 #endif
0058 CHARACTER*(MAX_LEN_MBUF) msgBuf
0059
0060 sec_per_year = 365.*86400.
0061
0062 time_step_loc = time_step / sec_per_year
0063
0064 PRINT *, "time_step_loc ", time_step_loc
0065
0066 DO bj=myByLo(myThid),myByHi(myThid)
0067 DO bi=myBxLo(myThid),myBxHi(myThid)
0068 DO j=1-3,sNy+3
0069 DO i=1-3,sNx+3
0070
96b006450c dngo*0071
0072
5ca83cd8f7 Dani*0073
0074 ytracflux (i,j,bi,bj) = 0. _d 0
0075 xtracflux (i,j,bi,bj) = 0. _d 0
0076 #ifdef STREAMICE_TRACER_AB
0077 GAD_trac_2dNm1(i,j,bi,bj)=GAD_trac_2d(i,j,bi,bj)
0078 GAD_trac_2d (i,j,bi,bj) = 0. _d 0
0079 #endif
0080
0081 IF (STREAMICE_ufacemask(i,j,bi,bj).eq.3.0) THEN
0082 BCVALX(i,j,bi,bj) = trac2d_ubdry_values_SI(i,j,bi,bj)
0083 ELSEIF (STREAMICE_ufacemask(i,j,bi,bj).eq.4.0) THEN
0084 BCVALX(i,j,bi,bj) = trac2d_ubdry_values_SI(i,j,bi,bj)
0085 ENDIF
0086
0087 IF (STREAMICE_vfacemask(i,j,bi,bj).eq.3.0) THEN
0088 BCVALy(i,j,bi,bj) = trac2d_vbdry_values_SI(i,j,bi,bj)
0089 ELSEIF (STREAMICE_vfacemask(i,j,bi,bj).eq.4.0) THEN
0090 BCVALy(i,j,bi,bj) = trac2d_vbdry_values_SI(i,j,bi,bj)
0091 ENDIF
0092
0093 ENDDO
0094 ENDDO
0095 ENDDO
0096 ENDDO
0097
0098 _EXCH_XY_RL(BCVALX,myThid)
0099 _EXCH_XY_RL(BCVALY,myThid)
0100
0101 #ifdef ALLOW_AUTODIFF_TAMC
0102
0103 #endif
0104
0105 CALL STREAMICE_ADV_FLUX_FL_X ( myThid ,
0106 I uTrans ,
0107 I trac2d ,
0108 I BCMASKX,
0109 I BCVALX,
0110 O xtracflux,
0111 I time_step_loc)
0112
0113 DO bj=myByLo(myThid),myByHi(myThid)
0114 DO bi=myBxLo(myThid),myBxHi(myThid)
0115 DO j=1-3,sNy+3
0116 DO i=1,sNx
0117 Gi = (myXGlobalLo-1)+(bi-1)*sNx+i
0118 Gj = (myYGlobalLo-1)+(bj-1)*sNy+j
0119 IF (((Gj .ge. 1) .and. (Gj .le. Ny))
0120 & .or.STREAMICE_NS_PERIODIC) THEN
0121
73e21ff944 Jean*0122 IF (STREAMICE_hmask(i,j,bi,bj).eq.1.0 .or.
5ca83cd8f7 Dani*0123 & STREAMICE_hmask(i,j,bi,bj).eq.2.0) THEN
0124
73e21ff944 Jean*0125 #ifdef STREAMICE_TRACER_AB
5ca83cd8f7 Dani*0126 GAD_trac_2d(i,j,bi,bj) = GAD_trac_2d(i,j,bi,bj) -
0127 #else
0128 trac2d(i,j,bi,bj) = trac2d(i,j,bi,bj) -
0129 #endif
0130 & ((xtracflux(i+1,j,bi,bj)*dyG(i+1,j,bi,bj) -
0131 & xtracflux(i,j,bi,bj)*dyG(i,j,bi,bj)) *
73e21ff944 Jean*0132 & recip_rA (i,j,bi,bj) -
0133 & trac2d(i,j,bi,bj) *
5ca83cd8f7 Dani*0134 & (utrans(i+1,j,bi,bj)*dyG(i+1,j,bi,bj)-
0135 & utrans(i,j,bi,bj)*dyG(i,j,bi,bj)) *
0136 & recip_rA(i,j,bi,bj))
73e21ff944 Jean*0137 #ifndef STREAMICE_TRACER_AB
5ca83cd8f7 Dani*0138 & * time_step_loc
0139 #endif
0140 ENDIF
0141 ENDIF
0142 ENDDO
0143 ENDDO
0144 ENDDO
0145 ENDDO
0146 _EXCH_XY_RL(utrans,myThid)
0147
0148 #ifdef ALLOW_AUTODIFF_TAMC
0149 # ifndef STREAMICE_TRACER_AB
0150
73e21ff944 Jean*0151 # endif
5ca83cd8f7 Dani*0152 #endif
0153
0154 CALL STREAMICE_ADV_FLUX_FL_Y ( myThid ,
0155 I vTrans ,
0156 I trac2d ,
0157 I BCMASKy,
0158 I BCVALy,
0159 O ytracflux,
0160 I time_step_loc)
0161
0162 DO bj=myByLo(myThid),myByHi(myThid)
0163 DO bi=myBxLo(myThid),myBxHi(myThid)
0164 DO j=1,sNy
0165 DO i=1,sNx
0166 Gi = (myXGlobalLo-1)+(bi-1)*sNx+i
0167 Gj = (myYGlobalLo-1)+(bj-1)*sNy+j
0168
73e21ff944 Jean*0169 IF (STREAMICE_hmask(i,j,bi,bj).eq.1.0 .or.
5ca83cd8f7 Dani*0170 & STREAMICE_hmask(i,j,bi,bj).eq.2.0) THEN
96b006450c dngo*0171
0172
0173
0174
0175
0176
5ca83cd8f7 Dani*0177
73e21ff944 Jean*0178 #ifdef STREAMICE_TRACER_AB
5ca83cd8f7 Dani*0179 GAD_trac_2d(i,j,bi,bj) = GAD_trac_2d(i,j,bi,bj) -
0180 #else
0181 trac2d(i,j,bi,bj) = trac2d(i,j,bi,bj) -
0182 #endif
0183 & ((ytracflux(i,j+1,bi,bj)*dxG(i,j+1,bi,bj) -
0184 & ytracflux(i,j,bi,bj)*dxG(i,j,bi,bj)) *
0185 & recip_rA (i,j,bi,bj) -
0186 & (vtrans(i,j+1,bi,bj)*dxG(i,j+1,bi,bj) -
0187 & vtrans(i,j,bi,bj)*dxG(i,j,bi,bj)) *
0188 & trac2d(i,j,bi,bj) *
0189 & recip_rA(i,j,bi,bj))
0190 #ifndef STREAMICE_TRACER_AB
0191 & * time_step_loc
0192 #endif
0193 ENDIF
0194 ENDDO
0195 ENDDO
0196 ENDDO
0197 ENDDO
0198
0199 #ifdef STREAMICE_TRACER_AB
0200
0201 DO bj=myByLo(myThid),myByHi(myThid)
0202 DO bi=myBxLo(myThid),myBxHi(myThid)
0203 DO j=1,sNy
0204 DO i=1,sNx
0205
73e21ff944 Jean*0206 trac2d(i,j,bi,bj) = trac2d(i,j,bi,bj) + time_step_loc *
5ca83cd8f7 Dani*0207 & GAD_trac_2d(i,j,bi,bj)
0208
0209 IF (myIter.eq.0) THEN
73e21ff944 Jean*0210 trac2d(i,j,bi,bj) = trac2d(i,j,bi,bj) + time_step_loc *
0211 & (.5+.01) *
5ca83cd8f7 Dani*0212 & (GAD_trac_2d(i,j,bi,bj) - GAD_trac_2dNm1(i,j,bi,bj))
0213 ENDIF
0214
0215 ENDDO
0216 ENDDO
0217 ENDDO
0218 ENDDO
0219
0220 #endif
0221
bd9e4b43de Mart*0222 _EXCH_XY_RL(trac2d, myThid)
73e21ff944 Jean*0223
5ca83cd8f7 Dani*0224 WRITE(msgBuf,'(A)') 'END STREAMICE_ADVECT_THICKNESS'
0225 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0226 & SQUEEZE_RIGHT , 1)
73e21ff944 Jean*0227
5ca83cd8f7 Dani*0228 #endif
0229 #endif
9d8b0af494 Jean*0230 RETURN
5ca83cd8f7 Dani*0231 END