Skip to content
Snippets Groups Projects
Commit dcece0a9 authored by Stefania Ciliberti's avatar Stefania Ciliberti
Browse files

add ADIAB_WAVE test

parent a138450c
No related branches found
No related tags found
No related merge requests found
Showing
with 1846 additions and 0 deletions
File added
../../../cfgs/SHARED/axis_def_nemo.xml
\ No newline at end of file
<!--
==============================================================================================
NEMO context
==============================================================================================
-->
<context id="nemo">
<!-- $id$ -->
<variable_definition>
<!-- Year/Month/Day of time origin for NetCDF files; defaults to 1800-01-01 -->
<variable id="ref_year" type="int"> 1900 </variable>
<variable id="ref_month" type="int"> 01 </variable>
<variable id="ref_day" type="int"> 01 </variable>
<variable id="rho0" type="float" > 1026.0 </variable>
<variable id="cpocean" type="float" > 3991.86795711963 </variable>
<variable id="convSpsu" type="float" > 0.99530670233846 </variable>
<variable id="rhoic" type="float" > 917.0 </variable>
<variable id="rhosn" type="float" > 330.0 </variable>
<variable id="missval" type="float" > 1.e20 </variable>
</variable_definition>
<!-- Fields definition -->
<field_definition src="./field_def_nemo-oce.xml"/> <!-- NEMO ocean dynamics -->
<!-- Files definition -->
<file_definition src="./file_def_nemo-oce.xml"/> <!-- NEMO ocean dynamics -->
<!-- Axis definition -->
<axis_definition src="./axis_def_nemo.xml"/>
<!-- Domain definition -->
<domain_definition src="./domain_def_nemo.xml"/>
<!-- Grids definition -->
<grid_definition src="./grid_def_nemo.xml"/>
</context>
../../../cfgs/SHARED/domain_def_nemo.xml
\ No newline at end of file
../../../cfgs/SHARED/field_def_nemo-oce.xml
\ No newline at end of file
<?xml version="1.0"?>
<!--
============================================================================================================
= output files definition =
= Define your own files =
= put the variables you want... =
============================================================================================================
-->
<file_definition type="one_file" name="@expname@" sync_freq="10d" min_digits="4">
<file_group id="1s" output_freq="1s" output_level="10" enabled=".TRUE." > <!-- 5d files -->
<file id="file1" name_suffix="_grid_U" description="ocean U grid variables" >
<field field_ref="e3u" name="e3u_inst" long_name="instantaneous U-cell thickness" operation="instant" />
<field field_ref="uoce" name="uo_inst" long_name="instantaneous sea water x velocity" operation="instant" />
<field field_ref="ustokes" name="sdzocrtx" long_name="instantaneous sea water sd x velocity" operation="instant"/>
</file>
</file_group>
</file_definition>
../../../cfgs/SHARED/grid_def_nemo.xml
\ No newline at end of file
<?xml version="1.0"?>
<simulation>
<!-- ============================================================================================ -->
<!-- XIOS context -->
<!-- ============================================================================================ -->
<context id="xios" >
<variable_definition>
<variable id="info_level" type="int">10</variable>
<variable id="using_server" type="bool">true</variable>
<variable id="using_oasis" type="bool">false</variable>
<variable id="oasis_codes_id" type="string" >oceanx</variable>
</variable_definition>
</context>
<!-- ============================================================================================ -->
<!-- NEMO CONTEXT add and suppress the components you need -->
<!-- ============================================================================================ -->
<context id="nemo" src="./context_nemo.xml"/> <!-- NEMO -->
</simulation>
This diff is collapsed.
../../../cfgs/SHARED/namelist_ref
\ No newline at end of file
This diff is collapsed.
MODULE usrdef_hgr
!!======================================================================
!! *** MODULE usrdef_hgr ***
!!
!! === ADIAB_WAVE configuration ===
!!
!! User defined : mesh and Coriolis parameter of a user configuration
!!======================================================================
!! History : 4.0 ! 2016-03 (S. Flavoni)
!!----------------------------------------------------------------------
!!----------------------------------------------------------------------
!! usr_def_hgr : initialize the horizontal mesh
!!----------------------------------------------------------------------
USE dom_oce ! ocean space and time domain
USE par_oce ! ocean space and time domain
USE phycst ! physical constants
USE usrdef_nam !
!
USE in_out_manager ! I/O manager
USE lib_mpp ! MPP library
IMPLICIT NONE
PRIVATE
PUBLIC usr_def_hgr ! called in domhgr.F90
!! * Substitutions
# include "do_loop_substitute.h90"
!!----------------------------------------------------------------------
!! NEMO/OCE 4.0 , NEMO Consortium (2018)
!! $Id: usrdef_hgr.F90 14223 2020-12-19 10:22:45Z smasson $
!! Software governed by the CeCILL license (see ./LICENSE)
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE usr_def_hgr( plamt , plamu , plamv , plamf , & ! geographic position (required)
& pphit , pphiu , pphiv , pphif , & !
& kff , pff_f , pff_t , & ! Coriolis parameter (if domain not on the sphere)
& pe1t , pe1u , pe1v , pe1f , & ! scale factors (required)
& pe2t , pe2u , pe2v , pe2f , & !
& ke1e2u_v , pe1e2u , pe1e2v ) ! u- & v-surfaces (if gridsize reduction is used in strait(s))
!!----------------------------------------------------------------------
!! *** ROUTINE usr_def_hgr ***
!!
!! ** Purpose : user defined mesh and Coriolis parameter
!!
!! ** Method : set all intent(out) argument to a proper value
!!
!! Here ADIAB_WAVE configuration :
!! Rectangular domain
!! - a constant horizontal resolution of 10m
!! - no Coriolis effect
!!
!! ** Action : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
!! - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane)
!! - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
!! - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2)
!!----------------------------------------------------------------------
REAL(wp), DIMENSION(:,:), INTENT(out) :: plamt, plamu, plamv, plamf ! longitude outputs [degrees]
REAL(wp), DIMENSION(:,:), INTENT(out) :: pphit, pphiu, pphiv, pphif ! latitude outputs [degrees]
INTEGER , INTENT(out) :: kff ! =1 Coriolis parameter computed here, =0 otherwise
REAL(wp), DIMENSION(:,:), INTENT(out) :: pff_f, pff_t ! Coriolis factor at f-point [1/s]
REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1t, pe1u, pe1v, pe1f ! i-scale factors [m]
REAL(wp), DIMENSION(:,:), INTENT(out) :: pe2t, pe2u, pe2v, pe2f ! j-scale factors [m]
INTEGER , INTENT(out) :: ke1e2u_v ! =1 u- & v-surfaces computed here, =0 otherwise
REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1e2u, pe1e2v ! u- & v-surfaces (if reduction in strait) [m2]
!
INTEGER :: ji, jj ! dummy loop indices
REAL(wp) :: zfact, zfact2 ! local scalars
!!-------------------------------------------------------------------------------
!
!
IF(lwp) WRITE(numout,*) 'usr_def_hgr : ADIAB_GLM configuration bassin'
IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ uniform grid spacing WITHOUT Coriolis force (f=0)'
!
! !== grid point position ==! (in kilometers)
zfact = rn_dx * 1.e-3 ! conversion in km
zfact2= rn_dy * 1.e-3
DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
! DO_2D( 1, 1, 1, 1 )
! ! longitude
plamt(ji,jj) = zfact * ( REAL( mig0(ji)-1 , wp ) )
plamu(ji,jj) = zfact * ( 0.5 + REAL( mig0(ji)-1 , wp ) )
plamv(ji,jj) = plamt(ji,jj)
plamf(ji,jj) = plamu(ji,jj)
! ! latitude
pphit(ji,jj) = zfact2 * ( REAL( mjg0(jj)-1 , wp ) )
pphiu(ji,jj) = pphit(ji,jj)
pphiv(ji,jj) = zfact2 * ( 0.5 + REAL( mjg0(jj)-1 , wp ) )
pphif(ji,jj) = pphiv(ji,jj)
END_2D
!
! !== Horizontal scale factors ==! (in meters)
pe1t(:,:) = rn_dx ; pe2t(:,:) = rn_dy
pe1u(:,:) = rn_dx ; pe2u(:,:) = rn_dy
pe1v(:,:) = rn_dx ; pe2v(:,:) = rn_dy
pe1f(:,:) = rn_dx ; pe2f(:,:) = rn_dy
!
! ! NO reduction of grid size in some straits
ke1e2u_v = 0 ! ==>> u_ & v_surfaces will be computed in dom_ghr routine
pe1e2u(:,:) = 0._wp ! CAUTION: set to zero to avoid error with some compilers that
pe1e2v(:,:) = 0._wp ! require an initialization of INTENT(out) arguments
!
!
! !== Coriolis parameter ==!
kff = 1 ! indicate not to compute Coriolis parameter afterward
!
pff_f(:,:) = 0._wp ! here No earth rotation: f=0
pff_t(:,:) = 0._wp
!
END SUBROUTINE usr_def_hgr
!!======================================================================
END MODULE usrdef_hgr
MODULE usrdef_istate
!!======================================================================
!! *** MODULE usrdef_istate ***
!!
!! === ADIAB_WAVE configuration ===
!!
!! User defined : set the initial state of a user configuration
!!======================================================================
!! History : 4.0 ! 2016-03 (S. Flavoni) Original code
!! ! 2020-11 (S. Techene, G. Madec) separate tsuv from ssh
!!----------------------------------------------------------------------
!!----------------------------------------------------------------------
!! usr_def_istate : initial state in Temperature and salinity
!!----------------------------------------------------------------------
USE par_oce ! ocean space and time domain
USE phycst ! physical constants
!
USE in_out_manager ! I/O manager
USE lib_mpp ! MPP library
IMPLICIT NONE
PRIVATE
PUBLIC usr_def_istate ! called in istate.F90
PUBLIC usr_def_istate_ssh ! called by domqco.F90
!! * Substitutions
# include "do_loop_substitute.h90"
!!----------------------------------------------------------------------
!! NEMO/OCE 4.0 , NEMO Consortium (2018)
!! $Id: usrdef_istate.F90 14834 2021-05-11 09:24:44Z hadcv $
!! Software governed by the CeCILL license (see ./LICENSE)
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv )
!!----------------------------------------------------------------------
!! *** ROUTINE usr_def_istate ***
!!
!! ** Purpose : Initialization of the dynamics and tracers
!! Here ADIAB_WAVE configuration
!!
!! ** Method : - set temprature field
!! - set salinity field
!!----------------------------------------------------------------------
REAL(wp), DIMENSION(jpi,jpj,jpk) , INTENT(in ) :: pdept ! depth of t-point [m]
REAL(wp), DIMENSION(jpi,jpj,jpk) , INTENT(in ) :: ptmask ! t-point ocean mask [m]
REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT( out) :: pts ! T & S fields [Celsius ; g/kg]
REAL(wp), DIMENSION(jpi,jpj,jpk) , INTENT( out) :: pu ! i-component of the velocity [m/s]
REAL(wp), DIMENSION(jpi,jpj,jpk) , INTENT( out) :: pv ! j-component of the velocity [m/s]
!
INTEGER :: ji, jj, jk ! dummy loop indices
!!----------------------------------------------------------------------
!
IF(lwp) WRITE(numout,*)
IF(lwp) WRITE(numout,*) 'usr_def_istate : analytical definition of initial state '
IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~ Ocean at rest, with a constant T and S'
!
pu (:,:,:) = 0._wp ! ocean at rest
pv (:,:,:) = 0._wp
!
pts(:,:,:,jp_tem) = 25._wp
pts(:,:,:,jp_sal) = 35._wp
!
END SUBROUTINE usr_def_istate
SUBROUTINE usr_def_istate_ssh( ptmask, pssh )
!!----------------------------------------------------------------------
!! *** ROUTINE usr_def_istate_ssh ***
!!
!! ** Purpose : Initialization of ssh
!!
!! ** Method : Set ssh as null, ptmask is required for test cases
!!----------------------------------------------------------------------
REAL(wp), DIMENSION(jpi,jpj,jpk) , INTENT(in ) :: ptmask ! t-point ocean mask [m]
REAL(wp), DIMENSION(jpi,jpj) , INTENT( out) :: pssh ! sea-surface height [m]
!!----------------------------------------------------------------------
!
IF(lwp) WRITE(numout,*)
IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : analytical definition of initial state'
IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~~ Ocean at rest, ssh is zero'
!
! Sea level:
pssh(:,:) = 0._wp
!
END SUBROUTINE usr_def_istate_ssh
!!======================================================================
END MODULE usrdef_istate
MODULE usrdef_nam
!!======================================================================
!! *** MODULE usrdef_nam ***
!!
!! === ADIAB_WAVE configuration ===
!!
!! User defined : set the domain characteristics of a user configuration
!!======================================================================
!! History : 4.0 ! 2016-03 (S. Flavoni, G. Madec) Original code
!!----------------------------------------------------------------------
!!----------------------------------------------------------------------
!! usr_def_nam : read user defined namelist and set global domain size
!! usr_def_hgr : initialize the horizontal mesh
!!----------------------------------------------------------------------
USE dom_oce
USE par_oce ! ocean space and time domain
USE phycst ! physical constants
!
USE in_out_manager ! I/O manager
USE lib_mpp ! MPP library
IMPLICIT NONE
PRIVATE
PUBLIC usr_def_nam ! called in nemogcm.F90 module
! !!* namusr_def namelist *!!
REAL(wp), PUBLIC :: rn_dx ! resolution in meters defining the horizontal domain size
REAL(wp), PUBLIC :: rn_dz ! resolution in meters defining the vertical domain size
REAL(wp), PUBLIC :: rn_dy
LOGICAL , PUBLIC :: ln_STOKES_ADIAB !Shallow/Inter water formula for the Stokes drift
!!----------------------------------------------------------------------
!! NEMO/OCE 4.0 , NEMO Consortium (2018)
!! $Id: usrdef_nam.F90 14433 2021-02-11 08:06:49Z smasson $
!! Software governed by the CeCILL license (see ./LICENSE)
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
!!----------------------------------------------------------------------
!! *** ROUTINE dom_nam ***
!!
!! ** Purpose : read user defined namelist and define the domain size
!!
!! ** Method : read in namusr_def containing all the user specific namelist parameter
!!
!! Here ADIAB configuration
!!
!! ** input : - namusr_def namelist found in namelist_cfg
!!----------------------------------------------------------------------
CHARACTER(len=*), INTENT(out) :: cd_cfg ! configuration name
INTEGER , INTENT(out) :: kk_cfg ! configuration resolution
INTEGER , INTENT(out) :: kpi, kpj, kpk ! global domain sizes
LOGICAL , INTENT(out) :: ldIperio, ldJperio ! i- and j- periodicity
LOGICAL , INTENT(out) :: ldNFold ! North pole folding
CHARACTER(len=1), INTENT(out) :: cdNFtype ! Folding type: T or F
!
INTEGER :: ios ! Local integer
!!
NAMELIST/namusr_def/ ln_zco, ln_zps, ln_sco, rn_dx, rn_dy, rn_dz, ln_STOKES_ADIAB
!!----------------------------------------------------------------------
!
READ ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 902 )
902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
!
IF(lwm) WRITE( numond, namusr_def )
!
cd_cfg = 'ADIAB_WAVE' ! name & resolution
kk_cfg = INT( rn_dx )
!
! Global Domain size: ADIAB_WAVE domain is 780 km x 5 grid-points x 4-6 m
kpi = INT( 780. / rn_dx )
kpj = 5. !
kpk = INT( 6. / rn_dz )!+1
! ! Set the lateral boundary condition of the global domain
ldIperio = .FALSE. ; ldJperio = .FALSE. ! closed domain
ldNFold = .FALSE. ; cdNFtype = '-'
!
! ! control print
IF(lwp) THEN
WRITE(numout,*) ' '
WRITE(numout,*) 'usr_def_nam : read the user defined namelist (namusr_def) in namelist_cfg'
WRITE(numout,*) '~~~~~~~~~~~ '
WRITE(numout,*) ' Namelist namusr_def : ADIAB_WAVE test case'
WRITE(numout,*) ' type of vertical coordinate : '
WRITE(numout,*) ' z-coordinate flag ln_zco = ', ln_zco
WRITE(numout,*) ' z-partial-step coordinate flag ln_zps = ', ln_zps
WRITE(numout,*) ' s-coordinate flag ln_sco = ', ln_sco
WRITE(numout,*) ' horizontal resolution rn_dx = ', rn_dx, ' meters'
WRITE(numout,*) ' horizontal resolution rn_dy = ', rn_dy, ' meters'
WRITE(numout,*) ' vertical resolution rn_dz = ', rn_dz, ' meters'
WRITE(numout,*) ' ADIAB_WAVE domain = 780 m x 5 grid-points x 4-6 m'
WRITE(numout,*) ' resulting global domain size : Ni0glo = ', kpi
WRITE(numout,*) ' Nj0glo = ', kpj
WRITE(numout,*) ' jpkglo = ', kpk
WRITE(numout,*) ' Stokes drift for Shallow/Inter water (ln_STOKES_ADIAB) = ', ln_STOKES_ADIAB
!
! Set the lateral boundary condition of the
! ADIAB_WAVE configuration : E-W periodic basin
!
WRITE(numout,*) ' '
WRITE(numout,*) ' Lateral boundary condition of the global domain'
WRITE(numout,*) ' ADIAB_WAVE : closed basin Iperio =', ldIperio
WRITE(numout,*) ' ADIAB_WAVE : closed basin Jperio =', ldJperio
ENDIF
!
END SUBROUTINE usr_def_nam
!!======================================================================
END MODULE usrdef_nam
MODULE usrdef_sbc
!!======================================================================
!! *** MODULE usrdef_sbc ***
!!
!! === ADIAB_WAVE configuration ===
!!
!! User defined : surface forcing of a user configuration
!!======================================================================
!! History : 4.0 ! 2016-03 (S. Flavoni, G. Madec) user defined interface
!!----------------------------------------------------------------------
!!----------------------------------------------------------------------
!! usrdef_sbc : user defined surface bounday conditions in ADIAB_WAVE case
!!----------------------------------------------------------------------
USE oce ! ocean dynamics and tracers
USE dom_oce ! ocean space and time domain
USE sbc_oce ! Surface boundary condition: ocean fields
USE sbcwave
USE phycst ! physical constants
!
USE in_out_manager ! I/O manager
USE lib_mpp ! distribued memory computing library
USE lbclnk ! ocean lateral boundary conditions (or mpp link)
USE lib_fortran !
IMPLICIT NONE
PRIVATE
PUBLIC usrdef_sbc_oce ! routine called in sbcmod module
PUBLIC usrdef_sbc_ice_tau ! routine called by icestp.F90 for ice dynamics
PUBLIC usrdef_sbc_ice_flx ! routine called by icestp.F90 for ice thermo
!! * Substitutions
# include "do_loop_substitute.h90"
!!----------------------------------------------------------------------
!! NEMO/OCE 4.0 , NEMO Consortium (2018)
!! $Id: usrdef_sbc.F90 14433 2021-02-11 08:06:49Z smasson $
!! Software governed by the CeCILL license (see ./LICENSE)
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE usrdef_sbc_oce( kt, Kbb )
!!---------------------------------------------------------------------
!! *** ROUTINE usrdef_sbc ***
!!
!! ** Purpose : provide at each time-step the ADIAB_WAVE surface boundary
!! condition, i.e. the momentum, heat and freshwater fluxes.
!!
!! ** Action : - set the ocean surface boundary condition, i.e.
!! utau, vtau, taum, wndm, qns, qsr, emp, sfx
!!
!! Reference : Hazeleger, W., and S. Drijfhout, JPO, 30, 677-695, 2000.
!!----------------------------------------------------------------------
INTEGER, INTENT(in) :: kt ! ocean time step
INTEGER, INTENT(in) :: Kbb ! ocean time index
!!
!!---------------------------------------------------------------------
! ---------------------------------- !
! control print at first time-step !
! ---------------------------------- !
IF( kt == nit000 .AND. lwp ) THEN
WRITE(numout,*)
WRITE(numout,*)'usrdef_sbc_oce : ADIAB_WAVE case: NO surface forcing'
WRITE(numout,*)'utau = vtau = taum = wndm = qns = qsr = emp = sfx = 0'
WRITE(numout,*)'~~~~~~~~~~~ '
ENDIF
!
utau(:,:) = 0._wp
vtau(:,:) = 0._wp
taum(:,:) = 0._wp
wndm(:,:) = 0._wp
!
emp (:,:) = 0._wp
sfx (:,:) = 0._wp
qns (:,:) = 0._wp
qsr (:,:) = 0._wp
!
IF( ln_wave ) CALL sbc_wave ( kt, Kbb )
END SUBROUTINE usrdef_sbc_oce
SUBROUTINE usrdef_sbc_ice_tau( kt )
INTEGER, INTENT(in) :: kt ! ocean time step
END SUBROUTINE usrdef_sbc_ice_tau
SUBROUTINE usrdef_sbc_ice_flx( kt, phs, phi )
INTEGER, INTENT(in) :: kt ! ocean time step
REAL(wp), DIMENSION(:,:,:), INTENT(in) :: phs ! snow thickness
REAL(wp), DIMENSION(:,:,:), INTENT(in) :: phi ! ice thickness
END SUBROUTINE usrdef_sbc_ice_flx
!!======================================================================
END MODULE usrdef_sbc
MODULE usrdef_zgr
!!======================================================================
!! *** MODULE usrdef_zgr ***
!!
!! === ADIAB_WAVE case ===
!!
!! user defined : vertical coordinate system of a user configuration
!!======================================================================
!! History : 4.0 ! 2016-08 (G. Madec, S. Flavoni) Original code
!!----------------------------------------------------------------------
!!----------------------------------------------------------------------
!! usr_def_zgr : user defined vertical coordinate system (required)
!! zgr_z1d : reference 1D z-coordinate
!!---------------------------------------------------------------------
USE oce ! ocean variables
USE dom_oce , ONLY: mi0, mi1 ! ocean space and time domain
USE dom_oce , ONLY: glamt ! ocean space and time domain
USE usrdef_nam ! User defined : namelist variables
!
USE in_out_manager ! I/O manager
USE lbclnk ! ocean lateral boundary conditions (or mpp link)
USE lib_mpp ! distributed memory computing library
USE timing ! Timing
IMPLICIT NONE
PRIVATE
PUBLIC usr_def_zgr ! called by domzgr.F90
!! * Substitutions
# include "do_loop_substitute.h90"
!!----------------------------------------------------------------------
!! NEMO/OCE 4.0 , NEMO Consortium (2018)
!! $Id: usrdef_zgr.F90 14857 2021-05-12 16:47:25Z hadcv $
!! Software governed by the CeCILL license (see ./LICENSE)
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE usr_def_zgr( ld_zco , ld_zps , ld_sco , ld_isfcav, & ! type of vertical coordinate
& pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d , & ! 1D reference vertical coordinate
& pdept , pdepw , & ! 3D t & w-points depth
& pe3t , pe3u , pe3v , pe3f , & ! vertical scale factors
& pe3w , pe3uw , pe3vw, & ! - - -
& k_top , k_bot ) ! top & bottom ocean level
!!---------------------------------------------------------------------
!! *** ROUTINE usr_def_zgr ***
!!
!! ** Purpose : User defined the vertical coordinates
!!
!!----------------------------------------------------------------------
LOGICAL , INTENT(in ) :: ld_zco, ld_zps, ld_sco ! vertical coordinate flags ( read in namusr_def )
LOGICAL , INTENT( out) :: ld_isfcav ! under iceshelf cavity flag
REAL(wp), DIMENSION(:) , INTENT( out) :: pdept_1d, pdepw_1d ! 1D grid-point depth [m]
REAL(wp), DIMENSION(:) , INTENT( out) :: pe3t_1d , pe3w_1d ! 1D grid-point depth [m]
REAL(wp), DIMENSION(:,:,:), INTENT( out) :: pdept, pdepw ! grid-point depth [m]
REAL(wp), DIMENSION(:,:,:), INTENT( out) :: pe3t , pe3u , pe3v , pe3f ! vertical scale factors [m]
REAL(wp), DIMENSION(:,:,:), INTENT( out) :: pe3w , pe3uw, pe3vw ! i-scale factors
INTEGER , DIMENSION(:,:) , INTENT( out) :: k_top, k_bot ! first & last ocean level
!
INTEGER :: ji, jj, jk ! dummy indices
INTEGER :: ik, jii ! local integers
REAL(wp) :: zfact, z1_jpkm1 ! local scalar
REAL(wp) :: ze3min ! local scalar
REAL(wp), DIMENSION(jpi,jpj) :: zht, zhu, z2d ! 2D workspace
REAL(wp) :: a0=0.261799388 !local scalar def bathy
REAL(wp) :: h1=6.0 !local scalar def bathy
REAL(wp) :: h2=4.0 !local scalar def bathy
REAL(wp) :: x2
COMPLEX , PARAMETER :: i=(0,1) !sqrt(-1)
!!----------------------------------------------------------------------
!
IF(lwp) WRITE(numout,*)
IF(lwp) WRITE(numout,*) 'usr_def_zgr : ADIAB_WAVE configuration (s-coordinate closed box ocean without cavities)'
IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
!
!
! type of vertical coordinate
! ---------------------------
! already set in usrdef_nam.F90 by reading the namusr_def namelist except for ISF
ld_isfcav = .FALSE.
!
zht(:,:)=h1
! ! ====================
! ! ADIAB_WAVE configuration
! ! ====================
IF(lwp) WRITE(numout,*)
IF(lwp) WRITE(numout,*) 'usr_def_zgr (ADIAB_WAVE) : Ardhuin et al 2007 formulation'
IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
!
DO ji = 1,40
x2=(-200+(ji-1)*10)
x2=(x2*a0-h2+h1)/h2
zht(ji,:)=-AIMAG((h1*(x2-i*a0)+(h2-h1)*LOG(1+EXP(x2-i*a0)))/a0)
END DO
DO jii=1, 40
zht(jpi*0.5+jii,:)=zht(jpi*0.5+1-jii,:)
ENDDO
IF(lwp) WRITE(numout,*) 'zht', zht(:,1)
!
! at u-point: averaging zht
DO_2D(0,0,0,0)
zhu(ji,jj) = 0.5_wp * ( zht(ji,jj) + zht(ji+1,jj) )
END_2D
CALL lbc_lnk( 'usrdef_zgr', zhu, 'U', 1. ) ! boundary condition: this mask the surrouding grid-points
! ! ==>>> set by hand non-zero value on first/last columns & rows
DO ji = mi0(1), mi1(1) ! first row of global domain only
zhu(ji,2) = zht(ji,2)
END DO
DO ji = mi0(jpiglo), mi1(jpiglo) ! last row of global domain only
zhu(ji,2) = zht(ji,2)
END DO
zhu(:,1) = zhu(:,2)
zhu(:,3) = zhu(:,2)
!
CALL zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d ) ! Reference z-coordinate system
!
!
! !== top masked level bathymetry ==! (all coordinates)
!
! no ocean cavities : top ocean level is ONE, except over land
! the ocean basin surrounded by land (1+nn_hls grid-points) set through lbc_lnk call
z2d(:,:) = 1._wp ! surface ocean is the 1st level
CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. ) ! closed basin, see userdef_nam.F90
k_top(:,:) = NINT( z2d(:,:) )
!
!
!
IF ( ld_sco ) THEN !== s-coordinate ==! (terrain-following coordinate)
!
k_bot(:,:) = jpkm1 * k_top(:,:) !* bottom ocean = jpk-1 (here use k_top as a land mask)
!
! !* terrain-following coordinate with e3.(k)=cst)
! ! ADIAB_WAVE case : identical with j-index (T=V, U=F)
z1_jpkm1 = 1._wp / REAL( jpkm1 , wp)
DO jk = 1, jpk
pdept(:,:,jk) = zht(:,:) * z1_jpkm1 * ( REAL( jk , wp ) - 0.5_wp )
pdepw(:,:,jk) = zht(:,:) * z1_jpkm1 * ( REAL( jk-1 , wp ) )
pe3t (:,:,jk) = zht(:,:) * z1_jpkm1
pe3u (:,:,jk) = zhu(:,:) * z1_jpkm1
pe3v (:,:,jk) = zht(:,:) * z1_jpkm1
pe3f (:,:,jk) = zhu(:,:) * z1_jpkm1
pe3w (:,:,jk) = zht(:,:) * z1_jpkm1
pe3uw(:,:,jk) = zhu(:,:) * z1_jpkm1
pe3vw(:,:,jk) = zht(:,:) * z1_jpkm1
END DO
ENDIF
!
!
IF ( ld_zco ) THEN !== z-coordinate ==! (step-like topography)
!
! !* bottom ocean compute from the depth of grid-points
k_bot(:,:) = jpkm1 * k_top(:,:) ! here use k_top as a land mask
DO jk = 1, jpkm1
WHERE( pdept_1d(jk) < zht(:,:) .AND. zht(:,:) <= pdept_1d(jk+1) ) k_bot(:,:) = jk * k_top(:,:)
END DO
! !* horizontally uniform coordinate (reference z-co everywhere)
DO jk = 1, jpk
pdept(:,:,jk) = pdept_1d(jk)
pdepw(:,:,jk) = pdepw_1d(jk)
pe3t (:,:,jk) = pe3t_1d (jk)
pe3u (:,:,jk) = pe3t_1d (jk)
pe3v (:,:,jk) = pe3t_1d (jk)
pe3f (:,:,jk) = pe3t_1d (jk)
pe3w (:,:,jk) = pe3w_1d (jk)
pe3uw(:,:,jk) = pe3w_1d (jk)
pe3vw(:,:,jk) = pe3w_1d (jk)
END DO
ENDIF
!
!
IF ( ld_zps ) THEN !== zps-coordinate ==! (partial bottom-steps)
!
ze3min = 0.1_wp * rn_dz
IF(lwp) WRITE(numout,*) ' minimum thickness of the partial cells = 10 % of e3 = ', ze3min
!
!
! !* bottom ocean compute from the depth of grid-points
k_bot(:,:) = jpkm1
DO jk = jpkm1, 1, -1
WHERE( zht(:,:) < pdepw_1d(jk) + ze3min ) k_bot(:,:) = jk-1
END DO
!
! !* vertical coordinate system
DO jk = 1, jpk ! initialization to the reference z-coordinate
pdept(:,:,jk) = pdept_1d(jk)
pdepw(:,:,jk) = pdepw_1d(jk)
pe3t (:,:,jk) = pe3t_1d (jk)
pe3u (:,:,jk) = pe3t_1d (jk)
pe3v (:,:,jk) = pe3t_1d (jk)
pe3f (:,:,jk) = pe3t_1d (jk)
pe3w (:,:,jk) = pe3w_1d (jk)
pe3uw(:,:,jk) = pe3w_1d (jk)
pe3vw(:,:,jk) = pe3w_1d (jk)
END DO
DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
ik = k_bot(ji,jj)
pdepw(ji,jj,ik+1) = MIN( zht(ji,jj) , pdepw_1d(ik+1) )
pe3t (ji,jj,ik ) = pdepw(ji,jj,ik+1) - pdepw(ji,jj,ik)
pe3t (ji,jj,ik+1) = pe3t (ji,jj,ik )
!
pdept(ji,jj,ik ) = pdepw(ji,jj,ik ) + pe3t (ji,jj,ik ) * 0.5_wp
pdept(ji,jj,ik+1) = pdepw(ji,jj,ik+1) + pe3t (ji,jj,ik+1) * 0.5_wp
pe3w (ji,jj,ik+1) = pdept(ji,jj,ik+1) - pdept(ji,jj,ik) ! = pe3t (ji,jj,ik )
pe3w (ji,jj,ik ) = pdept(ji,jj,ik ) - pdept(ji,jj,ik-1) ! st caution ik > 1
END_2D
! ! bottom scale factors and depth at U-, V-, UW and VW-points
! ! usually Computed as the minimum of neighbooring scale factors
pe3u (:,:,:) = pe3t(:,:,:) ! HERE configuration :
pe3v (:,:,:) = pe3t(:,:,:) ! e3 increases with i-index and identical with j-index
pe3f (:,:,:) = pe3t(:,:,:) ! so e3 minimum of (i,i+1) points is (i) point
pe3uw(:,:,:) = pe3w(:,:,:) ! in j-direction e3v=e3t and e3f=e3v
pe3vw(:,:,:) = pe3w(:,:,:) ! ==>> no need of lbc_lnk calls
!
ENDIF
!
END SUBROUTINE usr_def_zgr
SUBROUTINE zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d ) ! 1D reference vertical coordinate
!!----------------------------------------------------------------------
!! *** ROUTINE zgr_z1d ***
!!
!! ** Purpose : set the depth of model levels and the resulting
!! vertical scale factors.
!!
!! ** Method : 1D z-coordinate system (use in all type of coordinate)
!! The depth of model levels is set from dep(k), an analytical function:
!! w-level: depw_1d = dep(k)
!! t-level: dept_1d = dep(k+0.5)
!! The scale factors are the discrete derivative of the depth:
!! e3w_1d(jk) = dk[ dept_1d ]
!! e3t_1d(jk) = dk[ depw_1d ]
!!
!! === Here constant vertical resolution ===
!!
!! ** Action : - pdept_1d, pdepw_1d : depth of T- and W-point (m)
!! - pe3t_1d , pe3w_1d : scale factors at T- and W-levels (m)
!!----------------------------------------------------------------------
REAL(wp), DIMENSION(:), INTENT(out) :: pdept_1d, pdepw_1d ! 1D grid-point depth [m]
REAL(wp), DIMENSION(:), INTENT(out) :: pe3t_1d , pe3w_1d ! 1D vertical scale factors [m]
!
INTEGER :: jk ! dummy loop indices
REAL(wp) :: zt, zw ! local scalar
!!----------------------------------------------------------------------
!
IF(lwp) THEN ! Parameter print
WRITE(numout,*)
WRITE(numout,*) ' zgr_z1d : Reference vertical z-coordinates: uniform dz = ', rn_dz
WRITE(numout,*) ' ~~~~~~~'
ENDIF
!
! Reference z-coordinate (depth - scale factor at T- and W-points) ! Madec & Imbard 1996 function
! ----------------------
DO jk = 1, jpk
zw = REAL( jk , wp )
zt = REAL( jk , wp ) + 0.5_wp
pdepw_1d(jk) = rn_dz * REAL( jk-1 , wp )
pdept_1d(jk) = rn_dz * ( REAL( jk-1 , wp ) + 0.5_wp )
pe3w_1d (jk) = rn_dz
pe3t_1d (jk) = rn_dz
END DO
!
IF(lwp) THEN ! control print
WRITE(numout,*)
WRITE(numout,*) ' Reference 1D z-coordinate depth and scale factors:'
WRITE(numout, "(9x,' level gdept_1d gdepw_1d e3t_1d e3w_1d ')" )
WRITE(numout, "(10x, i4, 4f9.2)" ) ( jk, pdept_1d(jk), pdepw_1d(jk), pe3t_1d(jk), pe3w_1d(jk), jk = 1, jpk )
ENDIF
!
END SUBROUTINE zgr_z1d
!!======================================================================
END MODULE usrdef_zgr
# ADIAB_WAVE demonstration case
We here provide a physical description of this experiment and additional details as to how to run this experiment within NEMO. This experiment is **created and tested** for NEMO **code at revision 15197**.
An ipython notebook is also provided as a demonstration of possible analysis.
## Objectives
The purpose of this test case is to validate the implementation of the Generalized Lagrangian Mean equations for the coupling of NEMO with waves. This test case was first proposed by Ardhuin et al. (2008) and was successively detailed by Bennis et al (2011).
## Physical description
The ADIAB_WAVE test case consists on a steady monochromatic wave shoaling on a slope from 4 to 6-meter depth. It does not take into account the wave breaking nor bottom friction nor wave-induced mixing. The domain is rectangular with a size of 780m x 50m and with a uniform horizontal grid spacing rn_dx=rn_dy=10m. The flow is confined to a channel with a free-slip boundary condition at North and South and the bottom topography is uniform in the y-direction. The vertical grid is a terrain-following sigma-coordinates with 120 layers. The domain is initialized at rest with a constant temperature and salinity.
In a sake of simplicity, for this testcase, NEMO is forced offline by the wave model WaveWatch3 (WW3).
The initial characteristics of the wave field are a significant wave height Hs=1.02m, a wave period T=5.26s, and a wave direction theta=90° (propagation in the x-direction).
The calculation of the Stokes drift vertical decay in NEMO is currently based on the deep water approximation that is not verified in this test case. The MY_SRC/sbcwave.F90 includes the Stokes drift vertical decay parameterization for intermediate/shallow-water (Michaud et al, 2012).
## Exemple of run
The calculation of the Stokes drift for intermediate water is activated by the option ln_STOKES_ADIAB= .TRUE. in the namusr_def section of the namelist.
~~~fortran
!-----------------------------------------------------------------------
&namusr_def ! User defined : ADIAB_WAVE configuration
!-----------------------------------------------------------------------
! ! type of vertical coordinate
ln_zco = .false. ! z-coordinate
ln_zps = .false. ! z-partial-step coordinate
ln_sco = .true. ! s-coordinate
rn_dx = 10. ! horizontal resolution [meters]
rn_dy = 10.
rn_dz = 0.05 ! vertical resolution [meters]
ln_STOKES_ADIAB = .true. ! Stokes Drift (Shallow/Intermediate water)
/
~~~
The input_data folder contains the wave forcing as well as the East and West open boundary forcing.
The wave forcing file (sdw_WW3_ADIABWAVE_y0001m01d01.nc.tar.gz) need to be uncompressed before running.
Run the executable :
```
mpirun -np 1 ./nemo
```
The ADIAB_GLM_grid_U.nc output file should be generated.
The jupyter-notebook adiabwave_notebook.ipynb is set up to generate the vertical cross-section plots of the Stokes drift, the quasi-Eulerian velocity as well as the Lagrangian velocity after 900s of simulation. The quasi-Eulerian velocity is irrotational and homogeneous over the water column. The Lagrangian velocity vertical shear is entirely due to the Stokes drift.
## References
Ardhuin, F., Rascle, N., Belibassakis, K.A., 2008. Explicit wave-averaged primitive equations using a generalized Lagrangian mean. Ocean Model. 20, 35–60.
Bennis, A.C., Ardhuin, F., Dumas, F., 2011. On the coupling of wave and three-dimensional circulation models: Choice of theoretical framework, practical implementation and adiabatic tests. Ocean Model. 40, 260–272.
Michaud, H., Marsaleix, Leredde, P., Estournel, C., Bourrin, F., Lyard, F., Mayet, C., Ardhuin, F., 2012. Three-dimensional modelling of wave-induced current from the surfzone to the inner shelf. Ocean Sci. 8, 657–681.
bld::tool::fppkeys key_xios
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment