5.1.2  The Vertical Grid ( prep.F)


The file prep.F also sets up the vertical grid, shown in Fig. 5. The value of K0 specified in Diecast.h determines the number of cells in the vertical. There will be K1 = K0-1 grid cells in the vertical unless the model includes a bottom boundary layer (#define BBL). When a bottom boundary layer is included, it has a fixed thickness of HT_BBL and temperature, salinity, etc. for this layer are stored in the (I,J, K0) elements of the corresponding arrays. For the present discussion, we will assume that a bottom boundary layer is not included so further discussion of this topic will be given elsewhere.

The array Z stores both the K0 levels of the interfaces between the cells (including the top and bottom), and the K1 mid-depth levels of the cells. The element Z(1) = 0 is at the surface, Z(2) = ZTOP is at the mid-level of the top cell, and Z( K0+ K1) = HMAX is the deepest level in the model, i.e., at the bottom of cell K1. DZ(K), K = 1,..., K1 stores the thicknesses of the K1 cells in the vertical, with DZ(1) being the thickness of the top cell and DZ( K1) being the thickness of the deepest cell. ODZW(K) = 1./( Z(2*K) - Z(2*K-2)) stores the recriprocal of the distances between the mid-depths of cells K-1 and K and is used to calculate vertical gradients at the cell boundaries. For convenience, ODZW(1) (corresponding to the surface) is taken equal to ODZ(1) and ODZW(K0) (corresponding to the bottom) is taken equal to ODZ( K1), but these values are not normally used.

The user can set the depths explicitly by specifying Z. The user should specify the depths in cm of the interfaces between the layers, including top and bottom, which are the odd values Z( K), for K = 1,3,..., K0+ K1. The layer thicknesses should be increased gradually to avoid fictitious wave reflections at grid points. If this is done, be sure that the even values of the array are midpoints of the layers, i.e., that Z(2*K)=0.5*( Z(2*K+1)+ Z(2*K-1)), and then do not call the subroutine SETZW. However, for North Atlantic simulations, the present code sets the default Z-levels with a call to the subroutine SETZW, which receives the parameters K1, HMAX and ZTOP, and returns the vector Z. The subroutine SETZW sets Z(1) = 0, Z(2) = ZTOP and Z(2*K+1)- Z(2*K) = GX * ( Z(2*K)- Z(2*K-1)) for K = 1, ..., K1. Thus, GX is an expansion factor so that each level is thicker by the factor GX than the level above. Initially GX is set to 1.1 and an iterative procedure is used to determine the value of GX that results in Z( K0+ K1) = HMAX. After the vertical grid has been set up by SETZW, the even levels are reset to the mid-level depths of the corresponding cells ( Z(2*K) = 0.5* ( Z(2*K+1) + Z(2*K-1))). DZ and ODZW are then determined by simple differencing.

Note that the model does not use the actual depth array DEPTH(I,J) in the dynamical calculations of a simulation. The code in prep.F uses the values of the array DEPTH and the specified vertical levels Z( K01) to determine KB(I,J), the array that gives the number of water grid cells in the vertical from the surface to the bottom at each (I,J) grid point. The actual depths are thus adjusted to fit the discretized model levels in the vertical, giving a ``stairstep" approximation to the bathymetry. For a land point or at the boundary, KB is set to one. (See appendix A for a discussion of how flow through land boundaries is prevented.) At the grid point of maximum depth HMAX, the value is K1, the maximum number of layers. Note that depths greater than HMAX will be truncated to HMAX. There is no ``ghost zone'' below the deepest layer of the model. You should printout the values of the array KB(I,J) from program -/ prep.F to see how the model has structured the vertical cell resolution.

The depth array DEPTH(I,J) and the vertical level distribution Z(K) are used by prep.F to determine the mask arrays. The scalar mask array IN(I0,J0,K1) has values of 0 for land cells and 1 for water cells. Masks are determined because it is most efficient to perform the computations for model variables over all grid cells, both land and water, and then set those land values to zero. This is done by array multiplication of the variable by the mask. The mask IN is used for the A-grid variables at the center of a grid cell, T1, T2, S1, S2, P, RHOP, U1, U2, V1, V2. The mask arrays for the C-grid advective velocities IU(IP,J0,K0) and IV(I0,JP,K0) have the value 0 for a land or boundary point, and 1 for a water point, except at the first level where IU(I,J,1)=1 and IV(I,J,1)=1 for all points. This is necessary for the elliptic solver, which uses the swamp layer over the entire model domain of land and water grid points. The additional masks are used for the surface level C-grid advective velocities IU0(IP,J0) and IV0(I0,JP), which are 0 at a land or boundary point and 1 at a water point. The vertical velocity mask IW(I0,J0,K0) is also determined in prep.F. All the mask arrays are INTEGER*2 variables.




CANDIE Home User Guide Contents Previous Section Top of Page Next Section