/[MITgcm]/MITgcm_contrib/torge/itd/code/seaice_advdiff.F
ViewVC logotype

Diff of /MITgcm_contrib/torge/itd/code/seaice_advdiff.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by dimitri, Fri Apr 27 22:22:17 2012 UTC revision 1.5 by torge, Fri May 3 18:58:30 2013 UTC
# Line 53  CEndOfInterface Line 53  CEndOfInterface
53  C !LOCAL VARIABLES: ====================================================  C !LOCAL VARIABLES: ====================================================
54  C     === Local variables ===  C     === Local variables ===
55  C     i,j,bi,bj :: Loop counters  C     i,j,bi,bj :: Loop counters
56    #ifdef SEAICE_ITD
57    C     it        :: Loop counter for ice thickness categories
58    #endif
59  C     ks        :: surface level index  C     ks        :: surface level index
60  C     uc/vc     :: current ice velocity on C-grid  C     uc/vc     :: current ice velocity on C-grid
61  C     uTrans    :: volume transport, x direction  C     uTrans    :: volume transport, x direction
# Line 62  C     afy       :: horizontal advective Line 65  C     afy       :: horizontal advective
65  C     gFld      :: tendency of seaice field  C     gFld      :: tendency of seaice field
66  C     xA,yA     :: "areas" of X and Y face of tracer cells  C     xA,yA     :: "areas" of X and Y face of tracer cells
67        INTEGER i, j, bi, bj        INTEGER i, j, bi, bj
68    #ifdef SEAICE_ITD
69          INTEGER it
70    #endif
71        INTEGER ks        INTEGER ks
72        LOGICAL SEAICEmultiDimAdvection        LOGICAL SEAICEmultiDimAdvection
73  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
74        INTEGER itmpkey        INTEGER itmpkey
75  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
76  #ifdef ALLOW_SITRACER  #ifdef ALLOW_SITRACER
 # ifndef SEAICE_GROWTH_LEGACY  
77        _RL hEffNm1    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL hEffNm1    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
78        _RL areaNm1    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL areaNm1    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
 # endif /* ndef SEAICE_GROWTH_LEGACY */  
