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

source: NEMO/trunk/tests/ICE_ADV1D/MY_SRC/usrdef_hgr.F90 @ 13295

Last change on this file since 13295 was 13295, checked in by acc, 4 years ago

Replace do-loop macros in the trunk with alternative forms with greater flexibility for extra halo applications. This alters a lot of routines but does not change any behaviour or results. do_loop_substitute.h90 is greatly simplified by this change. SETTE results are identical to those with the previous revision

File size: 6.6 KB
Line 
1MODULE usrdef_hgr
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_hgr  ***
4   !!
5   !!                      ===  ICE_ADV1D 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 ICE_ADV1D 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   !! * Substitutions
29#  include "do_loop_substitute.h90"
30   !!----------------------------------------------------------------------
31   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
32   !! $Id: usrdef_hgr.F90 10074 2018-08-28 16:15:49Z nicolasmartin $
33   !! Software governed by the CeCILL license (see ./LICENSE)
34   !!----------------------------------------------------------------------
35CONTAINS
36
37   SUBROUTINE usr_def_hgr( plamt , plamu , plamv  , plamf  ,   &   ! geographic position (required)
38      &                    pphit , pphiu , pphiv  , pphif  ,   &   !
39      &                    kff   , pff_f , pff_t  ,            &   ! Coriolis parameter  (if domain not on the sphere)
40      &                    pe1t  , pe1u  , pe1v   , pe1f   ,   &   ! scale factors       (required)
41      &                    pe2t  , pe2u  , pe2v   , pe2f   ,   &   !
42      &                    ke1e2u_v      , pe1e2u , pe1e2v     )   ! u- & v-surfaces (if gridsize reduction is used in strait(s))
43      !!----------------------------------------------------------------------
44      !!                  ***  ROUTINE usr_def_hgr  ***
45      !!
46      !! ** Purpose :   user defined mesh and Coriolis parameter
47      !!
48      !! ** Method  :   set all intent(out) argument to a proper value
49      !!                ICE_ADV1D configuration : uniform grid spacing (rn_dx)
50      !!                without Coriolis force (f=0)
51      !!
52      !! ** Action  : - define longitude & latitude of t-, u-, v- and f-points (in degrees)
53      !!              - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane)
54      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters)
55      !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2)
56      !!----------------------------------------------------------------------
57      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
58      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
59      INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
60      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
61      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
62      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
63      INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise
64      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
65      !
66      INTEGER  ::   ji, jj     ! dummy loop indices
67      REAL(wp) ::   zphi0, zlam0, zbeta, zf0
68      REAL(wp) ::   zti, ztj   ! local scalars
69      !!-------------------------------------------------------------------------------
70      !
71      IF(lwp) WRITE(numout,*)
72      IF(lwp) WRITE(numout,*) 'usr_def_hgr : ICE_ADV1D configuration bassin'
73      IF(lwp) WRITE(numout,*)
74      IF(lwp) WRITE(numout,*) '          f-plane with regular grid-spacing rn_dx, rn_dy'
75
76      !                          ==========
77      zlam0 = -REAL( (Ni0glo-2)/2, wp) * 1.e-3 * rn_dx
78      zphi0 = -REAL( (Nj0glo-2)/2, wp) * 1.e-3 * rn_dy
79
80      DO_2D( 1, 1, 1, 1 )
81         zti = REAL( mig0_oldcmp(ji) - 1, wp )   ! start at i=0 in the global grid without halos
82         ztj = REAL( mjg0_oldcmp(jj) - 1, wp )   ! start at j=0 in the global grid without halos
83         
84         plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 *   zti
85         plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * ( zti + 0.5_wp )
86         plamv(ji,jj) = plamt(ji,jj) 
87         plamf(ji,jj) = plamu(ji,jj) 
88         
89         pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 *   ztj
90         pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * ( ztj + 0.5_wp )
91         pphiu(ji,jj) = pphit(ji,jj) 
92         pphif(ji,jj) = pphiv(ji,jj) 
93      END_2D
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.