Repository navigation
12. Setting up wetting and drying
git clone https://github.com/JMMP-Group/SEVERN-SWOT
cd SEVERN-SWOT
git checkout WAD
Follow the steps from 01. Compile NEMO and XIOS to 02. Build domain configuration file in this Wiki to create coordinates and bathymetry files.
If you wish to use the GEBCO bathymetry previously created just for testing purposes, the land values need to be changed to -9999.99
In $DOMAIN:
ncap2 -s 'where(Bathymetry == 0) Bathymetry=-9999.99' bathy_meter.nc tmp1.nc
mv tmp1.nc bathy_meter.nc
The GEBCO bathymetry would require further processing, because the model is unstable. However, for wetting & drying and to get a better representation of intertidal areas we recommend building the bathymetry using the EMODnet dataset.
From the repository (https://github.com/JMMP-Group/CO_AMM15) I have copied the folder BUILD_CFG/domwad with the modified .f90 tools routine. It is saved in the $DOMAIN folder (NOTE: I have modified the routines because initially they were not compiling, my changes are included in the WAD branch and listed at the bottom of this page for clarity). I have modified the make_tools.sh to add a copy of the modified routines before compiling the tools, in SCRIPTS run:
. ./make_tools_wad.sh
Then move into $DOMAIN, I have modified the namelist_cfg to include the changes specified here: https://github.com/endaodea/DOMAINCFG_BASED_ON_36_NEMO/wiki, check the changes are there:
rn_sbot_min = 1.0e-5 ! minimum depth of s-bottom surface (>0) (m)
rn_sbot_max = 10000.0 ! maximum depth of s-bottom surface (= ocean depth) (>0) (m)
rn_hc = 51.0 ! critical depth for transition to stretched coordinates
rn_rmax = 0.1 ! maximum cut-off r-value allowed (0<r_max<1)
!-----------------------------------------------------------------------
&namdom ! space and time domain (bathymetry, mesh, timestep)
!-----------------------------------------------------------------------
ldbletanh=.false.,
nn_bathy=1,
nn_msh=1,
ppa0=999999.0,
ppa1=999999.0,
ppa2=999999.0,
ppacr=9.0,
ppacr2=999999.0,
ppdzmin=6.0,
ppe1_deg=999999.0,
ppe1_m=999999.0,
ppe2_deg=999999.0,
ppe2_m=999999.0,
ppglam0=999999.0,
ppgphi0=999999.0,
pphmax=5720.0,
ppkth=23.563,
ppkth2=999999.0,
ppsur=999999.0,
rn_bathy=100.0,
rn_rdt=60.0,
rn_wd_ref_depth=20.0,
In SCRIPTS run:
. ./make_domain_cfg.sh
Two new variables are added: rn_wd_ref_depth and ht_wd. The former is set in the namelist file in $DOMAIN.
Follow the steps in 04. Make tidal boundary conditions in this Wiki
In SCRIPTS run:
. ./run_barotropicTide_WAD.sh
In the namelist I'm using the following parameters:
!-----------------------------------------------------------------------
&namwad ! Wetting and drying (default F)
!-----------------------------------------------------------------------
ln_wd_il = .false. ! T/F activation of iterative limiter
ln_wd_dl = .true. ! T/F activation of directional limiter
ln_wd_dl_bc = .true. ! T/F Directional limiteer Baroclinic option
ln_wd_dl_rmp = .true. ! T/F Turn on directional limiter ramp
rn_wdmin0 = 0.3 ! depth at which WaD starts
rn_wdmin1 = 0.2 ! Minimum wet depth on dried cells
rn_wdmin2 = 0.0001 ! Tolerance of min wet depth on dried cells
rn_wdld = 2.5 ! Land elevation below which WaD is allowed
nn_wdit = 20 ! Max iterations for WaD limiter
rn_wd_sbcdep = 5.0 ! Depth at which to taper sbc fluxes
rn_wd_sbcfra = 0.999 ! Fraction of SBC fluxes at taper depth (Must be <1)
These modifications are already included in the WAD branch
In domain.F90 I commented this 2 lines that were giving problems:
IF( ln_sco .OR. ln_mes ) THEN ! s-coordinate: store grid stiffness ratio (Not required anyway)
CALL dom_stiff( z2d )`
CALL iom_rstput( 0, 0, inum, 'stiffness', z2d ) ! Max. grid stiffness ratio
! CALL dom_stiff_3D( z3d )
CALL iom_rstput( 0, 0, inum, 'stiff3D', z3d ) ! 3D stiffness ratio
! CALL saw_tooth( z2d )
CALL iom_rstput( 0, 0, inum, 'saw_tooth', z2d ) ! Saw_tooth diagnostic
ENDIF
I was not managing to compile with the given domzgr.F90, so what I did is adding in mine the rimwidth modification bit...
! CEOD
! Add on some reference level to make nagative bathy positive to create
! sensible e3t_0's
!CEOD MAKE points on the perimeter assuming a bondary is here on shallower than
!10m so that tide can be specified here.
if(1==1) then !CEOD BDY CASE
DO jj = 1, jpj
DO ji = 1, jpi
!CEODIF( mig(ji) <= 2 .or. mjg(jj) <= 2 .or. mig(ji) >= jpiglo-2 .or. mjg(jj) >=jpjglo-2) then
IF( mig(ji) <= 9 .or. mjg(jj) <= 9 .or. mjg(jj) >=jpjglo-9) then
IF( bathy(ji,jj) > 0.0) then
bathy(ji,jj) = max(10.0,bathy(ji,jj)) !
ENDIF
ENDIF
END DO
END DO
endif !CEOD END BDY CAE
bathy(:,:) = bathy(:,:) + rn_wd_ref_depth ! Arbitrary reference level, This needs
! to be accounted for in istate in the actual model and bdys etc.
!CEODTEMP where (bathy (:,:) .lt. 0.5) bathy(:,:) = 0.0 !added clearance for min depth values 0.5 never going to need more that 50cm
where (bathy (:,:) .lt. 0.5) bathy(:,:) = 0.0 !added clearance for min depth values 0.5 never going to need more that 50cm
!CEOD FOR EXPLICIT10M where (bathy (:,:) .lt. 0.0) bathy(:,:) = 0.0 !added clearance for min depth values 0.5 never going to need more that 50cm
!First step excludes crazy points
! where (bathy (:,:) .lt. 20.0 .and. bathy(:,:) >0.0) bathy(:,:) = 20.0 !added clearance for min depth values 0.5 never going to need more that 50cm
!2nd step set to 10 any points btwee 0,-10
These modifications are already included in the WAD branch.
The comment !to be accounted for in istate in the actual model and bdys etc. made me thinking a piece of code for the initial conditions was missing and I've copied it usrdef_istate.F90
from Jason's code in MY_SRC
(https://github.com/NOC-MSM/GCOMS1k/blob/master/MY_SRC_v4.0.4/usrdef_istate.F90)