# How create regional configuration

## What do we need to create regional configuration

- Coordinates
- Bathymetry
- Boundary condition
- Initial condition
- Tide
- Runoff
- Surface forcing

# How Mercator create regional confiuration

### Hypothesis and limits of the method

#### Hypothesis

- orca grid to orca grid
- odd refinement
- free licence language

#### Limits of the method

- can't create domain on north pole or band of latitude
- don't create files to use TOP, LIM
- get data of the system used (ex: GLORYS, ORCA12…) to forced at boundaries and initialised new configuration, from local space.

### Coordinates

- extraction of the domain from an already existing coordinate file. [fortran]
- boundary still on U,V point

### Bathymetry

- extraction of the domain from an already existing bathymetry file [fortran code].
- merged bathymetry at boundary ($\sim1$\textdegree) with weighted function [fortran code].

### Boundary condition

- extrapolation of the above system ouput [fortran code].
- horizontally (first) : distance weighted function using nearest 9 points
- vertically : takes value of the upper point

- interpolation to refine grid (T,S,U,V,SSH) [fortran code] :
- horizontally: bilinear or bicubic

- extraction at boundaries [fortran code].
- output in OBC form.
- before run NEMO, concatenated files over the period [nco].

### Initial condition

- from a restart file (netcdf or dimg) or from a
`standard`*output [fortran code, nco] :*- extrapolation :
- horizontally (first) : distance weighted function using nearest 9 points.
- vertically : takes value of the upper point

- interpolation to refine grid (T,S,U,V,SSH) :
- horizontally: bilinear or bicubic

- extrapolation :

### Tide

- Interpolation and extraction of the domain from an already existing tide file (TPXO) [fortran code].

### Runoff

- as
`rain`*:*- interpolation and extraction of the domain from an already existing runoff file [fortran code].

- as
`rain`*and flux for biggest river :*- interpolation and extraction of the domain from an already existing runoff file (minor river) [fortran code].
- biggest river are include as flux (BDY) [fortran code].

### Surface forcing

manage inside NEMO using interpolation on the fly. (weighted function needed to do interpolation on the fly, could be created by WEIGHT tools already inside NEMO).

# How NOC create regional confiuration

### Boundary condition: BDY Tools

The BDY subroutines can be employed to communicate information from outside the regional model domain into the interior while supporting both outflow and inflow conditions. This set of tools was born out of a requirement to have a generic method by which to provide boundary data for use by these subroutines. The original code for these tools was written in Mathworks Matlab. It was subsequently translated into Python for wider distribution and to facilitate development. The Python port is 90\% complete and should be finished at tested by the end of the month. At present the tools have only been tested by transferring data from global ORCA simulations to refined regional domains, although in principle could use non-ORCA input to generate BDY data

- Works using a NEMO style namelist to initiate BDY configuration.
- Automatic identification of BDY points from a user chosen or predefined mask.
- KDTree nearest neighbour matchup between the identified BDY points and the associated locations on source grid.
- Data are first interpolated (horizontally) from source grid to destination BDY points using:
- Bilinear
- Gauss like – distance weighted function using nearest 9 points with a decorrelation distance r0 proportional to dx*cos(lat(j,i))
- Nearest – takes closest point on distance (for use with similar res src and dst grids)

- Then in the vertical
- Linear
- Cubic Spline

- Output in NEMO v3.2/3.3 and 3.4 forms
- Time stretching used to accommodate mismatch in source and destination calendars
- Optional smoothing of BDY boundary (post interpolation)
- Should be able to accept non NEMO netcdf src files, but not tested yet
- Handles rotation of vector quantities and can accommodate rotated grids (e.g. pan arctic)
- At present is only coded to use TPXO7.2 inverse tidal model to provide tidal boundary conditions

# How Met Office? create regional confiuration

### Hypothesis and limits of the method

#### Hypothesis

Regional models at the Met Office up to now have been based on a standard latitude/longitude grid, sometimes rotated (ie. north pole of grid not at geographical north pole). Open boundaries are handled using the NEMO BDY module. The code for generating the grid definition and model input files is a mixture of IDL and Fortran.

Most model input files are generated by 3D linear interpolation. Horizontal interpolation weights are calculated using the SCRIP code developed at Los Alamos. Met Office Fortran routines are used to calculate the vertical interpolation weights and perform the interpolation in 3D using the horizontal and vertical interpolation weights. The interpolation routine can handle full 3D interpolation required for eg. s-coordinate models. The interpolation routine rotates vector fields where necessary.

#### Limits of the method

- Only handles latitude\slash{}longitude grids (with possible rotation).
- Does not make use of flexibility of BDY module – only handles regular rectangular boundaries at edge of the domain.

### Coordinate

An IDL routine takes the model bathymetry as input (see \ref{MetOff_Bathy}) and generates the NEMO coordinates.nc file as well as the grid definition files required by the SCRIP routines. Note that this routine can only handle latitude/longitude grids with possible rotation.

### Bathymetry

Bathymetry on the model domain is derived from the GEBCO dataset using a box-averaging algorithm, ie. all data points within a model gridbox are averaged to find the model depth at that point. IDL code. Bathmetry at open boundaries is matched to the bathymetry of the low-resolution model supplying the boundary data. Sometimes hand editing of the bathymetry is performed, eg. to remove nearly-enclosed inlets on the coast.

Bathymetry for the North-West Shelf domain is derived from the NOOS 1 nautical mile bathymetry using grid-box averaging.

### Boundary condition

An IDL routine takes the model coordinates.nc file as input and generates the coordinates.bdy.nc file (definition of boundary in BDY module) as well as the grid definition files required by SCRIP. Note that this routine can only handle regular open boundaries around the edge of a rectangular domain, so doesn’t make use of the flexibility of the boundary zone definition in BDY.

Boundary data is generated using 3D linear interpolation. Tidal harmonic forcing data is interpolated from output from a tidal model.

### Initial condition

Regional models are spun up from rest. Initial temperature and salinity fields are either taken from climatology or from a low-resolution FOAM analysis. The temperature and salinity fields are interpolated to the model grid using 3D linear interpolation.

### Runoff

Runoff is generated from the GRDC climatological dataset using a set of bespoke scripts and fortran code. For each river the data point nearest to the coast is selected and applied to the nearest coastal point in the model. For large rivers the runoff is spread over a number of ocean points. Runoff is applied as a surface flux.

### Surface forcing

Surface forcing is derived from Met Office atmosphere model fields and interpolated to model points using bilinear interpolation.