Changeset 9707


Ignore:
Timestamp:
2018-05-31T11:48:34+02:00 (3 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.

Location:
branches/UKMO/dev_r5518_GO6_diag_bitcomp/NEMOGCM/NEMO/OPA_SRC
Files:
3 edited

Legend:

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

    r9614 r9707  
    254254   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   bathy                              !: ocean depth (meters) 
    255255   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tmask_i, umask_i, vmask_i, fmask_i !: interior domain T-point mask 
    256    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tmask_i_3d       !: 3D T-point mask of wrap and redundant N-fold points only. 
    257    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: umask_i_3d       !: 3D U-point mask of wrap and redundant N-fold points only. 
    258    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: vmask_i_3d       !: 3D V-point mask of wrap and redundant N-fold points only. 
     256   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tmask_i_diag     !: partial mask for use in T diagnostic mask calc.  
     257   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: umask_i_diag     !: partial mask for use in U diagnostic mask calc.  
     258   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: vmask_i_diag     !: partial mask for use in V diagnostic mask calc.  
    259259   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   bmask                              !: land/ocean mask of barotropic stream function 
    260260 
     
    410410      ALLOCATE( tmask(jpi,jpj,jpk) , umask(jpi,jpj,jpk),     &  
    411411         &      vmask(jpi,jpj,jpk) , fmask(jpi,jpj,jpk),     & 
    412                 tmask_i_3d(jpi,jpj,jpk),       & 
    413                 umask_i_3d(jpi,jpj,jpk),       & 
    414                 vmask_i_3d(jpi,jpj,jpk),       & 
     412                tmask_i_diag(jpi,jpj,jpk),     & 
     413                umask_i_diag(jpi,jpj,jpk),     & 
     414                vmask_i_diag(jpi,jpj,jpk),     & 
    415415                STAT=ierr(11) ) 
    416416 
  • 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 
  • branches/UKMO/dev_r5518_GO6_diag_bitcomp/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90

    r9614 r9707  
    14001400      IF ( ln_mskland ) THEN 
    14011401         ! mask land points, keep values on coast line -> specific mask for U, V and W points 
     1402 
     1403 
    14021404         SELECT CASE ( cdgrd ) 
     1405         ! The masks applied here are specifically used to mask out duplicate  
     1406         ! data poits in wrap columns and N-fold rows in order to ensure bit  
     1407         ! comparison of diagnostics which have not undergone an explicit 
     1408         ! lbc_lnk prior to writing and which are thus prone to junk in  
     1409         ! in these duplicate points since they are not usually explicitly  
     1410         ! involved in field computation.  
    14031411         CASE('T')    
    1404             zmask(:,:,:) = tmask_i_3d(:,:,:) 
    1405          CASE('U') 
    1406             zmask(:,:,:) = umask_i_3d(:,:,:)  
    1407          CASE('V')  
    1408             zmask(:,:,:) = vmask_i_3d(:,:,:)  
     1412            zmask(:,:,:) = tmask_i_diag(:,:,:) 
     1413         CASE('U')       
     1414            zmask(:,:,:) = umask_i_diag(:,:,:) 
     1415    CASE('V')   
     1416            zmask(:,:,:) = vmask_i_diag(:,:,:) 
    14091417         CASE('W')    
    1410             zmask(:,:,2:jpk  ) = tmask_i_3d(:,:,1:jpkm1) + tmask_i_3d(:,:,2:jpk)    
    1411             zmask(:,:,1) = tmask_i_3d(:,:,1) 
    1412          END SELECT 
     1418            zmask(:,:,2:jpk  ) = tmask_i_diag(:,:,1:jpkm1) + tmask_i_diag(:,:,2:jpk)    
     1419            zmask(:,:,1) = tmask_i_diag(:,:,1) 
     1420        END SELECT 
    14131421         ! 
    14141422#if ! defined key_xios2 
Note: See TracChangeset for help on using the changeset viewer.