/[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.4 by torge, Wed Mar 27 18:59:52 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    CToM<<<
57    #ifdef SEAICE_ITD
58    C     k         :: Loop counter for ice thickness categories
59    #endif
60    C>>>ToM
61  C     ks        :: surface level index  C     ks        :: surface level index
62  C     uc/vc     :: current ice velocity on C-grid  C     uc/vc     :: current ice velocity on C-grid
63  C     uTrans    :: volume transport, x direction  C     uTrans    :: volume transport, x direction
# Line 62  C     afy       :: horizontal advective Line 67  C     afy       :: horizontal advective
67  C     gFld      :: tendency of seaice field  C     gFld      :: tendency of seaice field
68  C     xA,yA     :: "areas" of X and Y face of tracer cells  C     xA,yA     :: "areas" of X and Y face of tracer cells
69        INTEGER i, j, bi, bj        INTEGER i, j, bi, bj
70    CToM<<<
71    #ifdef SEAICE_ITD
72          INTEGER k
73    #endif
74    C>>>ToM
75        INTEGER ks        INTEGER ks
76        LOGICAL SEAICEmultiDimAdvection        LOGICAL SEAICEmultiDimAdvection
77  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
78        INTEGER itmpkey        INTEGER itmpkey
79  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
80  #ifdef ALLOW_SITRACER  #ifdef ALLOW_SITRACER
 # ifndef SEAICE_GROWTH_LEGACY  
81        _RL hEffNm1    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL hEffNm1    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
82        _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 */  
83        INTEGER iTr, SEAICEadvSchSItr        INTEGER iTr, SEAICEadvSchSItr
84        _RL SEAICEdiffKhSItr        _RL SEAICEdiffKhSItr
85        _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 192  CADJ STORE heffm(:,:,bi,bj)  = comlev1_b
192  CADJ &     key = itmpkey, kind=isbyte  CADJ &     key = itmpkey, kind=isbyte
193  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj,  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj,
194  CADJ &     key = itmpkey, kind=isbyte  CADJ &     key = itmpkey, kind=isbyte
195    # ifdef SEAICE_VARIABLE_SALINITY
196    CADJ STORE hsalt(:,:,bi,bj)  = comlev1_bibj,
197    CADJ &     key = itmpkey, kind=isbyte
198    # endif
199  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
200    
201          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
202           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
203  #if ( defined (SEAICE_GROWTH_LEGACY) || defined (ALLOW_SITRACER) )  #ifdef ALLOW_SITRACER
204            hEffNm1(i,j,bi,bj) = HEFF(i,j,bi,bj)            hEffNm1(i,j,bi,bj) = HEFF(i,j,bi,bj)
205            areaNm1(i,j,bi,bj) = AREA(i,j,bi,bj)            areaNm1(i,j,bi,bj) = AREA(i,j,bi,bj)
206  #endif  #endif
# Line 206  C-    Calculate "volume transports" thro Line 218  C-    Calculate "volume transports" thro
218    
219  C--   Effective Thickness (Volume)  C--   Effective Thickness (Volume)
220          IF ( SEAICEadvHeff ) THEN          IF ( SEAICEadvHeff ) THEN
221    CToM<<<
222    #ifdef SEAICE_ITD
223            DO k=1,nITD
224             DO j=1-OLy,sNy+OLy
225              DO i=1-OLx,sNx+OLx
226               HEFF(i,j,bi,bj)=HEFFITD(i,j,k,bi,bj)
227              ENDDO
228             ENDDO
229    #endif
230    C>>>ToM
231            CALL SEAICE_ADVECTION(            CALL SEAICE_ADVECTION(
232       I         GAD_HEFF, SEAICEadvSchHeff,       I         GAD_HEFF, SEAICEadvSchHeff,
233       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 251  C     now do the "explicit" time step
251       &          )       &          )
252            ENDDO            ENDDO
253           ENDDO           ENDDO
254    CToM<<<
255    #ifdef SEAICE_ITD
256             DO j=1-OLy,sNy+OLy
257              DO i=1-OLx,sNx+OLx
258               HEFFITD(i,j,k,bi,bj)=HEFF(i,j,bi,bj)
259              ENDDO
260             ENDDO
261            ENDDO
262    #endif
263    C>>>ToM
264          ENDIF          ENDIF
265    
266  C--   Fractional area  C--   Fractional area
267          IF ( SEAICEadvArea ) THEN          IF ( SEAICEadvArea ) THEN
268    CToM<<<
269    #ifdef SEAICE_ITD
270            DO k=1,nITD
271             DO j=1-OLy,sNy+OLy
272              DO i=1-OLx,sNx+OLx
273               AREA(i,j,bi,bj)=AREAITD(i,j,k,bi,bj)
274              ENDDO
275             ENDDO
276    #endif
277    C>>>ToM
278            CALL SEAICE_ADVECTION(            CALL SEAICE_ADVECTION(
279       I         GAD_AREA, SEAICEadvSchArea,       I         GAD_AREA, SEAICEadvSchArea,
280       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 298  C     now do the "explicit" time step
298       &          )       &          )
299            ENDDO            ENDDO
300           ENDDO           ENDDO
301    CToM<<<
302    #ifdef SEAICE_ITD
303             DO j=1-OLy,sNy+OLy
304              DO i=1-OLx,sNx+OLx
305               AREAITD(i,j,k,bi,bj)=AREA(i,j,bi,bj)
306              ENDDO
307             ENDDO
308            ENDDO
309    #endif
310    C>>>ToM
311          ENDIF          ENDIF
312    
313  C--   Effective Snow Thickness (Volume)  C--   Effective Snow Thickness (Volume)
314          IF ( SEAICEadvSnow ) THEN          IF ( SEAICEadvSnow ) THEN
315    CToM<<<
316    #ifdef SEAICE_ITD
317            DO k=1,nITD
318             DO j=1-OLy,sNy+OLy
319              DO i=1-OLx,sNx+OLx
320               HSNOW(i,j,bi,bj)=HSNOWITD(i,j,k,bi,bj)
321              ENDDO
322             ENDDO
323    #endif
324    C>>>ToM
325            CALL SEAICE_ADVECTION(            CALL SEAICE_ADVECTION(
326       I         GAD_SNOW, SEAICEadvSchSnow,       I         GAD_SNOW, SEAICEadvSchSnow,
327       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 345  C     now do the "explicit" time step
345       &          )       &          )
346            ENDDO            ENDDO
347           ENDDO           ENDDO
348    CToM<<<
349    #ifdef SEAICE_ITD
350             DO j=1-OLy,sNy+OLy
351              DO i=1-OLx,sNx+OLx
352               HSNOWITD(i,j,k,bi,bj)=HSNOW(i,j,bi,bj)
353              ENDDO
354             ENDDO
355            ENDDO
356    #endif
357    C>>>ToM
358          ENDIF          ENDIF
359    
360  #ifdef SEAICE_VARIABLE_SALINITY  #ifdef SEAICE_VARIABLE_SALINITY
# Line 463  C---   end bi,bj loops Line 535  C---   end bi,bj loops
535        ELSE        ELSE
536  C--   if not multiDimAdvection  C--   if not multiDimAdvection
537    
 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  
   
538         IF ( SEAICEadvHEff ) THEN         IF ( SEAICEadvHEff ) THEN
539  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
540  CADJ STORE heff = comlev1, key = ikey_dynamics, kind=isbyte  CADJ STORE heff = comlev1, key = ikey_dynamics, kind=isbyte
541  #endif  #endif
542    CToM<<<
543    #ifdef SEAICE_ITD
544            DO k=1,nITD
545             DO bj=myByLo(myThid),myByHi(myThid)
546              DO bi=myBxLo(myThid),myBxHi(myThid)
547               DO j=1-OLy,sNy+OLy
548                DO i=1-OLx,sNx+OLx
549                 HEFF(i,j,bi,bj)=HEFFITD(i,j,k,bi,bj)
550                ENDDO
551               ENDDO
552              ENDDO
553             ENDDO
554    #endif
555    C>>>ToM        
556          CALL ADVECT( uc, vc, hEff, fldNm1, HEFFM, myThid )          CALL ADVECT( uc, vc, hEff, fldNm1, HEFFM, myThid )
557          IF ( SEAICEdiffKhHeff .GT. 0. _d 0 ) THEN          IF ( SEAICEdiffKhHeff .GT. 0. _d 0 ) THEN
558  C-    Add tendency due to diffusion  C-    Add tendency due to diffusion
# Line 506  C-    Add tendency due to diffusion Line 567  C-    Add tendency due to diffusion
567            ENDDO            ENDDO
568           ENDDO           ENDDO
569          ENDIF          ENDIF
570    CToM<<<      
571    #ifdef SEAICE_ITD
572             DO bj=myByLo(myThid),myByHi(myThid)
573              DO bi=myBxLo(myThid),myBxHi(myThid)
574               DO j=1-OLy,sNy+OLy
575                DO i=1-OLx,sNx+OLx
576                 HEFFITD(i,j,k,bi,bj)=HEFF(i,j,bi,bj)
577                ENDDO
578               ENDDO
579              ENDDO
580             ENDDO
581            ENDDO
582    #endif
583    C>>>ToM
584         ENDIF         ENDIF
585         IF ( SEAICEadvArea ) THEN         IF ( SEAICEadvArea ) THEN
586  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
587  CADJ STORE area = comlev1, key = ikey_dynamics, kind=isbyte  CADJ STORE area = comlev1, key = ikey_dynamics, kind=isbyte
588  #endif  #endif
589    CToM<<<
590    #ifdef SEAICE_ITD
591            DO k=1,nITD
592             DO bj=myByLo(myThid),myByHi(myThid)
593              DO bi=myBxLo(myThid),myBxHi(myThid)
594               DO j=1-OLy,sNy+OLy
595                DO i=1-OLx,sNx+OLx
596                 AREA(i,j,bi,bj)=AREAITD(i,j,k,bi,bj)
597                ENDDO
598               ENDDO
599              ENDDO
600             ENDDO
601    #endif
602    C>>>ToM        
603          CALL ADVECT( uc, vc, area, fldNm1, HEFFM, myThid )          CALL ADVECT( uc, vc, area, fldNm1, HEFFM, myThid )
604          IF ( SEAICEdiffKhArea .GT. 0. _d 0 ) THEN          IF ( SEAICEdiffKhArea .GT. 0. _d 0 ) THEN
605  C-    Add tendency due to diffusion  C-    Add tendency due to diffusion
# Line 525  C-    Add tendency due to diffusion Line 614  C-    Add tendency due to diffusion
614            ENDDO            ENDDO
615           ENDDO           ENDDO
616          ENDIF          ENDIF
617    CToM<<<      
618    #ifdef SEAICE_ITD
619             DO bj=myByLo(myThid),myByHi(myThid)
620              DO bi=myBxLo(myThid),myBxHi(myThid)
621               DO j=1-OLy,sNy+OLy
622                DO i=1-OLx,sNx+OLx
623                 AREAITD(i,j,k,bi,bj)=AREA(i,j,bi,bj)
624                ENDDO
625               ENDDO
626              ENDDO
627             ENDDO
628            ENDDO
629    #endif
630    C>>>ToM
631         ENDIF         ENDIF
632         IF ( SEAICEadvSnow ) THEN         IF ( SEAICEadvSnow ) THEN
633  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
634  CADJ STORE hsnow = comlev1, key = ikey_dynamics, kind=isbyte  CADJ STORE hsnow = comlev1, key = ikey_dynamics, kind=isbyte
635  #endif  #endif
636    CToM<<<
637    #ifdef SEAICE_ITD
638            DO k=1,nITD
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                 HSNOW(i,j,bi,bj)=HSNOWITD(i,j,k,bi,bj)
644                ENDDO
645               ENDDO
646              ENDDO
647             ENDDO
648    #endif
649    C>>>ToM        
650          CALL ADVECT( uc, vc, HSNOW, fldNm1, HEFFM, myThid )          CALL ADVECT( uc, vc, HSNOW, fldNm1, HEFFM, myThid )
651          IF ( SEAICEdiffKhSnow .GT. 0. _d 0 ) THEN          IF ( SEAICEdiffKhSnow .GT. 0. _d 0 ) THEN
652  C-    Add tendency due to diffusion  C-    Add tendency due to diffusion
# Line 544  C-    Add tendency due to diffusion Line 661  C-    Add tendency due to diffusion
661            ENDDO            ENDDO
662           ENDDO           ENDDO
663          ENDIF          ENDIF
664    CToM<<<      
665    #ifdef SEAICE_ITD
666             DO bj=myByLo(myThid),myByHi(myThid)
667              DO bi=myBxLo(myThid),myBxHi(myThid)
668               DO j=1-OLy,sNy+OLy
669                DO i=1-OLx,sNx+OLx
670                 HSNOWITD(i,j,k,bi,bj)=HSNOW(i,j,bi,bj)
671                ENDDO
672               ENDDO
673              ENDDO
674             ENDDO
675            ENDDO
676    #endif
677    C>>>ToM
678         ENDIF         ENDIF
679    
680  #ifdef SEAICE_VARIABLE_SALINITY  #ifdef SEAICE_VARIABLE_SALINITY

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

  ViewVC Help
Powered by ViewVC 1.1.22