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/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/tests/TSUNAMI/MY_SRC – NEMO

source: NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/tests/TSUNAMI/MY_SRC/usrdef_istate.F90 @ 14644

Last change on this file since 14644 was 14644, checked in by sparonuz, 3 years ago

Merge trunk -r14642:HEAD

File size: 4.7 KB
Line 
1MODULE usrdef_istate
2   !!======================================================================
3   !!                     ***  MODULE usrdef_istate   ***
4   !!
5   !!                      ===  TSUNAMI 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 )
41      !!----------------------------------------------------------------------
42      !!                   ***  ROUTINE usr_def_istate  ***
43      !!
44      !! ** Purpose :   Initialization of the dynamics and tracers
45      !!                Here TSUNAMI 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      INTEGER  ::   igloi, igloj   ! to be removed in the future, see comment bellow
60      !!----------------------------------------------------------------------
61      !
62      IF(lwp) WRITE(numout,*)
63      IF(lwp) WRITE(numout,*) 'usr_def_istate : TSUNAMI configuration, analytical definition of initial state'
64      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   '
65      !
66      pts(:,:,:,jp_tem) = 20._wp
67      pts(:,:,:,jp_sal) = 30._wp
68      pu( :,:,:       ) =  0._wp
69      pv( :,:,:       ) =  0._wp
70     
71   END SUBROUTINE usr_def_istate
72
73
74   SUBROUTINE usr_def_istate_ssh( ptmask, pssh )
75      !!----------------------------------------------------------------------
76      !!                   ***  ROUTINE usr_def_istate_ssh  ***
77      !!
78      !! ** Purpose :   Initialization of ssh
79      !!                Here TSUNAMI configuration
80      !!
81      !! ** Method  :   Set ssh
82      !!----------------------------------------------------------------------
83      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask   [m]
84      REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height   [m]
85      !
86      INTEGER  ::   ji, jj
87      REAL(wp), DIMENSION(jpi,jpj) ::  zdist
88      REAL(wp)                     ::  zmax
89      !!----------------------------------------------------------------------
90      !
91      IF(lwp) WRITE(numout,*)
92      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : TSUNAMI configuration, analytical definition of initial ssh'
93      !
94      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
95         zdist(ji,jj) = SQRT( glamt(ji,jj)**2 + gphit(ji,jj)**2 )
96      END_2D
97      zmax = MAXVAL( zdist ) / 20._wp
98      CALL mpp_max( 'usrdef_istate', zmax )
99
100      pssh(:,:) = 0 
101      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
102         IF( zdist(ji,jj) <= zmax )   pssh(ji,jj) = 0.1 * COS( zdist(ji,jj) / zmax * rpi * 0.5_wp )
103      END_2D
104
105      !
106      CALL lbc_lnk('usrdef_istate', pssh, 'T',  1. )            ! apply boundary conditions
107      !
108   END SUBROUTINE usr_def_istate_ssh
109   
110   !!======================================================================
111END MODULE usrdef_istate
Note: See TracBrowser for help on using the repository browser.