c_ --------------------------------------------------------------------- c_ RCS lines preceded by "c_ " c_ --------------------------------------------------------------------- c_ c_ $Source: /home/geo/ocmip/RCS/gridlab.f,v $ c_ $Revision: 1.2 $ c_ $Date: 1995/06/11 13:24:26 $ ; $State: Exp $ c_ $Author: orr $ ; $Locker: orr $ c_ c_ --------------------------------------------------------------------- c_ $Log: gridlab.f,v $ c_ Revision 1.2 1995/06/11 13:24:26 orr c_ Replaced STOP by RETURN at the end of this subroutine c_ c_ Revision 1.1 1995/05/04 14:08:29 orr c_ Initial revision c_ c_ --------------------------------------------------------------------- c_ subroutine gridlab(xlon, ylat, ztra, zbot, area, imask, bottom) c ------------------------------------------------------------------ c Routine to read model specs (grid, timestep, etc.), then pass c results to calling program, used for analysis at LMCE. c c NOTE: Three types of changes are necessary in this program c (1) Change the name of this routine, i.e., change the last c three letters "lab" to the three-letter code of your c laboratory. c ------------------------------- c | Three-letter Lab. Code | c ------------------------------- c | Laboratory L-code | c | ----------- ------ | c | AOS, Princeton aos | c | GFDL, Princeton gfd | c | Hadley Center had | c | Hamburg-MPI mpi | c | LMCE-CFR, Gif gif | c ------------------------------- c For example, the subroutine passing the Hamburg LSG c model grid (and associated specs) should be named c "gridmpi". c c (2) Changes in PART AA: c That is, change parameters imt, jmt, kmt to correspond to c your model. c c (3) Changes in PART BB: c (a) Change READ statements etc. to read in your model c grid specs etc, convert them to the proper units, c then export them as arguments tothis routine c (b) In your modified version of this subroutine, please c supply the appropriate named data files and the c format in which you are supplying them c (32 bit IEEE is preferred--see OCMIP guidelines c as well as notes in "trunlab.f"). c c James Orr, LMCE/DSM/CEA, Saclay (orr@cea.fr) c c 27 April 1995 c----------------------------------------------------------------------- c NOTATION: c --------- c The variable type is given in square brackets (above) c (r-real, i-integer, l-logical, c-character; s-scaler, a-array). c c OUTPUT: c ------- c [ra] xlon(imt,jmt,2) - Longitude in degrees, c where xlon(i,j,1) represents the center c of tracer grid box-(i,j) c and xlon(i,j,2) represents the lower c left corner of tracer c grid box-(i,j) c [ra] ylat(imt,jmt,2) - Latitude in degrees, c where ylat(i,j,1) represents the center c and ylat(i,j,2) represents the lower c left corner of the each c tracer grid-box c [ra] ztra(kmt) - vertical tracer grid points (i.e., the c center of each layer) in [m] c [ra] zbot(kmt) - vertical points defining the bottom of c each grid layer in [m] c [ra] area(imt,jmt) - surface area of grid box-(i,j) in [m^2] c (unmasked) c [ia] imask(imt,jmt,kmt)- tracer grid mask: 0 = ocean; 1 = land c [ra] bottom(imt,jmt) - Bottom depth in [m] if the bathymetry does c not fall on any level defined by zbot. c NOTE: for all models (except the Hamburg c LSG model), set all values of bottom c to -1.0 to signify that this array c is not used. c OTHER: c ------ c [is] imt = number of tracer points in direction i (Longitude) c [is] jmt = number of tracer points in direction j (Latitude) c [is] kmt = number of tracer points in direction k (Depth) c c----------------------------------------------------------------------- c implicit none integer imt, jmt, kmt c======================================================================= c BEGIN PART AA: c -------------- c Change imt, jmt, and kmt according to your model specs parameter (imt=360, jmt=180, kmt=20) c Arrays used to read in model grid, and used to compute values for c standard arrays given below real tlon(imt), tlat(jmt) real vlat(0:jmt), vlon(0:imt) real zdummy c -------------- c END PART AA: c======================================================================= real xlon(imt,jmt,2), ylat(imt,jmt,2) real ztra(kmt), zbot(kmt) real area(imt,jmt), bottom(imt,jmt) integer imask(imt,jmt,kmt) integer i, j, k integer ier character*80 filename c======================================================================= c BEGIN PART BB: c -------------- c Change following statements as necessary to read in model results c and pass them as output from this subroutine c ******************************************************************* c=> Open data file holding grid information c NOTE CONCERNING FILE FORMAT: c See notes in file "trunlab.f" concerning file format c (Preferred File Format: IEEE 32-bit standard binary) c ------------------------------------------------------------------- filename='gridlab.ieee' call asnfile(filename,'-N ieee -F f77',ier) open(unit=30, file=filename, form='unformatted') c ******************************************************************* c=> Read 1-D latitiude and longitude arrays (typically used with c rectangular grids) c ------------------------------------------------------------------- c EXAMPLE: (1) Read in grid having Bryan-Cox model structure (B-Grid) c (2) Manipulate and export results according to OCMIP form c ------------------------------------------------------------------- c Bryan-Cox Grid Cell: =========> "OCMIP" Grid Cell: c -------------------- ------------------ c -------------o (vlon(i), ----------------o (xlon(i+1,j+1,2), c | | vlat(j)) | | ylat(i+1,j+1,2)) c | | | | c | | | | c | x | =========> | x | c | (tlon(i), | | (xlon(i,j,1), | c | tlat(j)) | | ylat(i,j,1)) | c | | | | c o------------- o---------------- c (vlon(i-1), (xlon(i,j,2), c vlat(j-1)) ylat(i,j,2) c c ******************************************************************* c=> Read in Tracer and Velocity grid points c ------------------------------------------------------------------- do j=1,jmt read(30) tlat(j), vlat(j) end do do i=1,imt read(30) tlon(i), vlon(i) end do c ******************************************************************* c=> Create "zero" values for subtractions below c ------------------------------------------------------------------- vlat(0) = tlat(1) - (vlat(1) - tlat(1)) vlon(0) = tlon(1) - (vlon(1) - tlon(1)) c ******************************************************************* c=> Fill 2-D Lat & Lon arrays (for output) with values 1-D values above c ------------------------------------------------------------------- do j=1,jmt do i=1,imt xlon(i,j,1) = tlon(i) xlon(i,j,2) = vlon(i-1) ylat(i,j,1) = tlat(j) ylat(i,j,2) = vlat(j-1) end do end do c ******************************************************************* c=> Read in depths at the center and bottom of each level c (Double check "zbot" to be sure that abs(zbot(k)) > abs(ztra(k))) c ------------------------------------------------------------------- read (30) (ztra(k), k=1,kmt) read (30) zdummy, (zbot(k), k=1,kmt) c Convert [cm] to [m] do k=1,kmt zbot(k) = zbot(k) * 1.0e-02 ztra(k) = ztra(k) * 1.0e-02 end do c ******************************************************************* c=> Read in area of each tracer grid box, convert to m^2 (std OCMIP) c ------------------------------------------------------------------- read (30) ((area(i,j), i=1,imt), j=1,jmt) c Convert [cm^2] to [m^2] do j=1,jmt do i=1,imt area(i,j) = area(i,j) * 1.0e-04 end do end do c ******************************************************************* c=> Read in INTEGER tracer mask (0 if over land; 1 if over sea) c ------------------------------------------------------------------- read (30) (((imask(i,j,k), i=1,imt), j=1,jmt), k=1,kmt) c ******************************************************************* c=> Specify bottom topography: a meaningful array for "bottom" is only c important for the Hamburg model whose bottom topography does not c necessarily fall evenly at the edges of tracer grid boxes. c For all other models, keep the default value below (-1.0) which c signals that your model does not use this array. c ------------------------------------------------------------------- do j=1,jmt do i=1,imt bottom(i,j) = -1.0 end do end do c -------------- c END PART BB: c======================================================================= return end