79        INTEGER iTr, SEAICEadvSchSItr        INTEGER iTr, SEAICEadvSchSItr
80        _RL SEAICEdiffKhSItr        _RL SEAICEdiffKhSItr
81        _RL SItrExt   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL SItrExt   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
# Line 184  CADJ STORE heffm(:,:,bi,bj)  = comlev1_b Line 188  CADJ STORE heffm(:,:,bi,bj)  = comlev1_b
188  CADJ &     key = itmpkey, kind=isbyte  CADJ &     key = itmpkey, kind=isbyte
189  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj,  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj,
190  CADJ &     key = itmpkey, kind=isbyte  CADJ &     key = itmpkey, kind=isbyte
191    # ifdef SEAICE_VARIABLE_SALINITY
192    CADJ STORE hsalt(:,:,bi,bj)  = comlev1_bibj,
193    CADJ &     key = itmpkey, kind=isbyte
194    # endif
195  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
196    
197          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
198           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
199  #if ( defined (SEAICE_GROWTH_LEGACY) || defined (ALLOW_SITRACER) )  #ifdef ALLOW_SITRACER
200            hEffNm1(i,j,bi,bj) = HEFF(i,j,bi,bj)            hEffNm1(i,j,bi,bj) = HEFF(i,j,bi,bj)
201            areaNm1(i,j,bi,bj) = AREA(i,j,bi,bj)            areaNm1(i,j,bi,bj) = AREA(i,j,bi,bj)
202  #endif  #endif
# Line 206  C-    Calculate "volume transports" thro Line 214  C-    Calculate "volume transports" thro
214    
215  C--   Effective Thickness (Volume)  C--   Effective Thickness (Volume)
216          IF ( SEAICEadvHeff ) THEN          IF ( SEAICEadvHeff ) THEN
217    #ifdef SEAICE_ITD
218            DO it=1,nITD
219             DO j=1-OLy,sNy+OLy
220              DO i=1-OLx,sNx+OLx
221               HEFF(i,j,bi,bj)=HEFFITD(i,j,it,bi,bj)
222              ENDDO
223             ENDDO
224    #endif
225            CALL SEAICE_ADVECTION(            CALL SEAICE_ADVECTION(
226       I         GAD_HEFF, SEAICEadvSchHeff,       I         GAD_HEFF, SEAICEadvSchHeff,
227       I         uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj),       I         uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj),
# Line 229  C     now do the "explicit" time step Line 245  C     now do the "explicit" time step
245       &          )       &          )
246            ENDDO            ENDDO
247           ENDDO           ENDDO
248    #ifdef SEAICE_ITD
249             DO j=1-OLy,sNy+OLy
250              DO i=1-OLx,sNx+OLx
251               HEFFITD(i,j,it,bi,bj)=HEFF(i,j,bi,bj)
252              ENDDO
253             ENDDO
254            ENDDO
255    #endif
256          ENDIF          ENDIF
257    
258  C--   Fractional area  C--   Fractional area
259          IF ( SEAICEadvArea ) THEN          IF ( SEAICEadvArea ) THEN
260    #ifdef SEAICE_ITD
261            DO it=1,nITD
262             DO j=1-OLy,sNy+OLy
263              DO i=1-OLx,sNx+OLx
264               AREA(i,j,bi,bj)=AREAITD(i,j,it,bi,bj)
265              ENDDO
266             ENDDO
267    #endif
268            CALL SEAICE_ADVECTION(            CALL SEAICE_ADVECTION(
269       I         GAD_AREA, SEAICEadvSchArea,       I         GAD_AREA, SEAICEadvSchArea,
270       I         uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj),       I         uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj),
# Line 256  C     now do the "explicit" time step Line 288  C     now do the "explicit" time step
288       &          )       &          )
289            ENDDO            ENDDO
290           ENDDO           ENDDO
291    #ifdef SEAICE_ITD
292             DO j=1-OLy,sNy+OLy
293              DO i=1-OLx,sNx+OLx
294               AREAITD(i,j,it,bi,bj)=AREA(i,j,bi,bj)
295              ENDDO
296             ENDDO
297            ENDDO
298    #endif
299          ENDIF          ENDIF
300    
301  C--   Effective Snow Thickness (Volume)  C--   Effective Snow Thickness (Volume)
302          IF ( SEAICEadvSnow ) THEN          IF ( SEAICEadvSnow ) THEN
303    #ifdef SEAICE_ITD
304            DO it=1,nITD
305             DO j=1-OLy,sNy+OLy
306              DO i=1-OLx,sNx+OLx
307               HSNOW(i,j,bi,bj)=HSNOWITD(i,j,it,bi,bj)
308              ENDDO
309             ENDDO
310    #endif
311            CALL SEAICE_ADVECTION(            CALL SEAICE_ADVECTION(
312       I         GAD_SNOW, SEAICEadvSchSnow,       I         GAD_SNOW, SEAICEadvSchSnow,
313       I         uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj),       I         uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj),
# Line 283  C     now do the "explicit" time step Line 331  C     now do the "explicit" time step
331       &          )       &          )
332            ENDDO            ENDDO
333           ENDDO           ENDDO
334    #ifdef SEAICE_ITD
335             DO j=1-OLy,sNy+OLy
336              DO i=1-OLx,sNx+OLx
337               HSNOWITD(i,j,it,bi,bj)=HSNOW(i,j,bi,bj)
338              ENDDO
339             ENDDO
340            ENDDO
341    #endif
342          ENDIF          ENDIF
343    
344  #ifdef SEAICE_VARIABLE_SALINITY  #ifdef SEAICE_VARIABLE_SALINITY
# Line 463  C---   end bi,bj loops Line 519  C---   end bi,bj loops
519        ELSE        ELSE
520  C--   if not multiDimAdvection  C--   if not multiDimAdvection
521    
 Cold     This has to be done to comply with the time stepping in advect.F:  
 Cold     Making sure that the following routines see the different  
 Cold     time levels correctly  
 Cold     At the end of the routine ADVECT,  
 Cold     timelevel 1 is updated with advection contribution  
 Cold                 and diffusion contribution  
 Cold                 (which was computed in DIFFUS on timelevel 3)  
 Cold     timelevel 2 is the previous timelevel 1  
 Cold     timelevel 3 is the total diffusion tendency * deltaT  
 Cold                 (empty if no diffusion)  
 C--   This is what remains from old 3-level storage of AREA & HEFF: still  
 C     needed for SEAICE_GROWTH, Legacy branch. Left old comments here above.  
 #ifdef SEAICE_GROWTH_LEGACY  
        DO bj=myByLo(myThid),myByHi(myThid)  
         DO bi=myBxLo(myThid),myBxHi(myThid)  
          DO j=1-OLy,sNy+OLy  
           DO i=1-OLx,sNx+OLx  
            hEffNm1(i,j,bi,bj) = HEFF(i,j,bi,bj)  
            areaNm1(i,j,bi,bj) = AREA(i,j,bi,bj)  
           ENDDO  
          ENDDO  
         ENDDO  
        ENDDO  
 #endif  
   
