1 | MODULE usrdef_hgr |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE usrdef_hgr *** |
---|
4 | !! |
---|
5 | !! === VORTEX configuration === |
---|
6 | !! |
---|
7 | !! User defined : mesh and Coriolis parameter of a user configuration |
---|
8 | !!====================================================================== |
---|
9 | !! History : NEMO ! 2017-11 (J. Chanut) Original code |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !! usr_def_hgr : initialize the horizontal mesh for VORTEX 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, rn_ppgphi0 ! horizontal resolution in meters |
---|
19 | ! 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$ |
---|
33 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
34 | !!---------------------------------------------------------------------- |
---|
35 | CONTAINS |
---|
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 | !! VORTEX configuration : beta-plance with uniform grid spacing (rn_dx) |
---|
50 | !! |
---|
51 | !! ** Action : - define longitude & latitude of t-, u-, v- and f-points (in degrees) |
---|
52 | !! - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane) |
---|
53 | !! - define i- & j-scale factors at t-, u-, v- and f-points (in meters) |
---|
54 | !! - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2) |
---|
55 | !!---------------------------------------------------------------------- |
---|
56 | REAL(wp), DIMENSION(:,:), INTENT(out) :: plamt, plamu, plamv, plamf ! longitude outputs [degrees] |
---|
57 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pphit, pphiu, pphiv, pphif ! latitude outputs [degrees] |
---|
58 | INTEGER , INTENT(out) :: kff ! =1 Coriolis parameter computed here, =0 otherwise |
---|
59 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pff_f, pff_t ! Coriolis factor at f-point [1/s] |
---|
60 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1t, pe1u, pe1v, pe1f ! i-scale factors [m] |
---|
61 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe2t, pe2u, pe2v, pe2f ! j-scale factors [m] |
---|
62 | INTEGER , INTENT(out) :: ke1e2u_v ! =1 u- & v-surfaces computed here, =0 otherwise |
---|
63 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1e2u, pe1e2v ! u- & v-surfaces (if reduction in strait) [m2] |
---|
64 | ! |
---|
65 | INTEGER :: ji, jj ! dummy loop indices |
---|
66 | REAL(wp) :: zphi0, zlam0, zbeta, zf0 |
---|
67 | REAL(wp) :: zti, ztj ! local scalars |
---|
68 | !!------------------------------------------------------------------------------- |
---|
69 | ! |
---|
70 | IF(lwp) WRITE(numout,*) |
---|
71 | IF(lwp) WRITE(numout,*) 'usr_def_hgr : VORTEX configuration bassin' |
---|
72 | IF(lwp) WRITE(numout,*) |
---|
73 | IF(lwp) WRITE(numout,*) ' Beta-plane with regular grid-spacing' |
---|
74 | IF(lwp) WRITE(numout,*) ' given by rn_dx and rn_dy' |
---|
75 | ! |
---|
76 | ! |
---|
77 | ! Position coordinates (in kilometers) |
---|
78 | ! ========== |
---|
79 | #if defined key_agrif |
---|
80 | IF( Agrif_Root() ) THEN |
---|
81 | #endif |
---|
82 | ! Compatibility WITH old version: |
---|
83 | ! jperio = 0 => Ni0glo = jpigo_old_version |
---|
84 | ! => jpiglo-1 replaced by Ni0glo-1 |
---|
85 | zlam0 = -REAL( (Ni0glo-1)/2, wp) * 1.e-3 * rn_dx |
---|
86 | zphi0 = -REAL( (Nj0glo-1)/2, wp) * 1.e-3 * rn_dy |
---|
87 | #if defined key_agrif |
---|
88 | ELSE |
---|
89 | ! ! let lower left longitude and latitude from parent |
---|
90 | ! Compatibility WITH old version: |
---|
91 | ! jperio = 0 => Ni0glo = jpigo_old_version |
---|
92 | ! => Agrif_parent(jpiglo)-1 replaced by Agrif_parent(Ni0glo)-1 |
---|
93 | zlam0 = ( 0.5_wp - REAL( ( Agrif_parent(Ni0glo)-1 ) / 2, wp) ) * 1.e-3 * Agrif_irhox() * rn_dx & |
---|
94 | & + ( Agrif_Ix() + nbghostcells - 1 ) * Agrif_irhox() * rn_dx * 1.e-3 - ( 0.5_wp + nbghostcells ) * rn_dx * 1.e-3 |
---|
95 | zphi0 = ( 0.5_wp - REAL( ( Agrif_parent(Nj0glo)-1 ) / 2, wp) ) * 1.e-3 * Agrif_irhoy() * rn_dy & |
---|
96 | & + ( Agrif_Iy() + nbghostcells - 1 ) * Agrif_irhoy() * rn_dy * 1.e-3 - ( 0.5_wp + nbghostcells ) * rn_dy * 1.e-3 |
---|
97 | ENDIF |
---|
98 | #endif |
---|
99 | |
---|
100 | DO_2D( 1, 1, 1, 1 ) |
---|
101 | zti = REAL( mig0_oldcmp(ji) - 1, wp ) ! start at i=0 in the global grid without halos |
---|
102 | ztj = REAL( mjg0_oldcmp(jj) - 1, wp ) ! start at j=0 in the global grid without halos |
---|
103 | |
---|
104 | plamt(ji,jj) = zlam0 + rn_dx * 1.e-3 * zti |
---|
105 | plamu(ji,jj) = zlam0 + rn_dx * 1.e-3 * ( zti + 0.5_wp ) |
---|
106 | plamv(ji,jj) = plamt(ji,jj) |
---|
107 | plamf(ji,jj) = plamu(ji,jj) |
---|
108 | |
---|
109 | pphit(ji,jj) = zphi0 + rn_dy * 1.e-3 * ztj |
---|
110 | pphiv(ji,jj) = zphi0 + rn_dy * 1.e-3 * ( ztj + 0.5_wp ) |
---|
111 | pphiu(ji,jj) = pphit(ji,jj) |
---|
112 | pphif(ji,jj) = pphiv(ji,jj) |
---|
113 | END_2D |
---|
114 | ! |
---|
115 | ! Horizontal scale factors (in meters) |
---|
116 | ! ====== |
---|
117 | pe1t(:,:) = rn_dx ; pe2t(:,:) = rn_dy |
---|
118 | pe1u(:,:) = rn_dx ; pe2u(:,:) = rn_dy |
---|
119 | pe1v(:,:) = rn_dx ; pe2v(:,:) = rn_dy |
---|
120 | pe1f(:,:) = rn_dx ; pe2f(:,:) = rn_dy |
---|
121 | |
---|
122 | ! ! NO reduction of grid size in some straits |
---|
123 | ke1e2u_v = 0 ! ==>> u_ & v_surfaces will be computed in dom_hgr routine |
---|
124 | pe1e2u(:,:) = 0._wp ! CAUTION: set to zero to avoid error with some compilers that |
---|
125 | pe1e2v(:,:) = 0._wp ! require an initialization of INTENT(out) arguments |
---|
126 | ! |
---|
127 | ! |
---|
128 | ! !== Coriolis parameter ==! |
---|
129 | kff = 1 ! indicate not to compute Coriolis parameter afterward |
---|
130 | ! |
---|
131 | zbeta = 2._wp * omega * COS( rad * rn_ppgphi0 ) / ra |
---|
132 | zf0 = 2._wp * omega * SIN( rad * rn_ppgphi0 ) |
---|
133 | pff_f(:,:) = zf0 + zbeta * pphif(:,:) * 1.e+3 |
---|
134 | pff_t(:,:) = zf0 + zbeta * pphit(:,:) * 1.e+3 |
---|
135 | ! |
---|
136 | END SUBROUTINE usr_def_hgr |
---|
137 | |
---|
138 | !!====================================================================== |
---|
139 | END MODULE usrdef_hgr |
---|