! source file: /Users/oschlies/UVIC/master/testcase/updates/mw.h !======================= include file "mw.h" =========================== ! M E M O R Y W I N D O W ! Data layout on disk ! On disk, a latitude consists of a row of prognostic quantities. ! Latitudes are ordered from south to north on two logical disk ! units: one for time level "tau" and one for time level "tau-1". ! Newly computed "tau+1" quantities are written to the "tau-1" disk ! which serves double duty as a "tau+1" disk. ! Data layout in memory ! A memory window "MW" is constructed to hold a group of "jmw" ! adjacent latitude rows of prognostic quantities from disks "tau-1" ! and "tau". Parameter "jmw" controls the size of the MW and can be ! set anywhere from a minimum of three latitude rows to all "jmt" ! latitudes. In addition, the MW holds diagnostic quantities ! (density, hydrostatic pressure gradients, and advective ! velocities) along with work arrays for constructing intermediate ! fluxes used in solving the tracer and momentum equations. A ! latitude row in the MW is referred to by index "j" and corresponds ! to the physical latitude row "jrow" on disk. ! Data flow between disk and memory ! The MW is loaded with prognostic data from the first "jww" ! latitude rows on disks "tau" and "tau-1". As the tracer and ! momentum equations are solved for rows j=2 through jmw-1 in the ! MW, the solutions are written to disk "tau+1". When finished, the ! MW is moved northward by moving quantities from the northernmost ! two rows into the southernmost two rows within the MW. The ! remaining MW rows are then loaded with more latitude rows from ! disk. The process continues until all latitude rows 2 through ! jmt-1 on disk "tau+1" have been updated. ! Parallel processing considerations ! When the MW is opened all the way ("jmw" = "jmt"), there is no ! need for disk units since all three time levels for all prognostic ! quantities at all latitudes reside in the MW. Therefore, there is ! no need to read data, write data or move the MW northward (or ! re-calculate the three dimensional land/sea mask arrays). After a ! time step has finished, time level pointers on the next time step ! are simply updated to reflect where the "tau-1", "tau" and "tau+1" ! data is. In principle, MOM 2 can be viewed as a succession of ! triply nested do loops with parallelism exposed at the do loop ! level (fine grained parallelism) as opposed to the latitude row ! level (coarse grained parallelism) of MOM 1. This structure ! significantly reduces the memory requirements compared to MOM 1 ! when executing on multiple processors. On one processor, the ! memory requirement is comparable to MOM 1. ! based on code by: R. C. Pacanowski !======================================================================= include "derived_options.h" ! taum1 = tau-1 time level for variables in MW ! tau = tau time level for variables in MW ! taup1 = tau+1 time level for variables in MW integer taum1, tau, taup1 common /mwi/ taum1, tau, taup1 !----------------------------------------------------------------------- ! MW arrays for prognostic equations: !----------------------------------------------------------------------- ! u(i,k,j,n,tau) = total velocity where: ! i = index for longitude ! k = index for depth ! j = index for latitude row within MW ! n = component (1 = zonal, 2 = meridional) ! tau = time level (tau-1, tau, tau+1) ! (only internal modes are on disk and at tau+1 in the MW) ! t(i,k,j,n,tau) = tracer where: ! i = index for longitude ! k = index for depth ! j = index for latitude row within MW ! n = component (1 = temperature, 2 = salinity) ! if nt > 2 then other tracers are allowed. ! tau = time level (tau-1, tau, tau+1) ! note: temperature is potential temperature in degrees Celsius and ! salinity is in "model units", the deviation from 0.035 grams ! of salt/cm**3 of water, or, assuming a water density of ! 1 gram/cm**3, the deviation from 0.035 g of salt/g of water. ! one can convert model units to the more common units of parts ! per thousand (ppt) by adding 0.035 grams/cm**3 to the model ! units and then multiplying by 1000. common /mw/ u(imt,km,jmw,2,-1:1), t(imt,km,jmw,nt,-1:1) ! indicies for ocean tracer array ! itemp = index for temperature ! isalt = index for salinity ! idic = index for dissolved inorganic carbon ! ic14 = index for carbon 14 ! icfc11 = index for cfc11 ! icfc12 = index for cfc12 ! ialk = index for alkalinity ! ipo4 = index for phosphate ! iphyt = index for phytoplankton ! izoop = index for zooplankton ! idetr = index for detritus ! io2 = index for oxygen ! ino3 = index for nitrate ! idiaz = index for diazotrophs ! in2o = index for N2O ! iabioto2 = index for abiotO2 ! iprefo2 = index for prefO2 ! iprefpo4 = index for prefPO4 ! iprefno3 = index for prefNO3 ! mapt = map for ocean tracer names character(10) :: mapt common /mw_c/ mapt(nt) integer itemp, isalt, idic, ic14, icfc11, icfc12, ialk, ipo4 integer iphyt, izoop, idetr, io2, ino3, idiaz &, in2o &, iabioto2 &, iprefo2 &, iprefpo4 &, iprefno3 common /mw_i/ itemp, isalt, idic, ic14, icfc11, icfc12, ialk common /mw_i/ ipo4, iphyt, izoop, idetr, io2, ino3, idiaz &, in2o &, iabioto2 &, iprefo2 &, iprefpo4 &, iprefno3 ! indicies for ocean tracer source array ! istemp = index for temperature ! issalt = index for salinity ! isdic = index for carbon ! isc14 = index for carbon 14 ! isalk = index for alkalinity ! ispo4 = index for phosphate ! isphyt = index for phytoplankton ! iszoop = index for zooplankton ! isdetr = index for detritus ! itrc = index of tracer sources for all tracers (0 = no source) ! mapst = map for ocean tracer source names character(10) :: mapst common /mw_c/ mapst(nt) integer itrc common /mw_i/ itrc(nt) integer istemp, issalt, isdic, isc14, isalk, ispo4, isphyt integer iszoop, isdetr, iso2, isno3, isdiaz &, isn2o &, isabioto2 common /mw_i/ istemp, issalt, isdic, isc14,isalk, ispo4, isphyt common /mw_i/ iszoop, isdetr, iso2, isno3, isdiaz &, isn2o &, isabioto2 !----------------------------------------------------------------------- ! MW arrays for diagnostic equations and workspace: !----------------------------------------------------------------------- ! diagnostic advective velocities are in units of cm/sec ! adv_vet = advective velocity on the eastern face of a "T" cell ! adv_vnt = advective velocity on the northern face of a "T" cell ! adv_veu = advective velocity on the eastern face of a "u" cell ! adv_vnu = advective velocity on the northern face of a "u" cell ! adv_vbt = advective velocity on the bottom face of a "T" cell ! adv_vbu = advective velocity on the bottom face of a "u" cell ! rho = density at centre of a "T" cell in units of gm/cm**3 ! note: there is an arbitrary constant which is only a ! function of depth in "rho". It is related to ! subtracting a reference level density for purposes of ! accuracy. ! grad_p = hydrostatic pressure gradient for "u" cell. There are ! two components: (1,2) is for (dp/dx, dp/dy) common /mw/ adv_vet(imt,km,jsmw:jmw), adv_vnt(imt,km,1:jmw) common /mw/ adv_veu(imt,km,jsmw:jemw) common /mw/ adv_vnu(imt,km,1:jemw) common /mw/ adv_vbt(imt,0:km,jsmw:jmw) common /mw/ adv_vbu(imt,0:km,jsmw:jemw) common /mw/ rho(imt,km,jsmw:jmw) common /mw/ grad_p(imt,km,jsmw:jemw,2) ! tmask = tracer cell land/sea mask = (0.0, 1.0) on (land, sea) ! umask = velocity cell land/sea mask = (0.0, 1.0) on (land, sea) common /mw/ tmask(imt,km,1:jmw), umask(imt,km,1:jmw) ! these workspace arrays are recalculated for each component of the ! equations so do not have to be moved as the MW moves northward. ! adv_fe = advective flux across the eastern face of a cell ! adv_fn = advective flux across the northern face of a cell ! (removed in most cases and put directly into the ! statement functions for speed optimization.) ! adv_fb = advective flux across the bottom face of a cell ! diff_fe = diffusive flux across the eastern face of a cell ! diff_fn = diffusive flux across the northern face of a cell ! diff_fb = diffusive flux across the bottom face of a cell ! source = source term common /mw/ adv_fe(imt,km,jsmw:jemw) common /mw/ adv_fn(imt,km,1:jemw) common /mw/ adv_fb(imt,0:km,jsmw:jemw) common /mw/ diff_fe(imt,km,jsmw:jemw) common /mw/ diff_fn(imt,km,1:jemw) common /mw/ diff_fb(imt,0:km,jsmw:jemw) common /mw/ diff_fbiso(imt,0:km,jsmw:jemw) common /mw/ source(imt,km,jsmw:jemw) common /mw/ zzi(imt,km,jsmw:jemw) ! these grid factors are for optimizations and are recalculated as ! the MW moves northward so they do not have to be moved. common /mw/ cstdxtr(imt,jsmw:jmw), cstdxur(imt,jsmw:jmw) common /mw/ cstdxt2r(imt,jsmw:jmw),ah_cstdxur(imt,jsmw:jmw) common /mw/ csudxur(imt,jsmw:jmw) common /mw/ csudxtr(imt,jsmw:jmw) common /mw/ csudxu2r(imt,jsmw:jmw),am_csudxtr(imt,jsmw:jmw) ! these variables are either constant or globally dimensioned by ! "jmt", so they do not need to be moved as the MW moves northward ! advmet = coeff for metric advection. ! cori = Coriolis parameter for velocity component "n" common /advec/ advmet(jmt,2) common /coriol/ cori(imt,jmt,2) common /extwrk/ cf(imt,jmt,-1:1,-1:1) ! smf = surface momentum flux ! 1 => zonal wind stress (dynes/cm**2) ! 2 => meridional wind stress (dynes/cm**2) ! bmf = bottom momentum flux ! 1 => zonal bottom drag (dynes/cm**2) ! 2 => meridional bottom drag (dynes/cm**2) ! stf = surface tracer flux ! 1 => surface heat flux (cal/cm**2/sec = cm*degC/sec = ly/sec) ! 2 => surface salt flux (grams of salt/cm**2/sec) ! btf = bottom tracer flux (for consistency but normally zero!) ! 1 => bottom heat flux (cal/cm**2/sec = cm*degC/sec = ly/sec) ! 2 => bottom salt flux (grams of salt/cm**2/sec) common /mw/ smf(imt,1:jmw,2), bmf(imt,1:jmw,2) common /mw/ stf(imt,1:jmw,nt), btf(imt,1:jmw,nt) ! "antidiffusive" flux as in Zalesak, 1989( see FCTstm.h) ! same for R+, R- ! anti_fe = antidiffusive flux across the eastern face of a T cell ! anti_fn = antidiffusive flux across the northern face of a T cell ! anti_fb = antidiffusive flux across the bottom face of a T cell ! R_plusY = ratio of maximal feasible to maximal possible change ! of tracer T in subroutine tracer.F, N-S dimension delimiter ! R_minusY = ratio of minimal feasible to minimal possible change ! of tracer T in subroutine tracer.F, N-S dimension delimiter common /mw/ anti_fe(imt,km,jsmw:jmw,nt) common /mw/ anti_fn(imt,km,1:jmw-1+jmw/jmt,nt) common /mw/ anti_fb(imt,0:km,jsmw:jmw,nt) common /mw/ R_plusY(imt,km,1:jmw-1+jmw/jmt,nt) common /mw/ R_minusY(imt,km,1:jmw-1+jmw/jmt,nt)