Opened 7 years ago

Closed 7 years ago

#1253 closed Bug (fixed)

problem with reading mesh_mask in OFF_SRC

Reported by: vichi Owned by: vichi
Priority: normal Milestone:
Component: OFF Version: release-3.6
Severity: Keywords:
Cc: cetlod Branch review:
MP ready?: Task progress:

Description

If the user creates offline input data files with the version 3.6_alpha, then the OFFLINE does not work because variable e3t does not exist in the file, while it is looked for when reading the mesh_mask in OFF_SRC/domrea.F90.
This was not found because I believe everybody is using input files generated with previous versions of NEMO where e3t was written in the mesh_mask.
We have to be consistent with this release and it should be corrected before releasing the code. If users want to use previous files they will have to change the name of the variable in the input mesh_mask to make it consistent with 3.6

Suggested changes (including a better explanation of bottom indexing in the comments)

diff --git a/NEMOGCM/NEMO/OFF_SRC/domrea.F90 b/NEMOGCM/NEMO/OFF_SRC/domrea.F90
index ed95b59..54d3944 100644
--- a/NEMOGCM/NEMO/OFF_SRC/domrea.F90
+++ b/NEMOGCM/NEMO/OFF_SRC/domrea.F90
@@ -107,6 +107,13 @@ CONTAINS
             CALL iom_open( 'mesh_zgr', inum4 ) ! create 'mesh_zgr.nc'
             CALL iom_open( 'mask'    , inum2 ) ! create 'mask.nc'
 
+            !                                  ! ===========================
+         CASE DEFAULT                          ! return error 
+            !                                  ! mesh has to be provided
+            !                                  ! ===========================
+            CALL ctl_stop( ' OFFLINE mode requires the input mesh mask(s). ',   &
+            &                                 ' Invalid nn_msh value in the namelist (0 is not allowed)' )
+
          END SELECT
 
          !                                                         ! masks (inum2) 
@@ -172,10 +179,10 @@ CONTAINS
             CALL iom_get( inum4, jpdom_unknown, 'esigt', esigt )
             CALL iom_get( inum4, jpdom_unknown, 'esigw', esigw )
 
-            CALL iom_get( inum4, jpdom_data, 'e3t', fse3t_n(:,:,:) ) ! scale factors
-            CALL iom_get( inum4, jpdom_data, 'e3u', fse3u_n(:,:,:) )
-            CALL iom_get( inum4, jpdom_data, 'e3v', fse3v_n(:,:,:) )
-            CALL iom_get( inum4, jpdom_data, 'e3w', fse3w_n(:,:,:) )
+            CALL iom_get( inum4, jpdom_data, 'e3t_0', fse3t_n(:,:,:) ) ! scale factors
+            CALL iom_get( inum4, jpdom_data, 'e3u_0', fse3u_n(:,:,:) )
+            CALL iom_get( inum4, jpdom_data, 'e3v_0', fse3v_n(:,:,:) )
+            CALL iom_get( inum4, jpdom_data, 'e3w_0', fse3w_n(:,:,:) )
 
             CALL iom_get( inum4, jpdom_unknown, 'gdept_1d', gdept_1d ) ! depth
             CALL iom_get( inum4, jpdom_unknown, 'gdepw_1d', gdepw_1d )
@@ -189,10 +196,10 @@ CONTAINS
             CALL iom_get( inum4, jpdom_unknown, 'e3w_1d'  , e3w_1d   )
             !
             IF( nmsh <= 6 ) THEN                                        ! 3D vertical scale factors
