After prognostic equations have been integrated on rows within the MW and these rows have been written to disk (or ramdrive), the MW must be moved northward before computation can begin on the next group of rows. The movement takes place by copying quantities from the northernmost rows into the southernmost rows of the MW and then filling the remaining rows with data from disk (or ramdrive). The number of rows to be copied depends on the order of the MW. The ordering of the copies is important else data copied in one operation will be wiped out by the next copy. Which rows are to be copied is intimately tied into how arrays are dimensioned.
All arrays dimensioned within the MW must have their latitude dimension fall into one of the following four catagories:
dimension A(,,jmw) ! all cells within the MW
dimension B(,,1:jmw-1) ! all cells except j=jmw
dimension C(,,2:jmw) ! all cells except j=1
dimension D(,,2:jmw-1) ! all cells except j=1 and j=jmw
For further explanation and some examples of how array dimensions are determined, refer to Section 22.2.4. Assuming the above array structures, the copy part of the northward movement of the MW is demonstrated by the following segment of code which should be viewed in conjuction with Fig 11.6 to illustrate how the copy occurs for various array shapes and MW configurations. After prognostic equations have been solved on rows marked by ``x'', data from those rows is written to disk. Figure 11.7 illustrates the copy and move operations when option pressure_gradient_average is enabled. Note that tracers are computed on one row to the north of where baroclinic velocities are computed. The extra row is to allow for a four point average of pressure gradients when computing baroclinic velocities. When option pressure_gradient_average is enabled, only rows for which baroclinic equations are solved are written to disk (or ramdrive). Updated tracers on the extra row are copied into the next MW and get written to disk (or ramdrive) with baroclinic velocities from that MW.
for j=1,num_rows_to_copy jfrom = jmw - num_rows_to_copy + j ! MW row to copy data from jto = j ! MW row to copy data to do k=1,km ! for arrays dimensioned (1:jmw) do i=1,imt A(i,k,jto) = A(i,k,jfrom) enddo enddo if (jfrom .le. jmw-1) then ! for arrays dimensioned (1:jmw-1) do k=1,km do i=1,imt B(i,k,jto) = B(i,k,jfrom) enddo enddo endif if (jto .ge. 2) then ! for arrays dimensioned (2:jmw) do k=1,km do i=1,imt C(i,k,jto) = C(i,k,jfrom) enddo enddo endif #if defined fourth_order_window ! for arrays dimensioned (2:jmw-1) if (jto .ge. 2 .and. jfrom .le. jmw-1) then do k=1,km do i=1,imt D(i,k,jto) = D(i,k,jfrom) enddo enddo endif #endif enddo
Note that the number of copied rows is typically11.9
(11.5) |
which is the total number of buffer rows in the MW. The number of buffer rows required on the northern side and the southern side of the MW depends on the order of the MW (i.e. jbuf=n/2 for an n-th order MW). Note also that data in array ``D'' needs to be copied only when the MW is fourth order. After these copies have been made, the remaining rows in the MW from through j=jmw must be read from disk (or ramdrive) to fill up the MW before prognostic equations can be solved.