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.
#2588 (domain_cfg: various issues) – NEMO

Opened 4 years ago

Closed 3 years ago

#2588 closed Bug (fixed)

domain_cfg: various issues

Reported by: mathiot Owned by: mathiot
Priority: low Milestone:
Component: DOM Version:
Severity: minor Keywords:
Cc:

Description

Context

  • out of bound in some configuration with isf (domisf.F90)
  • dom_clo needs to be reactivated (domain.F90, see also #2503)
  • dom_wri needs to be reactivated (dommsk.F90, see also #2503)
  • restore proper computation of distance in domngb.F90 (see also #2503)
  • glob_* function use tmask_i. However some call it before tmask_i is initialised. As these calls are only used for sanity check and print, I suggest to remove tmask_i from the function. (lib_fortran_generic.h90)
  • initialised ln_read_cfg to False as it is used before the namelist bloc is read.

Analysis

...

Fix

  • domain.F90

     
    7676      !                       !==  Reference coordinate system  ==! 
    7777      ! 
    7878      CALL dom_nam               ! read namelist ( namrun, namdom ) 
    79                   !   CALL dom_clo               ! Closed seas and lake 
    8079          
    8180      CALL dom_hgr               ! Horizontal mesh 
    8281      CALL dom_zgr( ik_top, ik_bot )  ! Vertical mesh and bathymetry 
    8382      CALL dom_msk( ik_top, ik_bot )  ! Masks 
     83      IF ( ln_domclo ) CALL dom_clo               ! Closed seas and lake 
    8484      ! 
    85       ! 
    8685      CALL dom_ctl                  ! print extrema of masked scale factors 
    8786      !  
    8887#if ! defined key_agrif 
  • domisf.F90

     
    294294         imisfdep = misfdep 
    295295         zrisfdep = risfdep 
    296296         WHERE ( mbathy(:,:) == 0 ) 
    297             imask(:,:) = 0 
     297            imask(:,:) = jpk 
    298298            imbathy(:,:) = jpk 
    299299         END WHERE 
    300300         DO jj = 2, jpjm1 
     
    301301            DO ji = 2, jpim1 
    302302               IF(  (misfdep(ji,jj) > 1) .AND. (mbathy(ji,jj) > 0) ) THEN 
    303303                  ! 
    304                   ! what it should be 
     304                  ! what it should be (1 = should be connected; >= jpk = should not be connected) 
    305305                  imskip1 = imask(ji,jj) * imask(ji+1,jj  )  ! 1 = should be connected 
    306306                  imskim1 = imask(ji,jj) * imask(ji-1,jj  )  ! 1 = should be connected 
    307307                  imskjp1 = imask(ji,jj) * imask(ji  ,jj+1)  ! 1 = should be connected 
    308308                  imskjm1 = imask(ji,jj) * imask(ji  ,jj-1)  ! 1 = should be connected 
    309309                  ! 
    310                   ! what it is 
     310                  ! what it is ? ( 1 = no effective connection; jpk = effective connection ) 
    311311                  imskip1_r=jpk ; imskim1_r=jpk; imskjp1_r=jpk; imskjm1_r=jpk 
    312312                  IF (misfdep(ji,jj) > imbathy(ji+1,jj  )) imskip1_r=1.0 ! 1 = no effective connection 
    313313                  IF (misfdep(ji,jj) > imbathy(ji-1,jj  )) imskim1_r=1.0 ! 1 = no effective connection 
     
    315315                  IF (misfdep(ji,jj) > imbathy(ji  ,jj-1)) imskjm1_r=1.0 ! 1 = no effective connection 
    316316                  ! 
    317317                  ! defining level needed for connectivity 
    318                   ! imskip1 * imskip1_r == 1 means connections need to be enforce 
     318                  ! imskip1 * imskip1_r == 1   means    connection need to be enforce 
     319                  ! imskip1 * imskip1_r >= jpk means no connection need to be enforce 
    319320                  jk=MIN(imbathy(ji+1,jj  ) * imskip1_r * imskip1, & 
    320321                     &   imbathy(ji-1,jj  ) * imskim1_r * imskim1, & 
    321322                     &   imbathy(ji  ,jj+1) * imskjp1_r * imskjp1, & 
    322323                     &   imbathy(ji  ,jj-1) * imskjm1_r * imskjm1, & 
    323                      &   jpk+1 ) ! add jpk in the MIN to avoid out of boundary later on 
     324                     &   jpk ) ! add jpk in the MIN to avoid out of boundary later on 
    324325                  ! 
    325326                  ! if connectivity is OK or no connection needed (grounding line) or grounded, zmisfdep=misfdep 
    326327                  imisfdep(ji,jj)=MIN(misfdep(ji,jj),jk-1) 
     
    328329                  ! update isf draft if needed (need to be done here because next test is in meter and level) 
    329330                  IF ( imisfdep(ji,jj) < misfdep(ji,jj) ) THEN 
    330331                     jk = imisfdep(ji,jj) 
     332                     PRINT *, jk, ji, jj, misfdep(ji,jj),  narea 
    331333                     zrisfdep(ji,jj)  = gdepw_1d(jk+1) - MIN( e3zps_min, e3t_1d(jk)*e3zps_rat ) 
    332334                  END IF 
    333335    
  • dommsk.F90

     
    155155               ENDIF 
    156156            END DO   
    157157         END DO   
    158          ELSE 
     158      ELSE 
    159159         DO jk = 1, jpk 
    160160            DO jj = 1, jpj 
    161161               DO ji = 1, jpi 
     
    293293      ! User defined alteration of fmask (use to reduce ocean transport in specified straits) 
    294294      ! --------------------------------  
    295295      ! 
    296  
     296      ! write mesh mask 
     297      IF ( nn_msh > 0 ) CALL dom_wri 
     298      ! 
    297299      CALL usr_def_fmask( cp_cfg, jp_cfg, fmask ) 
    298300      ! 
    299301   END SUBROUTINE dom_msk 
  • domngb.F90

     
    4545      ! 
    4646      INTEGER :: ik         ! working level 
    4747      INTEGER , DIMENSION(2) ::   iloc 
    48       REAL(wp)               ::   zlon, zmini 
    4948      REAL(wp), DIMENSION(jpi,jpj) ::   zglam, zgphi, zmask, zdist 
    5049      !!-------------------------------------------------------------------- 
    5150      ! 
     
    5958      CASE DEFAULT ; zglam(:,:) = glamt(:,:) ; zgphi(:,:) = gphit(:,:) ; zmask(nldi:nlei,nldj:nlej) = tmask(nldi:nlei,nldj:nlej,ik) 
    6059      END SELECT 
    6160 
    62       zlon       = MOD( plon       + 720., 360. )                                     ! plon between    0 and 360 
    63       zglam(:,:) = MOD( zglam(:,:) + 720., 360. )                                     ! glam between    0 and 360 
    64       IF( zlon > 270. )   zlon = zlon - 360.                                          ! zlon between  -90 and 270 
    65       IF( zlon <  90. )   WHERE( zglam(:,:) > 180. ) zglam(:,:) = zglam(:,:) - 360.   ! glam between -180 and 180 
    66       zglam(:,:) = zglam(:,:) - zlon 
     61      zdist = dist(plon, plat, zglam, zgphi) 
    6762 
    6863      IF( lk_mpp ) THEN   
    6964         CALL mpp_minloc( 'domngb', zdist(:,:), zmask, rdist, iloc) 
  • domwri.F90

     
    214214      CALL lbc_lnk( 'domwri', puniq, cdgrd, 1. )            ! apply boundary conditions 
    215215      lldbl(:,:,1) = puniq(:,:) == ztstref(:,:)   ! check which values have been changed  
    216216      ! 
    217       puniq(:,:) = 1.                             ! default definition 
    218       ! fill only the inner part of the cpu with llbl converted into real  
    219       puniq(nldi:nlei,nldj:nlej) = REAL( COUNT( lldbl(nldi:nlei,nldj:nlej,:), dim = 3 ) , wp ) 
     217      puniq(:,:) = REAL( COUNT( lldbl(:,:,:), dim = 3 ) , wp ) 
    220218      ! 
    221219   END SUBROUTINE dom_uniq 
    222220 
  • lib_fortran_generic.h90

     
    116116      ! 
    117117      ipk = K_SIZE(ptab)   ! 3rd dimension 
    118118      ! 
    119       ztmp = ARRAY_OPERATION( ARRAY_IN(:,:,1)*tmask_i(:,:) ) 
     119      ztmp = ARRAY_OPERATION( ARRAY_IN(:,:,1)) 
    120120      DO jk = 2, ipk 
    121          ztmp = SCALAR_OPERATION(ztmp, ARRAY_OPERATION( ARRAY_IN(:,:,jk)*tmask_i(:,:) )) 
     121         ztmp = SCALAR_OPERATION(ztmp, ARRAY_OPERATION( ARRAY_IN(:,:,jk))) 
    122122      ENDDO 
    123123 
    124124      CALL MPP_OPERATION( cdname, ztmp) 
  • par_oce.f90

     
    2727   !!---------------------------------------------------------------------- 
    2828   !!                   namcfg namelist parameters 
    2929   !!---------------------------------------------------------------------- 
    30    LOGICAL       ::   ln_read_cfg      !: (=T) read the domain configuration file or (=F) not 
     30   LOGICAL       ::   ln_read_cfg = .FALSE.      !: (=T) read the domain configuration file or (=F) not 
    3131   CHARACTER(lc) ::      cn_domcfg        !: filename the configuration file to be read 
    3232   LOGICAL       ::   ln_write_cfg     !: (=T) create the domain configuration file 
    3333   CHARACTER(lc) ::      cn_domcfg_out    !: filename the configuration file to be read 

Commit History (2)

ChangesetAuthorTimeChangeLog
14931jchanut2021-05-31T16:36:45+02:00

#2638: restores Pierre's changes done in #2588 at r14199

14199mathiot2020-12-17T15:04:44+01:00

ticket #2588: various bug in domain_cfg (undefined variable before use, isf, closed sea re-activated ...)

Change History (6)

comment:1 Changed 4 years ago by clem

Good points. It looks to me that it concerns both 4.0-HEAD and the trunk

comment:2 Changed 4 years ago by mathiot

In 14199:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found

comment:3 Changed 4 years ago by mathiot

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

comment:4 Changed 3 years ago by mathiot

  • Resolution fixed deleted
  • Status changed from closed to reopened

ticket re-open: see #2643

comment:5 Changed 3 years ago by jchanut

In 14931:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found

comment:6 Changed 3 years ago by jchanut

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.