New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
usrdef_istate.F90 in NEMO/trunk/tests/BENCH/MY_SRC – NEMO

source: NEMO/trunk/tests/BENCH/MY_SRC/usrdef_istate.F90

Last change on this file was 14273, checked in by smasson, 3 years ago

trunk: fix DONUT and BENCH tests + minor fix in usrdef_sbc.F90 if icethd

File size: 5.5 KB
Line 
1MODULE usrdef_istate
2   !!======================================================================
3   !!                     ***  MODULE usrdef_istate   ***
4   !!
5   !!                      ===  BENCH configuration  ===
6   !!
7   !! User defined : set the initial state of a user configuration
8   !!======================================================================
9   !! History :  NEMO !
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!  usr_def_istate : initial state in Temperature and salinity
14   !!----------------------------------------------------------------------
15   USE par_oce        ! ocean space and time domain
16   USE dom_oce       
17   USE phycst         ! physical constants
18   !
19   USE in_out_manager ! I/O manager
20   USE lib_mpp        ! MPP library
21   USE lbclnk          ! lateral boundary conditions - mpp exchanges
22   !   
23   USE usrdef_nam
24   
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   usr_def_istate       ! called by istate.F90
29   PUBLIC   usr_def_istate_ssh   ! called by domqco.F90
30
31   !! * Substitutions
32#  include "do_loop_substitute.h90"
33   !!----------------------------------------------------------------------
34   !! NEMO/OPA 4.0 , NEMO Consortium (2016)
35   !! $Id$
36   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
37   !!----------------------------------------------------------------------
38CONTAINS
39 
40   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) !!st, pssh )
41      !!----------------------------------------------------------------------
42      !!                   ***  ROUTINE usr_def_istate  ***
43      !!
44      !! ** Purpose :   Initialization of the dynamics and tracers
45      !!                Here BENCH configuration
46      !!
47      !! ** Method  :   Set a gaussian anomaly of pressure and associated
48      !!                geostrophic velocities
49      !!----------------------------------------------------------------------
50      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   pdept   ! depth of t-point               [m]
51      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask             [m]
52      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(  out) ::   pts     ! T & S fields      [Celsius ; g/kg]
53      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]
54      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]
55      !
56      REAL(wp), DIMENSION(jpi,jpj) ::   z2d   ! 2D workspace
57      REAL(wp) ::   zfact
58      INTEGER  ::   ji, jj, jk
59      !!----------------------------------------------------------------------
60      !
61      IF(lwp) WRITE(numout,*)
62      IF(lwp) WRITE(numout,*) 'usr_def_istate : BENCH configuration, analytical definition of initial state'
63      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   '
64      !
65      ! define unique value on each point of the inner global domain. z2d ranging from 0.05 to -0.05
66      !
67      DO_2D( 0, 0, 0, 0 )   !  +/- 0.05
68         z2d(ji,jj) = 0.1 * ( 0.5 - REAL( mig0(ji) + (mjg0(jj)-1) * Ni0glo, wp ) / REAL( Ni0glo * Nj0glo, wp ) )
69      END_2D
70      !
71      DO_3D( 0, 0, 0, 0, 1, jpkm1 )
72         zfact = REAL(jk-1,wp) / REAL(jpk-1,wp)   ! 0 to 1 to add a basic stratification
73         ! temperature choosen to lead to ~50% ice at the beginning if rn_thres_sst = 0.5
74         pts(ji,jj,jk,jp_tem) = 20._wp*z2d(ji,jj) - 1._wp - 0.5_wp * zfact    ! -1 to -1.5 +/- 1.0 degG
75         ! salinity: 
76         pts(ji,jj,jk,jp_sal) = 30._wp + 1._wp * zfact + z2d(ji,jj)           ! 30 to 31   +/- 0.05 psu
77         ! velocities:
78         pu(ji,jj,jk) = z2d(ji,jj) *  0.1_wp * umask(ji,jj,jk)                ! +/- 0.005  m/s
79         pv(ji,jj,jk) = z2d(ji,jj) * 0.01_wp * vmask(ji,jj,jk)                ! +/- 0.0005 m/s
80      END_3D
81      pts(:,:,jpk,:) = 0._wp
82      pu( :,:,jpk  ) = 0._wp
83      pv( :,:,jpk  ) = 0._wp
84      !
85      CALL lbc_lnk('usrdef_istate',  pts, 'T',  1. )            ! apply boundary conditions
86      CALL lbc_lnk('usrdef_istate',   pu, 'U', -1. )            ! apply boundary conditions
87      CALL lbc_lnk('usrdef_istate',   pv, 'V', -1. )            ! apply boundary conditions
88     
89   END SUBROUTINE usr_def_istate
90
91
92   SUBROUTINE usr_def_istate_ssh( ptmask, pssh )
93      !!----------------------------------------------------------------------
94      !!                   ***  ROUTINE usr_def_istate_ssh  ***
95      !!
96      !! ** Purpose :   Initialization of ssh
97      !!                Here BENCH configuration
98      !!
99      !! ** Method  :   Set ssh
100      !!----------------------------------------------------------------------
101      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask   [m]
102      REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height   [m]
103      !
104      INTEGER  ::   ji, jj
105      !!----------------------------------------------------------------------
106      !
107      IF(lwp) WRITE(numout,*)
108      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : BENCH configuration, analytical definition of initial ssh'
109      !
110      DO_2D( 0, 0, 0, 0 )                              ! sea level:  +/- 0.05 m
111         pssh(ji,jj) = 0.1 * ( 0.5 - REAL( mig0(ji) + (mjg0(jj)-1) * Ni0glo, wp ) / REAL( Ni0glo * Nj0glo, wp ) )
112      END_2D
113      !
114      CALL lbc_lnk('usrdef_istate', pssh, 'T',  1. )   ! apply boundary conditions
115      !
116   END SUBROUTINE usr_def_istate_ssh
117   
118   !!======================================================================
119END MODULE usrdef_istate
Note: See TracBrowser for help on using the repository browser.