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/trunk/tests/ICEADV/MY_SRC – NEMO

source: NEMO/trunk/tests/ICEADV/MY_SRC/usrdef_hgr.F90 @ 10413

Last change on this file since 10413 was 10413, checked in by clem, 5 years ago

merge dev_r9947_SI3_advection with the trunk. All sette tests passed. There is probably a conservation issue with the new advection scheme that I should solve but the routine icedyn_adv_umx.F90 is going to change anyway in the next couple of weeks. At worst, the old routine can be plugged without harm

File size: 6.5 KB
RevLine 
[10413]1MODULE usrdef_hgr
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_hgr  ***
4   !!
5   !!                      ===  ICEADV configuration  ===
6   !!
7   !! User defined :   mesh and Coriolis parameter of a user configuration
8   !!======================================================================
9   !! History :  NEMO  ! 2016-08  (S. Flavoni, G. Madec)  Original code
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_hgr    : initialize the horizontal mesh for ICEADV configuration
14   !!----------------------------------------------------------------------
15   USE dom_oce         ! ocean space and time domain
16   USE par_oce         ! ocean space and time domain
17   USE phycst          ! physical constants
18   USE usrdef_nam, ONLY: rn_dx, rn_dy, ln_corio, rn_ppgphi0   ! horizontal resolution in meters
19   !                                                            coriolis and reference latitude
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 by domhgr.F90
27
28   !!----------------------------------------------------------------------
29   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
30   !! $Id: usrdef_hgr.F90 10074 2018-08-28 16:15:49Z 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      !!                ICEADV configuration : uniform grid spacing (rn_dx)
48      !!                without Coriolis force (f=0)
49      !!
50      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
51      !!              - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane)
52      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
53      !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2)
54      !!----------------------------------------------------------------------
55      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
56      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
57      INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
58      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
59      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
60      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
61      INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise
62      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
63      !
64      INTEGER  ::   ji, jj   ! dummy loop indices
65      REAL(wp) ::   zphi0, zlam0, zbeta, zf0
66      REAL(wp) ::   zti, zui, ztj, zvj   ! local scalars
67      !!-------------------------------------------------------------------------------
68      !
69      IF(lwp) WRITE(numout,*)
70      IF(lwp) WRITE(numout,*) 'usr_def_hgr : ICEADV configuration bassin'
71      IF(lwp) WRITE(numout,*)
72      IF(lwp) WRITE(numout,*) '          f-plane with regular grid-spacing rn_dx, rn_dy'
73
74      !                          ==========
75      zlam0 = -(jpiglo-1)/2 * 1.e-3 * rn_dx
76      zphi0 = -(jpjglo-1)/2 * 1.e-3 * rn_dy
77
78      DO jj = 1, jpj
79         DO ji = 1, jpi
80            zti = FLOAT( ji - 1 + nimpp - 1 )          ;  ztj = FLOAT( jj - 1 + njmpp - 1 )
81            zui = FLOAT( ji - 1 + nimpp - 1 ) + 0.5_wp ;  zvj = FLOAT( jj - 1 + njmpp - 1 ) + 0.5_wp
82
83            plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 * zti
84            plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * zui
85            plamv(ji,jj) = plamt(ji,jj) 
86            plamf(ji,jj) = plamu(ji,jj) 
87   
88            pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 * ztj
89            pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * zvj
90            pphiu(ji,jj) = pphit(ji,jj) 
91            pphif(ji,jj) = pphiv(ji,jj) 
92         END DO
93      END DO
94         
95      ! constant scale factors
96      pe1t(:,:) = rn_dx
97      pe2t(:,:) = rn_dy
98         
99      pe1u(:,:) = pe1t(:,:)      ;      pe2u(:,:) = pe2t(:,:)
100      pe1v(:,:) = pe1t(:,:)      ;      pe2v(:,:) = pe2t(:,:)
101      pe1f(:,:) = pe1t(:,:)      ;      pe2f(:,:) = pe2t(:,:)
102
103      !                             ! NO reduction of grid size in some straits
104      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_ghr routine
105      pe1e2u(:,:) = 0._wp           !    CAUTION: set to zero to avoid error with some compilers that
106      pe1e2v(:,:) = 0._wp           !             require an initialization of INTENT(out) arguments
107      !
108      !
109      !                       !==  Coriolis parameter  ==!
110      kff = 1                       !  indicate not to compute Coriolis parameter afterward
111      !
112      IF( ln_corio ) THEN
113         zbeta = 2._wp * omega * COS( rad * rn_ppgphi0 ) / ra
114         zf0   = 2._wp * omega * SIN( rad * rn_ppgphi0 )
115         pff_f(:,:) = zf0 + zbeta * pphif(:,:) * 1.e+3
116         pff_t(:,:) = zf0 + zbeta * pphit(:,:) * 1.e+3
117      ELSE
118         pff_f(:,:) = 0.
119         pff_t(:,:) = 0.
120      ENDIF
121      !
122   END SUBROUTINE usr_def_hgr
123
124   !!======================================================================
125END MODULE usrdef_hgr
Note: See TracBrowser for help on using the repository browser.