#include "PACKAGES_CONFIG.h" #include "CPP_OPTIONS.h" MODULE GRID_mod #include "SIZE.h" #include "EEPARAMS_P.h" #include "PARAMS_P.h" TYPE GRID_t SEQUENCE ! $Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/PRM/multi_comp_setup/fg/build/Attic/GRID_mod.F90,v 1.2 2008/04/25 18:46:56 jmc dead $ ! $Name: $ ! !BOP ! !ROUTINE: GRID.h ! !INTERFACE: ! include GRID.h ! !DESCRIPTION: \bv ! *==========================================================* ! | GRID.h ! | o Header file defining model grid. ! *==========================================================* ! | Model grid is defined for each process by reference to ! | the arrays set here. ! | Notes ! | ===== ! | The standard MITgcm convention of westmost, southern most ! | and upper most having the (1,1,1) index is used here. ! | i.e. ! |---------------------------------------------------------- ! | (1) Plan view schematic of model grid (top layer i.e. ) ! | ================================= ( ocean surface ) ! | ( or top of ) ! | ( atmosphere ) ! | This diagram shows the location of the model ! | prognostic variables on the model grid. The "T" ! | location is used for all tracers. The figure also ! | shows the southern most, western most indexing ! | convention that is used for all model variables. ! | ! | ! | V(i=1, V(i=Nx, ! | j=Ny+1, j=Ny+1, ! | k=1) k=1) ! | /|\ /|\ "PWX" ! | |---------|------------------etc.. |---- *--- ! | | | * | ! |"PWY"*******************************etc.. **********"PWY" ! | | | * | ! | | | * | ! | | | * | ! |U(i=1, ==> x | x *==>U ! | j=Ny,| T(i=1, | T(i=Nx, *(i=Nx+1, ! | k=1) | j=Ny, | j=Ny, * |j=Ny, ! | | k=1) | k=1) * |k=1) ! | ! | . . . ! | . . . ! | . . . ! | e e * e ! | t t * t ! | c c * c ! | | | * | ! | | | * | ! |U(i=1, ==> x | x * | ! | j=2, | T(i=1, | T(i=Nx, * | ! | k=1) | j=2, | j=2, * | ! | | k=1) | k=1) * | ! | | | * | ! | | /|\ | /|\ * | ! | -----------|------------------etc.. |-----*--- ! | | V(i=1, | V(i=Nx, * | ! | | j=2, | j=2, * | ! | | k=1) | k=1) * | ! | | | * | ! |U(i=1, ==> x ==>U(i=2, x *==>U ! | j=1, | T(i=1, | j=1, T(i=Nx, *(i=Nx+1, ! | k=1) | j=1, | k=1) j=1, * |j=1, ! | | k=1) | k=1) * |k=1) ! | | | * | ! | | /|\ | /|\ * | ! |"SB"++>|---------|------------------etc.. |-----*--- ! | /+\ V(i=1, V(i=Nx, * ! | + j=1, j=1, * ! | + k=1) k=1) * ! | "WB" "PWX" ! | ! | N, y increasing northwards ! | /|\ j increasing northwards ! | | ! | | ! | ======>E, x increasing eastwards ! | i increasing eastwards ! | ! | i: East-west index ! | j: North-south index ! | k: up-down index ! | U: x-velocity (m/s) ! | V: y-velocity (m/s) ! | T: potential temperature (oC) ! | "SB": Southern boundary ! | "WB": Western boundary ! |"PWX": Periodic wrap around in X. ! |"PWY": Periodic wrap around in Y. ! |---------------------------------------------------------- ! | (2) South elevation schematic of model grid ! | ======================================= ! | This diagram shows the location of the model ! | prognostic variables on the model grid. The "T" ! | location is used for all tracers. The figure also ! | shows the upper most, western most indexing ! | convention that is used for all model variables. ! | ! | "WB" ! | + ! | + ! | \+/ /|\ /|\ . ! |"UB"++>|-------- | -----------------etc.. | ----*--- ! | | rVel(i=1, | rVel(i=Nx, * | ! | | j=1, | j=1, * | ! | | k=1) | k=1) * | ! | | | * | ! |U(i=1, ==> x ==>U(i=2, x *==>U ! | j=1, | T(i=1, | j=1, T(i=Nx, *(i=Nx+1, ! | k=1) | j=1, | k=1) j=1, * |j=1, ! | | k=1) | k=1) * |k=1) ! | | | * | ! | | /|\ | /|\ * | ! | |-------- | -----------------etc.. | ----*--- ! | | rVel(i=1, | rVel(i=Nx, * | ! | | j=1, | j=1, * | ! | | k=2) | k=2) * | ! | ! | . . . ! | . . . ! | . . . ! | e e * e ! | t t * t ! | c c * c ! | | | * | ! | | | * | ! | | | * | ! | | | * | ! | | /|\ | /|\ * | ! | |-------- | -----------------etc.. | ----*--- ! | | rVel(i=1, | rVel(i=Nx, * | ! | | j=1, | j=1, * | ! | | k=Nr) | k=Nr) * | ! |U(i=1, ==> x ==>U(i=2, x *==>U ! | j=1, | T(i=1, | j=1, T(i=Nx, *(i=Nx+1, ! | k=Nr)| j=1, | k=Nr) j=1, * |j=1, ! | | k=Nr) | k=Nr) * |k=Nr) ! | | | * | ! |"LB"++>============================================== ! | "PWX" ! | ! | Up increasing upwards. ! |/|\ . ! | | ! | | ! | =====> E i increasing eastwards ! | | x increasing eastwards ! | | ! |\|/ ! | Down,k increasing downwards. ! | ! | Note: r => height (m) => r increases upwards ! | r => pressure (Pa) => r increases downwards ! | ! | ! | i: East-west index ! | j: North-south index ! | k: up-down index ! | U: x-velocity (m/s) ! | rVel: z-velocity ( units of r ) ! | The vertical velocity variable rVel is in units of ! | "r" the vertical coordinate. r in m will give ! | rVel m/s. r in Pa will give rVel Pa/s. ! | T: potential temperature (oC) ! | "UB": Upper boundary. ! | "LB": Lower boundary (always solid - therefore om|w == 0) ! | "WB": Western boundary ! |"PWX": Periodic wrap around in X. ! |---------------------------------------------------------- ! | (3) Views showing nomenclature and indexing ! | for grid descriptor variables. ! | ! | Fig 3a. shows the orientation, indexing and ! | notation for the grid spacing terms used internally ! | for the evaluation of gradient and averaging terms. ! | These varaibles are set based on the model input ! | parameters which define the model grid in terms of ! | spacing in X, Y and Z. ! | ! | Fig 3b. shows the orientation, indexing and ! | notation for the variables that are used to define ! | the model grid. These varaibles are set directly ! | from the model input. ! | ! | Figure 3a ! | ========= ! | |------------------------------------ ! | | | ! |"PWY"********************************* etc... ! | | | ! | | | ! | | | ! | | | ! | | | ! | | | ! | | | ! | ! | . . ! | . . ! | . . ! | e e ! | t t ! | c c ! | |-----------v-----------|-----------v----------|- ! | | | | ! | | | | ! | | | | ! | | | | ! | | | | ! | u<--dxF(i=1,j=2,k=1)--->u t | ! | |/|\ /|\ | | ! | | | | | | ! | | | | | | ! | | | | | | ! | |dyU(i=1, dyC(i=1, | | ! | --- ---|--j=2,---|--j=2,-----------------v----------|- ! | /|\ | | k=1) | k=1) | /|\ | ! | | | | | | dyF(i=2, | ! | | | | | | | j=1, | ! |dyG( |\|/ \|/ | | k=1) | ! | i=1,u--- t<---dxC(i=2,j=1,k=1)-->t | ! | j=1,| | | | ! | k=1)| | | | ! | | | | | | ! | | | | | | ! | \|/ | |<---dxV(i=2,j=1,k=1)--\|/ | ! |"SB"++>|___________v___________|___________v__________|_ ! | <--dxG(i=1,j=1,k=1)-----> ! | /+\ . ! | + ! | + ! | "WB" ! | ! | N, y increasing northwards ! | /|\ j increasing northwards ! | | ! | | ! | ======>E, x increasing eastwards ! | i increasing eastwards ! | ! | i: East-west index ! | j: North-south index ! | k: up-down index ! | u: x-velocity point ! | V: y-velocity point ! | t: tracer point ! | "SB": Southern boundary ! | "WB": Western boundary ! |"PWX": Periodic wrap around in X. ! |"PWY": Periodic wrap around in Y. ! | ! | Figure 3b ! | ========= ! | ! | . . ! | . . ! | . . ! | e e ! | t t ! | c c ! | |-----------v-----------|-----------v--etc... ! | | | ! | | | ! | | | ! | | | ! | | | ! | u<--delX(i=1)---------->u t ! | | | ! | | | ! | | | ! | | | ! | | | ! | |-----------v-----------------------v--etc... ! | | /|\ | ! | | | | ! | | | | ! | | | | ! | u delY(j=1) | t ! | | | | ! | | | | ! | | | | ! | | | | ! | | \|/ | ! |"SB"++>|___________v___________|___________v__etc... ! | /+\ . ! | + ! | + ! | "WB" ! | ! *==========================================================* ! \ev !EOP ! Macros that override/modify standard definitions #include "GRID_MACROS.h" ! !-- COMMON /GRID_R/ REAL valued grid defining variables. ! dxC - Cell center separation in X across western cell wall (m) ! dxG - Cell face separation in X along southern cell wall (m) ! dxF - Cell face separation in X thru cell center (m) ! dxV - V-point separation in X across south-west corner of cell (m) ! dyC - Cell center separation in Y across southern cell wall (m) ! dyG - Cell face separation in Y along western cell wall (m) ! dyF - Cell face separation in Y thru cell center (m) ! dyU - U-point separation in Y across south-west corner of cell (m) ! drC - Cell center separation along Z axis ( units of r ). ! drF - Cell face separation along Z axis ( units of r ). ! Rcolumn -Total thickness (in r_unit) of the fluid column ! R_low - base of fluid in r_unit (Depth(m) / Pressure(Pa) at top Atmos.) ! Ro_surf- surface reference (at rest) position, r_unit. ! klowC - index of the lowest "wet cell" (2D) ! hFac - Fraction of cell in vertical which is open i.e how ! "lopped" a cell is (dimensionless scale factor). ! Note: The code needs terms like MIN(hFac,hFac(I+1)) ! On some platforms it may be better to precompute ! hFacW, hFacE, ... here than do MIN on the fly. ! gravitySign - indicates the direction of gravity relative to R direction ! (= -1 for R=Z (Z increases upward, -gravity direction ) ! (= +1 for R=P (P increases downward, +gravity direction) ! rkSign - Vertical coordinate to vertical index orientation. ! ( +1 same orientation, -1 opposite orientation ) ! globalArea :: Domain Integrated horizontal Area [m2] ! maskH - cell Center full-column mask (= 2D mask) ! maskC - cell Center land mask ! maskW - West face land mask ! maskS - South face land mask ! recip_dxC - Recipricol of dxC ! recip_dxG - Recipricol of dxG ! recip_dxF - Recipricol of dxF ! recip_dxV - Recipricol of dxV ! recip_dyC - Recipricol of dxC ! recip_dyG - Recipricol of dyG ! recip_dyF - Recipricol of dyF ! recip_dyU - Recipricol of dyU ! recip_drC - Recipricol of drC ! recip_drF - Recipricol of drF ! recip_Rcol - Inverse of cell center column thickness (1/r_unit) ! recip_hFacC - Inverse of cell open-depth f[X,Y,Z] ( dimensionless ). ! recip_hFacW rhFacC center, rhFacW west, rhFacS south. ! recip_hFacS Note: This is precomputed here because it involves division. ! saFac - Shallow atmosphere factor (dimensionless scale factor). ! xC - X-coordinate of center of cell f[X,Y]. The units of xc, yc ! depend on the grid. They are not used in differencing or ! averaging but are just a convient quantity for I/O, ! diagnostics etc.. As such xc is in m for cartesian ! coordinates but degrees for spherical polar. ! yC - Y-coordinate of center of cell f[X,Y]. ! yG - Y-coordinate of corner of cell ( c-grid vorticity point) f[X,Y]. ! xC0, yC0 - West edge x coord ( metres or degrees ) ! South edge y coord ( metres or degrees ) ! rA - R-face are f[X,Y] ( m^2 ). ! Note: In a cartesian framework zA is simply dx*dy, ! however we use zA to allow for non-globally ! orthogonal coordinate frames (with appropriate ! metric terms). ! rC - R-coordinate of center of cell f[Z] (units of r). ! rF - R-coordinate of face of cell f[Z] (units of r). ! tanPhiAtU - tan of the latitude at U point. Used for spherical polar ! metric term in U equation. ! tanPhiAtV - tan of the latitude at V point. Used for spherical polar ! metric term in V equation. ! angleCosC :: cosine of grid orientation angle relative to Geographic direction ! at cell center: alpha=(Eastward_dir,grid_uVel_dir)=(North_d,vVel_d) ! angleSinC :: sinus of grid orientation angle relative to Geographic direction ! at cell center: alpha=(Eastward_dir,grid_uVel_dir)=(North_d,vVel_d) ! fCori :: Coriolis parameter at grid Center point ! fCoriG :: Coriolis parameter at grid Corner point ! fCoriCos :: Coriolis Cos(phi) parameter at grid Center point (for NH) INTEGER klowC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RL cosfacU(1-Oly:sNy+Oly,nSx,nSy) _RL cosfacV(1-Oly:sNy+Oly,nSx,nSy) _RL sqcosfacU(1-Oly:sNy+Oly,nSx,nSy) _RL sqcosfacV(1-Oly:sNy+Oly,nSx,nSy) _RL gravitySign _RL rkSign _RL globalArea _RS dxC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS dxF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS dxG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS dxV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS dyC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS dyF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS dyG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS dyU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS R_low (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS Ro_surf (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS hFacC (1-OLx:sN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,1-OLy:sNy+OLy,nSx,nSy) _RS recip_rA (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS recip_rAw (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS recip_rAs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS recip_rAz (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS maskH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) _RS maskW (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) _RS maskS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) _RS tanPhiAtU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS tanPhiAtV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS angleCosC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS angleSinC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS drC (1:Nr) _RS drF (1:Nr) _RS recip_drC (1:Nr) _RS recip_drF (1:Nr) _RS saFac (1:Nr) _RS rC (1:Nr) _RS rF (1:Nr+1) _RS xC0 _RS yC0 _RS fCori(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS fCoriG(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RS fCoriCos(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) #ifdef ALLOW_NONHYDROSTATIC _RS recip_hFacU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) #endif END TYPE GRID_t END MODULE GRID_mod