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/WAD/MY_SRC – NEMO

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

Last change on this file was 14053, checked in by techene, 3 years ago

#2385 added to the trunk

  • Property svn:keywords set to Id
File size: 12.0 KB
Line 
1MODULE usrdef_istate
2   !!======================================================================
3   !!                     ***  MODULE usrdef_istate   ***
4   !!
5   !!                  ===  WAD_TEST_CASES configuration  ===
6   !!
7   !! User defined : set the initial state of a user configuration
8   !!======================================================================
9   !! History :  4.0  ! 2016-03  (S. Flavoni) Original code
10   !!                 ! 2020-11  (S. Techene, G. Madec) separate tsuv from ssh
11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!  usr_def_istate : initial state in Temperature and salinity
15   !!----------------------------------------------------------------------
16   USE par_oce        ! ocean space and time domain
17   USE dom_oce , ONLY : mi0, mig, mjg, glamt, gphit, ht_0
18   USE phycst         ! physical constants
19   USE wet_dry        ! Wetting and drying
20   !
21   USE in_out_manager ! I/O manager
22   USE lib_mpp        ! MPP library
23   
24   IMPLICIT NONE
25   PRIVATE
26
27   PUBLIC   usr_def_istate       ! called in istate.F90
28   PUBLIC   usr_def_istate_ssh   ! called in sshwzv.F90
29
30   !! * Substitutions
31#  include "do_loop_substitute.h90"
32   !!----------------------------------------------------------------------
33   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
34   !! $Id$
35   !! Software governed by the CeCILL license (see ./LICENSE)
36   !!----------------------------------------------------------------------
37CONTAINS
38
39
40   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv )
41      !!----------------------------------------------------------------------
42      !!                   ***  ROUTINE usr_def_istate  ***
43      !!
44      !! ** Purpose :   Initialization of the dynamics and tracers
45      !!                Here WAD_TEST_CASES configuration
46      !!
47q      !! ** Method  : - set temprature field
48      !!              - set salinity   field
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      INTEGER  ::   ji, jj            ! dummy loop indices
56      REAL(wp) ::   zi, zj
57      !
58      INTEGER  ::   jk     ! dummy loop indices
59      REAL(wp) ::   zdam   ! location of dam [Km]
60      !!----------------------------------------------------------------------
61      !
62      IF(lwp) WRITE(numout,*)
63      IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD_TEST_CASES configuration, analytical definition of initial state'
64      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   Ocean at rest, with a constant temperature                    '
65      IF(lwp) WRITE(numout,*) '                 and  constant salinity (not used as rho=F(T) '
66      !
67      !
68      pu  (:,:,:) = 0._wp        ! ocean at rest
69      pv  (:,:,:) = 0._wp
70      !                          ! T & S profiles
71      pts(:,:,:,jp_tem) = 10._wp * ptmask(:,:,:)
72      !
73      pts(:,:,:,jp_sal) = 35._wp * ptmask(:,:,:)
74      !!----------------------------------------------------------------------
75      !
76      !!----------------------------------------------------------------------
77      !
78      ! Uniform T & S in most test cases
79      pts(:,:,:,jp_tem) = 10._wp
80      pts(:,:,:,jp_sal) = 35._wp
81      SELECT CASE ( nn_cfg ) 
82         !                                        ! ====================
83         CASE ( 1 )                               ! WAD 1 configuration
84            !                                     ! ====================
85            IF(lwp) WRITE(numout,*)
86            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Closed box with EW linear bottom slope'
87            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
88            !                                     ! ====================
89         CASE ( 2, 8 )                            ! WAD 2 configuration
90            !                                     ! ====================
91            IF(lwp) WRITE(numout,*)
92            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel, mid-range initial ssh slope'
93            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
94            !                                     ! ====================
95         CASE ( 3 )                               ! WAD 3 configuration
96            !                                     ! ====================
97            IF(lwp) WRITE(numout,*)
98            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel, extreme initial ssh slope' 
99            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
100            !                                     ! ====================
101         CASE ( 4 )                               ! WAD 4 configuration
102            !                                     ! ====================
103            IF(lwp) WRITE(numout,*)
104            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic bowl, mid-range initial ssh slope' 
105            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
106            !                                    ! ===========================
107         CASE ( 5, 7 )                           ! WAD 5 and 7 configurations
108            !                                    ! ===========================
109            IF(lwp) WRITE(numout,*)
110            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Double slope with shelf'
111            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
112            !                                     ! ====================
113         CASE ( 6 )                               ! WAD 6 configuration
114            !                                     ! ====================
115            IF(lwp) WRITE(numout,*)
116            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel with gaussian ridge' 
117            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
118            !
119            DO ji = mi0(jpiglo/2), mi0(jpiglo)
120               pts(ji,:,:,jp_sal) = 30._wp
121            END DO
122            !
123            !
124            !                                    ! ===========================
125         CASE DEFAULT                            ! NONE existing configuration
126            !                                    ! ===========================
127            WRITE(ctmp1,*) 'WAD test with a ', nn_cfg,' option is not coded'
128            !
129            CALL ctl_stop( ctmp1 )
130            !
131      END SELECT
132      !
133   END SUBROUTINE usr_def_istate
134
135     
136   SUBROUTINE usr_def_istate_ssh( ptmask, pssh )
137      !!----------------------------------------------------------------------
138      !!                   ***  ROUTINE usr_def_istate_ssh  ***
139      !!
140      !! ** Purpose :   Initialization of the dynamics and tracers
141      !!                Here WAD_TEST_CASES configuration
142      !!
143      !! ** Method  : - set ssh
144      !!----------------------------------------------------------------------
145      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask             [m]
146      REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height
147      INTEGER  ::   ji, jj            ! dummy loop indices
148      REAL(wp) ::   zi, zj
149      !
150      INTEGER  ::   jk     ! dummy loop indices
151      REAL(wp) ::   zdam   ! location of dam [Km]
152      !!----------------------------------------------------------------------
153      !
154      !
155      SELECT CASE ( nn_cfg ) 
156         !                                        ! ====================
157         CASE ( 1 )                               ! WAD 1 configuration
158            !                                     ! ====================
159            !
160            IF(lwp) WRITE(numout,*)
161            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Closed box with EW linear bottom slope'
162            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
163            !
164            DO ji = 1,jpi
165               pssh(ji,:) = ( -5.5_wp + 7.4_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1)
166            END DO
167            !                                     ! ====================
168         CASE ( 2, 8 )                            ! WAD 2 configuration
169            !                                     ! ====================
170            !
171            IF(lwp) WRITE(numout,*)
172            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel, mid-range initial ssh slope'
173            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
174            !
175            DO ji = 1,jpi
176               pssh(ji,:) = ( -1.5_wp + 5.0_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1)
177            END DO
178            !                                     ! ====================
179         CASE ( 3 )                               ! WAD 3 configuration
180            !                                     ! ====================
181            !
182            IF(lwp) WRITE(numout,*)
183            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel, extreme initial ssh slope' 
184            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
185            !
186            DO ji = 1,jpi
187               pssh(ji,:) = ( -4.5_wp + 6.8_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1)
188            END DO
189
190            !
191            !                                     ! ====================
192         CASE ( 4 )                               ! WAD 4 configuration
193            !                                     ! ====================
194            !
195            IF(lwp) WRITE(numout,*)
196            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic bowl, mid-range initial ssh slope' 
197            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
198            !
199            DO ji = 1, jpi
200               zi = MAX(1.0-((glamt(ji,1)-25._wp)**2)/400.0, 0.0 )
201               DO jj = 1, jpj
202                  zj = MAX(1.0-((gphit(1,jj)-17._wp)**2)/144.0, 0.0 )
203                  pssh(ji,jj) = -2.5_wp + 5.4_wp*zi*zj
204               END DO
205            END DO
206
207            !
208            !                                    ! ===========================
209         CASE ( 5, 7 )                           ! WAD 5 and 7 configurations
210            !                                    ! ===========================
211            !
212            IF(lwp) WRITE(numout,*)
213            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Double slope with shelf'
214            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
215            !
216            DO ji = 1,jpi
217               pssh(ji,:) = ( -2.5_wp + 5.5_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1)
218            END DO
219
220            !
221            !                                     ! ====================
222         CASE ( 6 )                               ! WAD 6 configuration
223            !                                     ! ====================
224            !
225            IF(lwp) WRITE(numout,*)
226            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel with gaussian ridge' 
227            IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
228            !
229            DO ji = 1,jpi
230               pssh(ji,:) = ( -2.5_wp + 5.5_wp*(50._wp-glamt(ji,1))/50._wp)*ptmask(ji,:,1)
231            END DO
232            !
233            DO ji = mi0(jpiglo/2), mi0(jpiglo)
234               pssh(ji,:) = -0.1*ptmask(ji,:,1)
235            END DO
236            !
237            !
238            !                                    ! ===========================
239         CASE DEFAULT                            ! NONE existing configuration
240            !                                    ! ===========================
241            WRITE(ctmp1,*) 'WAD test with a ', nn_cfg,' option is not coded'
242            !
243            CALL ctl_stop( ctmp1 )
244            !
245      END SELECT
246
247
248      !
249      ! Apply minimum wetdepth criterion
250      !
251      DO_2D( 1, 1, 1, 1 )
252         IF( ht_0(ji,jj) + pssh(ji,jj) < rn_wdmin1 ) THEN
253            pssh(ji,jj) = ptmask(ji,jj,1)*( rn_wdmin1 - ht_0(ji,jj) )
254         ENDIF
255      END_2D
256      !
257   END SUBROUTINE usr_def_istate_ssh
258
259   !!======================================================================
260END MODULE usrdef_istate
Note: See TracBrowser for help on using the repository browser.