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_hgr.F90 in NEMO/branches/2020/dev_r12527_Gurvan_ShallowWater/cfgs/penzAM98/MY_SRC – NEMO

source: NEMO/branches/2020/dev_r12527_Gurvan_ShallowWater/cfgs/penzAM98/MY_SRC/usrdef_hgr.F90 @ 13562

Last change on this file since 13562 was 13562, checked in by gm, 4 years ago

zgr_pse created only for NS coast

File size: 8.9 KB
Line 
1MODULE usrdef_hgr
2   !!======================================================================
3   !!                     ***  MODULE usrdef_hgr   ***
4   !!
5   !!                     ===  AM98 configuration  ===
6   !!
7   !! User defined :   mesh and Coriolis parameter of a user configuration
8   !!======================================================================
9   !! History :  4.0 ! 2016-03  (S. Flavoni)
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_hgr   : initialize the horizontal mesh
14   !!----------------------------------------------------------------------
15   USE dom_oce  , ONLY: nimpp, njmpp       ! ocean space and time domain
16   USE par_oce        ! ocean space and time domain
17   USE phycst         ! physical constants
18   USE usrdef_nam     !
19   !
20   USE in_out_manager ! I/O manager
21   USE lib_mpp        ! MPP library
22
23   IMPLICIT NONE
24   PRIVATE
25
26   PUBLIC   usr_def_hgr   ! called in domhgr.F90
27
28   !!----------------------------------------------------------------------
29   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
30   !! $Id: usrdef_hgr.F90 10069 2018-08-28 14:12:24Z nicolasmartin $
31   !! Software governed by the CeCILL license (see ./LICENSE)
32   !!----------------------------------------------------------------------
33CONTAINS
34
35   SUBROUTINE usr_def_hgr( plamt , plamu , plamv  , plamf  ,   &   ! geographic position (required)
36      &                    pphit , pphiu , pphiv  , pphif  ,   &   !
37      &                    kff   , pff_f , pff_t  ,            &   ! Coriolis parameter  (if domain not on the sphere)
38      &                    pe1t  , pe1u  , pe1v   , pe1f   ,   &   ! scale factors       (required)
39      &                    pe2t  , pe2u  , pe2v   , pe2f   ,   &   !
40      &                    ke1e2u_v      , pe1e2u , pe1e2v     )   ! u- & v-surfaces (if gridsize reduction is used in strait(s))
41      !!----------------------------------------------------------------------
42      !!                  ***  ROUTINE usr_def_hgr  ***
43      !!
44      !! ** Purpose :   user defined mesh and Coriolis parameter
45      !!
46      !! ** Method  :   set all intent(out) argument to a proper value
47      !!
48      !!                Here AM98 configuration :
49      !!          Rectangular mid-latitude domain
50      !!          - with axes rotated by 45 degrees
51      !!          - a constant horizontal resolution of 106 km
52      !!          - on a beta-plane
53      !!
54      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
55      !!              - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane)
56      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
57      !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2)
58      !!----------------------------------------------------------------------
59      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
60      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
61      INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
62      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
63      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
64      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
65      INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise
66      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
67      !
68      INTEGER  ::   ji, jj               ! dummy loop indices
69      REAL(wp) ::   zlam1, zlam0, zcos_theta, zim1 , zjm1 , ze1  , ze1deg ! local scalars
70      REAL(wp) ::   zphi1, zphi0, zsin_theta, zim05, zjm05, znorme        !   -      -
71      REAL(wp) ::   zgl, zbl, z1d      !   -      -
72
73      !!-------------------------------------------------------------------------------
74      !
75      !     !==  beta-plane with regular grid-spacing and rotated domain ==!  (AM98 configuration)
76      !
77      IF(lwp) WRITE(numout,*)
78      IF(lwp) WRITE(numout,*) 'usr_def_hgr : AM98 configuration (beta-plane with rotated regular grid-spacing)'
79      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
80      !
81      !
82      !                       !==  grid point position  ==!
83      !
84      ze1 =  rn_dx / REAL(nn_AM98, wp)                   ! [m] gridspacing used
85      zgl =  rn_domsiz + 2._wp * REAL(nn_gc, wp) * ze1   ! [m] length of the square with ghostcells
86      ! fit the best square around the square + ghost cells
87      zbl = zgl * ( COS( rn_theta * rad ) + SIN( rn_theta * rad ) )   ! length side bigger domain [m]
88      !
89      zcos_theta = COS( rn_theta * rad)
90      zsin_theta = SIN( rn_theta * rad)
91      ! Translation vers le coin bas-gauche du carré tourné
92      zlam1 =  zbl * COS((rn_theta + 45. )* rad ) / SQRT( 2._wp ) - rn_domsiz/2._wp
93      zphi1 =  zbl * SIN((rn_theta + 45. )* rad ) / SQRT( 2._wp ) - rn_domsiz/2._wp
94      ! select the nearest integer coordonate point
95      zlam0 = REAL( anint( zlam1 / (ze1 * zcos_theta)  ), wp ) * ze1 * zcos_theta
96      zphi0 = REAl( anint( zphi1 / (ze1 * zcos_theta)  ), wp ) * ze1 * zcos_theta
97      !
98      ! zlam0 = REAL( anint( zlam1 / ze1 ), wp ) * ze1
99      ! zphi0 = REAl( anint( zphi1 / ze1 ), wp ) * ze1
100      !
101      IF(lwp) WRITE(numout,*) '                           origin position    zlam0   = ', zlam0/1000,   ' km'
102      IF(lwp) WRITE(numout,*) '                           origin position    zphi0   = ', zphi0/1000,   ' km'
103      ! O1M = OM x rotation_theta - OO1
104      ! zim1, zim05, zjm1, zjm05 fit for 2 ghost cells on each side
105      DO jj = 1, jpj
106         DO ji = 1, jpi
107            zim1 = REAL( ji + nimpp - 1 )   ;   zim05 = REAL( ji + nimpp - 1 ) - 0.5
108            zjm1 = REAL( jj + njmpp - 1 )   ;   zjm05 = REAL( jj + njmpp - 1 ) - 0.5
109            !
110            !glamt(i,j) position (meters) at T-point
111            !gphit(i,j) position (meters) at T-point
112            plamt(ji,jj) =   zim05 * ze1 * zcos_theta - zjm05 * ze1 * zsin_theta - zlam0
113            pphit(ji,jj) = + zim05 * ze1 * zsin_theta + zjm05 * ze1 * zcos_theta - zphi0
114            !
115            !glamu(i,j) position (meters) at U-point
116            !gphiu(i,j) position (meters) at U-point
117            plamu(ji,jj) =   zim1  * ze1 * zcos_theta - zjm05 * ze1 * zsin_theta - zlam0
118            pphiu(ji,jj) = + zim1  * ze1 * zsin_theta + zjm05 * ze1 * zcos_theta - zphi0
119            !
120            !glamv(i,j) position (meters) at V-point
121            !gphiv(i,j) position (meters) at V-point
122            plamv(ji,jj) =   zim05 * ze1 * zcos_theta - zjm1  * ze1 * zsin_theta - zlam0
123            pphiv(ji,jj) = + zim05 * ze1 * zsin_theta + zjm1  * ze1 * zcos_theta - zphi0
124            !
125            !glamf(i,j) position (meters) at F-point
126            !gphif(i,j) position (meters) at F-point
127            plamf(ji,jj) =   zim1  * ze1 * zcos_theta - zjm1  * ze1 * zsin_theta - zlam0
128            pphif(ji,jj) = + zim1  * ze1 * zsin_theta + zjm1  * ze1 * zcos_theta - zphi0
129         END DO
130      END DO
131      !
132      !                       !== Horizontal scale factors ==! (in meters)
133      !
134      !                                         ! constant grid spacing
135      pe1t(:,:) =  ze1     ;      pe2t(:,:) = ze1
136      pe1u(:,:) =  ze1     ;      pe2u(:,:) = ze1
137      pe1v(:,:) =  ze1     ;      pe2v(:,:) = ze1
138      pe1f(:,:) =  ze1     ;      pe2f(:,:) = ze1
139      !
140      !                                         ! NO reduction of grid size in some straits
141      ke1e2u_v = 0                              !    ==>> u_ & v_surfaces will be computed in dom_ghr routine
142      pe1e2u(:,:) = 0._wp                       !    CAUTION: set to zero to avoid error with some compilers that
143      pe1e2v(:,:) = 0._wp                       !             require an initialization of INTENT(out) arguments
144      !
145      !
146      !                       !==  Coriolis parameter  ==!
147      kff = 1                                            !  indicate not to compute ff afterward
148      !
149      pff_f(:,:) =  REAL( rn_f0, wp ) + REAL( rn_beta, wp ) * ABS( pphif(:,:) ) ! f = f0 +beta* y
150      pff_t(:,:) =  REAL( rn_f0, wp ) + REAL( rn_beta, wp ) * ABS( pphit(:,:) ) ! f = f0 +beta* y
151      !
152      IF(lwp) WRITE(numout,*) '                           beta-plane used. f0   = ', rn_f0 ,  ' 1/s'
153      IF(lwp) WRITE(numout,*) '                           beta-plane used. beta = ', rn_beta, ' 1/(s.m)'
154      !
155   END SUBROUTINE usr_def_hgr
156
157   !!======================================================================
158END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.