B.1   Setting up PREP/ prep.F

The preparation procedure follows closely the steps outlined in Sect. 5.2.1, and because this is a SPECIAL_TEST, those in Sect. 5.2.3. The steps are:

1. We choose the application case name IKW_TEST_CASE for ``Internal Kelvin Wave Test Case" and add it to the file PREP/AN_ID.h with the code


and then comment out all other names in the file with an initial C. The name IKW_TEST_CASE is used in place of the more generic compiler option test name MY_TEST_CASE which was used in Sect. 5.2.3 of this manual.

2. Choose the appropriate compiler preprocessor options for this set up in the file PREP/Def_prep.h. For the IKW_TEST_CASE a sample Def_prep.h file is

#define lnblnk_ lnblnk /* compress blank spaces in character strings */

#define SPECIAL_TEST /* special test case */
#endif /* IKW_TEST_CASE */

Note that although the Rigid_Lid is undefined, it will be defined by default in the MAIN/Define.h file. The most important thing to note is that the model initialization will be set up by the user and not from the CANDIE climatology files, and so the SPECIAL_TEST option must be set.

3. We select the user defined resolution parameters for our problem I0 = J0 = 102. We choose 17 blocks for the elliptic solver NB0 = 17, each containing 6 points, so that J0 = 6* NB0 = 102. The user defined resolution parameters are set in the file PREP/Diecast.h. In the PARAMETER statements near the start of the file the following code is added

#elif defined IKW_TEST_CASE

This will yield the array of elliptic solver array points IE(1) = 5, IE(2) = 11, IE(3) = 17, ... , IE(NB0) = 101 = J0 - 1, as calculated by the default proceedure in the file PREP/prep.F. When setting up the elliptic solver blocks, one should review the notes on this in section 5.2.1 and the definition of IE(NB0) in the ARRAYS part of section 6. It is a good idea to print out the values determined for this array from PREP/prep.F as part of the initialization.

Also in file PREP/Diecast.h we declare arrays used for the temperature initialization as a function of depth.

#if defined IKW_TEST_CASE
#endif /* IKW_TEST_CASE */

4. The code to set up the bathymetry, initial temperature and salinity, and horizontal and vertical grid spacing is set in a file modified specifically for this case PREP/ SUBS /ikw_test_case.h. This is an appropriate file name (which could have been anything) and takes the place of the generic file name my_test_case.h used previously in the model description. One of the PREP/SUBS/test_case.h files that was copied and unzipped with the CANDIE is copied, renamed, and modified for this purpose. The fortran file PREP/SUBS/ikw_test_case.h for our circular basin case is included here

#ifdef BBL
#endif /* BBL */

C =======
C =======
C     dy0=1.e5
C     dy0=630.e5/264

      DO J=2,J0
YV(J)=YV(J-1)+DY(J-1) DYV(J)=.5*(DY(J)+DY(J-1)) Y(J-1)=.5*(YV(J)+YV(J-1)) CSV(J)=1. DXV(J)=DX0*CSV(J) enddo DO J=1,J0 ODY(J)=1./DY(J) ODYV(J)=1./DYV(J) OCS(J)=1./CS(J) ODX(J)=1./DX(J) OCSV(J)=1./CSV(J) ODXV(J)=1./DXV(J) enddo yv(jp)=yv(j0)+dy(j0) Y(j0)=.5*(YV(JP)+YV(J0)) dyv(jp)=dyv(j0) ODYV(JP)=1./DYV(JP) csv(jp)=1. OCSV(JP)=1./CSV(JP) dxv(jp)=dxv(j0) ODXV(JP)=1./DXV(JP) write(6,*)'j, Y(j) km' do j = 1, j0 write(6,*)j, y(j)/(1.e5),dy(j)/(1.e5) enddo C ---------------------------- C SET CORIOLIS PARAMETER ARRAY C ---------------------------- c DO J=1,J1 c Spherical curvature parameter c F(J)=1.E-04 c enddo c-------------------------------------------------------- do j=1,j0 elat=42.0+(j-51)/111.2 f(j)=2.*(7.292E-5)*sin(elat*3.141592/180.) write(6,4673) j,elat,f(j) 4673 format(5x,'j = ',i5,' elat = ',f10.4,' f = ',e12.4) enddo c-------------------------------------------------------- C ========== C Set depths C ========== do J=2,J1 do i=2,I1 ric=i0/2+0.5 rjc=j0/2+0.5 Ho(i,j)=0. r=sqrt((i-ric)**2+(j-rjc)**2) if(r.le.50) Ho(I,J)=100.e2 cwpo Ho(i,j)=max(0.,100.e2*(1-(r/50.)**2)) enddo enddo do I = 1, I0 Ho(I,1) = 0. Ho(I,J0) = 0. enddo do J = 1, J0 Ho(1,J) = 0. Ho(I0,J) = 0. enddo do J=1,J0 do I=1,I0 DEPTH(I,J)=Ho(i,j) enddo enddo Cdbg write(6,*)'j, Y(j) depth' do j = 1, j0 write(6,*)j, y(j)/1.e5,depth((i0+1)/2,j)/100. enddo Cdbg z(1)=0. z(3)=1.e2 z(5)=2.e2 z(7)=3.e2 z(9)=5.e2 z(11)=8.e2 z(13)=12.e2 z(15)=18.e2 z(17)=25.e2 z(19)=35.e2 z(21)=50.e2 z(23)=70.e2 z(25)=100.e2 do k=1,k1 z(2*k)=(z(2*k-1)+z(2*k+1))/2. enddo C write(6,*)'k, z(2*k+1 & -1):' DO K=1,K1 C write(6,*)k,Z(2*k+1)/100.,Z(2*k-1)/100. ODZ(K)=1./(Z(2*K+1)-Z(2*K-1)) enddo #ifdef BBL ODZ(K0)=1d0/ht_bbl #else ODZ(K0)=ODZ(K1)
#endif DO K=2,K1 ODZW(K)=1./(Z(2*K)-Z(2*K-2)) c write(*,*) 'ODZW', k, ODZW(k) enddo ODZW(1)=ODZ(1) ODZW(K0)=ODZ(K1) c---------------------------------------------------------- c write out the depths write(6,*) 'depth profile' do k=1,k0+k1 write(6,4219) k,z(k) 4219 format(5x,'k = ',i5,' z = ',f10.2) enddo c------------------ c initialize temp and salinity to constant value do k=1,k0 tmean(k)=0.0 smean(k)=0.2 enddo c------------------ do k=1,k1 if(z(2*k).le.5.e2)then Tmean(k)=20. elseif(z(2*k).ge.15.e2)then Tmean(k)=5. else Tmean(k)=20.-15.*(z(2*k)-5.e2)/10.e2 endif enddo do K = 1, K0 do J = 1, J0 do I = 1, I0 T1(I,J,K) = Tmean(k) S1(I,J,K) = Smean(k) enddo enddo enddo c------------------------ c write out the temp profile write(6,*) ' initial temp profile' do k=1,k1 write(6,4220) k,tmean(k) 4220 format(5x,'k = ',i5,' tmean = ',f10.2) enddo c---------------------------------------------------------------

