| 1 | [[TOC(heading=nemo_ConfigurationManagerNOC,nemo_ConfigurationManagerNOC/*, depth=1)]] |
| 2 | |
| 3 | = '''NOC BDY Tools''' = |
| 4 | |
| 5 | This is just a note to illustrate where I had got to with a few scripts to set up open boundaries for NEMO simulations using the BDY code. This set of tools was born out of a requirement to have a generic method by which to provide boundary data for use in regional NEMO configurations. The original code for these tools was written in Mathworks Matlab. It is was being translated into Python for wider distribution and to facilitate development, but this process stalled at the beginning of 2013. The Python port is 70% complete and the desire is to finish an alpha version within the next six months. At present the tools have only been tested by transferring data from global NEMO simulations to refined regional domains, although in principle could use non-NEMO input to generate BDY data. |
| 6 | |
| 7 | The BDY tools use grid information from the source data (e.g. a global NEMO 025 run) and destination simulation (i.e. the proposed regional simulation - at present you have to run the proposed regional simulation with nn_msh=3 to get the required mesh/mask files for the setup tools) to determine which source points are required for data extraction. This is done using a kdtree approximate nearest neighbour algorithm. The idea behind this targeted method is that if a NEMO style grid file is produced (tool to be written) for non-NEMO source data (e.g. we could use NCML [XML] to wrap non-NEMO netcdf files so they appear to have the common variables and dimensions e.g. votemper etc) in principle the BDY tools become more generic. At present the tools do not contain many options, but those that exist are accessed through a NEMO style namelist that is read in when the main python call is made. |
| 8 | |
| 9 | |
| 10 | == Summary: == |
| 11 | |
| 12 | • Works using a NEMO style namelist to initiate BDY configuration.[[BR]] |
| 13 | • Automatic identification of BDY points from a user chosen or predefined mask[[BR]] |
| 14 | • KDTree nearest neighbour matchup between the identified BDY points and the associated locations on source grid [[BR]] |
| 15 | • Data are first interpolated (horizontally) from source grid to destination BDY points using: [[BR]] |
| 16 | • Bi-linear[[BR]] |
| 17 | • Gauss-like – distance weighted function using nearest 9 points with a de-correlation distance r0 proportional to dx*cos(lat(j,i))[[BR]] |
| 18 | • Nearest – takes closest point on distance (for use with similar res src and dst grids)[[BR]] |
| 19 | • Then in the vertical[[BR]] |
| 20 | • Linear[[BR]] |
| 21 | • Cubic-Spline [[BR]] |
| 22 | • Output in NEMO v3.2/3.3 and 3.4 forms[[BR]] |
| 23 | • Time stretching used to accommodate mismatch in source and destination calendars[[BR]] |
| 24 | • Optional smoothing of BDY boundary (post interpolation)[[BR]] |
| 25 | • Should be able to accept non NEMO netcdf src files, but not tested yet[[BR]] |
| 26 | • Handles rotation of vector quantities and can accommodate rotated grids (e.g. pan arctic) [[BR]] |
| 27 | • At present is only coded to use TPXO7.2 inverse tidal model to provide tidal boundary conditions[[BR]] |
| 28 | • Recently add a hack to setup generic tracer boundary conditions (e.g. so one can include nutrients for coupled ecosystem simulations[[BR]] |
| 29 | |
| 30 | == Example namelist: == |
| 31 | |
| 32 | |
| 33 | {{{ |
| 34 | !----------------------------------------------------------------------- |
| 35 | ! vertical coordinate |
| 36 | !----------------------------------------------------------------------- |
| 37 | ln_zco = .false. ! z-coordinate - full steps (T/F) |
| 38 | ln_zps = .true. ! z-coordinate - partial steps (T/F) |
| 39 | ln_sco = .false. ! s- or hybrid z-s-coordinate (T/F) |
| 40 | rn_hmin = -10 ! min depth of the ocean (>0) or |
| 41 | ! min number of ocean level (<0) |
| 42 | |
| 43 | !----------------------------------------------------------------------- |
| 44 | ! s-coordinate or hybrid z-s-coordinate |
| 45 | !----------------------------------------------------------------------- |
| 46 | rn_sbot_min = 10. ! minimum depth of s-bottom surface (>0) (m) |
| 47 | rn_sbot_max = 7000. ! maximum depth of s-bottom surface |
| 48 | ! (= ocean depth) (>0) (m) |
| 49 | ln_s_sigma = .false. ! hybrid s-sigma coordinates |
| 50 | rn_hc = 150.0 ! critical depth with s-sigma |
| 51 | |
| 52 | !----------------------------------------------------------------------- |
| 53 | ! grid information |
| 54 | !----------------------------------------------------------------------- |
| 55 | cn_src_hgr = 'some_dir/mesh_hgr_src.nc' |
| 56 | cn_src_zgr = 'some_dir/mesh_zgr_src.nc' |
| 57 | cn_dst_hgr = 'some_dir/mesh_hgr_dst.nc' |
| 58 | cn_dst_zgr = 'some_dir/mesh_zgr_dst.nc' |
| 59 | cn_src_msk = 'some_dir/mask_src.nc' |
| 60 | |
| 61 | !----------------------------------------------------------------------- |
| 62 | ! I/O |
| 63 | !----------------------------------------------------------------------- |
| 64 | cn_src_dir = 'path_to_src_data/' |
| 65 | cn_dst_dir = 'path_to_dst_data/' |
| 66 | cn_fn = 'my_exp' ! prefix for output files |
| 67 | nn_fv = -1e20 ! set fill value for output files |
| 68 | |
| 69 | !----------------------------------------------------------------------- |
| 70 | ! unstructured open boundaries |
| 71 | !----------------------------------------------------------------------- |
| 72 | ln_coords_file = .true. ! =T : produce bdy coordinates files |
| 73 | cn_coords_file = 'coordinates.bdy.nc' ! name of bdy coordinates files |
| 74 | ! (if ln_coords_file=.TRUE.) |
| 75 | ln_mask_file = .false. ! =T : read mask from file |
| 76 | cn_mask_file = '' ! name of mask file (if ln_mask_file=.TRUE.) |
| 77 | ln_dyn2d = .true. ! boundary conditions for barotropic fields |
| 78 | ln_dyn3d = .true. ! boundary conditions for baroclinic velocities |
| 79 | ln_tra = .true. ! boundary conditions for T and S |
| 80 | ln_ice = .true. ! ice boundary condition |
| 81 | ln_tide = .true. ! tide boundary condition |
| 82 | nn_rimwidth = 9 ! width of the relaxation zone |
| 83 | |
| 84 | !----------------------------------------------------------------------- |
| 85 | ! Time information |
| 86 | !----------------------------------------------------------------------- |
| 87 | nn_year_000 = 1982 ! year start |
| 88 | nn_year_end = 1982 ! year end |
| 89 | nn_month_000 = 1 ! month start (default = 1 is years>1) |
| 90 | nn_month_end = 12 ! month end (default = 12 is years>1) |
| 91 | cn_dst_calendar = 'gregorian' ! output calendar format |
| 92 | nn_base_year = 1960 ! base year for time counter |
| 93 | |
| 94 | !----------------------------------------------------------------------- |
| 95 | ! Additional parameters |
| 96 | !----------------------------------------------------------------------- |
| 97 | nn_wei = 1 ! smoothing filter weights |
| 98 | rn_r0 = 0.0417 ! decorrelation distance use in gauss |
| 99 | ! smoothing onto dst points. Need to |
| 100 | ! make this a funct. of dlon |
| 101 | cn_history = 'bdy files produced by a.nobody' |
| 102 | ! history for netcdf file |
| 103 | ln_nemo3p4 = .true. ! else presume v3.2 or v3.3 |
| 104 | nn_alpha = 0 ! Euler rotation angle |
| 105 | nn_beta = 0 ! Euler rotation angle |
| 106 | nn_gamma = 0 ! Euler rotation angle |
| 107 | |
| 108 | }}} |
| 109 | |
| 110 | == Examples: == |