source: NEMO/branches/2019/dev_r11643_ENHANCE-11_CEthe_Shaconemo_diags/cfgs/SHARED/README.namelists @ 11998

Last change on this file since 11998 was 9532, checked in by gm, 3 years ago

dev_merge_2017: end of the renaming MLE

File size: 3.5 KB
Line 
1Simple style rules for namelists
2--------------------------------
3
4NEMO reference namelists should adhere to the following simple style rules:
5
61. Comments outside a namelist block start with !! in column 1
72. Each namelist block starts with 3 lines of the form:
8
9!-----------------------------------------------------------------------
10&namblockname        !   short description of block
11!-----------------------------------------------------------------------
12
13        with all ! and & 's starting in column 1
143. The closing / for each namelist block is in column 1
154. Comments within namelist blocks never start with !- . Use ! followed
16        by space or != etc.
17
18These conventions make it possible to construct empty configuration namelists.
19For example, a namelist_cfg template can be produced from namelist_ref with
20the following grep command; e.g.:
21
22grep -E  '^!-|^&|^/' namelist_ref > namelist_cfg.template
23
24head namelist_cfg.template
25 
26!-----------------------------------------------------------------------
27&namrun        !   parameters of the run
28!-----------------------------------------------------------------------
29/
30!-----------------------------------------------------------------------
31&namcfg        !   parameters of the configuration                     
32!-----------------------------------------------------------------------
33/
34!-----------------------------------------------------------------------
35&namdom        !   time and space domain
36!-----------------------------------------------------------------------
37/
38.
39.
40
41If all configuration namelists are produced and maintained using this
42strategy then standard, side-by-side comaparators, such as vimdiff or xxdiff,
43can be used to compare and transfer lines from the reference namelist to a
44configuration namelist when setting up a new configuration.
45
46Tips and tricks
47---------------
48
491. The following bash function is useful when checking which namelist blocks
50are in active use in a configuration namelist:
51
52  function  list_used_nl(){ grep -n -E '^&|^/' "$1" | sed -e 's/:/ /' \
53    | awk ' BEGIN { x = 0 } \
54      {if ( NR % 2 == 0 && $1 - x > 2 ) printf("%3d  %s\n", $1 - x , n) ; \
55       else x = $1; n = $2}' \
56    | sort -k 2;}
57
58which (assuming the namelist adheres to the conventions) will list the number
59of entries in each non-empty namelist block. The list is sorted on the block
60name to ease comparisons. For example:
61
62  list_used_nl ORCA2_LIM3_PISCES/EXP00/namelist_cfg
63
64  1 &nambbc
65  5 &nambbl
66  30 &namberg
67  10 &namcfg
68  4 &namctl
69  3 &namdom
70  1 &namdrg
71  5 &namdyn_adv
72  1 &namdyn_hpg
73  22 &namdyn_ldf
74  1 &namdyn_spg
75  5 &namdyn_vor
76  3 &nameos
77  1 &namhsb
78  4 &namrun
79  1 &namsbc
80  1 &namsbc_blk
81  3 &namtra_adv
82  28 &namtra_ldf
83  10 &namtra_ldfeiv
84  25 &namzdf
85  3 &namzdf_iwm
86
872. vimdiff can give garish colours in some terminals. Usually this is because
88vim assumes, incorrectly, that the terminal only supports 8 colours. Try forcing
89256 colours with:
90
91  :set t_Co=256
92
93to produce more pastel shades (add this to ~/.vimrc if successful).
94
953. Switching between vsplit panes in vim is a multi-key sequence. The tool is
96much easier to use if the sequence is mapped to a spare key. Here I use the
97§ and ± key on my Mac keyboard (add to ~/.vimrc):
98
99  map § ^Wl
100  map ± ^Wh
101
1024. With easy switching between panes, constructing namelists in vimdiff just
103requires the following commands in addition to normal editing:
104
105  ]c    - Go to next block of the diff
106  dp    - Push version of the block under cursor into the other pane
107  do    - Pull version of the block under cursor from the other pane
108
109
Note: See TracBrowser for help on using the repository browser.