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 9707 for branches/UKMO/dev_r5518_GO6_diag_bitcomp/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90 – NEMO

Ignore:
Timestamp:
2018-05-31T11:48:34+02:00 (6 years ago)
Author:
frrh
Message:

Work out N-fold mask points for U and V grids based on
value flipping during N-fold lbc_lnk operations.
It's much easier this way.
Tidy up remaining code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_GO6_diag_bitcomp/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90

    r9615 r9707  
     1 
    12MODULE dommsk 
    23   !!====================================================================== 
     
    138139      REAL(wp) ::  zphi_drake_passage, zshlat_antarc 
    139140      REAL(wp), POINTER, DIMENSION(:,:) ::  zwf 
     141      REAL(wp) :: uv(jpi,jpj) 
    140142      !! 
    141143      NAMELIST/namlbc/ rn_shlat, ln_vorlat 
     
    223225      ! -------------------- 
    224226      tmask_i(:,:) = ssmask(:,:)            ! (ISH) tmask_i = 1 even on the ice shelf 
     227 
    225228      iif = jpreci                         ! ??? 
    226229      iil = nlci - jpreci + 1 
     
    232235      tmask_i(   :   , 1 :ijf) = 0._wp      ! first rows 
    233236      tmask_i(   :   ,ijl:jpj) = 0._wp      ! last  rows (including mpp extra rows) 
    234  
    235       tmask_i_3d(:,:,:) = tmask(:,:,:)      ! Initialise 3D interior tmask with standard t mask 
    236       ! Now mask out any wrap columns 
    237       tmask_i_3d( 1 :iif,:,:) = 0._wp       ! first columns 
    238       tmask_i_3d(iil:jpi,:,:) = 0._wp       ! last  columns (including mpp extra columns) 
    239       ! Now mask out any extra rows 
    240       tmask_i_3d(:,1:ijf,:) = 0._wp         ! first rows 
    241       tmask_i_3d(:,ijl:jpj,:) = 0._wp       ! last  rows (including mpp extra rows) 
    242  
    243237 
    244238      ! north fold mask 
     
    252246            DO ji = iif+1, iil-1 
    253247               tmask_i(ji,nlej-1) = tmask_i(ji,nlej-1) * tpol(mig(ji)) 
    254                ! It would seem logical that the following SHOULD be applied,  
    255                ! but the existing code in iom.F90 which we are trying to  
    256                ! replicate, and where we aim to use this array simply uses  
    257                ! tmask which does NOT account for masking in the N-fold.   
    258                ! tmask_i_3d(ji,nlej-1,:) = tmask_i_3d(ji,nlej-1,:) * tpol(mig(ji)) 
    259248            END DO 
    260249         ENDIF 
     
    299288      CALL lbc_lnk( fmask_i, 'F', 1._wp ) 
    300289 
    301       ! Set up interior 3d U mask 
    302       umask_i_3d(2:jpim1,:,:) = tmask(2:jpim1,:,:) + tmask(3:jpi,:,:) 
    303       CALL lbc_lnk( umask_i_3d, 'U', 1. ) 
     290 
     291      ! Set up mask for diagnostics on T points, to exclude duplicate 
     292      ! data points in wrap and N-fold regions.  
     293      DO jk = 1, jpk 
     294         tmask_i_diag(:,:,jk) = tmask(:,:,jk) * tmask_i(:,:) 
     295      END DO 
     296 
     297      ! Set up mask for diagnostics on U points, to exclude duplicate 
     298      ! data points in wrap and N-fold regions.  
     299      umask_i_diag(:,:,:) = 1.0 
     300      umask_i_diag(2:jpim1,:,:) = tmask(2:jpim1,:,:) + tmask(3:jpi,:,:) 
     301      CALL lbc_lnk( umask_i_diag, 'U', 1. ) 
    304302      ! Now mask out any wrap columns 
    305       umask_i_3d( 1 :iif,:,:) = 0._wp       ! first columns 
    306       umask_i_3d(iil:jpi,:,:) = 0._wp       ! last  columns (including mpp extra columns) 
     303      umask_i_diag( 1 :iif,:,:) = 0._wp       ! first columns 
     304      umask_i_diag(iil:jpi,:,:) = 0._wp       ! last  columns (including mpp extra columns) 
     305      ! Now mask out any extra bottom rows 
     306      umask_i_diag(:,1:ijf,:) = 0._wp         ! first rows 
     307 
     308      ! Now find which points change sign during a U lbc_lnk to find 
     309      ! out which points to mask in the N fold.    
     310      uv(:,:) = 1.0 
     311      CALL lbc_lnk( uv, 'U', -1. ) 
     312 
     313      ! Now find out which points have changed sign and mask them  
     314      DO jj = 1, jpj 
     315         DO ji = 1, jpi 
     316            IF (uv(ji,jj) < 0.0) THEN 
     317               umask_i_diag(ji,jj,:) = 0.0 
     318            END IF 
     319         END DO 
     320      END DO 
     321 
     322      ! Set up mask for diagnostics on V points, to exclude duplicate 
     323      ! data points in wrap and N-fold regions.  
     324      vmask_i_diag(:,:,:) = 1.0 
     325      vmask_i_diag(:,2:jpjm1,:) = tmask(:,2:jpjm1,:) + tmask(:,3:jpj,:) 
     326      CALL lbc_lnk( vmask_i_diag, 'V', 1. ) 
     327 
     328      ! Now mask out any wrap columns 
     329      vmask_i_diag( 1 :iif,:,:) = 0._wp       ! first columns 
     330      vmask_i_diag(iil:jpi,:,:) = 0._wp       ! last  columns (including mpp extra columns) 
    307331      ! Now mask out any extra rows 
    308       umask_i_3d(:,1:ijf,:) = 0._wp         ! first rows 
    309       umask_i_3d(:,ijl:jpj,:) = 0._wp       ! last  rows (including mpp extra rows) 
    310  
    311       ! Set up interior 3d V mask 
    312       vmask_i_3d(:,2:jpjm1,:) = tmask(:,2:jpjm1,:) + tmask(:,3:jpj,:) 
    313       CALL lbc_lnk( vmask_i_3d, 'V', 1. ) 
    314       ! Now mask out any wrap columns 
    315       vmask_i_3d( 1 :iif,:,:) = 0._wp       ! first columns 
    316       vmask_i_3d(iil:jpi,:,:) = 0._wp       ! last  columns (including mpp extra columns) 
    317       ! Now mask out any extra rows 
    318       vmask_i_3d(:,1:ijf,:) = 0._wp         ! first rows 
    319       vmask_i_3d(:,ijl:jpj,:) = 0._wp       ! last  rows (including mpp extra rows) 
     332      vmask_i_diag(:,1:ijf,:) = 0._wp         ! first rows 
     333 
     334      ! Now find which points change sign during a V lbc_lnk to find 
     335      ! out which points to mask in the N fold.    
     336      uv(:,:) = 1.0 
     337      CALL lbc_lnk( uv, 'V', -1. ) 
     338 
     339      ! Now find out which points have changed sign and mask them  
     340      DO jj = 1, jpj 
     341         DO ji = 1, jpi 
     342            IF (uv(ji,jj) < 0.0) THEN 
     343               vmask_i_diag(ji,jj,:) = 0.0 
     344            END IF 
     345         END DO 
     346      END DO 
    320347 
    321348 
Note: See TracChangeset for help on using the changeset viewer.