-               CALL iom_get( inum4, jpdom_data, 'e3t', fse3t_n(:,:,:) )
-               CALL iom_get( inum4, jpdom_data, 'e3u', fse3u_n(:,:,:) )
-               CALL iom_get( inum4, jpdom_data, 'e3v', fse3v_n(:,:,:) )
-               CALL iom_get( inum4, jpdom_data, 'e3w', fse3w_n(:,:,:) )
+               CALL iom_get( inum4, jpdom_data, 'e3t_0', fse3t_n(:,:,:) )
+               CALL iom_get( inum4, jpdom_data, 'e3u_0', fse3u_n(:,:,:) )
+               CALL iom_get( inum4, jpdom_data, 'e3v_0', fse3v_n(:,:,:) )
+               CALL iom_get( inum4, jpdom_data, 'e3w_0', fse3w_n(:,:,:) )
             ELSE                                                        ! 2D bottom scale factors
                CALL iom_get( inum4, jpdom_data, 'e3t_ps', e3tp )
                CALL iom_get( inum4, jpdom_data, 'e3w_ps', e3wp )
@@ -227,9 +234,9 @@ CONTAINS
                END DO
             END IF
 
-            IF( iom_varid( inum4, 'gdept', ldstop = .FALSE. ) > 0 ) THEN   ! 3D depth of t- and w-level
-               CALL iom_get( inum4, jpdom_data, 'gdept', fsdept_n(:,:,:) )
-               CALL iom_get( inum4, jpdom_data, 'gdepw', fsdepw_n(:,:,:) )
+            IF( iom_varid( inum4, 'gdept_0', ldstop = .FALSE. ) > 0 ) THEN   ! 3D depth of t- and w-level
+               CALL iom_get( inum4, jpdom_data, 'gdept_0', fsdept_n(:,:,:) )
+               CALL iom_get( inum4, jpdom_data, 'gdepw_0', fsdepw_n(:,:,:) )
             ELSE                                                           ! 2D bottom depth
                CALL iom_get( inum4, jpdom_data, 'hdept', zprt )
                CALL iom_get( inum4, jpdom_data, 'hdepw', zprw )
@@ -346,22 +353,25 @@ CONTAINS
       !!
       !! ** Method  :   computes from mbathy with a minimum value of 1 over land
       !!
-      !! ** Action  : - update mbathy: level bathymetry (in level index)
+      !! ** Action  :   mbkt, mbku, mbkv :   vertical indices of the deeptest
+      !!                                     ocean level at t-, u- & v-points
+      !!                                     (min value = 1 over land)
       !!----------------------------------------------------------------------
       !
       INTEGER ::   ji, jj   ! dummy loop indices
       REAL(wp), POINTER, DIMENSION(:,:) :: zmbk
       !!----------------------------------------------------------------------
-
+      !
+      !
+      !
+      CALL wrk_alloc( jpi, jpj, zmbk )
       !
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) '    zgr_bot_level : ocean bottom k-index of T-, U-, V- and W-levels '
       IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~'
       !
-      CALL wrk_alloc( jpi, jpj, zmbk )
-      !
       mbkt(:,:) = MAX( mbathy(:,:) , 1 )    ! bottom k-index of T-level (=1 over land)
-      !
+      !                                     ! bottom k-index of W-level = mbkt+1
       DO jj = 1, jpjm1                      ! bottom k-index of u- (v-) level
          DO ji = 1, jpim1
             mbku(ji,jj) = MIN(  mbkt(ji+1,jj  ) , mbkt(ji,jj)  )

Commit History (1)

ChangesetAuthorTimeChangeLog
4569vichi2014-03-25T18:43:26+01:00

Correct problem with reading mesh_mask in OFF_SRC, Ticket #1253

The reading of mesh mask information is now compliant with the grid variables written in mesh_mask.nc. Be aware that if one is using a mesh_mask generated with a previous version of NEMO (<3.6) variable e3t must be renamed to e3t_0. This commit also adds information on the date which may be needed by other biogeochemical models.

Change History (2)

comment:1 Changed 7 years ago by vichi

Solved in commit [4569]

comment:2 Changed 7 years ago by vichi

  • Resolution set to fixed
  • Status changed from new to closed

Solved in commit [4569]

Note: See TracTickets for help on using tickets.