[8703] | 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 | |
---|
[14976] | 26 | REAL(wp) :: roffsetx, roffsety ! Offset in km to first f-point |
---|
| 27 | |
---|
[8703] | 28 | PUBLIC usr_def_hgr ! called by domhgr.F90 |
---|
| 29 | |
---|
[12740] | 30 | !! * Substitutions |
---|
| 31 | # include "do_loop_substitute.h90" |
---|
[8703] | 32 | !!---------------------------------------------------------------------- |
---|
[10073] | 33 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[8703] | 34 | !! $Id$ |
---|
[10073] | 35 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[8703] | 36 | !!---------------------------------------------------------------------- |
---|
| 37 | CONTAINS |
---|
| 38 | |
---|
| 39 | SUBROUTINE usr_def_hgr( plamt , plamu , plamv , plamf , & ! geographic position (required) |
---|
| 40 | & pphit , pphiu , pphiv , pphif , & ! |
---|
| 41 | & kff , pff_f , pff_t , & ! Coriolis parameter (if domain not on the sphere) |
---|
| 42 | & pe1t , pe1u , pe1v , pe1f , & ! scale factors (required) |
---|
| 43 | & pe2t , pe2u , pe2v , pe2f , & ! |
---|
| 44 | & ke1e2u_v , pe1e2u , pe1e2v ) ! u- & v-surfaces (if gridsize reduction is used in strait(s)) |
---|
| 45 | !!---------------------------------------------------------------------- |
---|
| 46 | !! *** ROUTINE usr_def_hgr *** |
---|
| 47 | !! |
---|
| 48 | !! ** Purpose : user defined mesh and Coriolis parameter |
---|
| 49 | !! |
---|
| 50 | !! ** Method : set all intent(out) argument to a proper value |
---|
| 51 | !! VORTEX configuration : beta-plance with uniform grid spacing (rn_dx) |
---|
| 52 | !! |
---|
| 53 | !! ** Action : - define longitude & latitude of t-, u-, v- and f-points (in degrees) |
---|
| 54 | !! - define coriolis parameter at f-point if the domain in not on the sphere (on beta-plane) |
---|
| 55 | !! - define i- & j-scale factors at t-, u-, v- and f-points (in meters) |
---|
| 56 | !! - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2) |
---|
| 57 | !!---------------------------------------------------------------------- |
---|
| 58 | REAL(wp), DIMENSION(:,:), INTENT(out) :: plamt, plamu, plamv, plamf ! longitude outputs [degrees] |
---|
| 59 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pphit, pphiu, pphiv, pphif ! latitude outputs [degrees] |
---|
| 60 | INTEGER , INTENT(out) :: kff ! =1 Coriolis parameter computed here, =0 otherwise |
---|
| 61 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pff_f, pff_t ! Coriolis factor at f-point [1/s] |
---|
| 62 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1t, pe1u, pe1v, pe1f ! i-scale factors [m] |
---|
| 63 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe2t, pe2u, pe2v, pe2f ! j-scale factors [m] |
---|
| 64 | INTEGER , INTENT(out) :: ke1e2u_v ! =1 u- & v-surfaces computed here, =0 otherwise |
---|
| 65 | REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1e2u, pe1e2v ! u- & v-surfaces (if reduction in strait) [m2] |
---|
| 66 | ! |
---|
[13286] | 67 | INTEGER :: ji, jj ! dummy loop indices |
---|
[14976] | 68 | REAL(wp) :: zbeta, zf0 |
---|
[13286] | 69 | REAL(wp) :: zti, ztj ! local scalars |
---|
[8703] | 70 | !!------------------------------------------------------------------------------- |
---|
| 71 | ! |
---|
| 72 | IF(lwp) WRITE(numout,*) |
---|
| 73 | IF(lwp) WRITE(numout,*) 'usr_def_hgr : VORTEX configuration bassin' |
---|
| 74 | IF(lwp) WRITE(numout,*) |
---|
| 75 | IF(lwp) WRITE(numout,*) ' Beta-plane with regular grid-spacing' |
---|
| 76 | IF(lwp) WRITE(numout,*) ' given by rn_dx and rn_dy' |
---|
| 77 | ! |
---|
| 78 | ! |
---|
| 79 | ! Position coordinates (in kilometers) |
---|
| 80 | ! ========== |
---|
[14976] | 81 | ! offset is given at first f-point, i.e. at (i,j) = (nn_hls+1, nn_hls+1) |
---|
| 82 | ! Here we assume the grid is centred around a T-point at the middle of |
---|
| 83 | ! of the domain (hence domain size is odd) |
---|
| 84 | roffsetx = (-REAL(Ni0glo-1, wp) + 1._wp) * 0.5 * 1.e-3 * rn_dx |
---|
| 85 | roffsety = (-REAL(Nj0glo-1, wp) + 1._wp) * 0.5 * 1.e-3 * rn_dy |
---|
[8703] | 86 | #if defined key_agrif |
---|
[14976] | 87 | IF( .NOT.Agrif_Root() ) THEN |
---|
| 88 | ! deduce offset from parent: |
---|
| 89 | roffsetx = Agrif_Parent(roffsetx) & |
---|
[15119] | 90 | & + (-(nbghostcells_x_w - 1) + (Agrif_Parent(nbghostcells_x_w) + Agrif_Ix()-2)*Agrif_Rhox()) * 1.e-3 * rn_dx |
---|
[14976] | 91 | roffsety = Agrif_Parent(roffsety) & |
---|
| 92 | & + (-(nbghostcells_y_s - 1) + (Agrif_Parent(nbghostcells_y_s) + Agrif_Iy()-2)*Agrif_Rhoy()) * 1.e-3 * rn_dy |
---|
| 93 | ENDIF |
---|
| 94 | #endif |
---|
[14223] | 95 | DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) |
---|
[14976] | 96 | zti = REAL( mig0(ji)-1, wp ) ! start at i=0 in the global grid without halos |
---|
| 97 | ztj = REAL( mjg0(jj)-1, wp ) ! start at j=0 in the global grid without halos |
---|
[12740] | 98 | |
---|
[14976] | 99 | plamt(ji,jj) = roffsetx + rn_dx * 1.e-3 * ( zti - 0.5_wp ) |
---|
| 100 | plamu(ji,jj) = roffsetx + rn_dx * 1.e-3 * zti |
---|
[12740] | 101 | plamv(ji,jj) = plamt(ji,jj) |
---|
| 102 | plamf(ji,jj) = plamu(ji,jj) |
---|
| 103 | |
---|
[14976] | 104 | pphit(ji,jj) = roffsety + rn_dy * 1.e-3 * ( ztj - 0.5_wp ) |
---|
| 105 | pphiv(ji,jj) = roffsety + rn_dy * 1.e-3 * ztj |
---|
[12740] | 106 | pphiu(ji,jj) = pphit(ji,jj) |
---|
| 107 | pphif(ji,jj) = pphiv(ji,jj) |
---|
| 108 | END_2D |
---|
[8703] | 109 | ! |
---|
| 110 | ! Horizontal scale factors (in meters) |
---|
| 111 | ! ====== |
---|
| 112 | pe1t(:,:) = rn_dx ; pe2t(:,:) = rn_dy |
---|
| 113 | pe1u(:,:) = rn_dx ; pe2u(:,:) = rn_dy |
---|
| 114 | pe1v(:,:) = rn_dx ; pe2v(:,:) = rn_dy |
---|
| 115 | pe1f(:,:) = rn_dx ; pe2f(:,:) = rn_dy |
---|
| 116 | |
---|
| 117 | ! ! NO reduction of grid size in some straits |
---|
| 118 | ke1e2u_v = 0 ! ==>> u_ & v_surfaces will be computed in dom_hgr routine |
---|
| 119 | pe1e2u(:,:) = 0._wp ! CAUTION: set to zero to avoid error with some compilers that |
---|
| 120 | pe1e2v(:,:) = 0._wp ! require an initialization of INTENT(out) arguments |
---|
| 121 | ! |
---|
| 122 | ! |
---|
| 123 | ! !== Coriolis parameter ==! |
---|
| 124 | kff = 1 ! indicate not to compute Coriolis parameter afterward |
---|
| 125 | ! |
---|
| 126 | zbeta = 2._wp * omega * COS( rad * rn_ppgphi0 ) / ra |
---|
| 127 | zf0 = 2._wp * omega * SIN( rad * rn_ppgphi0 ) |
---|
| 128 | pff_f(:,:) = zf0 + zbeta * pphif(:,:) * 1.e+3 |
---|
| 129 | pff_t(:,:) = zf0 + zbeta * pphit(:,:) * 1.e+3 |
---|
| 130 | ! |
---|
[9124] | 131 | END SUBROUTINE usr_def_hgr |
---|
[8703] | 132 | |
---|
| 133 | !!====================================================================== |
---|
| 134 | END MODULE usrdef_hgr |
---|