New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 14072 for NEMO/trunk/src/OCE/ISF/isfcpl.F90 – NEMO

Ignore:
Timestamp:
2020-12-04T08:48:38+01:00 (3 years ago)
Author:
laurent
Message:

Merging branch "2020/dev_r13648_ASINTER-04_laurent_bulk_ice", ticket #2369

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/ISF/isfcpl.F90

    r14053 r14072  
    3030   PRIVATE 
    3131 
    32    PUBLIC isfcpl_rst_write, isfcpl_init                    ! iceshelf restart read and write  
    33    PUBLIC isfcpl_ssh, isfcpl_tra, isfcpl_vol, isfcpl_cons  ! iceshelf correction for ssh, tra, dyn and conservation  
     32   PUBLIC isfcpl_rst_write, isfcpl_init                    ! iceshelf restart read and write 
     33   PUBLIC isfcpl_ssh, isfcpl_tra, isfcpl_vol, isfcpl_cons  ! iceshelf correction for ssh, tra, dyn and conservation 
    3434 
    3535   TYPE isfcons 
     
    5757      !!--------------------------------------------------------------------- 
    5858      !!                   ***  ROUTINE iscpl_init  *** 
    59       !!  
    60       !! ** Purpose : correct ocean state for new wet cell and horizontal divergence  
     59      !! 
     60      !! ** Purpose : correct ocean state for new wet cell and horizontal divergence 
    6161      !!              correction for the dynamical adjustement 
    6262      !! 
     
    7474      ! start on an euler time step 
    7575      l_1st_euler = .TRUE. 
    76       !  
     76      ! 
    7777      ! allocation and initialisation to 0 
    7878      CALL isf_alloc_cpl() 
     
    8888      IF(lwp) WRITE(numout,*) ' isfcpl_init:', id 
    8989      IF (id == 0) THEN 
    90          IF(lwp) WRITE(numout,*) ' isfcpl_init: restart variables for ice sheet coupling are missing, skip coupling for this leg '  
     90         IF(lwp) WRITE(numout,*) ' isfcpl_init: restart variables for ice sheet coupling are missing, skip coupling for this leg ' 
    9191         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~' 
    9292         IF(lwp) WRITE(numout,*) '' 
     
    119119#if ! defined key_qco 
    120120      e3t(:,:,:,Kbb)   = e3t(:,:,:,Kmm) 
    121 #endif  
     121#endif 
    122122   END SUBROUTINE isfcpl_init 
    123123 
    124     
     124 
    125125   SUBROUTINE isfcpl_rst_write( kt, Kmm ) 
    126126      !!--------------------------------------------------------------------- 
    127127      !!                   ***  ROUTINE iscpl_rst_write  *** 
    128       !!  
     128      !! 
    129129      !! ** Purpose : write icesheet coupling variables in restart 
    130130      !! 
     
    143143         ! 
    144144         zgdepw(:,:,jk) = gdepw(:,:,jk,Kmm) 
    145       END DO  
     145      END DO 
    146146      ! 
    147147      CALL iom_rstput( kt, nitrst, numrow, 'tmask'  , tmask  ) 
     
    154154   END SUBROUTINE isfcpl_rst_write 
    155155 
    156     
     156 
    157157   SUBROUTINE isfcpl_ssh(Kbb, Kmm, Kaa) 
    158       !!----------------------------------------------------------------------  
     158      !!---------------------------------------------------------------------- 
    159159      !!                   ***  ROUTINE iscpl_ssh  *** 
    160       !!  
     160      !! 
    161161      !! ** Purpose :   basic guess of ssh in new wet cell 
    162       !!  
     162      !! 
    163163      !! ** Method  :   basic extrapolation from neigbourg cells 
    164164      !! 
     
    176176      CALL iom_get( numror, jpdom_auto, 'ssmask'  , zssmask_b   ) ! need to extrapolate T/S 
    177177 
    178       ! compute new ssh if we open a full water column  
     178      ! compute new ssh if we open a full water column 
    179179      ! rude average of the closest neigbourgs (e1e2t not taking into account) 
    180180      ! 
     
    229229   END SUBROUTINE isfcpl_ssh 
    230230 
    231     
     231 
    232232   SUBROUTINE isfcpl_tra(Kmm) 
    233       !!----------------------------------------------------------------------  
     233      !!---------------------------------------------------------------------- 
    234234      !!                   ***  ROUTINE iscpl_tra  *** 
    235       !!  
    236       !! ** Purpose :   compute new tn, sn in case of evolving geometry of ice shelves  
    237       !!  
     235      !! 
     236      !! ** Purpose :   compute new tn, sn in case of evolving geometry of ice shelves 
     237      !! 
    238238      !! ** Method  :   tn, sn : basic extrapolation from neigbourg cells 
    239239      !! 
     
    250250      REAL(wp):: zdz, zdzm1, zdzp1 
    251251      !! 
    252       REAL(wp), DIMENSION(jpi,jpj)          :: zdmask  
     252      REAL(wp), DIMENSION(jpi,jpj)          :: zdmask 
    253253      REAL(wp), DIMENSION(jpi,jpj,jpk)      :: ztmask0, zwmaskn 
    254254      REAL(wp), DIMENSION(jpi,jpj,jpk)      :: ztmask1, zwmaskb, ztmp3d 
    255255      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts) :: zts0 
    256256      !!---------------------------------------------------------------------- 
    257       !  
     257      ! 
    258258      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b   ) ! need to extrapolate T/S 
    259259      !CALL iom_get( numror, jpdom_auto, 'wmask'  , zwmask_b  ) ! need to extrapolate T/S 
    260260      !CALL iom_get( numror, jpdom_auto, 'gdepw_n', zdepw_b(:,:,:) ) ! need to interpol vertical profile (vvl) 
    261261      ! 
    262       !  
     262      ! 
    263263      ! compute new T/S (interpolation) if vvl only for common wet cell in before and after wmask 
    264264      !PM: Is this IF needed since change to VVL by default 
     
    376376            &                         in your domain cfg computation'         ) 
    377377      END_3D 
    378       !  
     378      ! 
    379379   END SUBROUTINE isfcpl_tra 
    380     
     380 
    381381 
    382382   SUBROUTINE isfcpl_vol(Kmm) 
    383       !!----------------------------------------------------------------------  
     383      !!---------------------------------------------------------------------- 
    384384      !!                   ***  ROUTINE iscpl_vol  *** 
    385       !!  
    386       !! ** Purpose : compute the correction of the local divergence to apply   
     385      !! 
     386      !! ** Purpose : compute the correction of the local divergence to apply 
    387387      !!              during the first time step after the coupling. 
    388388      !! 
     
    390390      !!              - compute vertical input 
    391391      !!              - compute correction 
    392       !!                 
     392      !! 
    393393      !!---------------------------------------------------------------------- 
    394394      !! 
    395395      INTEGER, INTENT(in) :: Kmm    ! ocean time level index 
    396396      !!---------------------------------------------------------------------- 
    397       INTEGER :: ji, jj, jk  
     397      INTEGER :: ji, jj, jk 
    398398      INTEGER :: ikb, ikt 
    399399      !! 
     
    421421         ! 
    422422         ! 1.2: get volume flux after coupling (>0 out) 
    423          ! properly mask velocity  
     423         ! properly mask velocity 
    424424         ! (velocity are still mask with old mask at this stage) 
    425425         uu(:,:,jk,Kmm) = uu(:,:,jk,Kmm) * umask(:,:,jk) 
     
    459459      ! 
    460460      ! 3.2: get 3d tr(:,:,:,:,Krhs) increment to apply at the first time step 
    461       ! temperature and salt content flux computed using local ts(:,:,:,:,Kmm)  
     461      ! temperature and salt content flux computed using local ts(:,:,:,:,Kmm) 
    462462      ! (very simple advection scheme) 
    463463      ! (>0 out) 
     
    473473   END SUBROUTINE isfcpl_vol 
    474474 
    475     
     475 
    476476   SUBROUTINE isfcpl_cons(Kmm) 
    477       !!----------------------------------------------------------------------  
     477      !!---------------------------------------------------------------------- 
    478478      !!                   ***  ROUTINE iscpl_cons  *** 
    479       !!  
     479      !! 
    480480      !! ** Purpose :   compute the corrective increment in volume/salt/heat to put back the vol/heat/salt 
    481481      !!                removed or added during the coupling processes (wet or dry new cell) 
    482       !!  
     482      !! 
    483483      !! ** Method  :   - compare volume/heat/salt before and after 
    484484      !!                - look for the closest wet cells (share amoung neigbourgs if there are) 
    485485      !!                - build the correction increment to applied at each time step 
    486       !!                 
     486      !! 
    487487      !!---------------------------------------------------------------------- 
    488488      ! 
     
    496496      INTEGER  ::   iig  , ijg, ik                    ! dummy indices 
    497497      INTEGER  ::   jisf                              ! start, end and current position in the increment array 
    498       INTEGER  ::   ingb, ifind                       ! 0/1 target found or need to be found  
    499       INTEGER  ::   nisfl_area                        ! global number of cell concerned by the wet->dry case  
     498      INTEGER  ::   ingb, ifind                       ! 0/1 target found or need to be found 
     499      INTEGER  ::   nisfl_area                        ! global number of cell concerned by the wet->dry case 
    500500      INTEGER, DIMENSION(jpnij) :: nisfl              ! local  number of cell concerned by the wet->dry case 
    501501      ! 
    502502      REAL(wp) ::   z1_sum, z1_rdtiscpl 
    503503      REAL(wp) ::   zdtem, zdsal, zdvol, zratio       ! tem, sal, vol increment 
    504       REAL(wp) ::   zlon , zlat                       ! target location   
     504      REAL(wp) ::   zlon , zlat                       ! target location 
    505505      REAL(wp), DIMENSION(jpi,jpj,jpk) :: ztmask_b    ! mask before 
    506506      REAL(wp), DIMENSION(jpi,jpj,jpk) :: ze3t_b      ! scale factor before 
     
    522522      nstp_iscpl  = nitend - nit000 + 1 
    523523      rdt_iscpl   = nstp_iscpl * rn_Dt 
    524       z1_rdtiscpl = 1._wp / rdt_iscpl  
     524      z1_rdtiscpl = 1._wp / rdt_iscpl 
    525525 
    526526      IF (lwp) WRITE(numout,*) '            nb of stp for cons  = ', nstp_iscpl 
     
    552552               zdsal = ts(ji,jj,jk,jp_sal,Kmm) *  e3t(ji,jj,jk,Kmm) *  tmask  (ji,jj,jk)   & 
    553553                     - zs_b(ji,jj,jk)       * ze3t_b(ji,jj,jk) * ztmask_b(ji,jj,jk) 
    554              
     554 
    555555               ! volume, heat and salt differences in each cell (>0 means correction is an outward flux) 
    556556               ! in addition to the geometry change unconservation, need to add the divergence correction as it is flux across the boundary 
     
    575575            DO ji = Nis0,Nie0 
    576576               jip1=MIN(ji+1,jpi) ; jim1=MAX(ji-1,1) ; jjp1=MIN(jj+1,jpj) ; jjm1=MAX(jj-1,1) ; 
    577                IF ( tmask(ji,jj,jk) == 0._wp .AND. ztmask_b(ji,jj,jk) == 1._wp ) THEN  
     577               IF ( tmask(ji,jj,jk) == 0._wp .AND. ztmask_b(ji,jj,jk) == 1._wp ) THEN 
    578578                  nisfl(narea) = nisfl(narea) + MAX(SUM(tmask(jim1:jip1,jjm1:jjp1,jk)),1._wp) 
    579579               ENDIF 
     
    582582      ENDDO 
    583583      ! 
    584       ! global  
     584      ! global 
    585585      CALL mpp_sum('isfcpl',nisfl  ) 
    586586      ! 
     
    636636      ! share data among all processes because for some point we need to find the closest wet point (could be on other process) 
    637637      DO jproc=1,jpnij 
    638          !  
     638         ! 
    639639         ! share total number of isf point treated for proc jproc 
    640640         IF (jproc==narea) THEN 
     
    660660               ingb = zisfpts(jisf)%ngb 
    661661            ELSE 
    662                iig  =0   ; ijg  =0   ; ik   =0   
     662               iig  =0   ; ijg  =0   ; ik   =0 
    663663               zdvol=-HUGE(1.0) ; zdsal=-HUGE(1.0) ; zdtem=-HUGE(1.0) 
    664                zlat =-HUGE(1.0) ; zlon =-HUGE(1.0)    
     664               zlat =-HUGE(1.0) ; zlon =-HUGE(1.0) 
    665665               ingb = 0 
    666666            END IF 
     
    711711      INTEGER,                     INTENT(inout) :: kpts 
    712712      !!---------------------------------------------------------------------- 
    713       INTEGER,      INTENT(in   )           :: ki, kj, kk                  !    target location (kfind=0)  
     713      INTEGER,      INTENT(in   )           :: ki, kj, kk                  !    target location (kfind=0) 
    714714      !                                                                    ! or source location (kfind=1) 
    715715      INTEGER,      INTENT(in   ), OPTIONAL :: kfind                       ! 0  target cell already found 
    716716      !                                                                    ! 1  target to be determined 
    717       REAL(wp),     INTENT(in   )           :: pdvol, pdsal, pdtem, pratio ! vol/sal/tem increment  
     717      REAL(wp),     INTENT(in   )           :: pdvol, pdsal, pdtem, pratio ! vol/sal/tem increment 
    718718      !                                                                    ! and ratio in case increment span over multiple cells. 
    719719      !!---------------------------------------------------------------------- 
    720720      INTEGER :: ifind 
    721721      !!---------------------------------------------------------------------- 
    722       !  
     722      ! 
    723723      ! increment position 
    724724      kpts = kpts + 1 
Note: See TracChangeset for help on using the changeset viewer.