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.
#2328 (Introduce missing functionality for sn_cfctl options) – NEMO

Opened 3 years ago

Closed 21 months ago

Last modified 18 months ago

#2328 closed Defect (fixed)

Introduce missing functionality for sn_cfctl options

Reported by: acc Owned by: acc
Priority: low Milestone:
Component: TOP Version: trunk
Severity: minor Keywords:
Cc:

Description

Context

For v4.0 the sn_cfctl structure was introduced to provide greater control over the separate log files that can be produced by the model (ocean.output, layout.dat, run.stat, trac.stat etc.). The task was not completed and some logic is missing which means some of the outputs can only be produced by using the old, ln_ctl mechanism (which doesn't allow selection of subsets of processors for output).

Analysis

The sn_cfctl structure contains six options:

      LOGICAL :: l_runstat = .FALSE.  !: Produce/do not produce run.stat file (T/F)
      LOGICAL :: l_trcstat = .FALSE.  !: Produce/do not produce tracer.stat file (T/F)
      LOGICAL :: l_oceout  = .FALSE.  !: Produce all ocean.outputs    (T) or just one (F)
      LOGICAL :: l_layout  = .FALSE.  !: Produce all layout.dat files (T) or just one (F)
      LOGICAL :: l_mppout  = .FALSE.  !: Produce/do not produce mpp.output_XXXX files (T/F)
      LOGICAL :: l_mpptop  = .FALSE.  !: Produce/do not produce mpp.top.output_XXXX files (T/F)}

In the current trunk (and versions 4.0 and 4.0.1) the controls for run stat, trcstat and layout work as advertised but the other three have not yet been implemented. Support for oceout is easily added but the mppout and mpptop cases require more intervention. These latter two were the original functions of the ln_ctl control (which activates the prt_ctl and prt_trc_ctl calls respectively) and to target these specifically will require isolating the different uses that ln_ctl has been put to since.

Recommendation

Control over the production of ocean.output files can be implemented with a simple rearrangement of nemogcm.F90 (all variants) to process the sn_cfctl structure before setting lap; i.e.:

  • OCE/nemogcm.F90

     
    323323      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    324324902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
    325325      ! 
    326       lwp = (narea == 1) .OR. ln_ctl    ! control of all listing output print 
     326      ! finalize the definition of namctl variables 
     327      IF( sn_cfctl%l_config ) THEN 
     328         ! Activate finer control of report outputs 
     329         ! optionally switch off output from selected areas (note this only 
     330         ! applies to output which does not involve global communications) 
     331         IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
     332           & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
     333           &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
     334      ELSE 
     335         ! Use ln_ctl to turn on or off all options. 
     336         CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
     337      ENDIF 
    327338      ! 
     339      lwp = (narea == 1) .OR. ln_ctl .OR. sn_cfctl%l_oceout    ! control of all listing output print 
     340      ! 
    328341      IF(lwp) THEN                      ! open listing units 
    329342         ! 
    330343         IF( .NOT. lwm )   &            ! alreay opened for narea == 1 
     
    355368         ! 
    356369      ENDIF 
    357370      ! 
    358       ! finalize the definition of namctl variables 
    359       IF( sn_cfctl%l_config ) THEN 
    360          ! Activate finer control of report outputs 
    361          ! optionally switch off output from selected areas (note this only 
    362          ! applies to output which does not involve global communications) 
    363          IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
    364            & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
    365            &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
    366       ELSE 
    367          ! Use ln_ctl to turn on or off all options. 
    368          CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
    369       ENDIF 
    370       ! 
    371371      IF(lwm) WRITE( numond, namctl ) 
    372372      ! 
    373373      !                             !------------------------------------! 
     
    413413                           CALL     wad_init        ! Wetting and drying options 
    414414                           CALL     dom_init("OPA") ! Domain 
    415415      IF( ln_crs       )   CALL     crs_init        ! coarsened grid: domain initialization 
    416       IF( ln_ctl       )   CALL prt_ctl_init        ! Print control 
     416      IF( ln_ctl .OR. sn_cfctl%l_mppout )   & 
     417         &                 CALL prt_ctl_init        ! Print control 
    417418 
    418419      CALL diurnal_sst_bulk_init                ! diurnal sst 
    419420      IF( ln_diurnal   )   CALL diurnal_sst_coolskin_init   ! cool skin 

Implementing targeted control over the mpp output files will, in the first instance, be tried by converting all constructs such as:

      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf  - Ua: ', mask1=umask,               &
         &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )

to

      IF(ln_ctl .OR. sn_cfctl%mppout)   CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf  - Ua: ', mask1=umask,               &
         &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )

This needs to happen in many files so a PERL command such as:

perl -0777 -pi -e 's@(\s*IF\s*\(\s*ln_ctl)(\s*\))@\1 .OR. sn_cfctl%l_mppout\2@'  $file

can probably be put to good use.

Given the number of files to be touched by this process, the work will be done and evaluated on a fix branch.

Commit History (3)

ChangesetAuthorTimeChangeLog
11872acc2019-11-07T17:55:13+01:00

Branch 2019/fix_sn_cfctl_ticket2328. See #2328. Replacement of ln_ctl and activation of full functionality with sn_cfctl structure. These changes rename structure components l_mppout and l_mpptop as l_prtctl and l_prttrc and introduce l_glochk to activate former ln_ctl code in stpctl.F90 to perform global location of min and max checks. Also added is l_allon which can be used to activate all output (much like the former ln_ctl). If l_allon is .false. then l_config decides whether or not the suboptions are used.

   sn_cfctl%l_glochk = .FALSE.    ! Range sanity checks are local (F) or global (T). Set T for debugging only
   sn_cfctl%l_allon  = .FALSE.    ! IF T activate all options. If F deactivate all unless l_config is T
   sn_cfctl%l_config = .TRUE.     ! IF .true. then control which reports are written with the remaining options

Note, these changes pass SETTE tests but all references to ln_ctl need to be removed from the sette scripts.

11869acc2019-11-06T17:01:36+01:00

Branch 2019/fix_sn_cfctl_ticket2328. Changes to enable correct functionality for the sn_cfctl%l_mppout and sn_cfctl%l_mpptop options. These changes also introduce a sn_cfctl%l_oasout option to toggle the OASIS setup information (sbccpl.F90, only) which was yet another misuse of ln_ctl. The next step may be to remove most references to ln_ctl altogether and provide a single control mechanism. TBD. See ticket #2328

11866acc2019-11-06T11:16:45+01:00

Branch 2019/fix_sn_cfctl_ticket2328. Changes to enable correct functionality for the sn_cfctl%l_oceout option. See #2328

Change History (9)

comment:1 Changed 3 years ago by acc

In 11862:

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

comment:2 Changed 3 years ago by acc

In 11866:

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

comment:3 Changed 3 years ago by acc

In 11869:

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

comment:4 Changed 3 years ago by acc

In 11872:

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

comment:5 Changed 3 years ago by acc

In 12144:

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

comment:6 Changed 3 years ago by cetlod

In 12210:

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

comment:7 Changed 3 years ago by acc

In 12236:

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

comment:8 Changed 21 months ago by acc

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

Finished in the 2020 Mid-year merge

comment:9 Changed 18 months ago by acc

In 14390:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found
Note: See TracTickets for help on using tickets.