[6717] | 1 | MODULE usrdef_hgr |
---|
[6923] | 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE usrdef_hgr *** |
---|
| 4 | !! |
---|
| 5 | !! === GYRE configuration === |
---|
| 6 | !! |
---|
| 7 | !! User defined : mesh and Coriolis parameter of a user configuration |
---|
| 8 | !!====================================================================== |
---|
[7753] | 9 | !! History : 4.0 ! 2016-03 (S. Flavoni) |
---|
[6717] | 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 | USE timing ! Timing |
---|
| 23 | |
---|
| 24 | IMPLICIT NONE |
---|
| 25 | PRIVATE |
---|
| 26 | |
---|
[6923] | 27 | PUBLIC usr_def_hgr ! called in domhgr.F90 |
---|
[6717] | 28 | |
---|
| 29 | !!---------------------------------------------------------------------- |
---|
| 30 | !! NEMO/OPA 4.0 , NEMO Consortium (2016) |
---|
[12286] | 31 | !! $Id$ |
---|
[6717] | 32 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 33 | !!---------------------------------------------------------------------- |
---|
| 34 | CONTAINS |
---|
| 35 | |
---|
| 36 | SUBROUTINE usr_def_hgr( plamt , plamu , plamv , plamf , & ! geographic position (required) |
---|
| 37 | & pphit , pphiu , pphiv , pphif , & ! |
---|
| 38 | & kff , pff_f , pff_t , & ! Coriolis parameter (if domain not on the sphere) |
---|
| 39 | & pe1t , pe1u , pe1v , pe1f , & ! scale factors (required) |
---|
| 40 | & pe2t , pe2u , pe2v , pe2f , & ! |
---|
| 41 | & ke1e2u_v , pe1e2u , pe1e2v ) ! u- & v-surfaces (if gridsize reduction is used in strait(s)) |
---|
| 42 | !!---------------------------------------------------------------------- |
---|
| 43 | !! *** ROUTINE usr_def_hgr *** |
---|
| 44 | !! |
---|
| 45 | !! ** Purpose : user defined mesh and Coriolis parameter |
---|
| 46 | !! |
---|
| 47 | !! ** Method : set all intent(out) argument to a proper value |
---|
| 48 | !! |
---|
| 49 | !! Here GYRE configuration : |
---|
| 50 | !! Rectangular mid-latitude domain |
---|
| 51 | !! - with axes rotated by 45 degrees |
---|
| 52 | !! - a constant horizontal resolution of 106 km |
---|
| 53 | !! - on a beta-plane |
---|
| 54 | !! |
---|
| 55 | !! ** Action : - define longitude & latitude of t-, u-, v- and f-points (in degrees) |
---|
| 56 | !! - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane) |
---|
| 57 | !! - define i- & j-scale factors at t-, u-, v- and f-points (in meters) |
---|
| 58 | !! - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2) |
---|
| 59 | !!---------------------------------------------------------------------- |
---|
| 60 | REAL(wp), DIMENSION(:,:), INTENT(out) :: plamt, plamu, plamv, plamf ! longitude outputs [degrees] |
---|
| 61 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pphit, pphiu, pphiv, pphif ! latitude outputs [degrees] |
---|
| 62 | INTEGER , INTENT(out) :: kff ! =1 Coriolis parameter computed here, =0 otherwise |
---|
| 63 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pff_f, pff_t ! Coriolis factor at f-point [1/s] |
---|
| 64 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1t, pe1u, pe1v, pe1f ! i-scale factors [m] |
---|
| 65 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe2t, pe2u, pe2v, pe2f ! j-scale factors [m] |
---|
| 66 | INTEGER , INTENT(out) :: ke1e2u_v ! =1 u- & v-surfaces computed here, =0 otherwise |
---|
| 67 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1e2u, pe1e2v ! u- & v-surfaces (if reduction in strait) [m2] |
---|
| 68 | ! |
---|
| 69 | INTEGER :: ji, jj ! dummy loop indices |
---|
| 70 | REAL(wp) :: zlam1, zlam0, zcos_alpha, zim1 , zjm1 , ze1 , ze1deg, zf0 ! local scalars |
---|
| 71 | REAL(wp) :: zphi1, zphi0, zsin_alpha, zim05, zjm05, zbeta, znorme ! - - |
---|
| 72 | !!------------------------------------------------------------------------------- |
---|
| 73 | ! |
---|
| 74 | IF( nn_timing == 1 ) CALL timing_start('usr_def_hgr') |
---|
| 75 | ! |
---|
| 76 | ! !== beta-plane with regular grid-spacing and rotated domain ==! (GYRE configuration) |
---|
| 77 | ! |
---|
| 78 | IF(lwp) WRITE(numout,*) |
---|
| 79 | IF(lwp) WRITE(numout,*) 'usr_def_hgr : GYRE configuration (beta-plane with rotated regular grid-spacing)' |
---|
| 80 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 81 | ! |
---|
| 82 | ! |
---|
| 83 | ! !== grid point position ==! |
---|
| 84 | ! |
---|
| 85 | zlam1 = -85._wp ! position of gridpoint (i,j) = (1,jpjglo) |
---|
| 86 | zphi1 = 29._wp |
---|
| 87 | ! |
---|
| 88 | ze1 = 106000._wp / REAL( nn_GYRE , wp ) ! gridspacing in meters |
---|
| 89 | ! |
---|
| 90 | zsin_alpha = - SQRT( 2._wp ) * 0.5_wp ! angle: 45 degrees |
---|
| 91 | zcos_alpha = SQRT( 2._wp ) * 0.5_wp |
---|
| 92 | ze1deg = ze1 / (ra * rad) |
---|
| 93 | zlam0 = zlam1 + zcos_alpha * ze1deg * REAL( jpjglo-2 , wp ) |
---|
| 94 | zphi0 = zphi1 + zsin_alpha * ze1deg * REAL( jpjglo-2 , wp ) |
---|
| 95 | ! |
---|
| 96 | IF( ln_bench ) THEN ! benchmark: forced the resolution to be 106 km |
---|
| 97 | ze1 = 106000._wp ! but keep (lat,lon) at the right nn_GYRE resolution |
---|
| 98 | CALL ctl_warn( ' GYRE used as Benchmark: e1=e2=106km, no need to adjust rdt, ahm,aht ' ) |
---|
| 99 | ENDIF |
---|
| 100 | IF( nprint==1 .AND. lwp ) THEN |
---|
| 101 | WRITE(numout,*) 'ze1', ze1, 'cosalpha', zcos_alpha, 'sinalpha', zsin_alpha |
---|
| 102 | WRITE(numout,*) 'ze1deg', ze1deg, 'zlam0', zlam0, 'zphi0', zphi0 |
---|
| 103 | ENDIF |
---|
| 104 | ! |
---|
| 105 | DO jj = 1, jpj |
---|
| 106 | DO ji = 1, jpi |
---|
| 107 | zim1 = REAL( ji + nimpp - 1 ) - 1. ; zim05 = REAL( ji + nimpp - 1 ) - 1.5 |
---|
| 108 | zjm1 = REAL( jj + njmpp - 1 ) - 1. ; zjm05 = REAL( jj + njmpp - 1 ) - 1.5 |
---|
| 109 | ! |
---|
| 110 | !glamt(i,j) longitude at T-point |
---|
| 111 | !gphit(i,j) latitude at T-point |
---|
| 112 | plamt(ji,jj) = zlam0 + zim05 * ze1deg * zcos_alpha + zjm05 * ze1deg * zsin_alpha |
---|
| 113 | pphit(ji,jj) = zphi0 - zim05 * ze1deg * zsin_alpha + zjm05 * ze1deg * zcos_alpha |
---|
| 114 | ! |
---|
| 115 | !glamu(i,j) longitude at U-point |
---|
| 116 | !gphiu(i,j) latitude at U-point |
---|
| 117 | plamu(ji,jj) = zlam0 + zim1 * ze1deg * zcos_alpha + zjm05 * ze1deg * zsin_alpha |
---|
| 118 | pphiu(ji,jj) = zphi0 - zim1 * ze1deg * zsin_alpha + zjm05 * ze1deg * zcos_alpha |
---|
| 119 | ! |
---|
| 120 | !glamv(i,j) longitude at V-point |
---|
| 121 | !gphiv(i,j) latitude at V-point |
---|
| 122 | plamv(ji,jj) = zlam0 + zim05 * ze1deg * zcos_alpha + zjm1 * ze1deg * zsin_alpha |
---|
| 123 | pphiv(ji,jj) = zphi0 - zim05 * ze1deg * zsin_alpha + zjm1 * ze1deg * zcos_alpha |
---|
| 124 | ! |
---|
| 125 | !glamf(i,j) longitude at F-point |
---|
| 126 | !gphif(i,j) latitude at F-point |
---|
| 127 | plamf(ji,jj) = zlam0 + zim1 * ze1deg * zcos_alpha + zjm1 * ze1deg * zsin_alpha |
---|
| 128 | pphif(ji,jj) = zphi0 - zim1 * ze1deg * zsin_alpha + zjm1 * ze1deg * zcos_alpha |
---|
| 129 | END DO |
---|
| 130 | END DO |
---|
| 131 | ! |
---|
| 132 | ! !== Horizontal scale factors ==! (in meters) |
---|
| 133 | ! |
---|
| 134 | ! ! constant grid spacing |
---|
[7753] | 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 |
---|
[6717] | 141 | ke1e2u_v = 0 ! ==>> u_ & v_surfaces will be computed in dom_ghr routine |
---|
[7753] | 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 |
---|
[6717] | 144 | ! |
---|
| 145 | ! |
---|
| 146 | ! !== Coriolis parameter ==! |
---|
| 147 | kff = 1 ! indicate not to compute ff afterward |
---|
| 148 | ! |
---|
| 149 | zbeta = 2. * omega * COS( rad * zphi1 ) / ra ! beta at latitude zphi1 |
---|
| 150 | !SF we overwrite zphi0 (south point in latitude) used just above to define pphif (value of zphi0=15.5190567531966) |
---|
| 151 | !SF for computation of Coriolis we keep the parameter of Hazeleger, W., and S. S. Drijfhout, JPO 1998. |
---|
| 152 | zphi0 = 15._wp ! latitude of the most southern grid point |
---|
| 153 | zf0 = 2. * omega * SIN( rad * zphi0 ) ! compute f0 1st point south |
---|
| 154 | ! |
---|
[7753] | 155 | pff_f(:,:) = ( zf0 + zbeta * ABS( pphif(:,:) - zphi0 ) * rad * ra ) ! f = f0 +beta* y ( y=0 at south) |
---|
| 156 | pff_t(:,:) = ( zf0 + zbeta * ABS( pphit(:,:) - zphi0 ) * rad * ra ) ! f = f0 +beta* y ( y=0 at south) |
---|
[6717] | 157 | ! |
---|
| 158 | IF(lwp) WRITE(numout,*) ' beta-plane used. beta = ', zbeta, ' 1/(s.m)' |
---|
| 159 | ! |
---|
| 160 | IF( nn_timing == 1 ) CALL timing_stop('usr_def_hgr') |
---|
| 161 | ! |
---|
| 162 | END SUBROUTINE usr_def_hgr |
---|
| 163 | |
---|
| 164 | !!====================================================================== |
---|
| 165 | END MODULE usrdef_hgr |
---|