At the start of this file under the title METRICS, the user specifies

which sets the grid spacing in the X and Y directions to be 1 km = 105cm. The model code then uses this to set up the horizontal grid spacing arrays. In the code under the title SET CORIOLIS PARAMETER ARRAY, the values in the array F(J) are set for a lake centered on latitude 42°N. In the code under the title SET DEPTHS the depth is set to a constant value of 100 m = 104cm for a circular basin of radius 50 grid spaces. The land values are given the value of zero depth as input to the model. The resulting geometry is shown in Fig. 6. In this example the user specifies the vertical levels. The odd values of array Z(K) are specified in cm. These are the depths in cm of the interfaces between levels with Z(1) = 0 at the surface and Z(K0 + K1) = Z(25) = 100.e2 at the maximum depth. The model code then determines the depths of the intermediate Z(K) values which are the midpoints of the layers, and the other vertical metrics. Finally, the initial values of the temperature and salinity are specified as functions only of depth. The temperature is specified to represent a strong thermocline in the Great Lakes as mentioned at the start of this section, and the salinity is set to a constant 0.2 psu as is typical of the Great Lakes.

5. The file PREP/prep.F must be modified to read this file. In the file PREP/prep.F in the #ifdef SPECIAL_TEST - #else section near the start of the program, add the the block of code to include the file for this case initialization:

#include "SUBS/ikw_test_case.h"
#endif /* IKW_TEST_CASE */

The file PREP/Prep_parm.tag_root is not read by prep.F because the SPECIAL_TEST option is used. Also, the call to subroutine SETZW in file PREP/prep.F is not made, because we will explicitly specify the levels in the vertical.

6. No changes to the file PREP/Diecast.h are necessary.

7. The file PREP/SUBS/ikw_test_case.h must be added to the PREP/Makefile. In this file add the code



$(I14).o: $(I14).h
       cp $(I14).h $(I14).o

where the line with the cp command starts with the keyboard tab. The program is then compiled with the command ``make", or

make >& Makefile.out

which produces the executable file PREP/prep.

Next, a TAG_ROOT name is chosen for this initialization. We shall select the name FLAT13 to denote this flat bottom K0 = 13 case. This name can be put in the file PREP/prep.in which has the name on its only line, with no blank spaces which would be read in as characters. The file prep is executed with the command

./prep < prep.in >& prep.out

This could be run interactively with the command

./prep >& prep.out

and the program would prompt you for the input name, and then you would type FLAT13.

The output file prep.out contains the fortran 06 standard out of the preparation file prep.F, and should be looked at to see if the initialization data (grid spacing, Coriolis parameter, bathymetry array, vertical levels, and initial temperature and salinity) are those desired. The preparation also creates the following subdirectories of the project directory.


CANDIE Home User Guide Contents Previous Section Top Next Section