Commit 868014cc authored by ashbre's avatar ashbre
Browse files

Adding structure to namelists and fortran files and other small files

parent ed6b5111
!! -------------------
!! Namelist for SOSIE
!! -------------------
!!
!!
!! ************************************************************
!! &ninput => info about field to interpolate
!! and source grid to interpolate from
!! ************************************************************
!!
!! ivect : vector correction control on treated field [integer]
!! ivect = 0 : input field is not a component of a vector
!! or the target grid is regular (lregout = T)
!! * if non-regular distorted target grids (like ORCAX):
!! ivect = 1 : input field is a zonal (X) component of a vector
!! ivect = 2 : input field is a meridional (Y) component of a vector
!!
!! lregin : is the source grid regular? [logical]
!! (ie : are input longitude and latitude 1D?)
!!
!! cf_in : file containing the input field to be interpolated [char]
!! cv_in : name of treated variable (in input field file) [char]
!!
!! cv_t_in : name of time record variable in the input file [char]
!! or 'missing_rec' if no time record is present in the input file
!!
!! jt1 : first time record to be interpolated
!! jt2 : last time record to be interpolated
!! => set jt1 and jt2 to 0 if you want to skip this option
!! and interpolate the nt time steps of the current field
!!
!! jplev : level to treat if your file is 3D (spatial), has no influence if
!! your file is 2D in space !
!! ------------------------------------------------------------------
!! jplev > 0 = level to treat (ex : jplev = 1 will interpolate only
!! surface field corresponding to the 1st level )
!! ------------------------------------------------------------------
!! jplev = 0 : perform 3D interpolation (if input file is 3D) !!! |
!! ------------------------------------------------------------------
!! jplev = -1 : overrides good sense and forces sosie to understand that
!! your field to interpolate is 2D with a time record
!! (usually the case if the time record dimension in your
!! input file is not declared as UNLIMITED => bad! )
!! => so SOSIE doesn't mistake this time record with a depth!
!! -------------------------------------------------------------------
!!
!! cf_x_in : file containing the input grid (usually = cf_in) [char]
!! cv_lon_in : name of longitude in the input grid file [char]
!! cv_lat_in : name of latitude in the input grid file [char]
!!
!! cf_lsm_in : (only relevant if ldrown==.true.)
!! file containing the input land-sea mask [char]
!! Alternatively:
!! * specify " cf_lsm_in = 'missing_value' " if a 'missing_value' netcdf
!! attribute defines the mask on the input data field
!! * specify " cf_lsm_in = 'nan' " if mask is defined with NaN values
!! * specify " cf_lsm_in = 'value' if you want land regions to be defined
!! where field 'cv_in' is strictly equal to the numeric value read into 'cv_lsm_in'
!! * specify " cf_lsm_in = 'val+' if you want land regions to be defined
!! where field 'cv_in' is larger or equal to the numeric value read into 'cv_lsm_in'
!! * specify " cf_lsm_in = 'val-' if you want land regions to be defined
!! where field 'cv_in' is smaller or equal to the numeric value read into 'cv_lsm_in'
!! Ex: you want all points where your field is <= 0 to become land mask,
!! then specify: cf_lsm_in = 'val-' and cv_lsm_in = '0.00001'
!!
!! cv_lsm_in : (only relevant if ldrown==.true.)
!! name of land-sea mask variable [char]
!! or if cf_lsm_in = 'missing_value'--> '')
!! by default ocean is flagged with value 1
!! and continents are flagged with value 0
!! Alternatively:
!! a string of numeric value when cf_lsm_in is 'value', 'val-', or 'val+'
!!
!! ldrown : whether we call DROWN land filling procedure [logical]
!! => will propagate/extrapolate sea values (defined where lsm==1)
!! of field cv_in ONTO continents (defined WHERE lsm==0) to avoid
!! interpolation problems, such as continental values that contaminate
!! sea values during interpolation
!!
!! ewper : east-west periodicity on the input file/grid [integer]
!! = -1 --> no periodicity
!! >= 0 --> periodicity with overlap of ewper points
!!
!! vmax : upper bound not to exceed for treated variable [real]
!! vmin : lower bound not to exceed for treated variable [real]
!!
!! ismooth : if ismooth > 0 the field to be interpolated will be smoothed
!! prior to interpolation. By applying ismooth times a type of
!! closest neighboors boxcar smoothing algorithm
!! (check "SMOOTH" of mod_drown.f90)
!! => this is usefull to avoid sub-sampling when your target
!! grid is much coarser than your source grid
!! (i.e. when interpolating from high-res to low-res)
!! => start with a multiple of 10, typically 20, and adjust depending
!! on the result
!!
!!--------------------------------------------------------------------------
!!
&ninput
ivect = 0
lregin = T
cf_in = './initial_condition.nc'
cv_in = 'so'
cv_t_in = 'time'
jt1 = 0
jt2 = 0
jplev = 0
cf_x_in = './initial_condition.nc'
cv_lon_in = 'longitude'
cv_lat_in = 'latitude'
cf_lsm_in = 'missing_value'
cv_lsm_in = 'mask'
ldrown = T
ewper = -1
vmax = 1.E6
vmin = -1.E6
ismooth = 0
/
!!
!!
!!
!!
!! ***********************************************************
!! &n3d => info about source and target vertical levels/grids
!! ONLY IF 3D INTERPOLATION ( jplev = 0 in &ninput)
!! ***********************************************************
!!
!! Only mind if you do want to perform a 3D (spatial) interpolation
!!
!! Mind only if you do want to perform a 3D interpolation !
!! First, make sure that jplev is set to 0 !
!!
!! cf_z_in : file containing the input depth vector (associates a depth to a
!! given level). In most cases should be the same file than cf_x_in.
!! cv_z_in : name of the variable for the input depth vector
!!
!! cf_z_out : file containing the output depth vector (associates a depth to a
!! given level). In most cases should be the same file than cf_x_in.
!! cv_z_out : name of the variable for the output depth vector in file 'cf_z_out'
!! cv_z_out_name: name you wish to give to depth variable in file to be created...
!!
!! ctype_z_in : type of coordinates in input file (currently available z/sigma)
!! ctype_z_out : type of coordinates in output file (currently available z/sigma)
!!
!! These are to be set ONLY if ctype_z_in = 'sigma'
!! cf_bathy_in : file containing the bathymetry on input grid (usually ROMS grid file)
!! cv_bathy_in : name of bathymetry variable (usually h)
!! ssig_in : structure with ROMS s-coordinates parameters on input grid
!! Vtransform | Vstretching | Nlevels | theta_s | theta_b | Tcline | hmin
!!
!! These are to be set ONLY if ctype_z_out = 'sigma'
!! cf_bathy_out : file containing the bathymetry on output grid (usually ROMS grid file)
!! cv_bathy_out : name of bathymetry variable (usually h)
!! ssig_out : structure with ROMS s-coordinates parameters on output grid (see above)
!!
&n3d
cf_z_in = 'initial_condition.nc'
cv_z_in = 'depth'
cf_z_out = 'domain_cfg.nc'
cv_z_out = 'nav_lev'
cv_z_out_name = 'gdept'
ctype_z_in = 'z'
ctype_z_out = 'z'
/
!!
!!
!!
!!
!!
!! *****************************************************************
!! &nhtarget => info about horizontal target grid to interpolate to
!! *****************************************************************
!!
!! lregout : is the target grid regular ? [logical]
!! (ie : are output longitude and latitude 1D?)
!!
!! cf_x_out : file containing the target grid [char]
!! cv_lon_out : name of longitude variable [char]
!! cv_lat_out : name of latitude variable [char]
!!
!! TRICK: for interpolating onto a global regular spherical grid
!! ------ with a resolution of dx deg. of longitude and dy deg. of latitude
!! * cf_x_out = 'spheric' ! tells SOSIE to build a spherical output grid
!! * cv_lon_out = '1.0' ! your dx, here 1.0 deg.
!! * cv_lat_out = '1.0' ! your dy, here 1.0 deg.
!!
!!
!! cf_lsm_out : file containing output land-sea mask [char]
!! MUST BE 3D for 3D interpolation!
!! or specify 'missing_value' if a 'missing_value' netcdf
!! attribute defines the mask on a field 'X' in file 'cf_x_out'
!! (not needed if "lmout = .FALSE." --> '')
!!
!! cv_lsm_out : name of land-sea mask variable in 'cf_lsm_out' [char]
!! or name of field 'X' in 'cf_x_out' if you specified
!! cf_lsm_out = 'missing_value'
!! (not needed if "lmout = .FALSE." --> '')
!!
!! lmout : whether to mask the interpolated field on the output file [logical]
!! if lmout is set to .FALSE. and cf_lsm_out is different than '' the output
!! field will be drowned using the mask defined by cf_lsm_out (and cv_lsm_out)
!!
!! rmaskvalue : missing value given to output field (for continents) [logical]
!!
!! lct : whether to control or not time variable [logical]
!! TRUE -> specify time array with starting time 't0' and step 't_stp'
!! usefull if you do not have a "time" variable in your input netcdf file !
!! FALSE -> same time array as in input file is used
!! t0 : time to start (if lct is set to .TRUE.) [real]
!! t_stp : time step (if lct is set to .TRUE.) [real]
!!
!! ewper_out : east-west periodicity on the output file/grid [integer]
!! = -1 --> no periodicity
!! >= 0 --> periodicity with overlap of ewper points
!!
!!
&nhtarget
lregout = T
cf_x_out = 'initial_condition.nc'
cv_lon_out = 'longitude'
cv_lat_out = 'latitude'
cf_lsm_out = ''
cv_lsm_out = ''
lmout = F
!rmaskvalue = -9999
lct = F
t0 = 0.
t_stp = 0.
ewper_out = -1
/
!!
!!
!!
!!
!! *****************************************************************
!! &noutput => info on the (horizontal) interpolation method to use
!! and the netcdf file to generate
!! *****************************************************************
!!
!! This mostly deals with how the output file to be created is going to look like!
!!
!! cmethod : the 2D interpolation method to be used
!!
!! * use 'akima' if your input domain is regular (non-distorted grid)
!!
!! * use 'bilin' otherwise (bilinear 2D interpolation)
!!
!! * use 'no_xy' to only perform vertical interpolation, i.e. interpolate a
!! a 3D field given on ni*nj and nk_in levels to the same ni*nj 2D domain
!! but on nk_out levels!
!! => for example interpolates a 3D field from grid ORCAX.L46 to ORCAX.L75
!!
!! *** Into the netcdf file to be created : ***
!! cv_t_out : name of time record vector in the output file [char]
!! => set to cv_t_out='' if no time dimension
!! cv_out : name for treated variable in the output file [char]
!! cu_out : if not = '': then change the unit of treated variable units [char]
!! cln_out : if not = '': then change the long name treated variable [char]
!! cd_out : directory to create output file to [char]
!!
!! *** Naming of the output file : ***
!! csource : short string to describe the origin grid [char]
!! ctarget : short string to describe the target grid [char]
!! cextra : short extra indication about the file [char]
!!
&noutput
cmethod = 'bilin'
cv_t_out = 'time_counter'
cv_out = 'vosaline'
cu_out = 'PSU'
cln_out = 'Salinity'
cd_out = '.'
csource = 'COPERNICUS'
ctarget = 'INDIAN'
cextra = '2016'
/
!!
!! -------------------
!! Namelist for SOSIE
!! -------------------
!!
!!
!! ************************************************************
!! &ninput => info about field to interpolate
!! and source grid to interpolate from
!! ************************************************************
!!
!! ivect : vector correction control on treated field [integer]
!! ivect = 0 : input field is not a component of a vector
!! or the target grid is regular (lregout = T)
!! * if non-regular distorted target grids (like ORCAX):
!! ivect = 1 : input field is a zonal (X) component of a vector
!! ivect = 2 : input field is a meridional (Y) component of a vector
!!
!! lregin : is the source grid regular? [logical]
!! (ie : are input longitude and latitude 1D?)
!!
!! cf_in : file containing the input field to be interpolated [char]
!! cv_in : name of treated variable (in input field file) [char]
!!
!! cv_t_in : name of time record variable in the input file [char]
!! or 'missing_rec' if no time record is present in the input file
!!
!! jt1 : first time record to be interpolated
!! jt2 : last time record to be interpolated
!! => set jt1 and jt2 to 0 if you want to skip this option
!! and interpolate the nt time steps of the current field
!!
!! jplev : level to treat if your file is 3D (spatial), has no influence if
!! your file is 2D in space !
!! ------------------------------------------------------------------
!! jplev > 0 = level to treat (ex : jplev = 1 will interpolate only
!! surface field corresponding to the 1st level )
!! ------------------------------------------------------------------
!! jplev = 0 : perform 3D interpolation (if input file is 3D) !!! |
!! ------------------------------------------------------------------
!! jplev = -1 : overrides good sense and forces sosie to understand that
!! your field to interpolate is 2D with a time record
!! (usually the case if the time record dimension in your
!! input file is not declared as UNLIMITED => bad! )
!! => so SOSIE doesn't mistake this time record with a depth!
!! -------------------------------------------------------------------
!!
!! cf_x_in : file containing the input grid (usually = cf_in) [char]
!! cv_lon_in : name of longitude in the input grid file [char]
!! cv_lat_in : name of latitude in the input grid file [char]
!!
!! cf_lsm_in : (only relevant if ldrown==.true.)
!! file containing the input land-sea mask [char]
!! Alternatively:
!! * specify " cf_lsm_in = 'missing_value' " if a 'missing_value' netcdf
!! attribute defines the mask on the input data field
!! * specify " cf_lsm_in = 'nan' " if mask is defined with NaN values
!! * specify " cf_lsm_in = 'value' if you want land regions to be defined
!! where field 'cv_in' is strictly equal to the numeric value read into 'cv_lsm_in'
!! * specify " cf_lsm_in = 'val+' if you want land regions to be defined
!! where field 'cv_in' is larger or equal to the numeric value read into 'cv_lsm_in'
!! * specify " cf_lsm_in = 'val-' if you want land regions to be defined
!! where field 'cv_in' is smaller or equal to the numeric value read into 'cv_lsm_in'
!! Ex: you want all points where your field is <= 0 to become land mask,
!! then specify: cf_lsm_in = 'val-' and cv_lsm_in = '0.00001'
!!
!! cv_lsm_in : (only relevant if ldrown==.true.)
!! name of land-sea mask variable [char]
!! or if cf_lsm_in = 'missing_value'--> '')
!! by default ocean is flagged with value 1
!! and continents are flagged with value 0
!! Alternatively:
!! a string of numeric value when cf_lsm_in is 'value', 'val-', or 'val+'
!!
!! ldrown : whether we call DROWN land filling procedure [logical]
!! => will propagate/extrapolate sea values (defined where lsm==1)
!! of field cv_in ONTO continents (defined WHERE lsm==0) to avoid
!! interpolation problems, such as continental values that contaminate
!! sea values during interpolation
!!
!! ewper : east-west periodicity on the input file/grid [integer]
!! = -1 --> no periodicity
!! >= 0 --> periodicity with overlap of ewper points
!!
!! vmax : upper bound not to exceed for treated variable [real]
!! vmin : lower bound not to exceed for treated variable [real]
!!
!! ismooth : if ismooth > 0 the field to be interpolated will be smoothed
!! prior to interpolation. By applying ismooth times a type of
!! closest neighboors boxcar smoothing algorithm
!! (check "SMOOTH" of mod_drown.f90)
!! => this is usefull to avoid sub-sampling when your target
!! grid is much coarser than your source grid
!! (i.e. when interpolating from high-res to low-res)
!! => start with a multiple of 10, typically 20, and adjust depending
!! on the result
!!
!!--------------------------------------------------------------------------
!!
&ninput
ivect = 0
lregin = T
cf_in = './initial_condition.nc'
cv_in = 'thetao'
cv_t_in = 'time'
jt1 = 0
jt2 = 0
jplev = 0
cf_x_in = './initial_condition.nc'
cv_lon_in = 'longitude'
cv_lat_in = 'latitude'
cf_lsm_in = 'missing_value'
cv_lsm_in = 'mask'
ldrown = T
ewper = -1
vmax = 1.E6
vmin = -1.E6
ismooth = 0
/
!!
!!
!!
!!
!! ***********************************************************
!! &n3d => info about source and target vertical levels/grids
!! ONLY IF 3D INTERPOLATION ( jplev = 0 in &ninput)
!! ***********************************************************
!!
!! Only mind if you do want to perform a 3D (spatial) interpolation
!!
!! Mind only if you do want to perform a 3D interpolation !
!! First, make sure that jplev is set to 0 !
!!
!! cf_z_in : file containing the input depth vector (associates a depth to a
!! given level). In most cases should be the same file than cf_x_in.
!! cv_z_in : name of the variable for the input depth vector
!!
!! cf_z_out : file containing the output depth vector (associates a depth to a
!! given level). In most cases should be the same file than cf_x_in.
!! cv_z_out : name of the variable for the output depth vector in file 'cf_z_out'
!! cv_z_out_name: name you wish to give to depth variable in file to be created...
!!
!! ctype_z_in : type of coordinates in input file (currently available z/sigma)
!! ctype_z_out : type of coordinates in output file (currently available z/sigma)
!!
!! These are to be set ONLY if ctype_z_in = 'sigma'
!! cf_bathy_in : file containing the bathymetry on input grid (usually ROMS grid file)
!! cv_bathy_in : name of bathymetry variable (usually h)
!! ssig_in : structure with ROMS s-coordinates parameters on input grid
!! Vtransform | Vstretching | Nlevels | theta_s | theta_b | Tcline | hmin
!!
!! These are to be set ONLY if ctype_z_out = 'sigma'
!! cf_bathy_out : file containing the bathymetry on output grid (usually ROMS grid file)
!! cv_bathy_out : name of bathymetry variable (usually h)
!! ssig_out : structure with ROMS s-coordinates parameters on output grid (see above)
!!
&n3d
cf_z_in = 'initial_condition.nc'
cv_z_in = 'depth'
cf_z_out = 'domain_cfg.nc'
cv_z_out = 'nav_lev'
cv_z_out_name = 'gdept'
ctype_z_in = 'z'
ctype_z_out = 'z'
/
!!
!!
!!
!!
!!
!! *****************************************************************
!! &nhtarget => info about horizontal target grid to interpolate to
!! *****************************************************************
!!
!! lregout : is the target grid regular ? [logical]
!! (ie : are output longitude and latitude 1D?)
!!
!! cf_x_out : file containing the target grid [char]
!! cv_lon_out : name of longitude variable [char]
!! cv_lat_out : name of latitude variable [char]
!!
!! TRICK: for interpolating onto a global regular spherical grid
!! ------ with a resolution of dx deg. of longitude and dy deg. of latitude
!! * cf_x_out = 'spheric' ! tells SOSIE to build a spherical output grid
!! * cv_lon_out = '1.0' ! your dx, here 1.0 deg.
!! * cv_lat_out = '1.0' ! your dy, here 1.0 deg.
!!
!!
!! cf_lsm_out : file containing output land-sea mask [char]
!! MUST BE 3D for 3D interpolation!
!! or specify 'missing_value' if a 'missing_value' netcdf
!! attribute defines the mask on a field 'X' in file 'cf_x_out'
!! (not needed if "lmout = .FALSE." --> '')
!!
!! cv_lsm_out : name of land-sea mask variable in 'cf_lsm_out' [char]
!! or name of field 'X' in 'cf_x_out' if you specified
!! cf_lsm_out = 'missing_value'
!! (not needed if "lmout = .FALSE." --> '')
!!
!! lmout : whether to mask the interpolated field on the output file [logical]
!! if lmout is set to .FALSE. and cf_lsm_out is different than '' the output
!! field will be drowned using the mask defined by cf_lsm_out (and cv_lsm_out)
!!
!! rmaskvalue : missing value given to output field (for continents) [logical]
!!
!! lct : whether to control or not time variable [logical]
!! TRUE -> specify time array with starting time 't0' and step 't_stp'
!! usefull if you do not have a "time" variable in your input netcdf file !
!! FALSE -> same time array as in input file is used
!! t0 : time to start (if lct is set to .TRUE.) [real]
!! t_stp : time step (if lct is set to .TRUE.) [real]
!!
!! ewper_out : east-west periodicity on the output file/grid [integer]
!! = -1 --> no periodicity
!! >= 0 --> periodicity with overlap of ewper points
!!
!!
&nhtarget
lregout = T
cf_x_out = 'initial_condition.nc'
cv_lon_out = 'longitude'
cv_lat_out = 'latitude'
cf_lsm_out = ''
cv_lsm_out = ''
lmout = F
!rmaskvalue = -9999
lct = F
t0 = 0.
t_stp = 0.
ewper_out = -1
/
!!
!!
!!
!!
!! *****************************************************************
!! &noutput => info on the (horizontal) interpolation method to use
!! and the netcdf file to generate
!! *****************************************************************
!!
!! This mostly deals with how the output file to be created is going to look like!
!!
!! cmethod : the 2D interpolation method to be used
!!
!! * use 'akima' if your input domain is regular (non-distorted grid)
!!
!! * use 'bilin' otherwise (bilinear 2D interpolation)
!!
!! * use 'no_xy' to only perform vertical interpolation, i.e. interpolate a
!! a 3D field given on ni*nj and nk_in levels to the same ni*nj 2D domain
!! but on nk_out levels!
!! => for example interpolates a 3D field from grid ORCAX.L46 to ORCAX.L75
!!
!! *** Into the netcdf file to be created : ***
!! cv_t_out : name of time record vector in the output file [char]
!! => set to cv_t_out='' if no time dimension
!! cv_out : name for treated variable in the output file [char]
!! cu_out : if not = '': then change the unit of treated variable units [char]
!! cln_out : if not = '': then change the long name treated variable [char]
!! cd_out : directory to create output file to [char]
!!
!! *** Naming of the output file : ***
!! csource : short string to describe the origin grid [char]
!! ctarget : short string to describe the target grid [char]
!! cextra : short extra indication about the file [char]
!!
&noutput
cmethod = 'bilin'
cv_t_out = 'time_counter'
cv_out = 'votemper'
cu_out = 'C'
cln_out = 'Temperature'
cd_out = '.'
csource = 'COPERNICUS'
ctarget = 'INDIAN'
cextra = '2016'
/
!!
&comments
-----------------------------------------------------------------------------------
- grid_inputs holds parameters for the scripgrid routine which reformats information
about the input grids
- scripgrid always needs a coordinates.nc file in the
current directory and creates the remapped grid file correspondingly
- it uses the following namelist block to determine its actions
method: only 'regular' is yet implemented, this assumes a cartesian grid
input_lon: name of longitude variable in the input_file
input_lat: name of latitude variable in the input_file
nemo_lon: name of longitude variable in the coordinates.nc
nemo_lat: name of latitude variable in the coordinates.nc
/
&grid_inputs
input_file = 'vosaline_COPERNICUS-INDIAN_2016.nc'
nemo_file = 'coordinates.nc'
datagrid_file = 'remap_data_grid_R12.nc'
nemogrid_file = 'remap_nemo_grid_R12.nc'
method = 'regular'
input_lon = 'longitude'
input_lat = 'latitude'
nemo_lon = 'glamt'
nemo_lat = 'gphit'
nemo_mask = 'none'
nemo_mask_value = 0
input_mask = 'none'
input_mask_value = 0
/
&comments
-----------------------------------------------------------------------------------
- remap_inputs holds parameters for the scrip routine which calculates the weights
needed to convert between two grids
- two remap grid files are required as output by scripgrid
- num_maps is either 1 or 2 depending on whether the reverse transformation is required
- one or two interp_file names are then supplied; these hold the weights to convert
one grid to another
- the map_name variable is just descriptive
- map_method can be 'bilinear' 'conservative' or 'bicubic' (the latter untested)
- normalize_opt should usually be 'frac' or else the user needs to do this scaling
manually (this seems to the case for fractional ice cover)
- restrict_type should be 'latitude' or 'latlon' in which case num_srch_bins only are
used in one or two directions
- use_grid_area fields override the scrip calculation of area in case the model gets
slightly different answers, but the area needs to be supplied in the input files
- output_opt may be supplied and set to either 'scrip' or 'ncar-csm'
/
&remap_inputs
num_maps = 1
grid1_file = 'remap_data_grid_R12.nc'
grid2_file = 'remap_nemo_grid_R12.nc'
interp_file1 = 'data_nemo_bilin_R12.nc'
interp_file2 = 'nemo_data_bilin_R12.nc'
map1_name = 'R12 to nemo bilin Mapping'
map2_name = 'nemo to R12 bilin Mapping'
map_method = 'bilinear'
normalize_opt = 'frac'
output_opt = 'scrip'
restrict_type = 'latitude'
num_srch_bins = 90
luse_grid1_area = .false.
luse_grid2_area = .false.
/
&interp_inputs
input_file = "vosaline_COPERNICUS-INDIAN_2016.nc"
interp_file = "data_nemo_bilin_R12.nc"
input_name = "vosaline"
input_start = 1,1,1,1
input_stride = 1,1,1,1
input_stop = 0,0,0,0
input_vars = "gdept","time_counter"
/
&interp_outputs
output_file = "initcd_vosaline.nc"
output_mode = "create"
output_dims = 'x', 'y', 'z', 'time_counter'
output_scaling = "vosaline|1.0"
output_name = 'vosaline'
output_lon = 'x'
output_lat = 'y'
output_vars = "gdept","time_counter"
&comments
-----------------------------------------------------------------------------------
- shape_inputs holds parameters for the scripshape routine which rearranges the weights
into the form needed by the nemo on the fly interpolation code.
/
&shape_inputs
interp_file = 'data_nemo_bilin_R12.nc'
output_file = 'weights_bilinear_R12.nc'
ew_wrap = -1
/
&comments
-----------------------------------------------------------------------------------
- grid_inputs holds parameters for the scripgrid routine which reformats information
about the input grids
- scripgrid always needs a coordinates.nc file in the
current directory and creates the remapped grid file correspondingly
- it uses the following namelist block to determine its actions
method: only 'regular' is yet implemented, this assumes a cartesian grid
input_lon: name of longitude variable in the input_file
input_lat: name of latitude variable in the input_file
nemo_lon: name of longitude variable in the coordinates.nc
nemo_lat: name of latitude variable in the coordinates.nc
/
&grid_inputs
input_file = 'votemper_COPERNICUS-INDIAN_2016.nc'
nemo_file = 'coordinates.nc'
datagrid_file = 'remap_data_grid_R12.nc'
nemogrid_file = 'remap_nemo_grid_R12.nc'
method = 'regular'
input_lon = 'longitude'
input_lat = 'latitude'
nemo_lon = 'glamt'
nemo_lat = 'gphit'
nemo_mask = 'none'
nemo_mask_value = 0
input_mask = 'none'
input_mask_value = 0
/
&comments
-----------------------------------------------------------------------------------
- remap_inputs holds parameters for the scrip routine which calculates the weights
needed to convert between two grids
- two remap grid files are required as output by scripgrid
- num_maps is either 1 or 2 depending on whether the reverse transformation is required
- one or two interp_file names are then supplied; these hold the weights to convert
one grid to another
- the map_name variable is just descriptive
- map_method can be 'bilinear' 'conservative' or 'bicubic' (the latter untested)
- normalize_opt should usually be 'frac' or else the user needs to do this scaling
manually (this seems to the case for fractional ice cover)
- restrict_type should be 'latitude' or 'latlon' in which case num_srch_bins only are
used in one or two directions
- use_grid_area fields override the scrip calculation of area in case the model gets
slightly different answers, but the area needs to be supplied in the input files
- output_opt may be supplied and set to either 'scrip' or 'ncar-csm'
/
&remap_inputs
num_maps = 1
grid1_file = 'remap_data_grid_R12.nc'
grid2_file = 'remap_nemo_grid_R12.nc'
interp_file1 = 'data_nemo_bilin_R12.nc'
interp_file2 = 'nemo_data_bilin_R12.nc'
map1_name = 'R12 to nemo bilin Mapping'
map2_name = 'nemo to R12 bilin Mapping'
map_method = 'bilinear'
normalize_opt = 'frac'
output_opt = 'scrip'
restrict_type = 'latitude'
num_srch_bins = 90
luse_grid1_area = .false.
luse_grid2_area = .false.
/
&interp_inputs
input_file = "votemper_COPERNICUS-INDIAN_2016.nc"
interp_file = "data_nemo_bilin_R12.nc"
input_name = "votemper"
input_start = 1,1,1,1
input_stride = 1,1,1,1
input_stop = 0,0,0,0
input_vars = "gdept","time_counter"
/
&interp_outputs
output_file = "initcd_votemper.nc"
output_mode = "create"
output_dims = 'x', 'y', 'z', 'time_counter'
output_scaling = "votemper|1.0"
output_name = 'votemper'
output_lon = 'x'
output_lat = 'y'
output_vars = "gdept","time_counter"
&comments
-----------------------------------------------------------------------------------
- shape_inputs holds parameters for the scripshape routine which rearranges the weights
into the form needed by the nemo on the fly interpolation code.
/
&shape_inputs
interp_file = 'data_nemo_bilin_R12.nc'
output_file = 'weights_bilinear_R12.nc'
ew_wrap = -1
/
File added
<ns0:netcdf xmlns:ns0="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" title="NEMO aggregation">
<ns0:aggregation type="union">
<ns0:netcdf location="file:domain_cfg.nc">
<ns0:variable name="mbathy" orgName="top_level" />
<ns0:variable name="e3u" orgName="e3u_0" />
<ns0:variable name="e3v" orgName="e3v_0" />
</ns0:netcdf>
</ns0:aggregation>
</ns0:netcdf>
<ns0:netcdf xmlns:ns0="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" title="NEMO aggregation">
<ns0:aggregation type="union">
<ns0:netcdf>
<ns0:aggregation dimName="time_counter" name="temperature" type="joinExisting">
<ns0:netcdf location="http://gws-access.ceda.ac.uk/public/nemo/runs/ORCA0083-N01/means/1979/ORCA0083-N01_19791206d05T.nc" />
</ns0:aggregation>
</ns0:netcdf>
<ns0:netcdf>
<ns0:aggregation dimName="time_counter" name="salinity" type="joinExisting">
<ns0:netcdf location="http://gws-access.ceda.ac.uk/public/nemo/runs/ORCA0083-N01/means/1979/ORCA0083-N01_19791206d05T.nc" />
</ns0:aggregation>
</ns0:netcdf>
<ns0:netcdf>
<ns0:aggregation dimName="time_counter" name="zonal_velocity" type="joinExisting">
<ns0:netcdf location="http://gws-access.ceda.ac.uk/public/nemo/runs/ORCA0083-N01/means/1979/ORCA0083-N01_19791206d05U.nc" />
</ns0:aggregation>
</ns0:netcdf>
<ns0:netcdf>
<ns0:aggregation dimName="time_counter" name="meridian_velocity" type="joinExisting">
<ns0:netcdf location="http://gws-access.ceda.ac.uk/public/nemo/runs/ORCA0083-N01/means/1979/ORCA0083-N01_19791206d05V.nc" />
</ns0:aggregation>
</ns0:netcdf>
<ns0:netcdf>
<ns0:aggregation dimName="time_counter" name="sea_surface_height" type="joinExisting">
<ns0:netcdf location="http://gws-access.ceda.ac.uk/public/nemo/runs/ORCA0083-N01/means/1979/ORCA0083-N01_19791206d05T.nc" />
</ns0:aggregation>
</ns0:netcdf>
</ns0:aggregation>
</ns0:netcdf>
!-----------------------------------------------------------------------
! vertical coordinate
!-----------------------------------------------------------------------
ln_zco = .true. ! z-coordinate - full steps (T/F)
ln_zps = .false. ! z-coordinate - partial steps (T/F)
ln_sco = .false. ! s- or hybrid z-s-coordinate (T/F)
rn_hmin = -5 ! min depth of the ocean (>0) or
! min number of ocean level (<0)
!-----------------------------------------------------------------------
! s-coordinate or hybrid z-s-coordinate
!-----------------------------------------------------------------------
rn_sbot_min = 10. ! minimum depth of s-bottom surface (>0) (m)
rn_sbot_max = 7000. ! maximum depth of s-bottom surface
! (= ocean depth) (>0) (m)
ln_s_sigma = .false. ! hybrid s-sigma coordinates
rn_hc = 50.0 ! critical depth with s-sigma
!-----------------------------------------------------------------------
! grid information
!-----------------------------------------------------------------------
sn_src_hgr = './mesh_hgr_src.nc' ! parent /grid/
sn_src_zgr = './mesh_zgr_src.nc' ! parent
sn_dst_hgr = './domain_cfg.nc'
sn_dst_zgr = './inputs_dst.ncml' ! rename output variables
sn_src_msk = './mask_src.nc' ! parent
sn_bathy = './bathy_meter.nc'
!-----------------------------------------------------------------------
! I/O
!-----------------------------------------------------------------------
sn_src_dir = './inputs_src.ncml' ! src_files/'
sn_dst_dir = './'
sn_fn = 'INDIAN' ! prefix for output files
nn_fv = -1e20 ! set fill value for output files
nn_src_time_adj = 0 ! src time adjustment
sn_dst_metainfo = 'metadata info: ashbre'
!-----------------------------------------------------------------------
! unstructured open boundaries
!-----------------------------------------------------------------------
ln_coords_file = .true. ! =T : produce bdy coordinates files
cn_coords_file = 'coordinates.bdy.nc' ! name of bdy coordinates files (if ln_coords_file=.TRUE.)
ln_mask_file = .false. ! =T : read mask from file
cn_mask_file = './bdy_mask.nc' ! name of mask file (if ln_mask_file=.TRUE.)
ln_dyn2d = .true. ! boundary conditions for barotropic fields
ln_dyn3d = .false. ! boundary conditions for baroclinic velocities
ln_tra = .false. ! boundary conditions for T and S
ln_ice = .false. ! ice boundary condition
nn_rimwidth = 1 ! width of the relaxation zone
!-----------------------------------------------------------------------
! unstructured open boundaries tidal parameters
!-----------------------------------------------------------------------
ln_tide = .true. ! =T : produce bdy tidal conditions
clname(1) = 'M2'
clname(2) = 'S2'
clname(3) = 'K2'
clname(4) = 'Q1' ! name of constituent
clname(5) = 'O1'
clname(6) = 'P1'
clname(7) = 'K1'
clname(8) = 'N2'
ln_trans = .false.
sn_tide_h = './h_tpxo7.2.nc'
sn_tide_u = './u_tpxo7.2.nc'
!-----------------------------------------------------------------------
! Time information
!-----------------------------------------------------------------------
nn_year_000 = 1979 ! year start
nn_year_end = 1979 ! year end
nn_month_000 = 11 ! month start (default = 1 is years>1)
nn_month_end = 11 ! month end (default = 12 is years>1)
sn_dst_calendar = 'gregorian' ! output calendar format
nn_base_year = 1978 ! base year for time counter
sn_tide_grid = './grid_tpxo7.2.nc'
!-----------------------------------------------------------------------
! Additional parameters
!-----------------------------------------------------------------------
nn_wei = 1 ! smoothing filter weights
rn_r0 = 0.041666666 ! decorrelation distance use in gauss
! smoothing onto dst points. Need to
! make this a funct. of dlon
sn_history = 'bdy files produced by jelt from ORCA0083-N01'
! history for netcdf file
ln_nemo3p4 = .true. ! else presume v3.2 or v3.3
nn_alpha = 0 ! Euler rotation angle
nn_beta = 0 ! Euler rotation angle
nn_gamma = 0 ! Euler rotation angle
rn_mask_max_depth = 7000.0 ! Maximum depth to be ignored for the mask
rn_mask_shelfbreak_dist = 60 ! Distance from the shelf break
#!/bin/bash
# ---------------------------
#===============================================================
# CLUSTER BITS
#===============================================================
#PBS -N EA_R12
#PBS -l select=serial=true:ncpus=1
#PBS -l walltime=12:00:00
#PBS -A n01-ACCORD
#PBS -j oe
cd $PBS_O_WORKDIR
module unload anaconda
module load anaconda/2.2.0-python2
LD_LIBRARY_PATH=/opt/java/jdk1.8.0_51/jre/lib/amd64/server/:$LD_LIBRARY_PATH
export PYTHONPATH=~/.conda/envs/nrct_tide/lib/python2.7/site-packages/:$PYTHONPATH
source activate nrct_tide
#===============================================================
# LAUNCH JOB
#===============================================================
echo `date` : Launch Job
pynemo -s namelist.bdy
exit
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
MODULE dommsk
!!======================================================================
!! *** MODULE dommsk ***
!! Ocean initialization : domain land/sea mask
!!======================================================================
!! History : OPA ! 1987-07 (G. Madec) Original code
!! 6.0 ! 1993-03 (M. Guyon) symetrical conditions (M. Guyon)
!! 7.0 ! 1996-01 (G. Madec) suppression of common work arrays
!! - ! 1996-05 (G. Madec) mask computed from tmask
!! 8.0 ! 1997-02 (G. Madec) mesh information put in domhgr.F
!! 8.1 ! 1997-07 (G. Madec) modification of kbat and fmask
!! - ! 1998-05 (G. Roullet) free surface
!! 8.2 ! 2000-03 (G. Madec) no slip accurate
!! - ! 2001-09 (J.-M. Molines) Open boundaries
!! NEMO 1.0 ! 2002-08 (G. Madec) F90: Free form and module
!! - ! 2005-11 (V. Garnier) Surface pressure gradient organization
!! 3.2 ! 2009-07 (R. Benshila) Suppression of rigid-lid option
!! 3.6 ! 2015-05 (P. Mathiot) ISF: add wmask,wumask and wvmask
!! 4.0 ! 2016-06 (G. Madec, S. Flavoni) domain configuration / user defined interface
!!----------------------------------------------------------------------
!!----------------------------------------------------------------------
!! dom_msk : compute land/ocean mask
!!----------------------------------------------------------------------
USE oce ! ocean dynamics and tracers
USE dom_oce ! ocean space and time domain
USE usrdef_fmask ! user defined fmask
USE bdy_oce
USE in_out_manager ! I/O manager
USE iom
USE lbclnk ! ocean lateral boundary conditions (or mpp link)
USE lib_mpp ! Massively Parallel Processing library
USE wrk_nemo ! Memory allocation
USE timing ! Timing
IMPLICIT NONE
PRIVATE
PUBLIC dom_msk ! routine called by inidom.F90
! !!* Namelist namlbc : lateral boundary condition *
REAL(wp) :: rn_shlat ! type of lateral boundary condition on velocity
LOGICAL, PUBLIC :: ln_vorlat ! consistency of vorticity boundary condition
! with analytical eqs.
!! * Substitutions
# include "vectopt_loop_substitute.h90"
!!----------------------------------------------------------------------
!! NEMO/OPA 3.2 , LODYC-IPSL (2009)
!! $Id: dommsk.F90 7753 2017-03-03 11:46:59Z mocavero $
!! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE dom_msk( k_top, k_bot )
!!---------------------------------------------------------------------
!! *** ROUTINE dom_msk ***
!!
!! ** Purpose : Compute land/ocean mask arrays at tracer points, hori-
!! zontal velocity points (u & v), vorticity points (f) points.
!!
!! ** Method : The ocean/land mask at t-point is deduced from ko_top
!! and ko_bot, the indices of the fist and last ocean t-levels which
!! are either defined in usrdef_zgr or read in zgr_read.
!! The velocity masks (umask, vmask, wmask, wumask, wvmask)
!! are deduced from a product of the two neighboring tmask.
!! The vorticity mask (fmask) is deduced from tmask taking
!! into account the choice of lateral boundary condition (rn_shlat) :
!! rn_shlat = 0, free slip (no shear along the coast)
!! rn_shlat = 2, no slip (specified zero velocity at the coast)
!! 0 < rn_shlat < 2, partial slip | non-linear velocity profile
!! 2 < rn_shlat, strong slip | in the lateral boundary layer
!!
!! tmask_i : interior ocean mask at t-point, i.e. excluding duplicated
!! rows/lines due to cyclic or North Fold boundaries as well
!! as MPP halos.
!! tmask_h : halo mask at t-point, i.e. excluding duplicated rows/lines
!! due to cyclic or North Fold boundaries as well as MPP halos.
!!
!! ** Action : tmask, umask, vmask, wmask, wumask, wvmask : land/ocean mask
!! at t-, u-, v- w, wu-, and wv-points (=0. or 1.)
!! fmask : land/ocean mask at f-point (=0., or =1., or
!! =rn_shlat along lateral boundaries)
!! tmask_i : interior ocean mask
!! tmask_h : halo mask
!! ssmask , ssumask, ssvmask, ssfmask : 2D ocean mask
!!----------------------------------------------------------------------
INTEGER, DIMENSION(:,:), INTENT(in) :: k_top, k_bot ! first and last ocean level
!
INTEGER :: ji, jj, jk ! dummy loop indices
INTEGER :: iif, iil ! local integers
INTEGER :: ijf, ijl ! - -
INTEGER :: iktop, ikbot ! - -
INTEGER :: ios, inum
REAL(wp), POINTER, DIMENSION(:,:) :: zwf ! 2D workspace
!!
NAMELIST/namlbc/ rn_shlat, ln_vorlat
NAMELIST/nambdy/ ln_bdy ,nb_bdy, ln_coords_file, cn_coords_file, &
& ln_mask_file, cn_mask_file, cn_dyn2d, nn_dyn2d_dta, &
& cn_dyn3d, nn_dyn3d_dta, cn_tra, nn_tra_dta, &
& ln_tra_dmp, ln_dyn3d_dmp, rn_time_dmp, rn_time_dmp_out, &
& cn_ice_lim, nn_ice_lim_dta, &
& rn_ice_tem, rn_ice_sal, rn_ice_age, &
& ln_vol, nn_volctl, nn_rimwidth, nb_jpk_bdy
!!---------------------------------------------------------------------
!
IF( nn_timing == 1 ) CALL timing_start('dom_msk')
!
REWIND( numnam_ref ) ! Namelist namlbc in reference namelist : Lateral momentum boundary condition
READ ( numnam_ref, namlbc, IOSTAT = ios, ERR = 901 )
901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlbc in reference namelist', lwp )
REWIND( numnam_cfg ) ! Namelist namlbc in configuration namelist : Lateral momentum boundary condition
READ ( numnam_cfg, namlbc, IOSTAT = ios, ERR = 902 )
902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlbc in configuration namelist', lwp )
IF(lwm) WRITE ( numond, namlbc )
IF(lwp) THEN ! control print
WRITE(numout,*)
WRITE(numout,*) 'dommsk : ocean mask '
WRITE(numout,*) '~~~~~~'
WRITE(numout,*) ' Namelist namlbc'
WRITE(numout,*) ' lateral momentum boundary cond. rn_shlat = ',rn_shlat
WRITE(numout,*) ' consistency with analytical form ln_vorlat = ',ln_vorlat
ENDIF
IF ( rn_shlat == 0. ) THEN ; IF(lwp) WRITE(numout,*) ' ocean lateral free-slip '
ELSEIF ( rn_shlat == 2. ) THEN ; IF(lwp) WRITE(numout,*) ' ocean lateral no-slip '
ELSEIF ( 0. < rn_shlat .AND. rn_shlat < 2. ) THEN ; IF(lwp) WRITE(numout,*) ' ocean lateral partial-slip '
ELSEIF ( 2. < rn_shlat ) THEN ; IF(lwp) WRITE(numout,*) ' ocean lateral strong-slip '
ELSE
WRITE(ctmp1,*) ' rn_shlat is negative = ', rn_shlat
CALL ctl_stop( ctmp1 )
ENDIF
! Ocean/land mask at t-point (computed from ko_top and ko_bot)
! ----------------------------
!
tmask(:,:,:) = 0._wp
DO jj = 1, jpj
DO ji = 1, jpi
iktop = k_top(ji,jj)
ikbot = k_bot(ji,jj)
IF( iktop /= 0 ) THEN ! water in the column
tmask(ji,jj,iktop:ikbot ) = 1._wp
ENDIF
END DO
END DO
!SF add here lbc_lnk: bug not still understood : cause now domain configuration is read !
!!gm I don't understand why...
CALL lbc_lnk( tmask , 'T', 1._wp ) ! Lateral boundary conditions
! Mask corrections for bdy (read in mppini2)
REWIND( numnam_ref ) ! Namelist nambdy in reference namelist :Unstructured open boundaries
READ ( numnam_ref, nambdy, IOSTAT = ios, ERR = 903)
903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in reference namelist', lwp )
REWIND( numnam_cfg ) ! Namelist nambdy in configuration namelist :Unstructured open boundaries
READ ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 904 )
904 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in configuration namelist', lwp )
! ------------------------
IF ( ln_bdy .AND. ln_mask_file ) THEN
CALL iom_open( cn_mask_file, inum )
CALL iom_get ( inum, jpdom_data, 'bdy_msk', bdytmask(:,:) )
CALL iom_close( inum )
DO jk = 1, jpkm1
DO jj = 1, jpj
DO ji = 1, jpi
tmask(ji,jj,jk) = tmask(ji,jj,jk) * bdytmask(ji,jj)
END DO
END DO
END DO
ENDIF
! Ocean/land mask at u-, v-, and f-points (computed from tmask)
! ----------------------------------------
! NB: at this point, fmask is designed for free slip lateral boundary condition
DO jk = 1, jpk
DO jj = 1, jpjm1
DO ji = 1, fs_jpim1 ! vector loop
umask(ji,jj,jk) = tmask(ji,jj ,jk) * tmask(ji+1,jj ,jk)
vmask(ji,jj,jk) = tmask(ji,jj ,jk) * tmask(ji ,jj+1,jk)
END DO
DO ji = 1, jpim1 ! NO vector opt.
fmask(ji,jj,jk) = tmask(ji,jj ,jk) * tmask(ji+1,jj ,jk) &
& * tmask(ji,jj+1,jk) * tmask(ji+1,jj+1,jk)
END DO
END DO
END DO
CALL lbc_lnk( umask , 'U', 1._wp ) ! Lateral boundary conditions
CALL lbc_lnk( vmask , 'V', 1._wp )
CALL lbc_lnk( fmask , 'F', 1._wp )
! Ocean/land mask at wu-, wv- and w points (computed from tmask)
!-----------------------------------------
wmask (:,:,1) = tmask(:,:,1) ! surface
wumask(:,:,1) = umask(:,:,1)
wvmask(:,:,1) = vmask(:,:,1)
DO jk = 2, jpk ! interior values
wmask (:,:,jk) = tmask(:,:,jk) * tmask(:,:,jk-1)
wumask(:,:,jk) = umask(:,:,jk) * umask(:,:,jk-1)
wvmask(:,:,jk) = vmask(:,:,jk) * vmask(:,:,jk-1)
END DO
! Ocean/land column mask at t-, u-, and v-points (i.e. at least 1 wet cell in the vertical)
! ----------------------------------------------
ssmask (:,:) = MAXVAL( tmask(:,:,:), DIM=3 )
ssumask(:,:) = MAXVAL( umask(:,:,:), DIM=3 )
ssvmask(:,:) = MAXVAL( vmask(:,:,:), DIM=3 )
! Interior domain mask (used for global sum)
! --------------------
!
iif = jpreci ; iil = nlci - jpreci + 1
ijf = jprecj ; ijl = nlcj - jprecj + 1
!
! ! halo mask : 0 on the halo and 1 elsewhere
tmask_h(:,:) = 1._wp
tmask_h( 1 :iif, : ) = 0._wp ! first columns
tmask_h(iil:jpi, : ) = 0._wp ! last columns (including mpp extra columns)
tmask_h( : , 1 :ijf) = 0._wp ! first rows
tmask_h( : ,ijl:jpj) = 0._wp ! last rows (including mpp extra rows)
!
! ! north fold mask
tpol(1:jpiglo) = 1._wp
fpol(1:jpiglo) = 1._wp
IF( jperio == 3 .OR. jperio == 4 ) THEN ! T-point pivot
tpol(jpiglo/2+1:jpiglo) = 0._wp
fpol( 1 :jpiglo) = 0._wp
IF( mjg(nlej) == jpjglo ) THEN ! only half of the nlcj-1 row for tmask_h
DO ji = iif+1, iil-1
tmask_h(ji,nlej-1) = tmask_h(ji,nlej-1) * tpol(mig(ji))
END DO
ENDIF
ENDIF
!
IF( jperio == 5 .OR. jperio == 6 ) THEN ! F-point pivot
tpol( 1 :jpiglo) = 0._wp
fpol(jpiglo/2+1:jpiglo) = 0._wp
ENDIF
!
! ! interior mask : 2D ocean mask x halo mask
tmask_i(:,:) = ssmask(:,:) * tmask_h(:,:)
! Lateral boundary conditions on velocity (modify fmask)
! ---------------------------------------
IF( rn_shlat /= 0 ) THEN ! Not free-slip lateral boundary condition
!
CALL wrk_alloc( jpi,jpj, zwf )
!
DO jk = 1, jpk
zwf(:,:) = fmask(:,:,jk)
DO jj = 2, jpjm1
DO ji = fs_2, fs_jpim1 ! vector opt.
IF( fmask(ji,jj,jk) == 0._wp ) THEN
fmask(ji,jj,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(ji+1,jj), zwf(ji,jj+1), &
& zwf(ji-1,jj), zwf(ji,jj-1) ) )
ENDIF
END DO
END DO
DO jj = 2, jpjm1
IF( fmask(1,jj,jk) == 0._wp ) THEN
fmask(1 ,jj,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(2,jj), zwf(1,jj+1), zwf(1,jj-1) ) )
ENDIF
IF( fmask(jpi,jj,jk) == 0._wp ) THEN
fmask(jpi,jj,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(jpi,jj+1), zwf(jpim1,jj), zwf(jpi,jj-1) ) )
ENDIF
END DO
DO ji = 2, jpim1
IF( fmask(ji,1,jk) == 0._wp ) THEN
fmask(ji, 1 ,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(ji+1,1), zwf(ji,2), zwf(ji-1,1) ) )
ENDIF
IF( fmask(ji,jpj,jk) == 0._wp ) THEN
fmask(ji,jpj,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(ji+1,jpj), zwf(ji-1,jpj), zwf(ji,jpjm1) ) )
ENDIF
END DO
END DO
!
CALL wrk_dealloc( jpi,jpj, zwf )
!
CALL lbc_lnk( fmask, 'F', 1._wp ) ! Lateral boundary conditions on fmask
!
! CAUTION : The fmask may be further modified in dyn_vor_init ( dynvor.F90 ) depending on ln_vorlat
!
ENDIF
! User defined alteration of fmask (use to reduce ocean transport in specified straits)
! --------------------------------
!
CALL usr_def_fmask( cn_cfg, nn_cfg, fmask )
!
!
IF( nn_timing == 1 ) CALL timing_stop('dom_msk')
!
END SUBROUTINE dom_msk
!!======================================================================
END MODULE dommsk
MODULE dtatsd
!!======================================================================
!! *** MODULE dtatsd ***
!! Ocean data : read ocean Temperature & Salinity Data from gridded data
!!======================================================================
!! History : OPA ! 1991-03 () Original code
!! - ! 1992-07 (M. Imbard)
!! 8.0 ! 1999-10 (M.A. Foujols, M. Imbard) NetCDF FORMAT
!! NEMO 1.0 ! 2002-06 (G. Madec) F90: Free form and module
!! 3.3 ! 2010-10 (C. Bricaud, S. Masson) use of fldread
!! 3.4 ! 2010-11 (G. Madec, C. Ethe) Merge of dtatem and dtasal + suppression of CPP keys
!!----------------------------------------------------------------------
!!----------------------------------------------------------------------
!! dta_tsd : read and time interpolated ocean Temperature & Salinity Data
!!----------------------------------------------------------------------
USE oce ! ocean dynamics and tracers
USE dom_oce ! ocean space and time domain
USE fldread ! read input fields
USE in_out_manager ! I/O manager
USE phycst ! physical constants
USE lib_mpp ! MPP library
USE wrk_nemo ! Memory allocation
USE timing ! Timing
USE iom
IMPLICIT NONE
PRIVATE
PUBLIC dta_tsd_init ! called by opa.F90
PUBLIC dta_tsd ! called by istate.F90 and tradmp.90
LOGICAL , PUBLIC :: ln_tsd_init !: T & S data flag
LOGICAL , PUBLIC :: ln_tsd_interp !: vertical interpolation flag
LOGICAL , PUBLIC :: ln_tsd_tradmp !: internal damping toward input data flag
TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_tsd ! structure of input SST (file informations, fields read)
INTEGER :: jpk_init , inum_dta
INTEGER :: id ,linum ! local integers
INTEGER :: zdim(4)
!!----------------------------------------------------------------------
!! NEMO/OPA 3.3 , NEMO Consortium (2010)
!! $Id: dtatsd.F90 7753 2017-03-03 11:46:59Z mocavero $
!! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE dta_tsd_init( ld_tradmp )
!!----------------------------------------------------------------------
!! *** ROUTINE dta_tsd_init ***
!!
!! ** Purpose : initialisation of T & S input data
!!
!! ** Method : - Read namtsd namelist
!! - allocates T & S data structure
!!----------------------------------------------------------------------
LOGICAL, INTENT(in), OPTIONAL :: ld_tradmp ! force the initialization when tradp is used
!
INTEGER :: ios, ierr0, ierr1, ierr2, ierr3, ierr4, ierr5 ! local integers
!!
CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files
TYPE(FLD_N), DIMENSION(jpts+2):: slf_i ! array of namelist informations on the fields to read
TYPE(FLD_N) :: sn_tem, sn_sal, sn_dep, sn_msk
!!
NAMELIST/namtsd/ ln_tsd_init, ln_tsd_interp, ln_tsd_tradmp, cn_dir, sn_tem, sn_sal, sn_dep, sn_msk
!!----------------------------------------------------------------------
!
IF( nn_timing == 1 ) CALL timing_start('dta_tsd_init')
!
! Initialisation
ierr0 = 0 ; ierr1 = 0 ; ierr2 = 0 ; ierr3 = 0 ; ierr4 = 0 ; ierr5 = 0
!
REWIND( numnam_ref ) ! Namelist namtsd in reference namelist :
READ ( numnam_ref, namtsd, IOSTAT = ios, ERR = 901)
901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtsd in reference namelist', lwp )
REWIND( numnam_cfg ) ! Namelist namtsd in configuration namelist : Parameters of the run
READ ( numnam_cfg, namtsd, IOSTAT = ios, ERR = 902 )
902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtsd in configuration namelist', lwp )
IF(lwm) WRITE ( numond, namtsd )
IF( PRESENT( ld_tradmp ) ) ln_tsd_tradmp = .TRUE. ! forces the initialization when tradmp is used
IF(lwp) THEN ! control print
WRITE(numout,*)
WRITE(numout,*) 'dta_tsd_init : Temperature & Salinity data '
WRITE(numout,*) '~~~~~~~~~~~~ '
WRITE(numout,*) ' Namelist namtsd'
WRITE(numout,*) ' Initialisation of ocean T & S with T &S input data ln_tsd_init = ', ln_tsd_init
WRITE(numout,*) ' iInterpolation of initial conditions in the vertical ln_tsd_interp = ', ln_tsd_interp
WRITE(numout,*) ' damping of ocean T & S toward T &S input data ln_tsd_tradmp = ', ln_tsd_tradmp
WRITE(numout,*)
IF( .NOT.ln_tsd_init .AND. .NOT.ln_tsd_tradmp ) THEN
WRITE(numout,*)
WRITE(numout,*) ' T & S data not used'
ENDIF
ENDIF
!
IF( ln_rstart .AND. ln_tsd_init ) THEN
CALL ctl_warn( 'dta_tsd_init: ocean restart and T & S data intialisation, ', &
& 'we keep the restart T & S values and set ln_tsd_init to FALSE' )
ln_tsd_init = .FALSE.
ENDIF
IF( ln_tsd_interp .AND. ln_tsd_tradmp ) THEN
CALL ctl_stop( 'dta_tsd_init: Tracer damping and vertical interpolation not yet configured' ) ; RETURN
ENDIF
IF( ln_tsd_interp .AND. LEN(TRIM(sn_msk%wname)) > 0 ) THEN
CALL ctl_stop( 'dta_tsd_init: Using vertical interpolation and weights files not recommended' ) ; RETURN
ENDIF
!
! ! allocate the arrays (if necessary)
IF( ln_tsd_init .OR. ln_tsd_tradmp ) THEN
!
IF( ln_tsd_interp ) THEN
ALLOCATE( sf_tsd(jpts+2), STAT=ierr0 ) ! to carry the addtional depth information
ELSE
ALLOCATE( sf_tsd(jpts ), STAT=ierr0 )
ENDIF
IF( ierr0 > 0 ) THEN
CALL ctl_stop( 'dta_tsd_init: unable to allocate sf_tsd structure' ) ; RETURN
ENDIF
!
IF( ln_tsd_interp ) THEN
CALL iom_open ( trim(cn_dir) // trim(sn_dep%clname), inum_dta )
id = iom_varid( inum_dta, sn_dep%clvar, zdim )
jpk_init = zdim(3)
IF(lwp) WRITE(numout,*) 'Dimension of veritcal coordinate in ICs: ', jpk_init
CALL iom_close( inum_dta ) ! Close the input file
!
ALLOCATE( sf_tsd(jp_tem)%fnow(jpi,jpj,jpk_init ) , STAT=ierr0 )
IF( sn_tem%ln_tint ) ALLOCATE( sf_tsd(jp_tem)%fdta(jpi,jpj,jpk_init,2) , STAT=ierr1 )
ALLOCATE( sf_tsd(jp_sal)%fnow(jpi,jpj,jpk_init ) , STAT=ierr2 )
IF( sn_sal%ln_tint ) ALLOCATE( sf_tsd(jp_sal)%fdta(jpi,jpj,jpk_init,2) , STAT=ierr3 )
ALLOCATE( sf_tsd(jp_dep)%fnow(jpi,jpj,jpk_init ) , STAT=ierr4 )
ALLOCATE( sf_tsd(jp_msk)%fnow(jpi,jpj,jpk_init ) , STAT=ierr5 )
ELSE
ALLOCATE( sf_tsd(jp_tem)%fnow(jpi,jpj,jpk) , STAT=ierr0 )
IF( sn_tem%ln_tint ) ALLOCATE( sf_tsd(jp_tem)%fdta(jpi,jpj,jpk,2) , STAT=ierr1 )
ALLOCATE( sf_tsd(jp_sal)%fnow(jpi,jpj,jpk) , STAT=ierr2 )
IF( sn_sal%ln_tint ) ALLOCATE( sf_tsd(jp_sal)%fdta(jpi,jpj,jpk,2) , STAT=ierr3 )
ENDIF ! ln_tsd_interp
!
IF( ierr0 + ierr1 + ierr2 + ierr3 + ierr4 + ierr5 > 0 ) THEN
CALL ctl_stop( 'dta_tsd : unable to allocate T & S data arrays' ) ; RETURN
ENDIF
! ! fill sf_tsd with sn_tem & sn_sal and control print
slf_i(jp_tem) = sn_tem ; slf_i(jp_sal) = sn_sal
IF( ln_tsd_interp ) slf_i(jp_dep) = sn_dep ; slf_i(jp_msk) = sn_msk
CALL fld_fill( sf_tsd, slf_i, cn_dir, 'dta_tsd', 'Temperature & Salinity data', 'namtsd', no_print )
!
ENDIF
!
IF( nn_timing == 1 ) CALL timing_stop('dta_tsd_init')
!
END SUBROUTINE dta_tsd_init
SUBROUTINE dta_tsd( kt, ptsd )
!!----------------------------------------------------------------------
!! *** ROUTINE dta_tsd ***
!!
!! ** Purpose : provides T and S data at kt
!!
!! ** Method : - call fldread routine
!! - ORCA_R2: add some hand made alteration to read data
!! - 'key_orca_lev10' interpolates on 10 times more levels
!! - s- or mixed z-s coordinate: vertical interpolation on model mesh
!! - ln_tsd_tradmp=F: deallocates the T-S data structure
!! as T-S data are no are used
!!
!! ** Action : ptsd T-S data on medl mesh and interpolated at time-step kt
!!----------------------------------------------------------------------
INTEGER , INTENT(in ) :: kt ! ocean time-step
REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT( out) :: ptsd ! T & S data
!
INTEGER :: ji, jj, jk, jl, jk_init ! dummy loop indicies
INTEGER :: ik, il0, il1, ii0, ii1, ij0, ij1 ! local integers
REAL(wp):: zl, zi
!!----------------------------------------------------------------------
!
IF( nn_timing == 1 ) CALL timing_start('dta_tsd')
!
CALL fld_read( kt, 1, sf_tsd ) !== read T & S data at kt time step ==!
!
!
!!gm This should be removed from the code ===>>>> T & S files has to be changed
!
! !== ORCA_R2 configuration and T & S damping ==!
IF( cn_cfg == "orca" .AND. nn_cfg == 2 .AND. ln_tsd_tradmp ) THEN ! some hand made alterations
!
ij0 = 101 ; ij1 = 109 ! Reduced T & S in the Alboran Sea
ii0 = 141 ; ii1 = 155
DO jj = mj0(ij0), mj1(ij1)
DO ji = mi0(ii0), mi1(ii1)
sf_tsd(jp_tem)%fnow(ji,jj,13:13) = sf_tsd(jp_tem)%fnow(ji,jj,13:13) - 0.20_wp
sf_tsd(jp_tem)%fnow(ji,jj,14:15) = sf_tsd(jp_tem)%fnow(ji,jj,14:15) - 0.35_wp
sf_tsd(jp_tem)%fnow(ji,jj,16:25) = sf_tsd(jp_tem)%fnow(ji,jj,16:25) - 0.40_wp
!
sf_tsd(jp_sal)%fnow(ji,jj,13:13) = sf_tsd(jp_sal)%fnow(ji,jj,13:13) - 0.15_wp
sf_tsd(jp_sal)%fnow(ji,jj,14:15) = sf_tsd(jp_sal)%fnow(ji,jj,14:15) - 0.25_wp
sf_tsd(jp_sal)%fnow(ji,jj,16:17) = sf_tsd(jp_sal)%fnow(ji,jj,16:17) - 0.30_wp
sf_tsd(jp_sal)%fnow(ji,jj,18:25) = sf_tsd(jp_sal)%fnow(ji,jj,18:25) - 0.35_wp
END DO
END DO
ij0 = 87 ; ij1 = 96 ! Reduced temperature in Red Sea
ii0 = 148 ; ii1 = 160
sf_tsd(jp_tem)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 4:10 ) = 7.0_wp
sf_tsd(jp_tem)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 11:13 ) = 6.5_wp
sf_tsd(jp_tem)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 14:20 ) = 6.0_wp
ENDIF
!!gm end
!
IF( kt == nit000 .AND. lwp )THEN
WRITE(numout,*)
WRITE(numout,*) 'dta_tsd: interpolates T & S data onto current mesh'
ENDIF
!
IF( ln_tsd_interp ) THEN ! probably should use pointers in the following to make more readable
!
DO jk = 1, jpk ! determines the intepolated T-S profiles at each (i,j) points
DO jj= 1, jpj
DO ji= 1, jpi
zl = gdept_0(ji,jj,jk)
IF( zl < sf_tsd(jp_dep)%fnow(ji,jj,1) ) THEN ! above the first level of data
ptsd(ji,jj,jk,jp_tem) = sf_tsd(jp_tem)%fnow(ji,jj,1)
ptsd(ji,jj,jk,jp_sal) = sf_tsd(jp_sal)%fnow(ji,jj,1)
ELSEIF( zl > sf_tsd(jp_dep)%fnow(ji,jj,jpk_init) ) THEN ! below the last level of data
ptsd(ji,jj,jk,jp_tem) = sf_tsd(jp_tem)%fnow(ji,jj,jpk_init)
ptsd(ji,jj,jk,jp_sal) = sf_tsd(jp_sal)%fnow(ji,jj,jpk_init)
ELSE ! inbetween : vertical interpolation between jk_init & jk_init+1
DO jk_init = 1, jpk_init-1 ! when gdept(jk_init) < zl < gdept(jk_init+1)
IF( sf_tsd(jp_msk)%fnow(ji,jj,jk_init+1) == 0 ) THEN ! if there is no data fill down
sf_tsd(jp_tem)%fnow(ji,jj,jk_init+1) = sf_tsd(jp_tem)%fnow(ji,jj,jk_init)
sf_tsd(jp_sal)%fnow(ji,jj,jk_init+1) = sf_tsd(jp_sal)%fnow(ji,jj,jk_init)
ENDIF
IF( (zl-sf_tsd(jp_dep)%fnow(ji,jj,jk_init)) * (zl-sf_tsd(jp_dep)%fnow(ji,jj,jk_init+1)) <= 0._wp ) THEN
zi = ( zl - sf_tsd(jp_dep)%fnow(ji,jj,jk_init) ) / &
& (sf_tsd(jp_dep)%fnow(ji,jj,jk_init+1)-sf_tsd(jp_dep)%fnow(ji,jj,jk_init))
ptsd(ji,jj,jk,jp_tem) = sf_tsd(jp_tem)%fnow(ji,jj,jk_init) + &
& (sf_tsd(jp_tem)%fnow(ji,jj,jk_init+1)-sf_tsd(jp_tem)%fnow(ji,jj,jk_init)) * zi
ptsd(ji,jj,jk,jp_sal) = sf_tsd(jp_sal)%fnow(ji,jj,jk_init) + &
& (sf_tsd(jp_sal)%fnow(ji,jj,jk_init+1)-sf_tsd(jp_sal)%fnow(ji,jj,jk_init)) * zi
ENDIF
END DO
ENDIF
ENDDO
ENDDO
END DO
!
ptsd(:,:,:,jp_tem) = ptsd(:,:,:,jp_tem) *tmask(:,:,:)
ptsd(:,:,:,jp_sal) = ptsd(:,:,:,jp_sal) *tmask(:,:,:)
ELSE !== z- or zps- coordinate ==!
!
ptsd(:,:,:,jp_tem) = sf_tsd(jp_tem)%fnow(:,:,:) * tmask(:,:,:) ! Mask
ptsd(:,:,:,jp_sal) = sf_tsd(jp_sal)%fnow(:,:,:) * tmask(:,:,:)
!
IF( ln_zps ) THEN ! zps-coordinate (partial steps) interpolation at the last ocean level
DO jj = 1, jpj
DO ji = 1, jpi
ik = mbkt(ji,jj)
IF( ik > 1 ) THEN
zl = ( gdept_1d(ik) - gdept_0(ji,jj,ik) ) / ( gdept_1d(ik) - gdept_1d(ik-1) )
ptsd(ji,jj,ik,jp_tem) = (1.-zl) * ptsd(ji,jj,ik,jp_tem) + zl * ptsd(ji,jj,ik-1,jp_tem)
ptsd(ji,jj,ik,jp_sal) = (1.-zl) * ptsd(ji,jj,ik,jp_sal) + zl * ptsd(ji,jj,ik-1,jp_sal)
ENDIF
ik = mikt(ji,jj)
IF( ik > 1 ) THEN
zl = ( gdept_0(ji,jj,ik) - gdept_1d(ik) ) / ( gdept_1d(ik+1) - gdept_1d(ik) )
ptsd(ji,jj,ik,jp_tem) = (1.-zl) * ptsd(ji,jj,ik,jp_tem) + zl * ptsd(ji,jj,ik+1,jp_tem)
ptsd(ji,jj,ik,jp_sal) = (1.-zl) * ptsd(ji,jj,ik,jp_sal) + zl * ptsd(ji,jj,ik+1,jp_sal)
END IF
END DO
END DO
ENDIF
!
ENDIF
!
IF( .NOT.ln_tsd_tradmp ) THEN !== deallocate T & S structure ==!
! (data used only for initialisation)
IF(lwp) WRITE(numout,*) 'dta_tsd: deallocte T & S arrays as they are only use to initialize the run'
DEALLOCATE( sf_tsd(jp_tem)%fnow ) ! T arrays in the structure
IF( sf_tsd(jp_tem)%ln_tint ) DEALLOCATE( sf_tsd(jp_tem)%fdta )
DEALLOCATE( sf_tsd(jp_sal)%fnow ) ! S arrays in the structure
IF( sf_tsd(jp_sal)%ln_tint ) DEALLOCATE( sf_tsd(jp_sal)%fdta )
IF( ln_tsd_interp ) DEALLOCATE( sf_tsd(jp_dep)%fnow ) ! T arrays in the structure
IF( ln_tsd_interp ) DEALLOCATE( sf_tsd(jp_msk)%fnow ) ! T arrays in the structure
DEALLOCATE( sf_tsd ) ! the structure itself
ENDIF
!
IF( nn_timing == 1 ) CALL timing_stop('dta_tsd')
!
END SUBROUTINE dta_tsd
!!======================================================================
END MODULE dtatsd
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment