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.
#2502 (DOMcfg: improve reproducibility of the domcfg.nc) – NEMO

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#2502 closed Defect (fixed)

DOMcfg: improve reproducibility of the domcfg.nc

Reported by: mathiot Owned by: mathiot
Priority: low Milestone: Unscheduled
Component: tools Version: trunk
Severity: minor Keywords: DOMAINcfg,
Cc:

Description

Context

When you found a domaincfg.nc, it is difficult to know how it has been built and how to reproduce it. MEOM/DRAKKAR build a script to add a specific the namelist_cfg in it as netcdf variable and input file name as attribute. A script to generate the namelist from the domcfg.nc is also available.

Analysis

To partially fix this, namelist_cfg should be introduced in the domcfg.nc output file AND bathymetry, coordinate (...) files name used to generate the input file should be added to the namelist_cfg (default name being the one specified in namelist_ref of the domain_cfg).

Steps

  • Introduced in the namelist the ability to use non generic name for coordinates, bathy, isf draft:
   cn_fcoord   =  'coordinates.nc'             ! external coordinates file (jphgr_msh = 0)
   cn_topo     =  'bathy_meter.nc           '  ! external topo file (nn_bathy =1/2)
   cn_topolvl  =  'bathy_level.nc           '  ! external topo file (nn_bathy =1) 
   cn_fisfd    =  'isf_draft_meter.nc'         ! external isf draft (nn_bathy =1 and ln_isfcav = .true.)
   cn_bath     =  'Bathymetry'                 ! topo name in file  (nn_bathy =1/2)
   cn_bathlvl  =  'Bathy_level'                ! lvl name in file   (nn_bathy =1) 
   cn_visfd    =  'isf_draft'                  ! isf draft variable (nn_bathy =1 and ln_isfcav = .true.)
  • Add the sript to include the namelist_cfg.nc into the domcfg.nc netcdf:
    ./dom_doc.exe -h
      usage : dom_doc -n NAMELIST-file 
                            -d DOMAIN_CFG-file
           
          PURPOSE :
             Add information in the domain_cfg.nc file after its creation for
             NEMO4. The additional information consists in a new netcdf variable
             called namelist_cfg, holding the content of the used namelist_cfg.
           
          ARGUMENTS :
             -n NAMELIST-file : name of the namelist_cfg. file required
             -d DOMAIN_CFG-file : name of the domain_cfg file to document. file requ
     ired
           
          OUTPUT : 
              input DOMAIN_CFG-file is modified on output.
    
  • Add the reverse script (ie to generate the namelist from the namelist_cfg netcdf variable):
    ./xtrac_namelist.bash domain_cfg.nc namelist_output
    (base) mathiotp@f-dahu:.../test_trunk$ cat namelist_output 
    !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    !! NEMO/OCE :   Reference namelist_ref                                !!
    !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    !! NEMO/OCE  :  1 - Domain & run manager (namrun, namcfg, namdom, namzgr, namzgr_sco )
    !!              8 - diagnostics      (namnc4)
    !!             10 - miscellaneous    (nammpp, namctl)
    !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    !-----------------------------------------------------------------------
    &namrun        !   parameters of the run
    !-----------------------------------------------------------------------
    ...
    /
    !-----------------------------------------------------------------------
    &namdom        !   space and time domain (bathymetry, mesh, timestep)
    !-----------------------------------------------------------------------
       ln_read_cfg = .false.   !  Read from a domain_cfg file
       nn_bathy    =    1      !  compute analyticaly (=0) or read (=1) the bathymetry file
                               !  or compute (2) from external bathymetry
       nn_interp   =    1                          ! type of interpolation (nn_bathy =2)
       cn_domcfg   = ' '       ! Name of the domain_cfg input file
       cn_fcoord   =  'coordinates.nc'             ! external coordinates file (nn_bathy =2)
       cn_topo     =  'bathy_meter.nc'             ! external topo file (nn_bathy =2)
       cn_topolvl  =  'bathy_level.nc'             ! external topo file (nn_bathy =2)
       cn_fisfd    =  'isf_draft_meter.nc'         ! external isf draft (nn_bathy =2 and ln_isfcav = .true.)
       cn_bath     =  'Bathymetry_isf'             ! topo name in file  (nn_bathy =2)
       cn_visfd    =  'isf_draft'                  ! isf draft variable (nn_bathy =2 and ln_isfcav = .true.)
       cn_lon      =  'nav_lon'                    ! lon  name in file  (nn_bathy =2)
       cn_lat      =  'nav_lat'                    ! lat  name in file  (nn_bathy =2)
       rn_bathy    =    0.     !  value of the bathymetry. if (=0) bottom flat at jpkm1
       nn_msh      =    1      !  create (=1) a mesh file or not (=0)
       rn_hmin     =   10.     !  min depth of the ocean (>0) or min number of ocean level (<0) (out of ice shelf cavity)
       rn_e3zps_min=   20.0     !  partial step thickness is set larger than the minimum of
       rn_e3zps_rat=    0.1    !  rn_e3zps_min and rn_e3zps_rat*e3t, with 0<rn_e3zps_rat<1
                               !
       rn_rdt      =  720.0    !  time step for the dynamics (and tracer if nn_acc=0)
       rn_atfp     =    0.1    !  asselin time filter parameter
       ln_crs      = .false.      !  Logical switch for coarsening module
       jphgr_msh   =       2               !  type of horizontal mesh
      ...
    

Commit History (4)

ChangesetAuthorTimeChangeLog
13391mathiot2020-08-10T11:11:42+02:00

ticket #2502: remove development branch

13390mathiot2020-08-10T11:09:15+02:00

ticket #2502: merge ticket branch into trunk. DOMAIN_cfg namelist contains now fields to specify input files names (bathy meter and level files, coord file, isf draft meter and level files), save it into the netcdf (dom_doc.exe) and re-generate the namelist if needed (xtrac_namelist.bash). The usage is documented in the DOMAIN_cfg README.rst.

13345mathiot2020-07-27T14:51:36+02:00

ticket #2502: changes to generate exactly the same namelist without any trailing space (if there are some) in the namelist_cfg.

13339mathiot2020-07-27T10:34:24+02:00

branch to implement ticket #2502

Change History (7)

comment:1 Changed 4 years ago by mathiot

In 13339:

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

comment:2 Changed 4 years ago by mathiot

In 13345:

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

comment:3 Changed 4 years ago by davestorkey

I had a go with this and it all seems to work for eORCA025.

comment:4 Changed 4 years ago by mathiot

In 13390:

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

comment:5 Changed 4 years ago by mathiot

In 13391:

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

comment:6 Changed 4 years ago by mathiot

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

comment:7 Changed 4 years ago by mathiot

Thank you Dave for the external testing.

Note: See TracTickets for help on using tickets.