Generate BDY coordinate files runtime based on nambdy_index
Context
At present, both the manual and reference cfgs addresses with the use of the BDY
trough the use of coordinate files, e.g., coordinates.bdy.nc
.
Only few information are provided about the alternative way of using nambdy_index
namelist and documentation should be improved.
The namelist approach could be profitably exploited to add directly in NEMO code the creation of BDY
coordinate files based on the user defined segments trough nambdy_index
. In this way coordinate files will strictly comply with the model grid definition without the need to use external tools.
In additon, these files could represent a good support for the user when interpolating data from external sources on bdy segments.
Proposal
The creation of BDY
coordinate files for each segment defined by the user trough nambdy_index
can be plugged into the bdyini.F90
and executed only by the main processor in order to produce only one file. This will be done automatically without the specification of an additional namelists control paramater. In fact, the aim is that these files will then replace the use of nambdy_index
once created.
For example, one can setup the bdy segments definition trough the namelist and make a first run of the code to produce the netcdf files by setting
nambdy
to use bdy data equal to the initial state (option=0
). Afterwards, with the generated coordinate file in place one can build boundary data files.
The expected outcome from the following nambdy_index
configuration for a North boundary segment spanning the entire domain
&nambdy_index
ctypebdy = 'N'
nbdyind = -1
/
is a coordinate file that should look like in the following example
coordinates.bdy.North
netcdf coordinates.bdy.North {
dimensions:
yb = 1 ;
xbT = 550 ;
xbU = 549 ;
xbV = 550 ;
lev = 75 ;
variables:
short nbit(yb, xbT) ;
nbit:long_name = "t-grid index along X axis" ;
nbit:units = "-" ;
short nbjt(yb, xbT) ;
nbjt:long_name = "t-grid index along Y axis" ;
nbjt:units = "-" ;
short nbrt(yb, xbT) ;
nbrt:long_name = "Rim index of segment" ;
nbrt:units = "-" ;
short nbiu(yb, xbU) ;
nbiu:long_name = "u-grid index along X axis" ;
nbiu:units = "-" ;
short nbju(yb, xbU) ;
nbju:long_name = "u-grid index along Y axis" ;
nbju:units = "-" ;
short nbru(yb, xbU) ;
nbru:long_name = "Rim index of segment" ;
nbru:units = "-" ;
short nbiv(yb, xbV) ;
nbiv:long_name = "v-grid index along X axis" ;
nbiv:units = "-" ;
short nbjv(yb, xbV) ;
nbjv:long_name = "v-grid index along Y axis" ;
nbjv:units = "-" ;
short nbrv(yb, xbV) ;
nbrv:long_name = "Rim index of segment" ;
nbrv:units = "-" ;
float depth(lev) ;
depth:long_name = "Vertical levels" ;
depth:units = "meters" ;
// global attributes:
:title = "BDY coordinate file" ;
:boundary = "North" ;
:rimwidth = 1 ;
}
With this file containing all the correct bdy indices, one can easily extract gphi/glam
and e1/e2
metrics from the usual mash_mask
file to fill in those informations necessary for data interpolation procedures.
Along with the above coding, the documentation will be further improved.