522         IF ( SEAICEadvHEff ) THEN         IF ( SEAICEadvHEff ) THEN
523  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
524  CADJ STORE heff = comlev1, key = ikey_dynamics, kind=isbyte  CADJ STORE heff = comlev1, key = ikey_dynamics, kind=isbyte
525  #endif  #endif
526    #ifdef SEAICE_ITD
527            DO it=1,nITD
528             DO bj=myByLo(myThid),myByHi(myThid)
529              DO bi=myBxLo(myThid),myBxHi(myThid)
530               DO j=1-OLy,sNy+OLy
531                DO i=1-OLx,sNx+OLx
532                 HEFF(i,j,bi,bj)=HEFFITD(i,j,it,bi,bj)
533                ENDDO
534               ENDDO
535              ENDDO
536             ENDDO
537    #endif
538          CALL ADVECT( uc, vc, hEff, fldNm1, HEFFM, myThid )          CALL ADVECT( uc, vc, hEff, fldNm1, HEFFM, myThid )
539          IF ( SEAICEdiffKhHeff .GT. 0. _d 0 ) THEN          IF ( SEAICEdiffKhHeff .GT. 0. _d 0 ) THEN
540  C-    Add tendency due to diffusion  C-    Add tendency due to diffusion
# Line 506  C-    Add tendency due to diffusion Line 549  C-    Add tendency due to diffusion
549            ENDDO            ENDDO
550           ENDDO           ENDDO
551          ENDIF          ENDIF
552    #ifdef SEAICE_ITD
553             DO bj=myByLo(myThid),myByHi(myThid)
554              DO bi=myBxLo(myThid),myBxHi(myThid)
555               DO j=1-OLy,sNy+OLy
556                DO i=1-OLx,sNx+OLx
557                 HEFFITD(i,j,it,bi,bj)=HEFF(i,j,bi,bj)
558                ENDDO
559               ENDDO
560              ENDDO
561             ENDDO
562            ENDDO
563    #endif
564         ENDIF         ENDIF
565         IF ( SEAICEadvArea ) THEN         IF ( SEAICEadvArea ) THEN
566  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
567  CADJ STORE area = comlev1, key = ikey_dynamics, kind=isbyte  CADJ STORE area = comlev1, key = ikey_dynamics, kind=isbyte
568  #endif  #endif
569    #ifdef SEAICE_ITD
570            DO it=1,nITD
571             DO bj=myByLo(myThid),myByHi(myThid)
572              DO bi=myBxLo(myThid),myBxHi(myThid)
573               DO j=1-OLy,sNy+OLy
574                DO i=1-OLx,sNx+OLx
575                 AREA(i,j,bi,bj)=AREAITD(i,j,it,bi,bj)
576                ENDDO
577               ENDDO
578              ENDDO
579             ENDDO
580    #endif
581          CALL ADVECT( uc, vc, area, fldNm1, HEFFM, myThid )          CALL ADVECT( uc, vc, area, fldNm1, HEFFM, myThid )
582          IF ( SEAICEdiffKhArea .GT. 0. _d 0 ) THEN          IF ( SEAICEdiffKhArea .GT. 0. _d 0 ) THEN
583  C-    Add tendency due to diffusion  C-    Add tendency due to diffusion
# Line 525  C-    Add tendency due to diffusion Line 592  C-    Add tendency due to diffusion
592            ENDDO            ENDDO
593           ENDDO           ENDDO
594          ENDIF          ENDIF
595    #ifdef SEAICE_ITD
596             DO bj=myByLo(myThid),myByHi(myThid)
597              DO bi=myBxLo(myThid),myBxHi(myThid)
598               DO j=1-OLy,sNy+OLy
599                DO i=1-OLx,sNx+OLx
600                 AREAITD(i,j,it,bi,bj)=AREA(i,j,bi,bj)
601                ENDDO
602               ENDDO
603              ENDDO
604             ENDDO
605            ENDDO
606    #endif
607         ENDIF         ENDIF
608         IF ( SEAICEadvSnow ) THEN         IF ( SEAICEadvSnow ) THEN
609  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
610  CADJ STORE hsnow = comlev1, key = ikey_dynamics, kind=isbyte  CADJ STORE hsnow = comlev1, key = ikey_dynamics, kind=isbyte
611  #endif  #endif
612    #ifdef SEAICE_ITD
613            DO it=1,nITD
614             DO bj=myByLo(myThid),myByHi(myThid)
615              DO bi=myBxLo(myThid),myBxHi(myThid)
616               DO j=1-OLy,sNy+OLy
617                DO i=1-OLx,sNx+OLx
618                 HSNOW(i,j,bi,bj)=HSNOWITD(i,j,it,bi,bj)
619                ENDDO
620               ENDDO
621              ENDDO
622             ENDDO
623    #endif
624          CALL ADVECT( uc, vc, HSNOW, fldNm1, HEFFM, myThid )          CALL ADVECT( uc, vc, HSNOW, fldNm1, HEFFM, myThid )
625          IF ( SEAICEdiffKhSnow .GT. 0. _d 0 ) THEN          IF ( SEAICEdiffKhSnow .GT. 0. _d 0 ) THEN
626  C-    Add tendency due to diffusion  C-    Add tendency due to diffusion
# Line 544  C-    Add tendency due to diffusion Line 635  C-    Add tendency due to diffusion
635            ENDDO            ENDDO
636           ENDDO           ENDDO
637          ENDIF          ENDIF
638    #ifdef SEAICE_ITD
639             DO bj=myByLo(myThid),myByHi(myThid)
640              DO bi=myBxLo(myThid),myBxHi(myThid)
641               DO j=1-OLy,sNy+OLy
642                DO i=1-OLx,sNx+OLx
643                 HSNOWITD(i,j,it,bi,bj)=HSNOW(i,j,bi,bj)
644                ENDDO
645               ENDDO
646              ENDDO
647             ENDDO
648            ENDDO
649    #endif
650         ENDIF         ENDIF
651    
652  #ifdef SEAICE_VARIABLE_SALINITY  #ifdef SEAICE_VARIABLE_SALINITY

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22