diff --git a/BB86/bb86 b/BB86/bb86
new file mode 100755
index 0000000..801262e
Binary files /dev/null and b/BB86/bb86 differ
diff --git a/BB86/bb86.exe b/BB86/bb86.exe
new file mode 100755
index 0000000..23a2593
Binary files /dev/null and b/BB86/bb86.exe differ
diff --git a/BB86/bb86.f b/BB86/bb86.f
new file mode 100755
index 0000000..906734b
--- /dev/null
+++ b/BB86/bb86.f
@@ -0,0 +1,1108 @@
+ PROGRAM RIGIDSF
+c
+C ****************************************************************
+C * THIS PROGRAM IS AN ADAPTATION OF THE BLECK AND BOUDRA (1986) *
+C * ISOPYCNIC COORDINATE GENERAL CIRCULATION MODEL. *
+C * RECTANGULAR BASIN VERSION WITH OR WITHOUT NO-SLIP BOUNDARY *
+C * CONDITION *
+C *****************************************************************
+C
+C II = NUMBER OF GRID POINTS IN x-DIRECTION C
+C JJ = NUMBER OF GRID POINTS IN y-DIRECTION C
+C KK = NUMBER OF LAYERS C
+C II1 = II - 1 C
+C JJ1 = JJ - 1 C
+C DP --> LAYER THICKNESS in pressure units
+C PBOT --> PRESSURE AT THE BOTTOM [dyn/(cm**2)]
+C UFLUX --> LAYER VELOCITY TIMES LAYER THICKNESS
+C UTROP --> BAROTROPIC VELOCITY
+C
+C======================================================================C
+C======================================================================C
+C RECALL THAT THE # OF GRID POINTS HAS TO BE A PRODUCT OF SMALL
+C PRIMES IN ORDER TO MAKE USE OF THE FFT TO SOLVE THE POISSON
+C EQUATION.
+C
+
+ PARAMETER(II=101,JJ=II,KK=2,II2=II-2,JJ2=JJ-2,MAX=II2)
+ PARAMETER(NW=INT(2.5*MAX+II))
+C
+C======================================================================C
+C
+ REAL U(II,JJ,2*KK) ,V(II,JJ,2*KK) ,DP(II,JJ,2*KK),MONTG(II,JJ,KK)
+ . ,P(II,JJ,KK+1) ,CORIO(II,JJ) ,ABSVOR(II,JJ)
+ . ,UTROP(II,JJ) ,VTROP(II,JJ) ,VORT(II,JJ) ,PS(II,JJ)
+ . ,DEL2U(II,JJ) ,STRESY(II,JJ) ,STRMF(II,JJ) ,WSAVE(NW)
+ . ,EIG(II,JJ) ,UFLUX(II,JJ)
+ . ,VFLUX(II,JJ) ,UOLD(II,JJ,KK), DEL2V(II,JJ)
+ . ,VOLD(II,JJ,KK),PBOT(JJ) ,THETA(KK) ,DP0(KK)
+ . ,DISVIS(KK) ,STRESS(KK) ,XCONT(KK) ,ZETA(II,JJ)
+ . ,UTIL1(II,JJ) ,DPM(II,JJ,KK) ,UM(II,JJ,KK)
+ . ,UTIL2(II,JJ) , VM(II,JJ,KK)
+ . ,STRESX(II,JJ), PU(II,JJ,KK+1), PV(II,JJ,KK+1), ULD(II,JJ,KK)
+ . ,VLD(II,JJ,KK)
+c
+c
+C
+ EQUIVALENCE (VORT,STRMF)
+C
+C ----------------------------------------------------------------------
+C
+c -------------------------------------------------------------
+c
+C --- FUNCTIONS TO MIMIC CRAY VECTOR MASK FUNCTIONS
+c
+ CVMGP(A,B,C)=A*(.5+SIGN(.5,C))+B*(.5-SIGN(.5,C))
+c
+c -------------------------------------------------------------
+C
+C
+C======================================================================C
+C DEFINE PHYSICAL PARAMETERS C
+C======================================================================C
+C
+C --- SUBTRACT FOLLOWING VALUES FROM 1. TO OBTAIN LAYER SPECIFIC VOLUME
+c
+ DATA THETA/0.0263,0.0265/
+c
+C
+c RHO=1./(1-THETA) GIVES THE RELATION BETWEEN RHO AND THETA
+c
+C
+C --- HORIZONTAL GRID SCALE
+
+ DATA SCALE/20.E5/ ! in cm
+C
+c
+C --- PRESSURE AND DP's ARE GIVEN IN UNITS OF dyn/(cm**2)
+C --- EAST-WEST DIRECTION ARRAY OF BOTTOM PRESSURES
+
+ DATA PBOT/II*5000.E5/
+ DATA PBOTTM/5000.E5/
+
+C
+C --- GRAVITATIONAL ACCELERATION
+ DATA G/980.6/
+C
+C
+C --- VELOCITY TIME SMOOTHING WEIGHTS
+ DATA WGT1,WGT2/.75,.125/
+C
+C
+C --- DEPTH OF WIND STRESS FORCING AND LINEAR BOTTOM DRAG COEFFICIENT
+ DATA PSTRES/50.E5/,DRAG/1.E-7/
+C
+C
+C --- TWO LEAP FROG TIME LEVELS
+ DATA M,N/2,1/
+C
+ DATA VISCOS/1.E6/
+C
+ DATA EPS/1.E5/,EPS1/1.E5/,EPSIL/1.E-9/
+C
+C --- 'EPS' IS USED WHEREVER LAYER THICKNESS MUST
+C --- BE BOUNDED AWAY FROM ZERO.
+C
+
+c
+C --- MODEL IS TO BE INTEGRATED FROM TIME STEP 'NSTEP1' TO 'NSTEP2'
+C
+ READ(5,*) NDAY1,NDAY2
+ print*,'nday1= ', nday1, ' nday2 = ', nday2
+C
+ READ(5,*)DELT ! TIME STEP OF INTEGRATION
+C
+ READ(5,*)(DP0(K),K=1,KK)
+ print*,'dp0(1) = ',dp0(1),' dp0(2) = ',dp0(2)
+C
+ READ(5,*)STRESSA,IFREE
+ print*,'stressa = ', stressa
+ if(ifree.eq.1) print*,'Model run with free-slip boundary cond.'
+ if(ifree.eq.2) print*,'Model run with no-slip boundary cond.'
+C
+C --------------------------------------------------------------------
+C
+ NSTEP1=NDAY1*86400./DELT + .0001
+ NSTEP2=NDAY2*86400./DELT + .0001
+C
+C -------------------------------------------------------------------
+C
+ SCALE2=SCALE**2
+ X=1./SCALE
+ II1 = II-1
+ JJ1 = JJ-1
+ BETA=2.E-13
+C
+C
+C
+C======================================================================C
+C INITIALIZATION C
+C======================================================================C
+C
+C --- CALL INITIALIZATION SUBROUTINE FOR POISSON SOLVER:
+C
+ CALL POINIT(II-2,JJ-2,II,PBOT,EIG,WSAVE)
+C
+C --- SPECIFY INITIAL AND BOUNDARY CONDITIONS
+C
+C
+ DO 10 I=1,II
+ DO 10 J=1,JJ
+C
+C --- CORIOLIS PARAMETER
+ CORIO(I,J)=.93E-4+FLOAT(J-JJ1/2)*SCALE*BETA
+C
+C======================================================================C
+C WIND STRESS PROFILE C
+C======================================================================C
+C
+ STRESX(I,J)=STRESSA*COS(FLOAT(J-1)/FLOAT(JJ1)
+ . *6.28318530718)*G/PSTRES
+ STRESY(I,J)=0.
+C
+C======================================================================C
+c The wind stress is prescribed as a body force and is assumed
+c to decrease linearly to the depth corresponding to PSTRES.
+c If the upper layer thickness (actually corresponding pressure)
+c becomes less than PSTRES, then the forcing is distributed
+c to the second layer and so on according to the linear law.
+C
+C
+ ABSVOR(I,J)=CORIO(I,J)
+ UFLUX(I,J)=0.
+ VFLUX(I,J)=0.
+ STRMF(I,J)=0.
+ MONTG(I,J,KK)=0.
+ P(I,J,1)=0.
+C
+ DO 10 K=1,KK
+ U(I,J,K )=0.
+ U(I,J,K+KK)=0.
+ V(J,J,K )=0.
+ V(I,J,K+KK)=0.
+ DP(I,J,K )=DP0(K)
+10 DP(I,J,K+KK)=DP0(K)
+C======================================================================C
+C======================================================================C
+C
+ DELT1=DELT
+C
+ WRITE(6,551)II
+551 FORMAT(2X'NUMBER OF GRID ELEMENTS IN EACH DIRECTION : 'I3)
+ WRITE(6,552)SCALE
+552 FORMAT(2X'GRID SIZE : 'E6.1)
+ WRITE(6,553)DELT
+553 FORMAT(2X'TIME STEP : 'F8.1)
+ WRITE(6,554)VISCOS
+554 FORMAT(2X'Viscosity : 'e10.4)
+C
+C======================================================================C
+C --- RESTART FROM RESTART FILES IF COMPUTATION IS NOT TO START C
+C FROM REST C
+C======================================================================C
+C
+ IF(NSTEP1.EQ.0) GO TO 75
+c
+C ---------------------------------------------------------------
+C
+ DELT1=DELT+DELT
+C
+C ---------------------------------------------------------------
+C
+ NO=10
+ READ (NO) NSTEP0,TIME0,U
+ NO=11
+ READ (NO) NSTEP0,TIME0,V
+ NO=12
+ READ (NO) NSTEP0,TIME0,DP
+C
+C======================================================================C
+C
+C --- FOLLOWIND DO LOOP NEEDED ONLY IF HISTORY FILE USED TO RESTART
+C
+C DO 2 K = 1,KK
+C DO 2 I = 1,II
+C DO 2 J = 1,JJ
+C V(I,J,K+KK) = V(I,J,K)
+C U(I,J,K+KK) = U(I,J,K)
+C 2 DP(I,J,K+KK)= DP(I,J,K)
+C DELT1=DELT
+C
+C======================================================================C
+C
+ WRITE (6,1112) NSTEP0,NSTEP1
+1112 FORMAT (15X'TIME STEP IN HISTORY FILE - 'I7,9X'WANTED - 'I7)
+C
+C
+ IF(NSTEP0.NE.NSTEP1) THEN
+ WRITE (6,103) NSTEP0,NSTEP1
+103 FORMAT (/' STEP NO.'I5' SHOULD BE'I5)
+ ENDIF
+C
+75 CONTINUE
+ IREC=0
+ NSTEP=NSTEP1
+ WRITE (6,102) NSTEP
+102 FORMAT (/' MODEL INTEGRATION STARTS FROM TIME STEP ',I6/)
+C
+C
+C
+C=======================================================================C
+C C
+C MAIN LOOP STARTS HERE C
+C ===================== C
+C ========= C
+C=======================================================================C
+C
+15 MM=(M-1)*KK
+ NN=(N-1)*KK
+c
+c
+ NSTEP=NSTEP+1
+ TIME=NSTEP*DELT/86400.
+ INDEX=0
+ IF (AMOD(TIME+.0001,1.).LT..0002) INDEX=1
+C
+C
+C=======================================================================C
+C CONTINUITY EQUATION (LAYER THICKNESS PREDICTION) C
+C=======================================================================C
+C
+C ****************************************************************
+C --- ----------------------------------------------------------------
+C
+C --- (USING 'FLUX CORRECTED TRANSPORT' ALGORITHM)
+C
+C --- ----------------------------------------------------------------
+C ****************************************************************
+C
+ DO 39 J=1,JJ1
+ DO 39 I=1,II1
+ UTROP(I,J)=0.
+39 VTROP(I,J)=0.
+ DO 1 K=1,KK
+ KM=K+MM
+ KN=K+NN
+C
+C --- COMPUTE LOW-ORDER (DIFFUSIVE) FLUXES
+C
+ DO 11 J=1,JJ1
+ DO 11 I=2,II1
+11 UFLUX(I,J)=U(I,J,KM)*CVMGP(DP(I-1,J,KN),DP(I,J,KN),U(I,J,KM))
+ DO 12 J=2,JJ1
+ DO 12 I=1,II1
+12 VFLUX(I,J)=V(I,J,KM)*CVMGP(DP(I,J-1,KN),DP(I,J,KN),V(I,J,KM))
+C
+C --- ADVANCE DP FIELD USING LOW-ORDER (DIFFUSIVE) FLUX VALUES
+C
+ DO 19 J=1,JJ1
+ DO 19 I=1,II1
+ UOLD(I,J,K)=DP(I,J,KN)
+19 DP(I,J,KN)=DP(I,J,KN)-(UFLUX(I+1,J)-UFLUX(I,J)
+ . +VFLUX(I,J+1)-VFLUX(I,J))*X*DELT1
+C
+C --- COMPUTE 'ANTIDIFFUSIVE' (I.E., HIGH-ORDER MINUS LOW-ORDER) FLUXES
+C
+C
+C --- SECOND-ORDER FLUXES FOR CONTINUITY EQUATION
+C
+ DO 16 J=1,JJ1
+ UFLUX( 2,J)=U( 2,J,KM)*.5*(DP( 2,J,KM)+DP( 1,J,KM))-
+ .UFLUX( 2,J)
+16 UFLUX(II1,J)=U(II1,J,KM)*.5*(DP(II2,J,KM)+DP(II1,J,KM))-
+ .UFLUX(II1,J)
+ DO 17 I=1,II1
+ VFLUX(I, 2)=V(I, 2,KM)*.5*(DP(I, 2,KM)+DP(I, 1,KM))-
+ .VFLUX(I, 2)
+17 VFLUX(I,JJ1)=V(I,JJ1,KM)*.5*(DP(I,JJ2,KM)+DP(I,JJ1,KM))-
+ .VFLUX(I,JJ1)
+ DO 20 J=1,JJ1
+ DO 20 I=3,II2
+ 20 UFLUX(I,J)=U(I,J,KM)*.5*(DP(I,J,KM)+DP(I-1,J,KM))-
+ .UFLUX(I,J)
+ DO 21 J=3,JJ2
+ DO 21 I=1,II1
+ 21 VFLUX(I,J)=V(I,J,KM)*.5*(DP(I,J,KM)+DP(I,J-1,KM))-
+ .VFLUX(I,J)
+C
+C --- AT EACH GRID POINT, DETERMINE THE RATIO OF THE LARGEST PERMISSIBLE
+C --- POS. (NEG.) CHANGE IN DP TO THE SUM OF ALL INCOMING (OUTGOING) FLUXES
+C
+C --- FIRST, THE FOUR CORNER POINTS...
+ UTIL1( 1, 1)=-(DP( 1, 1,KN)-AMAX1(
+ .DP( 1, 1,KN),DP( 2, 1,KN),DP( 1, 2,KN)))
+ ./((-AMIN1(0.,UFLUX( 2, 1))
+ . -AMIN1(0.,VFLUX( 1, 2))+EPSIL)*X*DELT1)
+ UTIL2( 1, 1)=-(DP( 1, 1,KN)-AMAX1(0.,AMIN1(
+ .DP( 1, 1,KN),DP( 2, 1,KN),DP( 1, 2,KN))))
+ ./((-AMAX1(0.,UFLUX( 2, 1))
+ . -AMAX1(0.,VFLUX( 1, 2))-EPSIL)*X*DELT1)
+C
+ UTIL1( 1,JJ1)=-(DP( 1,JJ1,KN)-AMAX1(
+ .DP( 1,JJ1,KN),DP( 2,JJ1,KN),DP( 1,JJ2,KN)))
+ ./((-AMIN1(0.,UFLUX( 2,JJ1))
+ . +AMAX1(0.,VFLUX( 1,JJ1))+EPSIL)*X*DELT1)
+ UTIL2( 1,JJ1)=-(DP( 1,JJ1,KN)-AMAX1(0.,AMIN1(
+ .DP( 1,JJ1,KN),DP( 2,JJ1,KN),DP( 1,JJ2,KN))))
+ ./((-AMAX1(0.,UFLUX( 2,JJ1))
+ . +AMIN1(0.,VFLUX( 1,JJ1))-EPSIL)*X*DELT1)
+C
+ UTIL1(II1, 1)=-(DP(II1, 1,KN)-AMAX1(
+ .DP(II1, 1,KN),DP(II2, 1,KN),DP(II1, 2,KN)))
+ ./(( AMAX1(0.,UFLUX(II1, 1))
+ . -AMIN1(0.,VFLUX(II1, 2))+EPSIL)*X*DELT1)
+ UTIL2(II1, 1)=-(DP(II1, 1,KN)-AMAX1(0.,AMIN1(
+ .DP(II1, 1,KN),DP(II2, 1,KN),DP(II1, 2,KN))))
+ ./(( AMIN1(0.,UFLUX(II1, 1))
+ . -AMAX1(0.,VFLUX(II1, 2))-EPSIL)*X*DELT1)
+C
+ UTIL1(II1,JJ1)=-(DP(II1,JJ1,KN)-AMAX1(
+ .DP(II1,JJ1,KN),DP(II2,JJ1,KN),DP(II1,JJ2,KN)))
+ ./(( AMAX1(0.,UFLUX(II1,JJ1))
+ . +AMAX1(0.,VFLUX(II1,JJ1))+EPSIL)*X*DELT1)
+ UTIL2(II1,JJ1)=-(DP(II1,JJ1,KN)-AMAX1(0.,AMIN1(
+ .DP(II1,JJ1,KN),DP(II2,JJ1,KN),DP(II1,JJ2,KN))))
+ ./(( AMIN1(0.,UFLUX(II1,JJ1))
+ . +AMIN1(0.,VFLUX(II1,JJ1))-EPSIL)*X*DELT1)
+C
+C --- NOW THE REMAINING LATERAL BOUNDARY POINTS...
+ DO 25 I=2,II2
+ UTIL1(I, 1)=-(DP(I, 1,KN)-AMAX1(
+ .DP(I, 1,KN),DP(I-1, 1,KN),DP(I+1, 1,KN),DP(I, 2,KN)))
+ ./((AMAX1(0.,UFLUX(I, 1))-AMIN1(0.,UFLUX(I+1, 1))
+ . -AMIN1(0.,VFLUX(I , 2))+EPSIL)*X*DELT1)
+ UTIL2(I, 1)=-(DP(I, 1,KN)-AMAX1(0.,AMIN1(
+ .DP(I, 1,KN),DP(I-1, 1,KN),DP(I+1, 1,KN),DP(I, 2,KN))))
+ ./((AMIN1(0.,UFLUX(I, 1))-AMAX1(0.,UFLUX(I+1, 1))
+ . -AMAX1(0.,VFLUX(I , 2))-EPSIL)*X*DELT1)
+ UTIL1(I,JJ1)=-(DP(I,JJ1,KN)-AMAX1(
+ .DP(I,JJ1,KN),DP(I-1,JJ1,KN),DP(I+1,JJ1,KN),DP(I,JJ2,KN)))
+ ./((AMAX1(0.,UFLUX(I,JJ1))-AMIN1(0.,UFLUX(I+1,JJ1))
+ . +AMAX1(0.,VFLUX(I,JJ1)) +EPSIL)*X*DELT1)
+ 25 UTIL2(I,JJ1)=-(DP(I,JJ1,KN)-AMAX1(0.,AMIN1(
+ .DP(I,JJ1,KN),DP(I-1,JJ1,KN),DP(I+1,JJ1,KN),DP(I,JJ2,KN))))
+ ./((AMIN1(0.,UFLUX(I,JJ1))-AMAX1(0.,UFLUX(I+1,JJ1))
+ . +AMIN1(0.,VFLUX(I,JJ1)) -EPSIL)*X*DELT1)
+C
+ DO 26 J=2,JJ2
+ UTIL1( 1,J)=-(DP( 1,J,KN)-AMAX1(
+ .DP( 1,J,KN),DP( 2,J,KN),DP( 1,J-1,KN),DP( 1,J+1,KN)))
+ ./(( -AMIN1(0.,UFLUX( 2,J ))
+ . +AMAX1(0.,VFLUX( 1,J))-AMIN1(0.,VFLUX( 1,J+1))+EPSIL)*X*DELT1)
+ UTIL2( 1,J)=-(DP( 1,J,KN)-AMAX1(0.,AMIN1(
+ .DP( 1,J,KN),DP( 2,J,KN),DP( 1,J-1,KN),DP( 1,J+1,KN))))
+ ./(( -AMAX1(0.,UFLUX( 2,J ))
+ . +AMIN1(0.,VFLUX( 1,J))-AMAX1(0.,VFLUX( 1,J+1))-EPSIL)*X*DELT1)
+ UTIL1(II1,J)=-(DP(II1,J,KN)-AMAX1(
+ .DP(II1,J,KN),DP(II2,J,KN),DP(II1,J-1,KN),DP(II1,J+1,KN)))
+ ./((AMAX1(0.,UFLUX(II1,J))
+ . +AMAX1(0.,VFLUX(II1,J))-AMIN1(0.,VFLUX(II1,J+1))+EPSIL)*X*DELT1)
+ 26 UTIL2(II1,J)=-(DP(II1,J,KN)-AMAX1(0.,AMIN1(
+ .DP(II1,J,KN),DP(II2,J,KN),DP(II1,J-1,KN),DP(II1,J+1,KN))))
+ ./((AMIN1(0.,UFLUX(II1,J))
+ . +AMIN1(0.,VFLUX(II1,J))-AMAX1(0.,VFLUX(II1,J+1))-EPSIL)*X*DELT1)
+C
+C --- FINALLY, THE INTERIOR GRID POINTS...
+ DO 27 J=2,JJ2
+ DO 27 I=2,II2
+ UTIL1(I,J)=-(DP(I,J,KN)-AMAX1(
+ .DP(I,J,KN),DP(I-1,J,KN),DP(I+1,J,KN),DP(I,J-1,KN),DP(I,J+1,KN)))
+ ./((AMAX1(0.,UFLUX(I,J))-AMIN1(0.,UFLUX(I+1,J))
+ . +AMAX1(0.,VFLUX(I,J))-AMIN1(0.,VFLUX(I,J+1))+EPSIL)*X*DELT1)
+ 27 UTIL2(I,J)=-(DP(I,J,KN)-AMAX1(0.,AMIN1(
+ .DP(I,J,KN),DP(I-1,J,KN),DP(I+1,J,KN),DP(I,J-1,KN),DP(I,J+1,KN))))
+ ./((AMIN1(0.,UFLUX(I,J))-AMAX1(0.,UFLUX(I+1,J))
+ . +AMIN1(0.,VFLUX(I,J))-AMAX1(0.,VFLUX(I,J+1))-EPSIL)*X*DELT1)
+C
+C --- LIMIT ANTIDIFFUSIVE FLUXES
+C --- (RETAIN INFORMATION ABOUT FLUX CLIPPING IN -UTROP,VTROP-. THIS
+C --- WILL ALLOW US LATER TO RESTORE NONDIVERGENCE OF BAROTROPIC FLOW.)
+C
+ DO 28 J=1,JJ1
+ DO 28 I=2,II1
+ UTROP(I,J)=UTROP(I,J)+UFLUX(I,J)*
+ .(1.-CVMGP(AMIN1(1.,UTIL1(I,J),UTIL2(I-1,J)),
+ . AMIN1(1.,UTIL2(I,J),UTIL1(I-1,J)),UFLUX(I,J)))
+28 UFLUX(I,J)=UFLUX(I,J)*CVMGP(AMIN1(1.,UTIL1(I,J),UTIL2(I-1,J)),
+ . AMIN1(1.,UTIL2(I,J),UTIL1(I-1,J)),
+ .UFLUX(I,J))
+ DO 29 J=2,JJ1
+ DO 29 I=1,II1
+ VTROP(I,J)=VTROP(I,J)+VFLUX(I,J)*
+ .(1.-CVMGP(AMIN1(1.,UTIL1(I,J),UTIL2(I,J-1)),
+ . AMIN1(1.,UTIL2(I,J),UTIL1(I,J-1)),VFLUX(I,J)))
+29 VFLUX(I,J)=VFLUX(I,J)*CVMGP(AMIN1(1.,UTIL1(I,J),UTIL2(I,J-1)),
+ . AMIN1(1.,UTIL2(I,J),UTIL1(I,J-1)),
+ .VFLUX(I,J))
+C
+C --- ADD ANTIDIFFUSIVE FLUXES TO DP FIELD
+C
+ DO 1 J=1,JJ1
+ DO 1 I=1,II1
+1 DP(I,J,KN)=DP(I,J,KN)-(UFLUX(I+1,J)-UFLUX(I,J)
+ . +VFLUX(I,J+1)-VFLUX(I,J))*X*DELT1
+C
+C --- RESTORE NONDIVERGENCE OF VERTICALLY INTEGRATED FLOW
+C
+ DO 5 J=1,JJ1
+ DO 5 K=1,KK
+ DO 5 I=1,II1
+5 P(I,J,K+1)=P(I,J,K)+DP(I,J,K+NN)
+ DO 14 K=1,KK
+ KN=K+NN
+ DO 44 J=1,JJ1
+ DO 44 I=2,II1
+44 UFLUX(I,J)=UTROP(I,J)*CVMGP(DP(I-1,J,KN)/P(I-1,J,KK+1),
+ . DP(I ,J,KN)/P(I ,J,KK+1),UTROP(I,J))
+ DO 45 J=2,JJ1
+ DO 45 I=1,II1
+45 VFLUX(I,J)=VTROP(I,J)*CVMGP(DP(I,J-1,KN)/P(I,J-1,KK+1),
+ . DP(I,J ,KN)/P(I,J ,KK+1),VTROP(I,J))
+ DO 14 J=1,JJ1
+ DO 14 I=1,II1
+14 DP(I,J,KN)=DP(I,J,KN)-(UFLUX(I+1,J)-UFLUX(I,J)
+ . +VFLUX(I,J+1)-VFLUX(I,J))*X*DELT1
+C
+C ****************************************************************
+C
+C --- END OF F C T CALCULATIONS
+C
+C ****************************************************************
+C
+C=======================================================================C
+C HYDROSTATIC EQUATION C
+C=======================================================================C
+C
+ DO 83 J=1,JJ1
+ DO 8 K=1,KK
+ DO 8 I=1,II1
+ 8 P(I,J,K+1)=P(I,J,K)+DP(I,J,K+MM)
+ DO 13 KI=2,KK
+ K=KK+1-KI
+ DO 13 I=1,II1
+ 13 MONTG(I,J,K)=MONTG(I,J,K+1)+P(I,J,K+1)*(THETA(K+1)-THETA(K))
+C
+C --- TIME SMOOTHING OF THICKNESS FIELD
+C
+ DO 83 K=1,KK
+ DO 83 I=1,II1
+ 83 DP(I,J,K+MM)=DP(I,J,K+MM)*.98+(UOLD(I,J,K)+DP(I,J,K+NN))*.01
+C
+C
+C=======================================================================C
+C MOMENTUM EQUATIONS C
+C=======================================================================C
+C
+ DO 9 K=1,KK
+
+ KM=K+MM
+ KN=K+NN
+ XCONT(K)=0.
+ DISVIS(K)=0.
+ STRESS(K)=0.
+C
+c
+C
+c
+C=======================================================================C
+C VORTICITY COMPUTATION C
+C=======================================================================C
+C
+ DO 80 I=2,II1
+ DO 80 J=2,JJ1
+ 80 ABSVOR(I,J)=(CORIO(I,J)+(V(I,J,KM)-V(I-1,J,KM)-U(I,J,KM)
+ .+U(I,J-1,KM))*X)
+c
+c Impose the boundary conditions on the calculation of ABSVOR
+c near the boundaries
+c
+C
+ IF(IFREE.EQ.2) THEN ! for no-slip
+
+ DO 81 J=2,JJ1
+ ABSVOR(1,J)=(CORIO(1,J)+2.*V(1,J,KM)*X)
+ 81 ABSVOR(II,J)=(CORIO(II,J)-2.*V(II1,J,KM)*X)
+C
+ DO 82 I=2,II1
+ ABSVOR(I,1)=(CORIO(I,1)-2.*U(I,1,KM)*X)
+ 82 ABSVOR(I,JJ)=(CORIO(I,JJ)+2.*U(I,JJ1,KM)*X)
+
+ ENDIF
+C
+C
+C======================================================================C
+C OOOOOOOOOOOOOOOOOOOOO C
+C=======================================================================C
+C U EQUATION C
+C=======================================================================C
+C
+C=======================================================================C
+C THICKNESS FIELD FOR LATERAL DIFFUSION C
+C=======================================================================C
+
+ DO 412 J=1,JJ1
+ PS(1,J)=DP(1,J,KM)
+ PS(II,J)=DP(II1,J,KM)
+ UOLD(1,J,K)=0.
+ UOLD(II,J,K)=0.
+C
+ DO 412 I=2,II1
+ PS(I,J)=.5*(DP(I,J,KM)+DP(I-1,J,KM))
+ UOLD(I,J,K)=U(I,J,KN)
+ 412 CONTINUE
+C
+ DO 37 J=1,JJ1
+ JA=MAX0( 1,J-1)
+ JB=MIN0(JJ1,J+1)
+c
+c Set up the free-slip or no-slip boundary conditions
+c (if.ifree.eq.1 ---> free slip boundary condition)
+C
+ SIG1 = 1.
+ SIG2 = 1.
+ if(ifree.eq.2) then ! no-slip boundary condition
+ IF(J.EQ. 1) SIG1 = -1.
+ IF(J.EQ.JJ1) SIG2 = -1.
+ endif
+C
+C --- RECTANGULAR BASIN
+c
+C ...this DEL2U term is neccesary for the laplacian viscosity term...
+C
+ DO 37 I=2,II1
+ 37 DEL2U(I,J)=
+ .((PS(I+1,J)+PS(I,J))*(UOLD(I+1,J,K)-UOLD(I,J,K))-
+ . (PS(I,J)+PS(I-1,J))*(UOLD(I,J,K)-UOLD(I-1,J,K))+
+ . (PS(I,JB)+PS(I,J))*(SIG2*UOLD(I,JB,K)-UOLD(I,J,K))-
+ . (PS(I,J )+PS(I,JA))*(UOLD(I,J,K)-SIG1*UOLD(I,JA,K)))*.5
+
+C=======================================================================C
+C BEGIN INTEGRATION OF U MOMENTUM EQUATION C
+C=======================================================================C
+ DO 61 J=1,JJ1
+CDIR$ IVDEP
+ DO 6 I=2,II1
+6 U(I,J,KN)=
+C
+C --- HORIZONTAL PRESSURE FORCE (X-DIRECTION)
+ .U(I,J,KN)-DELT1*((MONTG(I,J,K)-MONTG(I-1,J,K)
+C
+C --- GRADIENT OF KINETIC ENERGY
+ .+.25*(U(I+1,J,KM)**2+V(I ,J,KM)**2+V(I ,J+1,KM)**2
+ . -U(I-1,J,KM)**2-V(I-1,J,KM)**2-V(I-1,J+1,KM)**2))*X
+C
+C --- ABSOLUTE VORTICITY FLUX
+ .-.125*(V(I,J,KM)+V(I,J+1,KM)+V(I-1,J,KM)+V(I-1,J+1,KM))*
+ .(ABSVOR(I,J)+ABSVOR(I,J+1))
+C
+C --- WIND STRESS FORCING
+ .-STRESX(I,J)*(AMIN1(P(I,J,K+1)+P(I-1,J,K+1)+1.E3,PSTRES+PSTRES)
+ . -AMIN1(P(I,J,K )+P(I-1,J,K ) ,PSTRES+PSTRES))/
+ . ( P(I,J,K+1)+P(I-1,J,K+1)+1.E3
+ . -P(I,J,K )-P(I-1,J,K ))
+C
+C --- VISCOUS DIFFUSION
+ .-DEL2U(I,J)*VISCOS*X*X
+ ./AMAX1(.5*(DP(I,J,KM)+DP(I-1,J,KM)),EPS))
+C
+ IF (INDEX.EQ.0) GO TO 61
+C --- EVALUATE TERMS IN KINETIC ENERGY EQUATION
+ DO 59 I=2,II1
+C
+ XCONT(K)=XCONT(K)-U(I,J,KM)*.5*(DP(I,J,KM)+DP(I-1,J,KM))*
+ .(MONTG(I,J,K)-MONTG(I-1,J,K))/(G*SCALE)
+C
+ STRESS(K)=STRESS(K)+U(I,J,KM)*.5*(DP(I,J,KM)+DP(I-1,J,KM))*
+ .STRESX(I,J)*(AMIN1(P(I,J,K+1)+P(I-1,J,K+1)+1.E3,PSTRES+PSTRES)
+ . -AMIN1(P(I,J,K )+P(I-1,J,K ) ,PSTRES+PSTRES))/
+ . ( P(I,J,K+1)+P(I-1,J,K+1)+1.E3
+ . -P(I,J,K )-P(I-1,J,K ))/G
+C
+ IF (K.EQ.KK) STRESS(K)=STRESS(K)-
+ .DRAG*.5*(DP(I,J,KM)+DP(I-1,J,KM))*U(I,J,KM)*U(I,J,KN)/G
+C
+59 DISVIS(K)=DISVIS(K)-U(I,J,KM)*.5*(DP(I,J,KM)+DP(I-1,J,KM))/G
+ .*DEL2U(I,J)*VISCOS*X*X
+ ./AMAX1(.5*(DP(I,J,KM)+DP(I-1,J,KM)),EPS)
+61 CONTINUE
+C
+C=======================================================================C
+C OOOOOOOOOOOOOOOOOOOOO C
+C=======================================================================C
+C V EQUATION C
+C=======================================================================C
+C
+ DO 76 I=1,II1
+ PS(I,1)=DP(I,1,KM)
+ PS(I,JJ)=DP(I,JJ1,KM)
+ VOLD(I,1,K)=0.
+ VOLD(I,JJ,K)=0.
+ DO 76 J=2,JJ1
+ PS(I,J)=.5*(DP(I,J,KM)+DP(I,J-1,KM))
+ VOLD(I,J,K)=V(I,J,KN)
+ 76 CONTINUE
+C
+C
+ DO 420 I=1,II1
+ IA=MAX0(1,I-1)
+ IB=MIN0(II1,I+1)
+c
+c Set up the free-slip or no-slip boundary conditions
+c (if.ifree.eq.1 ---> free slip boundary condition)
+C
+ SIG1 = 1.
+ SIG2 = 1.
+ if(ifree.eq.2) then ! no-slip boundary condition
+ IF(I.EQ. 1) SIG1 = -1.
+ IF(I.EQ.II1) SIG2 = -1.
+ endif
+C
+ DO 420 J=2,JJ1
+ 420 DEL2V(I,J)=
+ .((PS(IB,J)+PS(I,J))*(SIG2*VOLD(IB,J,K)-VOLD(I,J,K))-
+ . (PS(I,J)+PS(IA,J))*(VOLD(I,J,K)-SIG1*VOLD(IA,J,K))+
+ . (PS(I,J+1)+PS(I,J))*(VOLD(I,J+1,K)-VOLD(I,J,K))-
+ . (PS(I,J)+PS(I,J-1))*(VOLD(I,J,K)-VOLD(I,J-1,K)))*.5
+
+C======================================================================C
+C BEGIN INTEGRATION OF V-MOMENTUM-EQUATION C
+C======================================================================C
+C
+ DO 62 I=1,II1
+CDIR$ IVDEP
+ DO 7 J=2,JJ1
+7 V(I,J,KN)=
+C
+C --- HORIZONTAL PRESSURE FORCE (Y-DIRECTION)
+ .V(I,J,KN)-DELT1*((MONTG(I,J,K)-MONTG(I,J-1,K)
+C
+C --- GRADIENT OF KINETIC ENERGY
+ .+.25*(V(I,J+1,KM)**2+U(I,J ,KM)**2+U(I+1,J ,KM)**2
+ . -V(I,J-1,KM)**2-U(I,J-1,KM)**2-U(I+1,J-1,KM)**2))*X
+C
+C --- ABSOLUTE VORTICITY FLUX
+ .+.125*(U(I,J,KM)+U(I+1,J,KM)+U(I,J-1,KM)+U(I+1,J-1,KM))*
+ .(ABSVOR(I,J)+ABSVOR(I+1,J))
+C
+C --- WIND STRESS FORCING
+ .-STRESY(I,J)*(AMIN1(P(I,J,K+1)+P(I,J-1,K+1)+1.E3,PSTRES+PSTRES)
+ . -AMIN1(P(I,J,K )+P(I,J-1,K ) ,PSTRES+PSTRES))/
+ . ( P(I,J,K+1)+P(I,J-1,K+1)+1.E3
+ . -P(I,J,K )-P(I,J-1,K ))
+C
+C --- VISCOUS DIFFUSION
+ .-DEL2V(I,J)*X*X*VISCOS
+ ./AMAX1(.5*(DP(I,J,KM)+DP(I,J-1,KM)),EPS))
+ IF (INDEX.EQ.0) GO TO 62
+C
+C --- EVALUATE TERMS IN KINETIC ENERGY EQUATION
+ DO 60 J=2,JJ1
+ XCONT(K)=XCONT(K)-V(I,J,KM)*.5*(DP(I,J,KM)+DP(I,J-1,KM))*
+ .(MONTG(I,J,K)-MONTG(I,J-1,K))/(G*SCALE)
+C
+ STRESS(K)=STRESS(K)+V(I,J,KM)*.5*(DP(I,J,KM)+DP(I,J-1,KM))*
+ .STRESY(I,J)*(AMIN1(P(I,J,K+1)+P(I,J-1,K+1)+1.E3,PSTRES+PSTRES)
+ . -AMIN1(P(I,J,K )+P(I,J-1,K ) ,PSTRES+PSTRES))/
+ . ( P(I,J,K+1)+P(I,J-1,K+1)+1.E3
+ . -P(I,J,K )-P(I,J-1,K ))/G
+C
+ IF (K.EQ.KK) STRESS(K)=STRESS(K)-
+ .DRAG*.5*(DP(I,J,KM)+DP(I,J-1,KM))*V(I,J,KM)*V(I,J,KN)/G
+C
+60 DISVIS(K)=DISVIS(K)-V(I,J,KM)*.5*(DP(I,J,KM)+DP(I,J-1,KM))/G
+ .*DEL2V(I,J)*X*X*VISCOS
+ ./AMAX1(.5*(DP(I,J,KM)+DP(I,J-1,KM)),EPS)
+62 CONTINUE
+9 CONTINUE
+C
+C======================================================================C
+C BOTTOM DRAG C
+C======================================================================C
+C
+ KN=KK+NN
+ DO 18 J=1,JJ1
+ DO 18 I=1,II1
+ U(I,J,KN)=U(I,J,KN)*(1.-DRAG*DELT1)
+18 V(I,J,KN)=V(I,J,KN)*(1.-DRAG*DELT1)
+C
+C----------------------------------------------------------------------C
+C
+ DO 850 K=1,KK
+ DO 850 I=1,II1
+ DO 850 J=1,JJ1
+ 850 P(I,J,K+1)=P(I,J,K)+DP(I,J,K+NN)
+C
+C
+C --- SUBSTITUTE DEPTH-WEIGHTED AVERAGES FOR (U,V) AT MASSLESS GRID POINTS
+C
+ DO 771 K=1,KK+1
+ DO 771 J=1,JJ1
+ DO 771 I=2,II1
+ 771 PU(I,J,K)=.5*(P(I,J,K)+P(I-1,J,K))
+C
+ DO 772 K=1,KK+1
+ DO 772 J=2,JJ1
+ DO 772 I=1,II1
+ 772 PV(I,J,K)=.5*(P(I,J,K)+P(I,J-1,K))
+C
+C
+ DO 774 K=1,KK
+ DO 668 J=2,JJ1
+ DO 668 I=1,II1
+ 668 VLD(I,J,K)=V(I,J,K+NN)*(PV(I,J,K+1)-PV(I,J,K))
+C
+ DO 773 K1=1,K-1
+ DO 773 J=2,JJ1
+ DO 773 I=1,II1
+ 773 VLD(I,J,K)=VLD(I,J,K)+V(I,J,K1+NN)*
+ .(AMIN1(PV(I,J,K ),AMAX1(PV(I,J,K+1)-EPS1,PV(I,J,K1+1)))
+ .-AMIN1(PV(I,J,K ),AMAX1(PV(I,J,K+1)-EPS1,PV(I,J,K1 ))))
+C
+ DO 774 K1=K+1,KK
+ DO 774 J=2,JJ1
+ DO 774 I=1,II1
+ 774 VLD(I,J,K)=VLD(I,J,K)+V(I,J,K1+NN)*
+ .(AMAX1(PV(I,J,K+1),AMIN1(PV(I,J,K )+EPS1,PV(I,J,K1+1)))
+ .-AMAX1(PV(I,J,K+1),AMIN1(PV(I,J,K )+EPS1,PV(I,J,K1 ))))
+C
+ DO 663 K=1,KK
+ DO 663 J=2,JJ1
+ DO 663 I=1,II1
+ 663 V(I,J,K+NN)=VLD(I,J,K)/
+ .(AMAX1(PV(I,J,K+1),AMIN1(PV(I,J,K )+EPS1,PV(I,J,KK+1)))
+ .-AMIN1(PV(I,J,K ),AMAX1(PV(I,J,K+1)-EPS1,PV(I,J, 1))))
+C
+ DO 863 J=1,JJ1
+C
+ DO 874 K=1,KK
+ DO 888 I=2,II1
+ 888 ULD(I,J,K)=U(I,J,K+NN)*(PU(I,J,K+1)-PU(I,J,K))
+ DO 873 K1=1,K-1
+ DO 873 I=2,II1
+ 873 ULD(I,J,K)=ULD(I,J,K)+U(I,J,K1+NN)*
+ .(AMIN1(PU(I,J,K ),AMAX1(PU(I,J,K+1)-EPS1,PU(I,J,K1+1)))
+ .-AMIN1(PU(I,J,K ),AMAX1(PU(I,J,K+1)-EPS1,PU(I,J,K1 ))))
+C
+ DO 874 K1=K+1,KK
+ DO 874 I=2,II1
+ 874 ULD(I,J,K)=ULD(I,J,K)+U(I,J,K1+NN)*
+ .(AMAX1(PU(I,J,K+1),AMIN1(PU(I,J,K )+EPS1,PU(I,J,K1+1)))
+ .-AMAX1(PU(I,J,K+1),AMIN1(PU(I,J,K )+EPS1,PU(I,J,K1 ))))
+C
+ DO 863 K=1,KK
+ DO 863 I=2,II1
+ 863 U(I,J,K+NN)=ULD(I,J,K)/
+ .(AMAX1(PU(I,J,K+1),AMIN1(PU(I,J,K )+EPS1,PU(I,J,KK+1)))
+ .-AMIN1(PU(I,J,K ),AMAX1(PU(I,J,K+1)-EPS1,PU(I,J,1 ))))
+
+C======================================================================C
+C REMOVE DIVERGENT COMPONENT FROM MEAN MOTION (RIGID LID APPROXIMAT.) C
+C======================================================================C
+C
+ DO 36 J=1,JJ1
+ DO 36 I=1,II1
+ P(I,J,KK+1)=0.
+ UTROP(I,J)=0.
+36 VTROP(I,J)=0.
+ DO 32 K=1,KK
+ KN=K+NN
+ DO 30 J=1,JJ1
+ DO 30 I=1,II1
+30 P(I,J,KK+1)=P(I,J,KK+1)+DP(I,J,KN)
+ DO 46 J=1,JJ1
+ UTROP( 2,J)=UTROP( 2,J)+U( 2,J,KN)*(DP( 2,J,KN)+DP( 1,J,KN))
+46 UTROP(II1,J)=UTROP(II1,J)+U(II1,J,KN)*(DP(II2,J,KN)+DP(II1,J,KN))
+ DO 31 J=1,JJ1
+ DO 31 I=3,II2
+ 31 UTROP(I,J)=UTROP(I,J)+U(I,J,KN)*(DP(I,J,KN)+DP(I-1,J,KN))
+ DO 47 I=1,II1
+ VTROP(I, 2)=VTROP(I, 2)+V(I, 2,KN)*(DP(I, 2,KN)+DP(I, 1,KN))
+47 VTROP(I,JJ1)=VTROP(I,JJ1)+V(I,JJ1,KN)*(DP(I,JJ2,KN)+DP(I,JJ1,KN))
+ DO 32 J=3,JJ2
+ DO 32 I=1,II1
+ 32 VTROP(I,J)=VTROP(I,J)+V(I,J,KN)*(DP(I,J,KN)+DP(I,J-1,KN))
+C
+C
+ DO 34 J=1,JJ1
+ DO 34 I=2,II1
+34 UTROP(I,J)=UTROP(I,J)/(P(I,J,KK+1)+P(I-1,J,KK+1))
+ DO 35 J=2,JJ1
+ DO 35 I=1,II1
+35 VTROP(I,J)=VTROP(I,J)/(P(I,J,KK+1)+P(I,J-1,KK+1))
+ DO 33 J=2,JJ1
+ DO 33 I=2,II1
+33 VORT(I,J)=(VTROP(I,J)-VTROP(I-1,J)-UTROP(I,J)+UTROP(I,J-1))
+C
+C=======================================================================C
+C --- SOLVE POISSON EQUATION TO DETERMINE ROTATIONAL PART OF MEAN MOTION
+C --- FOR TESTING THE FFT ROUTINE, ACTIVATE THE TWO STATEMENTS ..PRINT 110...
+C --- AND THE LOOP DO 52.... FOR PBOTTM=CONST., THE RESULTS SHOULD AGREE
+C=======================================================================C
+C
+ IF (INDEX.GT.0) PRINT 110,(VORT(I,I),I=2,13)
+110 FORMAT (1X,1P12E10.3)
+
+ CALL POISSON(VORT(2,2),II,II2,JJ2,PBOT,EIG,WSAVE)
+C
+ DO 52 I=2,13
+52 UTIL1(I,I)=(STRMF(I-1,I)+STRMF(I+1,I)
+ . +STRMF(I,I-1)+STRMF(I,I+1)-4.*STRMF(I,I))/PBOTTM
+ IF (INDEX.GT.0) PRINT 110,(UTIL1(I,I),I=2,13)
+C
+C
+C
+C=======================================================================C
+C COMPUTE THE NONDIVERGENT BAROTROPIC VELOCITY FIELD (UTROP) FROM C
+C THE STREMFUNCTION AND SUBTRACT THIS FROM THE TOTAL TO FIND THE C
+C DIVERGENT PART OF THE BAROTROPIC FLOW. C
+C=======================================================================C
+C
+ DO 43 J=1,JJ1
+ DO 43 I=2,II1
+43 UTROP(I,J)=UTROP(I,J)-(STRMF(I,J)-STRMF(I,J+1))
+ ./(.5*(P(I,J,KK+1)+P(I-1,J,KK+1)))
+C
+ DO 40 J=2,JJ1
+ DO 40 I=1,II1
+40 VTROP(I,J)=VTROP(I,J)-(STRMF(I+1,J)-STRMF(I,J))
+ ./(.5*(P(I,J,KK+1)+P(I,J-1,KK+1)))
+C
+ DO 41 K=1,KK
+ KN=K+NN
+ DO 42 J=1,JJ1
+ DO 42 I=2,II1
+42 U(I,J,KN)=U(I,J,KN)-UTROP(I,J)
+ DO 41 J=2,JJ1
+ DO 41 I=1,II1
+41 V(I,J,KN)=V(I,J,KN)-VTROP(I,J)
+C
+C=======================================================================C
+C SMOOTH U AND V FIELDS IN TIME C
+C=======================================================================C
+C
+ DO 22 K=1,KK
+ KM=K+MM
+ KN=K+NN
+ DO 324 J=1,JJ1
+ DO 324 I=2,II1
+ U(I,J,KM)=U(I,J,KM)*WGT1+(UOLD(I,J,K)+U(I,J,KN))*WGT2
+324 CONTINUE
+
+ DO 222 J=2,JJ1
+ DO 222 I=1,II1
+ V(I,J,KM)=V(I,J,KM)*WGT1+(VOLD(I,J,K)+V(I,J,KN))*WGT2
+222 CONTINUE
+C
+22 CONTINUE
+c
+C=======================================================================C
+C C
+C OUTPUT AND DIAGNOSTIC CALCULATIONS C
+C ================================== C
+C C
+C=======================================================================C
+C
+ IF (INDEX.EQ.0) GO TO 23
+ PRINT 100,NSTEP,TIME
+100 FORMAT (' T I M E S T E P'I9,25X'D A Y'F8.1)
+C
+C --- ENERGY DIAGNOSTICS
+C
+ PBAR=0.
+ SUMWGT=0.
+ SUMPOT=0.
+ SUMKIN=0.
+ SUMXGR=0.
+ SUMSTR=0.
+ SUMDIS=0.
+ SUMEKT=0.
+ DO 53 K=1,KK
+ KM=K+MM
+ EPOT=0.
+ EKIN=0.
+ WEIGHT=PBOTTM
+ DO 51 I=1,II1
+ DO 51 J=1,JJ1
+ IF (K.EQ.1)
+ .EPOT=EPOT+.5*(STRMF(I,J)*CORIO(I,J)*SCALE/P(I,J,KK+1))**2/G
+ IF (K.GT.1)
+ .EPOT=EPOT+.5*(P(I,J,K)-PBAR)**2*(THETA(K)-THETA(K-1))/G
+ EKIN=EKIN+.25*DP(I,J,KM)*(U(I,J,KM)**2+U(I+1,J,KM)**2
+ . +V(I,J,KM)**2+V(I,J+1,KM)**2)/G
+C --- CORRECT KINETIC ENERGY BUDGET FOR REMOVAL OF DIVERGENT PART OF MEAN MOTION
+ XCONT(K)=XCONT(K)-.5*DP(I,J,KM)*
+ .(U(I ,J,KM)*UTROP(I ,J)+V(I,J ,KM)*VTROP(I,J )
+ .+U(I+1,J,KM)*UTROP(I+1,J)+V(I,J+1,KM)*VTROP(I,J+1))/(G*DELT1)
+51 WEIGHT=AMIN1(WEIGHT,DP(I,J,KM))
+ EPOT=EPOT/(II1*JJ1)
+ EKIN=EKIN/(II1*JJ1)
+ DISVIS(K)=-DISVIS(K)/(II1*JJ1)
+ XCONT(K)=XCONT(K)/(II1*JJ1)
+ STRESS(K)=STRESS(K)/(II1*JJ1)
+ EKINT=STRESS(K)+XCONT(K)+DISVIS(K)
+ PRINT 101,WEIGHT,EPOT,EKIN,EKINT,XCONT(K),STRESS(K),DISVIS(K),K
+101 FORMAT (1P' THKN'E10.2' EPOT'E10.2' EKIN'E10.2' EKINT'E10.2
+ .' XCONT'E10.2' STRESS'E10.2' DISSIP'E10.2,I4)
+ SUMWGT=SUMWGT+WEIGHT
+ SUMKIN=SUMKIN+EKIN
+ SUMPOT=SUMPOT+EPOT
+ SUMXGR=SUMXGR+XCONT(K)
+ SUMSTR=SUMSTR+STRESS(K)
+ SUMDIS=SUMDIS+DISVIS(K)
+ SUMEKT=SUMEKT+EKINT
+53 PBAR=PBAR+DP0(K)
+ PRINT 101,SUMWGT,SUMPOT,SUMKIN,SUMEKT,SUMXGR,SUMSTR,SUMDIS
+C
+C --- OUTPUT TO RESTART FILE
+C
+ NO=20
+ REWIND (NO)
+ WRITE (NO) NSTEP,DAY,U
+ NO=21
+ REWIND (NO)
+ WRITE (NO) NSTEP,DAY,V
+ NO=22
+ REWIND (NO)
+ WRITE (NO) NSTEP,DAY,DP
+C
+C --- OUTPUT TO HISTORY FILE
+C
+ NO=30
+ WRITE (NO) (((U(I,J,K),I=1,II),J=1,JJ),K=1,KK),NSTEP
+ NO=31
+ WRITE (NO) (((V(I,J,K),I=1,II),J=1,JJ),K=1,KK),NSTEP
+ NO=32
+ WRITE (NO) (((DP(I,J,K),I=1,II),J=1,JJ),K=1,KK),NSTEP
+C
+C --- OUTPUT TO AVERAGED FILES
+C
+C
+C
+ IREC=IREC+1
+ DO 180 K=1,KK
+ DO 180 J=1,JJ
+ DO 180 I=1,II
+ DPM(I,J,K)=DP(I,J,K+NN)+DPM(I,J,K)
+ UM(I,J,K)=U(I,J,K+NN)+UM(I,J,K)
+ 180 VM(I,J,K)=V(I,J,K+NN)+VM(I,J,K)
+C
+ NO=23
+C REWIND (NO)
+C WRITE (NO) UM,IREC
+ NO=24
+C REWIND (NO)
+C WRITE (NO) VM,IREC
+ NO=25
+C REWIND (NO)
+C WRITE (NO) DPM,IREC
+C
+C
+23 L=M
+ M=N
+ N=L
+ IF (NSTEP.GE.NSTEP2) STOP '(NORMAL)'
+ DELT1=DELT+DELT
+ GO TO 15
+ END
+C=======================================================================C
+C C
+ SUBROUTINE POINIT(M,N,L,PBOT,EIG,WSAVE)
+C ======================================= C
+C INITIALIZATION ROUTINE FOR FFTPSSN: C
+C THIS VERSION OF POINIT PERMITS PBOTTOM TO VARY IN Y DIRECTION C
+C=======================================================================C
+
+ REAL EIG(L,N), WORK(1), PBOT(L)
+ PI = 4.*ATAN(1.)
+C--- INITIALIZE FFT ROUTINE
+ CALL SINTI(M,WSAVE)
+
+C--- EIGENVALUES OF TRIDIAGONAL MATRIX
+ DO 1 J=1,M
+ DO 1 K=1,N
+ 1 EIG(J,K) = -1./PBOT(K) - 1./PBOT(K+1)
+ . -8.*SIN(J*PI/2./(M+1))**2/(PBOT(K)+PBOT(K+1))
+C--- GAUSSIAN ELIMINATION OF TRI-DIAGONAL SYSTEM - LEFT HAND SIDE
+ DO 2 K = 2,N
+ DO 2 J = 1,M
+ 2 EIG(J,K) = EIG(J,K) - 1./(PBOT(K)**2*EIG(J,K-1))
+c
+ RETURN
+ END
+c
+C=================================================================C
+C C
+ SUBROUTINE POISSON(ZETA,II,M,N,PBOT,EIG,WSAVE)
+C ============================================== C
+C C
+C C
+C This subroutine uses a Fast Sine Transform algorithm C
+C to solve the POISSON EQUATION: C
+C C
+C PSI + PSI = ZETA C
+C xx yy C
+C C
+C using the Dirichlet's boundary conditions: C
+C C
+C PSI(0,y) = PSI(Lx,y) = PSI(x,0) = PSI(x,Ly) = 0 C
+C C
+C in a rectangular domain with dimensions Lx, Ly. C
+C --------------------------- C
+C Note that the the array ZETA inputs the right hand C
+C side of the equation and returns the solution, PSI. C
+C C
+C WSAVE is an working array of dimension int(2.5*MAX+15) C
+C if II2=JJ2 then WSAVE does not need to be modified C
+C by calling SINTI again. C
+C ******************** C
+C THIS SUBROUTINE CALLS SUBROUTINES SINT AND SINTI, FROM C
+C NCAR'S PACKAGE: FFTPACK (LINK WITH LIBRARY MYLIBRY.OLB) C
+C=================================================================C
+
+ DIMENSION ZETA(II,*), EIG(II,*), PBOT(*), WSAVE(*)
+
+ PI = 4.*ATAN(1.)
+ N1 = N+1
+ M1 = M+1
+C=================================================================C
+C PART I - COMPUTES TRANSFORM OF ZETA(I,J) C
+C=================================================================C
+
+ DO 60 K = 1,N
+ DO 50 J = 1,M
+ 50 ZETA(J,K) = ZETA(J,K)/(2.*(M1))
+C--- FORWARD TRANSFORM:
+ 60 CALL SINT(M,ZETA(1,K),WSAVE)
+
+C--- GAUSSIAN ELIMINATION - RIGHT HAND SIDE
+ DO 2 K=2,N
+ DO 2 J=1,M
+ 2 ZETA(J,K) = ZETA(J,K)-ZETA(J,K-1)/(PBOT(K)*EIG(J,K-1))
+
+ DO 3 J=1,M
+ 3 ZETA(J,N) = ZETA(J,N)/EIG(J,N)
+
+ DO 4 K=N-1,1,-1
+ DO 4 J=1,M
+ 4 ZETA(J,K)=(ZETA(J,K)-ZETA(J,K+1)/PBOT(K+1))/EIG(J,K)
+
+C--- BACK TRANSFORM:
+ DO 6 K=1,N
+ CALL SINT(M,ZETA(1,K),WSAVE)
+ 6 ZETA(M1,K) = 0.
+
+ RETURN
+ END
+C
+c=========================================================================
+c=========================================================================
+c INPUT FILE NEEDED WITH PARAMETERS
+c=========================================================================
+c
+c 0,5 ! nstep1, nstep2
+c 1200 ! delt
+c 500.e5,4500.e5 ! dp(1),dp(2)
+c 1.0,2 ! wind stress, 1 --> free slip, 2 --> no-slip
+c 5.e6 ! viscosity in cgs units
+c
+c=========================================================================
diff --git a/BB86/compil.csh b/BB86/compil.csh
new file mode 100755
index 0000000..97c7c8a
--- /dev/null
+++ b/BB86/compil.csh
@@ -0,0 +1,9 @@
+#!/bin/csh
+
+## Compilation
+ifort -c fft.f bb86.f
+ifort -o bb86 -i8 -r8 fft.o bb86.o
+
+\rm *.o
+echo 'Compilation done !'
+
diff --git a/BB86/fft.f b/BB86/fft.f
new file mode 100755
index 0000000..88c692f
--- /dev/null
+++ b/BB86/fft.f
@@ -0,0 +1,704 @@
+C
+C
+C FFT PACKAGE FOR BB86 - AN ALTERNATIVE IS TO USE FFT99.F
+C
+C
+C
+C **********************************************************************
+C FFTPACK.FOR C
+C Contains the Fortran codes for FFT subroutines in C
+C Library FFTPACK.LIB C
+c c
+c This is a reduced version of what is contained in sint.stuff, c
+c so that only those subroutines that are being used in the c
+c POINIT were kept. c
+C======================================================================C
+
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE SINTI (N,WSAVE)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION WSAVE(*)
+C LOGICAL Q8Q4
+C SAVE Q8Q4
+ DATA PI /3.14159265358979/
+C DATA Q8Q4 /.TRUE./
+C IF (Q8Q4) THEN
+C CALL Q8QST4 ('LOCLIB', 'FFTPACK', 'SINTI', 'VERSION 4')
+C Q8Q4 = .FALSE.
+C ENDIF
+ IF (N .LE. 1) RETURN
+ NS2 = N/2
+ NP1 = N+1
+ DT = PI/FLOAT(NP1)
+ DO 101 K=1,NS2
+ WSAVE(K) = 2.*SIN(K*DT)
+ 101 CONTINUE
+ CALL RFFTI (NP1,WSAVE(NS2+1))
+ RETURN
+ END
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE SINT (N,X,WSAVE)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION X(*) ,WSAVE(*)
+C LOGICAL Q8Q4
+C SAVE Q8Q4
+C DATA Q8Q4 /.TRUE./
+C IF (Q8Q4) THEN
+C CALL Q8QST4 ('LOCLIB', 'FFTPACK', 'SINT', 'VERSION 4')
+C Q8Q4 = .FALSE.
+C ENDIF
+ NP1 = N+1
+ IW1 = N/2+1
+ IW2 = IW1+NP1
+ IW3 = IW2+NP1
+ CALL SINT1(N,X,WSAVE,WSAVE(IW1),WSAVE(IW2),WSAVE(IW3))
+ RETURN
+ END
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE SINT1(N,WAR,WAS,XH,X,IFAC)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION WAR(*),WAS(*),X(*),XH(*),IFAC(*)
+ DATA SQRT3 /1.73205080756888/
+ DO 100 I=1,N
+ XH(I) = WAR(I)
+ WAR(I) = X(I)
+ 100 CONTINUE
+ IF (N-2 .LT. 0) THEN
+ GOTO 101
+ ELSE IF (N-2 .EQ. 0) THEN
+ GOTO 102
+ ELSE
+ GOTO 103
+ END IF
+ 101 XH(1) = XH(1)+XH(1)
+ GO TO 106
+ 102 XHOLD = SQRT3*(XH(1)+XH(2))
+ XH(2) = SQRT3*(XH(1)-XH(2))
+ XH(1) = XHOLD
+ GO TO 106
+ 103 NP1 = N+1
+ NS2 = N/2
+ X(1) = 0.
+ DO 104 K=1,NS2
+ KC = NP1-K
+ T1 = XH(K)-XH(KC)
+ T2 = WAS(K)*(XH(K)+XH(KC))
+ X(K+1) = T1+T2
+ X(KC+1) = T2-T1
+ 104 CONTINUE
+ MODN = MOD(N,2)
+ IF (MODN .NE. 0) X(NS2+2) = 4.*XH(NS2+1)
+ CALL RFFTF1 (NP1,X,XH,WAR,IFAC)
+ XH(1) = .5*X(1)
+ DO 105 I=3,N,2
+ XH(I-1) = -X(I)
+ XH(I) = XH(I-2)+X(I-1)
+ 105 CONTINUE
+ IF (MODN .NE. 0) GO TO 106
+ XH(N) = -X(N+1)
+ 106 DO 107 I=1,N
+ X(I) = WAR(I)
+ WAR(I) = XH(I)
+ 107 CONTINUE
+ RETURN
+ END
+c
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RFFTI (N,WSAVE)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION WSAVE(*)
+C LOGICAL Q8Q4
+C SAVE Q8Q4
+C DATA Q8Q4 /.TRUE./
+C IF (Q8Q4) THEN
+C CALL Q8QST4 ('LOCLIB', 'FFTPACK', 'RFFTI', 'VERSION 4')
+C Q8Q4 = .FALSE.
+C ENDIF
+ IF (N .EQ. 1) RETURN
+ CALL RFFTI1 (N,WSAVE(N+1),WSAVE(2*N+1))
+ RETURN
+ END
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RFFTI1 (N,WA,IFAC)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION WA(*) ,IFAC(*) ,NTRYH(4)
+ DATA NTRYH(1),NTRYH(2),NTRYH(3),NTRYH(4)/4,2,3,5/
+ NL = N
+ NF = 0
+ J = 0
+ 101 J = J+1
+ IF (J-4 .lt. 0) THEN
+ GOTO 102
+ ELSE IF (J-4 .eq. 0) THEN
+ GOTO 102
+ ELSE
+ GOTO 103
+ END IF
+ 102 NTRY = NTRYH(J)
+ GO TO 104
+ 103 NTRY = NTRY+2
+ 104 NQ = NL/NTRY
+ NR = NL-NTRY*NQ
+ IF (NR .lt. 0) THEN
+ GOTO 101
+ ELSE IF (NR .eq. 0) THEN
+ GOTO 105
+ ELSE
+ GOTO 101
+ END IF
+ 105 NF = NF+1
+ IFAC(NF+2) = NTRY
+ NL = NQ
+ IF (NTRY .NE. 2) GO TO 107
+ IF (NF .EQ. 1) GO TO 107
+ DO 106 I=2,NF
+ IB = NF-I+2
+ IFAC(IB+2) = IFAC(IB+1)
+ 106 CONTINUE
+ IFAC(3) = 2
+ 107 IF (NL .NE. 1) GO TO 104
+ IFAC(1) = N
+ IFAC(2) = NF
+ TPI = 6.28318530717959
+ ARGH = TPI/FLOAT(N)
+ IS = 0
+ NFM1 = NF-1
+ L1 = 1
+ IF (NFM1 .EQ. 0) RETURN
+ DO 110 K1=1,NFM1
+ IP = IFAC(K1+2)
+ LD = 0
+ L2 = L1*IP
+ IDO = N/L2
+ IPM = IP-1
+ DO 109 J=1,IPM
+ LD = LD+L1
+ I = IS
+ ARGLD = FLOAT(LD)*ARGH
+ FI = 0.
+ DO 108 II=3,IDO,2
+ I = I+2
+ FI = FI+1.
+ ARG = FI*ARGLD
+ WA(I-1) = COS(ARG)
+ WA(I) = SIN(ARG)
+ 108 CONTINUE
+ IS = IS+IDO
+ 109 CONTINUE
+ L1 = L2
+ 110 CONTINUE
+ RETURN
+ END
+c
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RFFTF (N,R,WSAVE)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION R(*) ,WSAVE(*)
+C LOGICAL Q8Q4
+C SAVE Q8Q4
+C DATA Q8Q4 /.TRUE./
+C IF (Q8Q4) THEN
+C CALL Q8QST4 ('LOCLIB', 'FFTPACK', 'RFFTF', 'VERSION 4')
+C Q8Q4 = .FALSE.
+C ENDIF
+ IF (N .EQ. 1) RETURN
+ CALL RFFTF1 (N,R,WSAVE,WSAVE(N+1),WSAVE(2*N+1))
+ RETURN
+ END
+c
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RFFTF1 (N,C,CH,WA,IFAC)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION CH(*) ,C(*) ,WA(*) ,IFAC(*)
+ NF = IFAC(2)
+ NA = 1
+ L2 = N
+ IW = N
+ DO 111 K1=1,NF
+ KH = NF-K1
+ IP = IFAC(KH+3)
+ L1 = L2/IP
+ IDO = N/L2
+ IDL1 = IDO*L1
+ IW = IW-(IP-1)*IDO
+ NA = 1-NA
+ IF (IP .NE. 4) GO TO 102
+ IX2 = IW+IDO
+ IX3 = IX2+IDO
+ IF (NA .NE. 0) GO TO 101
+ CALL RADF4 (IDO,L1,C,CH,WA(IW),WA(IX2),WA(IX3))
+ GO TO 110
+ 101 CALL RADF4 (IDO,L1,CH,C,WA(IW),WA(IX2),WA(IX3))
+ GO TO 110
+ 102 IF (IP .NE. 2) GO TO 104
+ IF (NA .NE. 0) GO TO 103
+ CALL RADF2 (IDO,L1,C,CH,WA(IW))
+ GO TO 110
+ 103 CALL RADF2 (IDO,L1,CH,C,WA(IW))
+ GO TO 110
+ 104 IF (IP .NE. 3) GO TO 106
+ IX2 = IW+IDO
+ IF (NA .NE. 0) GO TO 105
+ CALL RADF3 (IDO,L1,C,CH,WA(IW),WA(IX2))
+ GO TO 110
+ 105 CALL RADF3 (IDO,L1,CH,C,WA(IW),WA(IX2))
+ GO TO 110
+ 106 IF (IP .NE. 5) GO TO 108
+ IX2 = IW+IDO
+ IX3 = IX2+IDO
+ IX4 = IX3+IDO
+ IF (NA .NE. 0) GO TO 107
+ CALL RADF5 (IDO,L1,C,CH,WA(IW),WA(IX2),WA(IX3),WA(IX4))
+ GO TO 110
+ 107 CALL RADF5 (IDO,L1,CH,C,WA(IW),WA(IX2),WA(IX3),WA(IX4))
+ GO TO 110
+ 108 IF (IDO .EQ. 1) NA = 1-NA
+ IF (NA .NE. 0) GO TO 109
+ CALL RADFG (IDO,IP,L1,IDL1,C,C,C,CH,CH,WA(IW))
+ NA = 1
+ GO TO 110
+ 109 CALL RADFG (IDO,IP,L1,IDL1,CH,CH,CH,C,C,WA(IW))
+ NA = 0
+ 110 L2 = L1
+ 111 CONTINUE
+ IF (NA .EQ. 1) RETURN
+ DO 112 I=1,N
+ C(I) = CH(I)
+ 112 CONTINUE
+ RETURN
+ END
+c
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RADF2 (IDO,L1,CC,CH,WA1)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION CH(IDO,2,L1) ,CC(IDO,L1,2) ,
+ 1 WA1(*)
+ DO 101 K=1,L1
+ CH(1,1,K) = CC(1,K,1)+CC(1,K,2)
+ CH(IDO,2,K) = CC(1,K,1)-CC(1,K,2)
+ 101 CONTINUE
+ IF (IDO-2 .lt. 0) THEN
+ GOTO 107
+ ELSE IF (IDO-2 .eq. 0) THEN
+ GOTO 105
+ ELSE
+ GOTO 102
+ END IF
+ 102 IDP2 = IDO+2
+ DO 104 K=1,L1
+ DO 103 I=3,IDO,2
+ IC = IDP2-I
+ TR2 = WA1(I-2)*CC(I-1,K,2)+WA1(I-1)*CC(I,K,2)
+ TI2 = WA1(I-2)*CC(I,K,2)-WA1(I-1)*CC(I-1,K,2)
+ CH(I,1,K) = CC(I,K,1)+TI2
+ CH(IC,2,K) = TI2-CC(I,K,1)
+ CH(I-1,1,K) = CC(I-1,K,1)+TR2
+ CH(IC-1,2,K) = CC(I-1,K,1)-TR2
+ 103 CONTINUE
+ 104 CONTINUE
+ IF (MOD(IDO,2) .EQ. 1) RETURN
+ 105 DO 106 K=1,L1
+ CH(1,2,K) = -CC(IDO,K,2)
+ CH(IDO,1,K) = CC(IDO,K,1)
+ 106 CONTINUE
+ 107 RETURN
+ END
+c
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RADF3 (IDO,L1,CC,CH,WA1,WA2)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION CH(IDO,3,L1) ,CC(IDO,L1,3) ,
+ 1 WA1(*) ,WA2(*)
+ DATA TAUR,TAUI /-.5,.866025403784439/
+ DO 101 K=1,L1
+ CR2 = CC(1,K,2)+CC(1,K,3)
+ CH(1,1,K) = CC(1,K,1)+CR2
+ CH(1,3,K) = TAUI*(CC(1,K,3)-CC(1,K,2))
+ CH(IDO,2,K) = CC(1,K,1)+TAUR*CR2
+ 101 CONTINUE
+ IF (IDO .EQ. 1) RETURN
+ IDP2 = IDO+2
+ DO 103 K=1,L1
+ DO 102 I=3,IDO,2
+ IC = IDP2-I
+ DR2 = WA1(I-2)*CC(I-1,K,2)+WA1(I-1)*CC(I,K,2)
+ DI2 = WA1(I-2)*CC(I,K,2)-WA1(I-1)*CC(I-1,K,2)
+ DR3 = WA2(I-2)*CC(I-1,K,3)+WA2(I-1)*CC(I,K,3)
+ DI3 = WA2(I-2)*CC(I,K,3)-WA2(I-1)*CC(I-1,K,3)
+ CR2 = DR2+DR3
+ CI2 = DI2+DI3
+ CH(I-1,1,K) = CC(I-1,K,1)+CR2
+ CH(I,1,K) = CC(I,K,1)+CI2
+ TR2 = CC(I-1,K,1)+TAUR*CR2
+ TI2 = CC(I,K,1)+TAUR*CI2
+ TR3 = TAUI*(DI2-DI3)
+ TI3 = TAUI*(DR3-DR2)
+ CH(I-1,3,K) = TR2+TR3
+ CH(IC-1,2,K) = TR2-TR3
+ CH(I,3,K) = TI2+TI3
+ CH(IC,2,K) = TI3-TI2
+ 102 CONTINUE
+ 103 CONTINUE
+ RETURN
+ END
+c
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RADF4 (IDO,L1,CC,CH,WA1,WA2,WA3)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION CC(IDO,L1,4) ,CH(IDO,4,L1) ,
+ 1 WA1(*) ,WA2(*) ,WA3(*)
+ DATA HSQT2 /.7071067811865475/
+ DO 101 K=1,L1
+ TR1 = CC(1,K,2)+CC(1,K,4)
+ TR2 = CC(1,K,1)+CC(1,K,3)
+ CH(1,1,K) = TR1+TR2
+ CH(IDO,4,K) = TR2-TR1
+ CH(IDO,2,K) = CC(1,K,1)-CC(1,K,3)
+ CH(1,3,K) = CC(1,K,4)-CC(1,K,2)
+ 101 CONTINUE
+ IF (IDO-2 .le. 0) THEN
+ GOTO 107
+ ELSE IF (IDO-2 .eq. 0) THEN
+ GOTO 105
+ ELSE
+ GOTO 102
+ END IF
+ 102 IDP2 = IDO+2
+ DO 104 K=1,L1
+ DO 103 I=3,IDO,2
+ IC = IDP2-I
+ CR2 = WA1(I-2)*CC(I-1,K,2)+WA1(I-1)*CC(I,K,2)
+ CI2 = WA1(I-2)*CC(I,K,2)-WA1(I-1)*CC(I-1,K,2)
+ CR3 = WA2(I-2)*CC(I-1,K,3)+WA2(I-1)*CC(I,K,3)
+ CI3 = WA2(I-2)*CC(I,K,3)-WA2(I-1)*CC(I-1,K,3)
+ CR4 = WA3(I-2)*CC(I-1,K,4)+WA3(I-1)*CC(I,K,4)
+ CI4 = WA3(I-2)*CC(I,K,4)-WA3(I-1)*CC(I-1,K,4)
+ TR1 = CR2+CR4
+ TR4 = CR4-CR2
+ TI1 = CI2+CI4
+ TI4 = CI2-CI4
+ TI2 = CC(I,K,1)+CI3
+ TI3 = CC(I,K,1)-CI3
+ TR2 = CC(I-1,K,1)+CR3
+ TR3 = CC(I-1,K,1)-CR3
+ CH(I-1,1,K) = TR1+TR2
+ CH(IC-1,4,K) = TR2-TR1
+ CH(I,1,K) = TI1+TI2
+ CH(IC,4,K) = TI1-TI2
+ CH(I-1,3,K) = TI4+TR3
+ CH(IC-1,2,K) = TR3-TI4
+ CH(I,3,K) = TR4+TI3
+ CH(IC,2,K) = TR4-TI3
+ 103 CONTINUE
+ 104 CONTINUE
+ IF (MOD(IDO,2) .EQ. 1) RETURN
+ 105 CONTINUE
+ DO 106 K=1,L1
+ TI1 = -HSQT2*(CC(IDO,K,2)+CC(IDO,K,4))
+ TR1 = HSQT2*(CC(IDO,K,2)-CC(IDO,K,4))
+ CH(IDO,1,K) = TR1+CC(IDO,K,1)
+ CH(IDO,3,K) = CC(IDO,K,1)-TR1
+ CH(1,2,K) = TI1-CC(IDO,K,3)
+ CH(1,4,K) = TI1+CC(IDO,K,3)
+ 106 CONTINUE
+ 107 RETURN
+ END
+c
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RADF5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION CC(IDO,L1,5) ,CH(IDO,5,L1) ,
+ 1 WA1(*) ,WA2(*) ,WA3(*) ,WA4(*)
+ DATA TR11,TI11,TR12,TI12 /.309016994374947,.951056516295154,
+ 1-.809016994374947,.587785252292473/
+ DO 101 K=1,L1
+ CR2 = CC(1,K,5)+CC(1,K,2)
+ CI5 = CC(1,K,5)-CC(1,K,2)
+ CR3 = CC(1,K,4)+CC(1,K,3)
+ CI4 = CC(1,K,4)-CC(1,K,3)
+ CH(1,1,K) = CC(1,K,1)+CR2+CR3
+ CH(IDO,2,K) = CC(1,K,1)+TR11*CR2+TR12*CR3
+ CH(1,3,K) = TI11*CI5+TI12*CI4
+ CH(IDO,4,K) = CC(1,K,1)+TR12*CR2+TR11*CR3
+ CH(1,5,K) = TI12*CI5-TI11*CI4
+ 101 CONTINUE
+ IF (IDO .EQ. 1) RETURN
+ IDP2 = IDO+2
+ DO 103 K=1,L1
+ DO 102 I=3,IDO,2
+ IC = IDP2-I
+ DR2 = WA1(I-2)*CC(I-1,K,2)+WA1(I-1)*CC(I,K,2)
+ DI2 = WA1(I-2)*CC(I,K,2)-WA1(I-1)*CC(I-1,K,2)
+ DR3 = WA2(I-2)*CC(I-1,K,3)+WA2(I-1)*CC(I,K,3)
+ DI3 = WA2(I-2)*CC(I,K,3)-WA2(I-1)*CC(I-1,K,3)
+ DR4 = WA3(I-2)*CC(I-1,K,4)+WA3(I-1)*CC(I,K,4)
+ DI4 = WA3(I-2)*CC(I,K,4)-WA3(I-1)*CC(I-1,K,4)
+ DR5 = WA4(I-2)*CC(I-1,K,5)+WA4(I-1)*CC(I,K,5)
+ DI5 = WA4(I-2)*CC(I,K,5)-WA4(I-1)*CC(I-1,K,5)
+ CR2 = DR2+DR5
+ CI5 = DR5-DR2
+ CR5 = DI2-DI5
+ CI2 = DI2+DI5
+ CR3 = DR3+DR4
+ CI4 = DR4-DR3
+ CR4 = DI3-DI4
+ CI3 = DI3+DI4
+ CH(I-1,1,K) = CC(I-1,K,1)+CR2+CR3
+ CH(I,1,K) = CC(I,K,1)+CI2+CI3
+ TR2 = CC(I-1,K,1)+TR11*CR2+TR12*CR3
+ TI2 = CC(I,K,1)+TR11*CI2+TR12*CI3
+ TR3 = CC(I-1,K,1)+TR12*CR2+TR11*CR3
+ TI3 = CC(I,K,1)+TR12*CI2+TR11*CI3
+ TR5 = TI11*CR5+TI12*CR4
+ TI5 = TI11*CI5+TI12*CI4
+ TR4 = TI12*CR5-TI11*CR4
+ TI4 = TI12*CI5-TI11*CI4
+ CH(I-1,3,K) = TR2+TR5
+ CH(IC-1,2,K) = TR2-TR5
+ CH(I,3,K) = TI2+TI5
+ CH(IC,2,K) = TI5-TI2
+ CH(I-1,5,K) = TR3+TR4
+ CH(IC-1,4,K) = TR3-TR4
+ CH(I,5,K) = TI3+TI4
+ CH(IC,4,K) = TI4-TI3
+ 102 CONTINUE
+ 103 CONTINUE
+ RETURN
+ END
+c
+c
+c
+c
+c==========================================================c
+c==========================================================c
+ SUBROUTINE RADFG (IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA)
+c==========================================================c
+c==========================================================c
+c
+ DIMENSION CH(IDO,L1,IP) ,CC(IDO,IP,L1) ,
+ 1 C1(IDO,L1,IP) ,C2(IDL1,IP),
+ 2 CH2(IDL1,IP) ,WA(*)
+ DATA TPI/6.28318530717959/
+ ARG = TPI/FLOAT(IP)
+ DCP = COS(ARG)
+ DSP = SIN(ARG)
+ IPPH = (IP+1)/2
+ IPP2 = IP+2
+ IDP2 = IDO+2
+ NBD = (IDO-1)/2
+ IF (IDO .EQ. 1) GO TO 119
+ DO 101 IK=1,IDL1
+ CH2(IK,1) = C2(IK,1)
+ 101 CONTINUE
+ DO 103 J=2,IP
+ DO 102 K=1,L1
+ CH(1,K,J) = C1(1,K,J)
+ 102 CONTINUE
+ 103 CONTINUE
+ IF (NBD .GT. L1) GO TO 107
+ IS = -IDO
+ DO 106 J=2,IP
+ IS = IS+IDO
+ IDIJ = IS
+ DO 105 I=3,IDO,2
+ IDIJ = IDIJ+2
+ DO 104 K=1,L1
+ CH(I-1,K,J) = WA(IDIJ-1)*C1(I-1,K,J)+WA(IDIJ)*C1(I,K,J)
+ CH(I,K,J) = WA(IDIJ-1)*C1(I,K,J)-WA(IDIJ)*C1(I-1,K,J)
+ 104 CONTINUE
+ 105 CONTINUE
+ 106 CONTINUE
+ GO TO 111
+ 107 IS = -IDO
+ DO 110 J=2,IP
+ IS = IS+IDO
+ DO 109 K=1,L1
+ IDIJ = IS
+ DO 108 I=3,IDO,2
+ IDIJ = IDIJ+2
+ CH(I-1,K,J) = WA(IDIJ-1)*C1(I-1,K,J)+WA(IDIJ)*C1(I,K,J)
+ CH(I,K,J) = WA(IDIJ-1)*C1(I,K,J)-WA(IDIJ)*C1(I-1,K,J)
+ 108 CONTINUE
+ 109 CONTINUE
+ 110 CONTINUE
+ 111 IF (NBD .LT. L1) GO TO 115
+ DO 114 J=2,IPPH
+ JC = IPP2-J
+ DO 113 K=1,L1
+ DO 112 I=3,IDO,2
+ C1(I-1,K,J) = CH(I-1,K,J)+CH(I-1,K,JC)
+ C1(I-1,K,JC) = CH(I,K,J)-CH(I,K,JC)
+ C1(I,K,J) = CH(I,K,J)+CH(I,K,JC)
+ C1(I,K,JC) = CH(I-1,K,JC)-CH(I-1,K,J)
+ 112 CONTINUE
+ 113 CONTINUE
+ 114 CONTINUE
+ GO TO 121
+ 115 DO 118 J=2,IPPH
+ JC = IPP2-J
+ DO 117 I=3,IDO,2
+ DO 116 K=1,L1
+ C1(I-1,K,J) = CH(I-1,K,J)+CH(I-1,K,JC)
+ C1(I-1,K,JC) = CH(I,K,J)-CH(I,K,JC)
+ C1(I,K,J) = CH(I,K,J)+CH(I,K,JC)
+ C1(I,K,JC) = CH(I-1,K,JC)-CH(I-1,K,J)
+ 116 CONTINUE
+ 117 CONTINUE
+ 118 CONTINUE
+ GO TO 121
+ 119 DO 120 IK=1,IDL1
+ C2(IK,1) = CH2(IK,1)
+ 120 CONTINUE
+ 121 DO 123 J=2,IPPH
+ JC = IPP2-J
+ DO 122 K=1,L1
+ C1(1,K,J) = CH(1,K,J)+CH(1,K,JC)
+ C1(1,K,JC) = CH(1,K,JC)-CH(1,K,J)
+ 122 CONTINUE
+ 123 CONTINUE
+C
+ AR1 = 1.
+ AI1 = 0.
+ DO 127 L=2,IPPH
+ LC = IPP2-L
+ AR1H = DCP*AR1-DSP*AI1
+ AI1 = DCP*AI1+DSP*AR1
+ AR1 = AR1H
+ DO 124 IK=1,IDL1
+ CH2(IK,L) = C2(IK,1)+AR1*C2(IK,2)
+ CH2(IK,LC) = AI1*C2(IK,IP)
+ 124 CONTINUE
+ DC2 = AR1
+ DS2 = AI1
+ AR2 = AR1
+ AI2 = AI1
+ DO 126 J=3,IPPH
+ JC = IPP2-J
+ AR2H = DC2*AR2-DS2*AI2
+ AI2 = DC2*AI2+DS2*AR2
+ AR2 = AR2H
+ DO 125 IK=1,IDL1
+ CH2(IK,L) = CH2(IK,L)+AR2*C2(IK,J)
+ CH2(IK,LC) = CH2(IK,LC)+AI2*C2(IK,JC)
+ 125 CONTINUE
+ 126 CONTINUE
+ 127 CONTINUE
+ DO 129 J=2,IPPH
+ DO 128 IK=1,IDL1
+ CH2(IK,1) = CH2(IK,1)+C2(IK,J)
+ 128 CONTINUE
+ 129 CONTINUE
+C
+ IF (IDO .LT. L1) GO TO 132
+ DO 131 K=1,L1
+ DO 130 I=1,IDO
+ CC(I,1,K) = CH(I,K,1)
+ 130 CONTINUE
+ 131 CONTINUE
+ GO TO 135
+ 132 DO 134 I=1,IDO
+ DO 133 K=1,L1
+ CC(I,1,K) = CH(I,K,1)
+ 133 CONTINUE
+ 134 CONTINUE
+ 135 DO 137 J=2,IPPH
+ JC = IPP2-J
+ J2 = J+J
+ DO 136 K=1,L1
+ CC(IDO,J2-2,K) = CH(1,K,J)
+ CC(1,J2-1,K) = CH(1,K,JC)
+ 136 CONTINUE
+ 137 CONTINUE
+ IF (IDO .EQ. 1) RETURN
+ IF (NBD .LT. L1) GO TO 141
+ DO 140 J=2,IPPH
+ JC = IPP2-J
+ J2 = J+J
+ DO 139 K=1,L1
+ DO 138 I=3,IDO,2
+ IC = IDP2-I
+ CC(I-1,J2-1,K) = CH(I-1,K,J)+CH(I-1,K,JC)
+ CC(IC-1,J2-2,K) = CH(I-1,K,J)-CH(I-1,K,JC)
+ CC(I,J2-1,K) = CH(I,K,J)+CH(I,K,JC)
+ CC(IC,J2-2,K) = CH(I,K,JC)-CH(I,K,J)
+ 138 CONTINUE
+ 139 CONTINUE
+ 140 CONTINUE
+ RETURN
+ 141 DO 144 J=2,IPPH
+ JC = IPP2-J
+ J2 = J+J
+ DO 143 I=3,IDO,2
+ IC = IDP2-I
+ DO 142 K=1,L1
+ CC(I-1,J2-1,K) = CH(I-1,K,J)+CH(I-1,K,JC)
+ CC(IC-1,J2-2,K) = CH(I-1,K,J)-CH(I-1,K,JC)
+ CC(I,J2-1,K) = CH(I,K,J)+CH(I,K,JC)
+ CC(IC,J2-2,K) = CH(I,K,JC)-CH(I,K,J)
+ 142 CONTINUE
+ 143 CONTINUE
+ 144 CONTINUE
+ RETURN
+ END
diff --git a/BB86/fort.20 b/BB86/fort.20
new file mode 100755
index 0000000..595307d
Binary files /dev/null and b/BB86/fort.20 differ
diff --git a/BB86/fort.21 b/BB86/fort.21
new file mode 100755
index 0000000..a4cfc43
Binary files /dev/null and b/BB86/fort.21 differ
diff --git a/BB86/fort.22 b/BB86/fort.22
new file mode 100755
index 0000000..f1491f9
Binary files /dev/null and b/BB86/fort.22 differ
diff --git a/BB86/fort.30 b/BB86/fort.30
new file mode 100755
index 0000000..b4eda79
Binary files /dev/null and b/BB86/fort.30 differ
diff --git a/BB86/fort.31 b/BB86/fort.31
new file mode 100755
index 0000000..0951536
Binary files /dev/null and b/BB86/fort.31 differ
diff --git a/BB86/fort.32 b/BB86/fort.32
new file mode 100755
index 0000000..141d0eb
Binary files /dev/null and b/BB86/fort.32 differ
diff --git a/BB86/input b/BB86/input
new file mode 100755
index 0000000..7aa8e56
--- /dev/null
+++ b/BB86/input
@@ -0,0 +1,4 @@
+0,360
+1200
+500.e5,4500.e5
+-1.0,2
diff --git a/IDL/UTILITIES/closeps.pro b/IDL/UTILITIES/closeps.pro
new file mode 100755
index 0000000..bb0d793
--- /dev/null
+++ b/IDL/UTILITIES/closeps.pro
@@ -0,0 +1,115 @@
+;+
+;
+; @file_comments
+; Close the Postscript mode
+;
+; when archive_ps ne 0, we add the name and the date at the bottom left corner
+; of the postscript page.
+; If the postscript is called idl.ps we change its name to number.ps
+; (number automatically found to be 1 larger that any of the existing ps file)
+;
+; @keyword INFOWIDGET {type=long integer}
+; id of the information widget (created by openps)
+; that we have to destroy at the end of closeps (when the postscript is done).
+;
+; @uses
+; cm_4ps
+;
+; @history
+; Sebastien Masson (smasson\@lodyc.jussieu.fr)
+; 21/12/98
+; June 2005: Sebastien Masson, english version with new commons
+;
+; @version
+; $Id: closeps.pro 371 2008-08-07 09:32:02Z pinsard $
+;
+;-
+PRO closeps, INFOWIDGET=infowidget
+;
+compile_opt idl2, strictarrsubs
+;
+IF lmgr(/demo) EQ 1 THEN return
+;
+;@cm_4ps
+ IF NOT keyword_set(key_forgetold) THEN BEGIN
+;@updatenew
+ ENDIF
+;
+ IF !d.name NE 'PS' THEN GOTO, last_part
+;------------------------------------------------------------
+; if archive_ps /= 0 we will add its name and the date at the bottom
+; left corner of the page (in case if the postscript will be archived
+; in printps
+;------------------------------------------------------------
+ IF keyword_set(archive_ps) THEN BEGIN
+;------------------------------------------------------------
+; we get the name of the latest created postscript.
+;------------------------------------------------------------
+ psdir = isadirectory(psdir, title = 'Select psdir')
+ nameps = file_search(psdir+'*.ps' $
+ , /test_regular, /test_write, /nosort)
+ dates = (file_info(nameps)).mtime
+ lastdate = (reverse(sort(temporary(dates))))[0]
+ nameps = nameps[lastdate]
+ nameps = file_basename(nameps, '.ps')
+; If this name is idl.ps then we change it to the number.ps
+ IF nameps EQ 'idl' then BEGIN
+; get the name of all the *.ps or *.ps.gz files available in psdir
+ allps = file_search(psdir+'*[.ps|.ps.gz|.pdf]', /test_regular, /nosort)
+ allps = file_basename(file_basename(allps,'.gz'),'.ps')
+ allps = file_basename(allps,'.pdf')
+; find which of these names corresponds to numbers...
+; get ascii codes of the names
+ testnumb = byte(allps)
+; longest name
+ maxstrlen = (size(testnumb, /dimensions))[0]
+; ascii codes can be 0 or between byte('0') and byte('9')
+ testnumb = testnumb EQ 0 OR $
+ (testnumb GE (byte('0'))[0] AND testnumb LE (byte('9'))[0])
+ testnumb = where(total(testnumb, 1) EQ maxstrlen, count)
+ IF count NE 0 THEN BEGIN
+; get the largest number
+ psnumber = fix(allps[testnumb])
+ psnumber = (psnumber[reverse(sort(psnumber))])[0] + 1
+ ENDIF ELSE psnumber = 0
+ nameps = strtrim(psnumber, 2)
+ ENDIF
+;------------------------------------------------------------
+; we annotate the postscript
+;------------------------------------------------------------
+ date = byte(systime(0)) ; we get the date
+ xyouts, !d.x_px_cm, !d.y_px_cm $
+ , nameps+') '+string(date[4:10])+string(date[20:23]) $
+ , /device, charsize = .75
+ ENDIF
+;------------------------------------------------------------
+; close the postscript mode
+ device, /close
+;
+last_part:
+;
+ thisOS = strupcase(strmid(!version.os_family, 0, 3))
+ CASE thisOS of
+ 'MAC': SET_PLOT, thisOS
+ 'WIN': SET_PLOT, thisOS
+ ELSE: SET_PLOT, 'X'
+ ENDCASE
+; def_myuniquetmpdir
+; colorfile = myuniquetmpdir + 'original_colors.dat'
+; IF file_test(colorfile, /regular) THEN BEGIN
+; restore, colorfile
+; file_delete, colorfile, /quiet
+; ; reload the original colors
+; tvlct, red, green, blue
+; ENDIF
+ !p.font = -1
+; force background color to the last color (white)
+ ; !p.BACKGROUND=(!d.n_colors-1) < 255
+ ; !p.color=0
+ ; if !d.n_colors gt 256 then !p.background='ffffff'x
+;------------------------------------------------------------
+ if keyword_set(infowidget) then $
+ widget_control, long(infowidget), bad_id = toto, /destroy
+;------------------------------------------------------------
+ return
+end
diff --git a/IDL/UTILITIES/colorbar2.pro b/IDL/UTILITIES/colorbar2.pro
new file mode 100755
index 0000000..3a6a16f
--- /dev/null
+++ b/IDL/UTILITIES/colorbar2.pro
@@ -0,0 +1,467 @@
+;+
+; NAME:
+; COLORBAR
+;
+; PURPOSE:
+;
+; The purpose of this routine is to add a color bar to the current
+; graphics window.
+;
+; AUTHOR:
+;
+; FANNING SOFTWARE CONSULTING
+; David Fanning, Ph.D.
+; 1645 Sheely Drive
+; Fort Collins, CO 80526 USA
+; Phone: 970-221-0438
+; E-mail: davidf@dfanning.com
+; Coyote's Guide to IDL Programming: http://www.dfanning.com/
+;
+; CATEGORY:
+;
+; Graphics, Widgets.
+;
+; CALLING SEQUENCE:
+;
+; COLORBAR
+;
+; INPUTS:
+;
+; None.
+;
+; KEYWORD PARAMETERS:
+;
+; ANNOTATECOLOR: The name of the "annotation color" to use. The names are those for
+; FSC_COLOR, and using the keyword implies that FSC_COLOR is also in
+; your !PATH. If this keyword is used, the annotation color is loaded
+; *after* the color bar is displayed. The color will be represented
+; as theColor = FSC_COLOR(ANNOTATECOLOR, COLOR). This keyword is provide
+; to maintain backward compatibility, but also to solve the problem of
+; and extra line in the color bar when this kind of syntax is used in
+; conjunction with the indexed (DEVICE, DECOMPOSED=0) model is used:
+;
+; LoadCT, 33
+; TVImage, image
+; Colorbar, Color=FSC_Color('firebrick')
+;
+; The proper syntax for device-independent color is like this:
+;
+; LoadCT, 33
+; TVImage, image
+; Colorbar, AnnotateColor='firebrick', Color=255
+;
+; BOTTOM: The lowest color index of the colors to be loaded in
+; the bar.
+;
+; CHARSIZE: The character size of the color bar annotations. Default is 1.0.
+;
+; COLOR: The color index of the bar outline and characters. Default
+; is !P.Color..
+;
+; DIVISIONS: The number of divisions to divide the bar into. There will
+; be (divisions + 1) annotations. The default is 6.
+;
+; FONT: Sets the font of the annotation. Hershey: -1, Hardware:0, True-Type: 1.
+;
+; FORMAT: The format of the bar annotations. Default is '(I0)'.
+;
+; INVERTCOLORS: Setting this keyword inverts the colors in the color bar.
+;
+; MAXRANGE: The maximum data value for the bar annotation. Default is
+; NCOLORS.
+;
+; MINRANGE: The minimum data value for the bar annotation. Default is 0.
+;
+; MINOR: The number of minor tick divisions. Default is 2.
+;
+; NCOLORS: This is the number of colors in the color bar.
+;
+; NODISPLAY: COLORBAR uses FSC_COLOR to specify some of it colors. Normally,
+; FSC_COLOR loads "system" colors as part of its palette of colors.
+; In order to do so, it has to create an IDL widget, which in turn
+; has to make a connection to the windowing system. If your program
+; is being run without a window connection, then this program will
+; fail. If you can live without the system colors (and most people
+; don't even know they are there, to tell you the truth), then setting
+; this keyword will keep them from being loaded, and you can run
+; COLORBAR without a display.
+;
+; POSITION: A four-element array of normalized coordinates in the same
+; form as the POSITION keyword on a plot. Default is
+; [0.88, 0.10, 0.95, 0.90] for a vertical bar and
+; [0.10, 0.88, 0.90, 0.95] for a horizontal bar.
+;
+; RANGE: A two-element vector of the form [min, max]. Provides an
+; alternative way of setting the MINRANGE and MAXRANGE keywords.
+;
+; REVERSE: Setting this keyword reverses the colors in the colorbar.
+;
+; RIGHT: This puts the labels on the right-hand side of a vertical
+; color bar. It applies only to vertical color bars.
+;
+; TICKNAMES: A string array of names or values for the tick marks.
+;
+; TITLE: This is title for the color bar. The default is to have
+; no title.
+;
+; TOP: This puts the labels on top of the bar rather than under it.
+; The keyword only applies if a horizontal color bar is rendered.
+;
+; VERTICAL: Setting this keyword give a vertical color bar. The default
+; is a horizontal color bar.
+;
+; COMMON BLOCKS:
+;
+; None.
+;
+; SIDE EFFECTS:
+;
+; Color bar is drawn in the current graphics window.
+;
+; RESTRICTIONS:
+;
+; The number of colors available on the graphics display device (not the
+; PostScript device) is used unless the NCOLORS keyword is used.
+;
+; Requires the FSC_COLOR program from the Coyote Library:
+;
+; http://www.dfanning.com/programs/fsc_color.pro
+;
+; EXAMPLE:
+;
+; To display a horizontal color bar above a contour plot, type:
+;
+; LOADCT, 5, NCOLORS=100
+; CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $
+; C_COLORS=INDGEN(25)*4, NLEVELS=25
+; COLORBAR, NCOLORS=100, POSITION=[0.15, 0.85, 0.95, 0.90]
+;
+; MODIFICATION HISTORY:
+;
+; Written by: David W. Fanning, 10 JUNE 96.
+; 10/27/96: Added the ability to send output to PostScript. DWF
+; 11/4/96: Substantially rewritten to go to screen or PostScript
+; file without having to know much about the PostScript device
+; or even what the current graphics device is. DWF
+; 1/27/97: Added the RIGHT and TOP keywords. Also modified the
+; way the TITLE keyword works. DWF
+; 7/15/97: Fixed a problem some machines have with plots that have
+; no valid data range in them. DWF
+; 12/5/98: Fixed a problem in how the colorbar image is created that
+; seemed to tickle a bug in some versions of IDL. DWF.
+; 1/12/99: Fixed a problem caused by RSI fixing a bug in IDL 5.2. Sigh... DWF.
+; 3/30/99: Modified a few of the defaults. DWF.
+; 3/30/99: Used NORMAL rather than DEVICE coords for positioning bar. DWF.
+; 3/30/99: Added the RANGE keyword. DWF.
+; 3/30/99: Added FONT keyword. DWF
+; 5/6/99: Many modifications to defaults. DWF.
+; 5/6/99: Removed PSCOLOR keyword. DWF.
+; 5/6/99: Improved error handling on position coordinates. DWF.
+; 5/6/99. Added MINOR keyword. DWF.
+; 5/6/99: Set Device, Decomposed=0 if necessary. DWF.
+; 2/9/99: Fixed a problem caused by setting BOTTOM keyword, but not NCOLORS. DWF.
+; 8/17/99. Fixed a problem with ambiguous MIN and MINOR keywords. DWF
+; 8/25/99. I think I *finally* got the BOTTOM/NCOLORS thing sorted out. :-( DWF.
+; 10/10/99. Modified the program so that current plot and map coordinates are
+; saved and restored after the colorbar is drawn. DWF.
+; 3/18/00. Moved a block of code to prevent a problem with color decomposition. DWF.
+; 4/28/00. Made !P.Font default value for FONT keyword. DWF.
+; 9/26/00. Made the code more general for scalable pixel devices. DWF.
+; 1/16/01. Added INVERTCOLORS keyword. DWF.
+; 5/11/04. Added TICKNAME keyword. DWF.
+; 9/29/05. Added REVERSE keywords, which does the *exact* same thing as
+; INVERTCOLORS, but I can never remember the latter keyword name. DWF.
+; 1/2/07. Added ANNOTATECOLOR keyword. DWF.
+; 4/14/07. Changed the default FORMAT to I0. DWF.
+; 5/1/07. Unexpected consequence of default format change is colorbar annotations
+; no longer match contour plot levels. Changed to explicit formating of
+; colorbar axis labels before PLOT command. DWF.
+; 5/25/07. Previous change has unanticipated effect on color bars using
+; logarithmic scaling, which is not really supported, but I have an
+; article on my web page describing how to do it: http://www.dfanning.com/graphics_tips/logcb.html.
+; Thus, I've fixed the program to accommodate log scaling, while still not OFFICIALLY
+; supporting it. DWF.
+; 10/3/07. Method used to calculate TICKNAMES produces incorrect values in certain cases when
+; the min and max range values are integers. Now force range values to be floats. DWF.
+; 10/17/07. Accidentaly use of INTERP keyword in CONGRID results in wrong bar values for
+; low NCOLORS numbers when INVERTCOLORS or REVERSE keyword is used. Removed INTERP keyword. DWF.
+; 11/10/07. Finished fixing program to accommodate log scaling in ALL possible permutations. DWF.
+; 8 Feb 2008. Added CRONJOB keyword and decided to use month names when I write the date. DWF.
+; 8 Feb 2008. Renamed CRONJOB to NODISPLAY to better reflect its purpose. DWF.
+;-
+;
+;###########################################################################
+;
+; LICENSE
+;
+; This software is OSI Certified Open Source Software.
+; OSI Certified is a certification mark of the Open Source Initiative.
+;
+; Copyright 2000-2008 Fanning Software Consulting.
+;
+; This software is provided "as-is", without any express or
+; implied warranty. In no event will the authors be held liable
+; for any damages arising from the use of this software.
+;
+; Permission is granted to anyone to use this software for any
+; purpose, including commercial applications, and to alter it and
+; redistribute it freely, subject to the following restrictions:
+;
+; 1. The origin of this software must not be misrepresented; you must
+; not claim you wrote the original software. If you use this software
+; in a product, an acknowledgment in the product documentation
+; would be appreciated, but is not required.
+;
+; 2. Altered source versions must be plainly marked as such, and must
+; not be misrepresented as being the original software.
+;
+; 3. This notice may not be removed or altered from any source distribution.
+;
+; For more information on Open Source Software, visit the Open Source
+; web site: http://www.opensource.org.
+;
+;###########################################################################
+
+
+PRO COLORBAR2, BOTTOM=bottom, CHARSIZE=charsize, COLOR=color, DIVISIONS=divisions, $
+ FORMAT=format, POSITION=position, MAXRANGE=maxrange, MINRANGE=minrange, NCOLORS=ncolors, $
+ TITLE=title, VERTICAL=vertical, TOP=top, RIGHT=right, MINOR=minor, $
+ RANGE=range, FONT=font, TICKLEN=ticklen, _EXTRA=extra, INVERTCOLORS=invertcolors, $
+ TICKNAMES=ticknames, REVERSE=reverse, ANNOTATECOLOR=annotatecolor, XLOG=xlog, YLOG=ylog, $
+ NODISPLAY=nodisplay
+
+ compile_opt idl2
+
+ ; Return to caller on error.
+ On_Error, 2
+
+ ; Save the current plot state.
+ bang_p = !P
+ bang_x = !X
+ bang_Y = !Y
+ bang_Z = !Z
+ bang_Map = !Map
+
+ ; Are scalable pixels available on the device?
+ IF (!D.Flags AND 1) NE 0 THEN scalablePixels = 1 ELSE scalablePixels = 0
+
+ ; Which release of IDL is this?
+ thisRelease = Float(!Version.Release)
+
+ ; Check and define keywords.
+ IF N_ELEMENTS(ncolors) EQ 0 THEN BEGIN
+
+ ; Most display devices to not use the 256 colors available to
+ ; the PostScript device. This presents a problem when writing
+ ; general-purpose programs that can be output to the display or
+ ; to the PostScript device. This problem is especially bothersome
+ ; if you don't specify the number of colors you are using in the
+ ; program. One way to work around this problem is to make the
+ ; default number of colors the same for the display device and for
+ ; the PostScript device. Then, the colors you see in PostScript are
+ ; identical to the colors you see on your display. Here is one way to
+ ; do it.
+
+ IF scalablePixels THEN BEGIN
+ oldDevice = !D.NAME
+
+ ; What kind of computer are we using? SET_PLOT to appropriate
+ ; display device.
+
+ thisOS = !VERSION.OS_FAMILY
+ thisOS = STRMID(thisOS, 0, 3)
+ thisOS = STRUPCASE(thisOS)
+ CASE thisOS of
+ 'MAC': SET_PLOT, thisOS
+ 'WIN': SET_PLOT, thisOS
+ ELSE: SET_PLOT, 'X'
+ ENDCASE
+
+ ; Here is how many colors we should use.
+ ncolors = !D.TABLE_SIZE
+ SET_PLOT, oldDevice
+ ENDIF ELSE ncolors = !D.TABLE_SIZE
+ ENDIF
+ IF N_ELEMENTS(bottom) EQ 0 THEN bottom = 0B
+ IF N_ELEMENTS(charsize) EQ 0 THEN charsize = 1.0
+ IF N_ELEMENTS(format) EQ 0 THEN format = '(I0)'
+ IF N_ELEMENTS(color) EQ 0 THEN color = !P.Color
+ minrange = (N_ELEMENTS(minrange) EQ 0) ? 0. : Float(minrange)
+ maxrange = (N_ELEMENTS(maxrange) EQ 0) ? Float(ncolors) : Float(maxrange)
+ IF N_ELEMENTS(ticklen) EQ 0 THEN ticklen = 0.2
+ IF N_ELEMENTS(minor) EQ 0 THEN minor = 2
+ IF N_ELEMENTS(range) NE 0 THEN BEGIN
+ minrange = Float(range[0])
+ maxrange = Float(range[1])
+ ENDIF
+ IF N_ELEMENTS(divisions) EQ 0 THEN divisions = 6
+ IF N_ELEMENTS(font) EQ 0 THEN font = !P.Font
+ IF N_ELEMENTS(title) EQ 0 THEN title = ''
+ xlog = Keyword_Set(xlog)
+ ylog = Keyword_Set(ylog)
+
+ ; You can't have a format set *and* use ticknames.
+ IF N_ELEMENTS(ticknames) NE 0 THEN format = ""
+
+ ; If the format is NOT null, then format the ticknames yourself.
+ IF (xlog XOR ylog) EQ 0 THEN BEGIN
+ IF format NE "" THEN BEGIN
+ step = (maxrange - minrange) / divisions
+ levels = minrange > (Indgen(divisions+1) * step + minrange) < maxrange
+ IF StrPos(StrLowCase(format), 'i') NE -1 THEN levels = Round(levels)
+ ticknames = String(levels, Format=format)
+ format = "" ; No formats allowed in PLOT call now that we have ticknames.
+ ENDIF
+ ENDIF
+
+ IF KEYWORD_SET(vertical) THEN BEGIN
+ bar = REPLICATE(1B,20) # BINDGEN(ncolors)
+ IF Keyword_Set(invertcolors) THEN bar = Reverse(bar, 2)
+ IF N_ELEMENTS(position) EQ 0 THEN BEGIN
+ position = [0.88, 0.1, 0.95, 0.9]
+ ENDIF ELSE BEGIN
+ IF position[2]-position[0] GT position[3]-position[1] THEN BEGIN
+ position = [position[1], position[0], position[3], position[2]]
+ ENDIF
+ IF position[0] GE position[2] THEN Message, "Position coordinates can't be reconciled."
+ IF position[1] GE position[3] THEN Message, "Position coordinates can't be reconciled."
+ ENDELSE
+ ENDIF ELSE BEGIN
+ bar = BINDGEN(ncolors) # REPLICATE(1B, 20)
+ IF Keyword_Set(invertcolors) THEN bar = Reverse(bar, 1)
+ IF N_ELEMENTS(position) EQ 0 THEN BEGIN
+ position = [0.1, 0.88, 0.9, 0.95]
+ ENDIF ELSE BEGIN
+ IF position[3]-position[1] GT position[2]-position[0] THEN BEGIN
+ position = [position[1], position[0], position[3], position[2]]
+ ENDIF
+ IF position[0] GE position[2] THEN Message, "Position coordinates can't be reconciled."
+ IF position[1] GE position[3] THEN Message, "Position coordinates can't be reconciled."
+ ENDELSE
+ ENDELSE
+
+ ; Scale the color bar.
+ bar = BYTSCL(bar, TOP=(ncolors-1) < (255-bottom)) + bottom
+
+ IF Keyword_Set(reverse) THEN BEGIN
+ IF Keyword_Set(vertical) THEN bar = Reverse(bar,2) ELSE bar = Reverse(bar,1)
+ ENDIF
+
+ ; Get starting locations in NORMAL coordinates.
+ xstart = position[0]
+ ystart = position[1]
+
+ ; Get the size of the bar in NORMAL coordinates.
+ xsize = (position[2] - position[0])
+ ysize = (position[3] - position[1])
+
+ ; Display the color bar in the window. Sizing is
+ ; different for PostScript and regular display.
+ IF scalablePixels THEN BEGIN
+
+ TV, bar, xstart, ystart, XSIZE=xsize, YSIZE=ysize, /Normal
+
+ ENDIF ELSE BEGIN
+
+ bar = CONGRID(bar, CEIL(xsize*!D.X_VSize), CEIL(ysize*!D.Y_VSize))
+
+ ; Decomposed color off if device supports it.
+ CASE StrUpCase(!D.NAME) OF
+ 'X': BEGIN
+ IF thisRelease GE 5.2 THEN Device, Get_Decomposed=thisDecomposed
+ Device, Decomposed=0
+ ENDCASE
+ 'WIN': BEGIN
+ IF thisRelease GE 5.2 THEN Device, Get_Decomposed=thisDecomposed
+ Device, Decomposed=0
+ ENDCASE
+ 'MAC': BEGIN
+ IF thisRelease GE 5.2 THEN Device, Get_Decomposed=thisDecomposed
+ Device, Decomposed=0
+ ENDCASE
+ ELSE:
+ ENDCASE
+
+ TV, bar, xstart, ystart, /Normal
+
+ ; Restore Decomposed state if necessary.
+ CASE StrUpCase(!D.NAME) OF
+ 'X': BEGIN
+ IF thisRelease GE 5.2 THEN Device, Decomposed=thisDecomposed
+ ENDCASE
+ 'WIN': BEGIN
+ IF thisRelease GE 5.2 THEN Device, Decomposed=thisDecomposed
+ ENDCASE
+ 'MAC': BEGIN
+ IF thisRelease GE 5.2 THEN Device, Decomposed=thisDecomposed
+ ENDCASE
+ ELSE:
+ ENDCASE
+
+ ENDELSE
+
+ ; Annotate the color bar.
+ IF N_Elements(annotateColor) NE 0 THEN $
+ color = FSC_Color(annotateColor, color, NODISPLAY=Keyword_Set(nodisplay))
+
+ IF KEYWORD_SET(vertical) THEN BEGIN
+
+ IF KEYWORD_SET(right) THEN BEGIN
+
+ PLOT, [minrange,maxrange], [minrange,maxrange], /NODATA, XTICKS=1, $
+ YTICKS=divisions, XSTYLE=1, YSTYLE=9, $
+ POSITION=position, COLOR=color, CHARSIZE=charsize, /NOERASE, $
+ XTICKFORMAT='(A1)', YTICKFORMAT='(A1)', YMINOR=minor, _EXTRA=extra, $
+ YTICKNAME=ticknames, FONT=font, YLOG=ylog
+
+ AXIS, YAXIS=1, YRANGE=[minrange, maxrange], YTICKFORMAT=format, YTICKS=divisions, $
+ YTICKLEN=ticklen, YSTYLE=1, COLOR=color, CHARSIZE=charsize, $
+ FONT=font, YTITLE=title, _EXTRA=extra, YMINOR=minor, YTICKNAME=ticknames, YLOG=ylog
+
+ ENDIF ELSE BEGIN
+
+ PLOT, [minrange,maxrange], [minrange,maxrange], /NODATA, XTICKS=1, $
+ YTICKS=divisions, YSTYLE=1, XSTYLE=1, TITLE=title, $
+ POSITION=position, COLOR=color, CHARSIZE=charsize, /NOERASE, $
+ XTICKFORMAT='(A1)', YTICKFORMAT=format, YMinor=minor, _EXTRA=extra, $
+ YTICKNAME=ticknames, YLOG=ylog, YTICKLEN=ticklen
+
+ ENDELSE
+
+ ENDIF ELSE BEGIN
+
+ IF KEYWORD_SET(top) THEN BEGIN
+
+ PLOT, [minrange,maxrange], [minrange,maxrange], /NODATA, XTICKS=divisions, $
+ YTICKS=1, XSTYLE=9, YSTYLE=1, $
+ POSITION=position, COLOR=color, CHARSIZE=charsize, /NOERASE, $
+ YTICKFORMAT='(A1)', XTICKFORMAT='(A1)', XTICKLEN=ticklen, $
+ XRANGE=[minrange, maxrange], FONT=font, XMINOR=minor,_EXTRA=extra, $
+ XTICKNAME=ticknames, XLOG=xlog
+
+ AXIS, XTICKS=divisions, XSTYLE=1, COLOR=color, CHARSIZE=charsize, $
+ XTICKFORMAT=format, XTICKLEN=ticklen, XRANGE=[minrange, maxrange], XAXIS=1, $
+ FONT=font, XTITLE=title, _EXTRA=extra, XCHARSIZE=charsize, XMINOR=minor, $
+ XTICKNAME=ticknames, XLOG=xlog
+
+ ENDIF ELSE BEGIN
+
+ PLOT, [minrange,maxrange], [minrange,maxrange], /NODATA, XTICKS=divisions, $
+ YTICKS=1, XSTYLE=1, YSTYLE=1, TITLE=title, $
+ POSITION=position, COLOR=color, CHARSIZE=charsize, /NOERASE, $
+ YTICKFORMAT='(A1)', XTICKFORMAT=format, XTICKLEN=ticklen, $
+ XRANGE=[minrange, maxrange], FONT=font, XMinor=minor, _EXTRA=extra, $
+ XTICKNAME=ticknames, XLOG=xlog
+
+ ENDELSE
+
+ ENDELSE
+
+ ; Restore the previous plot and map system variables.
+ !P = bang_p
+ !X = bang_x
+ !Y = bang_y
+ !Z = bang_z
+ !Map = bang_map
+
+END
diff --git a/IDL/UTILITIES/openps.pro b/IDL/UTILITIES/openps.pro
new file mode 100755
index 0000000..45de1bf
--- /dev/null
+++ b/IDL/UTILITIES/openps.pro
@@ -0,0 +1,130 @@
+;+
+;
+; @file_comments
+; switch to postscript mode and define it
+;
+; @param namepsin {in}{optional}
+; name of the postscript file.
+; Extension '.ps' is added if missing. It will be stored in the psdir directory.
+;
+; @keyword FILENAME
+; to define the name of the postscript file through a keyword rather than with
+; namepsin input argument (in this case the keyword can be pass through
+; different routines via _EXTRA keyword).
+;
+; @keyword INFOWIDGET
+; If INFOWIDGET is present, it specifies a named variable into which the id of
+; the widget giving information about the postscript creation is stored as a
+; long integer.
+; This id is needed by closeps to kill the information widget.
+;
+; @keyword KEEP_PFONT
+; activate to suppress the modification of !p.font
+; (by default we force !p.font = 0 to make smaller postscripts)
+;
+; @keyword PORTRAIT
+;
+; @keyword LANDSCAPE
+;
+; @keyword KEEPPFONT
+; same as keep_pfont
+;
+; @keyword LIGHTNESS
+; a scalar used to change the Lightness of the color palette to be able to
+; adjust according to the printer we use, the media (paper or slide)...
+; > 1 to get darker colors
+;
+; @keyword _EXTRA
+; Used to pass keywords to DEVICE.
+;
+; @uses
+; cm_4ps
+;
+; @history
+; Sebastien Masson (smasson\@lodyc.jussieu.fr)
+; 21/12/98
+; 1/2/98: ajout de nameps en input
+; 1/9/1999: ajout du mot cle FILENAME et du widget
+; June 2005: Sebastien Masson, cleaning, english version with new commons
+;
+; @version
+; $Id: openps.pro 371 2008-08-07 09:32:02Z pinsard $
+;
+;-
+PRO openps, namepsin, FILENAME=filename, PAGE_SIZE=page_size $
+ , KEEPPFONT=keeppfont, KEEP_PFONT=keep_pfont $
+ , PORTRAIT=key_portrait, LANDSCAPE=landscape $
+ , LIGHTNESS=Lightness, _EXTRA=ex
+;
+;
+ compile_opt idl2, strictarrsubs
+;
+ IF lmgr(/demo) EQ 1 THEN BEGIN
+ dummy = report('impossible to create a PS in demo mode')
+ return
+ ENDIF
+;
+;@cm_4ps
+IF NOT keyword_set(key_forgetold) THEN BEGIN
+;@updatenew
+ENDIF
+;------------------------------------------------------------
+; close the postscript device if we are already in postscript mode
+ IF !d.name EQ 'PS' THEN device, /close
+; switch to postscript mode
+ set_plot,'ps'
+;------------------------------------------------------------
+; if we use keyword Lightness
+; save the actual color palette in a temporary file
+; (to be restored when calling closeps
+;------------------------------------------------------------
+ IF n_elements(Lightness) NE 0 THEN BEGIN
+ IF Lightness NE 1 THEN BEGIN
+ tvlct, red, green, blue, /get
+ def_myuniquetmpdir
+ save, red, green, blue, filename = myuniquetmpdir + 'original_colors.dat'
+ palit, Lightness, red, green, blue
+ ENDIF
+ ENDIF
+;------------------------------------------------------------
+; we define the name of the file
+;------------------------------------------------------------
+ CASE 1 OF
+ n_params() EQ 1:nameps = namepsin
+ keyword_set(filename): nameps = filename
+ ELSE:nameps = xquestion('Name of the postscript file?', 'idl.ps', /chkwid)
+ ENDCASE
+; make sure that nameps ends with '.ps'
+ nameps = file_dirname(nameps, /mark_directory) + $
+ file_basename(nameps, '.ps') + '.ps'
+; add path (psdir) and check that nameps is ok
+; nameps = isafile(nameps, iodir = psdir, /new)
+;------------------------------------------------------------
+; we define xsize, ysize, xoffset and yoffset
+;------------------------------------------------------------
+ IF n_elements(portrait) NE 0 OR n_elements(landscape) NE 0 THEN $
+ key_portrait = keyword_set(portrait) * (1 - keyword_set(landscape))
+
+ if key_portrait EQ 1 then begin
+ xs = min(page_size)
+ ys = max(page_size)
+ xoff = 0.
+ yoff = 0.
+ ENDIF ELSE BEGIN
+ xs = max(page_size)
+ ys = min(page_size)
+ xoff = 0.
+ yoff = max(page_size)
+ ENDELSE
+;------------------------------------------------------------
+; We define the device of the postscript mode
+;------------------------------------------------------------
+ device, /color, /Helvetica, filename = strcompress(nameps, /remove_all) $
+ , LANDSCAPE = 1 - key_portrait, PORTRAIT = key_portrait $
+ , xsize = xs, ysize = ys, xoffset = xoff, yoffset = yoff $
+ , bits_per_pixel = 8, language_level = 2, _EXTRA = ex
+; to make smaller postcripts
+ IF NOT (keyword_set(keeppfont) OR keyword_set(keep_pfont)) $
+ THEN !p.font = 0
+ RETURN
+END
diff --git a/IDL/UTILITIES/read_depth_hycom.pro b/IDL/UTILITIES/read_depth_hycom.pro
new file mode 100755
index 0000000..a955fc0
--- /dev/null
+++ b/IDL/UTILITIES/read_depth_hycom.pro
@@ -0,0 +1,35 @@
+PRO read_depth_hycom, im, jm, file, bathy
+
+ ;; Script to read the HYCOM bathymetry file
+ ;; A. Bozec Aug, 2011
+
+ close,/all
+ ;; Dimensions of the domain
+ idm = im
+ jdm = jm
+ idm1 = float(idm)
+ ijdm = idm1*jdm
+
+
+ ;; NPAD size and Tabs definition
+ npad=4096. - ijdm MOD 4096
+ rr2 = fltarr(ijdm)
+ toto = fltarr(npad)
+ bathy = fltarr(idm, jdm)
+
+
+ ;; Grid Directory and file
+ file1 = file
+
+ ;; READING the file
+ openu, 1, file1, /swap_endian
+ readu, 1, rr2
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO bathy(i, j) = rr2(j*idm1+i)
+ ENDFOR
+ close, 1
+
+ ;; Mask the bathymetry
+ bathy(where(bathy GT 1e20)) = !values.f_nan
+
+END
diff --git a/IDL/UTILITIES/read_grid_hycom.pro b/IDL/UTILITIES/read_grid_hycom.pro
new file mode 100755
index 0000000..7df8243
--- /dev/null
+++ b/IDL/UTILITIES/read_grid_hycom.pro
@@ -0,0 +1,95 @@
+PRO read_grid_hycom, im, jm, io, file, plon, plat, ulon, ulat, vlon, vlat, qlon, qlat, pang, pscx, pscy, qscx, qscy, uscx, uscy, vscx, vscy, cori, pasp
+
+ ;; Script to read the HYCOM grid file
+ ;; A. Bozec Aug, 2011
+
+ close,/all
+
+ ;; Dimensions of the domain
+ idm = im
+ jdm = jm
+ idm1 = float(im)
+ ijdm = idm1*jdm
+
+ tt = fltarr(idm, jdm, 19)
+
+ ;; NPAD size
+ npad=4096. - ijdm MOD 4096
+ rr2 = fltarr(ijdm)
+ if (npad NE 4096) then toto = fltarr(npad)
+
+ ;; Grid Directory and file
+ iodir = io
+ plon = fltarr(idm, jdm)
+ plat = fltarr(idm, jdm)
+
+ qlon = fltarr(idm, jdm)
+ qlat = fltarr(idm, jdm)
+
+ ulon = fltarr(idm, jdm)
+ ulat = fltarr(idm, jdm)
+
+ vlon = fltarr(idm, jdm)
+ vlat = fltarr(idm, jdm)
+
+ pang= fltarr(idm, jdm)
+ pscx = fltarr(idm, jdm)
+ pscy = fltarr(idm, jdm)
+
+ qscx = fltarr(idm, jdm)
+ qscy = fltarr(idm, jdm)
+
+ uscx = fltarr(idm, jdm)
+ uscy = fltarr(idm, jdm)
+
+ vscx = fltarr(idm, jdm)
+ vscy = fltarr(idm, jdm)
+
+ cori = fltarr(idm, jdm)
+ pasp = fltarr(idm, jdm)
+
+ openu, 1, iodir+file, /swap_endian
+ FOR jk = 0, 18 DO BEGIN
+ if (npad NE 4096) then begin
+ readu, 1, rr2, toto
+ endif else begin
+ readu, 1, rr2
+ endelse
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO tt(i, j, jk) = rr2(j*idm1+i)
+ ENDFOR
+ ENDFOR
+
+ plon(*, *) = tt(*, *, 0)
+ plat(*, *) = tt(*, *, 1)
+
+ qlon(*, *) = tt(*, *, 2)
+ qlat(*, *) = tt(*, *, 3)
+
+ ulon(*, *) = tt(*, *, 4)
+ ulat(*, *) = tt(*, *, 5)
+
+ vlon(*, *) = tt(*, *, 6)
+ vlat(*, *) = tt(*, *, 7)
+
+ pang(*, *) = tt(*, *, 8)
+
+ pscx(*, *) = tt(*, *, 9)
+ pscy(*, *) = tt(*, *, 10)
+
+ qscx(*, *) = tt(*, *, 11)
+ qscy(*, *) = tt(*, *, 12)
+
+ uscx(*, *) = tt(*, *, 13)
+ uscy(*, *) = tt(*, *, 14)
+
+ vscx(*, *) = tt(*, *, 15)
+ vscy(*, *) = tt(*, *, 16)
+
+ cori(*, *) = tt(*, *, 17)
+ pasp(*, *) = tt(*, *, 18)
+
+ close, 1
+
+
+END
diff --git a/IDL/UTILITIES/sigma0_hycom.pro b/IDL/UTILITIES/sigma0_hycom.pro
new file mode 100755
index 0000000..652a44b
--- /dev/null
+++ b/IDL/UTILITIES/sigma0_hycom.pro
@@ -0,0 +1,15 @@
+FUNCTION sigma0_hycom, T, S
+
+
+;;
+;; --- coefficients for sigma-0 (based on Brydon & Sun fit)
+ C1= -1.36471E-01 & C2= 4.68181E-02
+ C3= 8.07004E-01 & C4=-7.45353E-03
+ C5= -2.94418E-03 & C6= 3.43570E-05
+ C7= 3.48658E-05
+
+;; --- sigma-theta as a function of temp (deg c) and salinity (mil)
+ SIG=(C1+C3*S+T*(C2+C5*S+T*(C4+C7*S+C6*T)))
+
+return,SIG
+end
diff --git a/IDL/UTILITIES/sigma2_hycom.pro b/IDL/UTILITIES/sigma2_hycom.pro
new file mode 100755
index 0000000..a785680
--- /dev/null
+++ b/IDL/UTILITIES/sigma2_hycom.pro
@@ -0,0 +1,15 @@
+FUNCTION sigma2_hycom, T, S
+
+
+;;
+;; --- coefficients for sigma-2 (based on Brydon & Sun fit)
+ C1= 9.77093E+00 & C2=-2.26493E-02
+ C3= 7.89879E-01 & C4=-6.43205E-03
+ C5=-2.62983E-03 & C6= 2.75835E-05
+ C7= 3.15235E-05
+
+;; --- sigma-theta as a function of temp (deg c) and salinity (mil)
+ SIG=(C1+C3*S+T*(C2+C5*S+T*(C4+C7*S+C6*T)))
+
+return,SIG
+end
diff --git a/IDL/UTILITIES/sofsig.pro b/IDL/UTILITIES/sofsig.pro
new file mode 100755
index 0000000..bc2c440
--- /dev/null
+++ b/IDL/UTILITIES/sofsig.pro
@@ -0,0 +1,23 @@
+FUNCTION sofsig, T, R, sig
+
+ IF (sig EQ 2) THEN BEGIN
+;; --- coefficients for sigma-2 (based on Brydon & Sun fit)
+ C1= 9.77093E+00 & C2=-2.26493E-02
+ C3= 7.89879E-01 & C4=-6.43205E-03
+ C5=-2.62983E-03 & C6= 2.75835E-05
+ C7= 3.15235E-05
+ ENDIF
+
+ IF (sig EQ 0) THEN BEGIN
+;; --- coefficients for sigma-0 (based on Brydon & Sun fit)
+ C1=-1.36471E-01 & C2= 4.68181E-02
+ C3= 8.07004E-01 & C4=-7.45353E-03
+ C5=-2.94418E-03 & C6= 3.43570E-05
+ C7= 3.48658E-05
+ ENDIF
+;
+; --- salinity (mil) as a function of sigma and temperature (deg c)
+ sof=(R-C1-T*(C2+T*(C4+C6*T)))/(C3+T*(C5+C7*T))
+
+return,sof
+end
diff --git a/IDL/UTILITIES/spherdist.pro b/IDL/UTILITIES/spherdist.pro
new file mode 100755
index 0000000..aeee9eb
--- /dev/null
+++ b/IDL/UTILITIES/spherdist.pro
@@ -0,0 +1,81 @@
+FUNCTION spherdist, lon1, lat1, lon2, lat2
+
+;;
+;; --- ------------------------------------------------
+;; --- Computes the distance between geo. pos.
+;; --- lon1,lat1 and lon2,lat2.
+;; --- input is in degrees.
+;;
+;; --- output is real*4 for better global consistancy,
+;; --- by truncating double precision roundoff errors.
+;; --- real*4 is not in f90, but is widely supported.
+;;
+;; --- Based on m_spherdist.F90 from Geir Evanson.
+;; --- ------------------------------------------------
+;;
+ invradian=double(0.017453292)
+ rearth=double(6371001.0) ; Radius of earth
+ deg360 = double(360.)
+ deg0 = double(0.)
+ deg90 = double(90.)
+ one = double(1.)
+;;
+;;
+;; ensure that spherdist(ax,ay,bx,by) == spherdist(bx,by,ax,ay)
+;;
+ dlon1 = double(lon1)
+ dlon1 = dlon1 MOD deg360
+ IF (dlon1 LT deg0) THEN dlon1 = dlon1 + deg360
+ lat1 = double(lat1)
+
+ dlon2 = double(lon2)
+ dlon2 = dlon2 MOD deg360
+ IF(dlon2 LT deg0) THEN dlon2 = dlon2 + deg360
+ lat2 = double(lat2)
+
+ CASE 1 OF
+ (lat1 LT lat2) : BEGIN
+ rlon1=dlon1*invradian ;lon1 in rad
+ rlat1=(deg90-lat1)*invradian ;90-lat1 in rad
+ rlon2=dlon2*invradian ;lon2 in rad
+ rlat2=(deg90-lat2)*invradian ;90-lat2 in rad
+ END
+ (lat1 EQ lat2) AND (dlon1 LE dlon2) : BEGIN
+ rlon1=dlon1*invradian ;lon1 in rad
+ rlat1=(deg90-lat1)*invradian ;90-lat1 in rad
+ rlon2=dlon2*invradian ;lon2 in rad
+ rlat2=(deg90-lat2)*invradian ;90-lat2 in rad
+ END
+ ELSE : BEGIN
+ rlon2=dlon1*invradian ;lon1 in rad
+ rlat2=(deg90-lat1)*invradian ;90-lat1 in rad
+ rlon1=dlon2*invradian ;lon2 in rad
+ rlat1=(deg90-lat2)*invradian ;90-lat2 in rad
+ END
+ ENDCASE
+
+
+
+;;;
+ x1= sin(rlat1)*cos(rlon1) ;x,y,z of pos 1.
+ y1= sin(rlat1)*sin(rlon1)
+ z1= cos(rlat1)
+;;
+ x2= sin(rlat2)*cos(rlon2) ;x,y,z of pos 2.
+ y2= sin(rlat2)*sin(rlon2)
+ z2= cos(rlat2)
+;;
+ dr=acos(min([one,x1*x2+y1*y2+z1*z2])) ; Arc length
+;;
+ spher=dr*rearth
+ spher = float(spher)
+;;
+return, spher
+
+
+
+; lon1 = -60.08
+; lon2 = -60.00
+; lat1 = 35.08
+; lat2 = 35.08
+END
diff --git a/IDL/UTILITIES/sub_var2.pro b/IDL/UTILITIES/sub_var2.pro
new file mode 100755
index 0000000..c047470
--- /dev/null
+++ b/IDL/UTILITIES/sub_var2.pro
@@ -0,0 +1,56 @@
+PRO sub_var2, im, jm, fName, num2, ivar, var
+
+
+ ;; Script to read a 2-D variable from hycom archive file
+ ;;----------------------------------------------------------------------
+ ;; Input:
+ ;; fName : file name '.a'
+ ;; im, jm : dimension for full domain
+ ;; num2 : number of 2d variables -- .b
+ ;; ivar : index of the 2d variable
+ ;;----------------------------------------------------------------------
+ ;;
+ ;; A. Bozec May, 2013
+
+ close,/all
+
+ ;; Dimensions of the domain
+ idm = im
+ jdm = jm
+ idm1 = float(im)
+ ijdm = idm1*jdm
+
+ tt = fltarr(idm, jdm, num2)
+
+ si_2d = num2
+
+ ;; NPAD size
+ npad=4096. - ijdm MOD 4096
+ rr2 = fltarr(ijdm)
+ toto = fltarr(npad)
+
+ ;; Directory and file
+ iodir = fName
+
+ ;; Tab Declaration
+ var = fltarr(idm, jdm)
+
+ ;; Open file
+ openr, 1, iodir, /swap_endian
+
+ ;; Read 2D fields
+ FOR jk = 0, si_2d-1 DO BEGIN
+ readu, 1, rr2, toto
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO tt(i, j, jk) = rr2(j*idm1+i)
+ ENDFOR
+ ENDFOR
+ var(*, *) = tt(*, *, ivar-1)
+
+ close, 1
+
+ ;; Put nan on missing values
+ var(where(var GT 1e20)) = !values.f_nan
+
+END
+
diff --git a/IDL/UTILITIES/sub_var3.pro b/IDL/UTILITIES/sub_var3.pro
new file mode 100755
index 0000000..770406f
--- /dev/null
+++ b/IDL/UTILITIES/sub_var3.pro
@@ -0,0 +1,68 @@
+PRO sub_var3, im, jm, km, fName, num2, num3, ivar, var
+
+
+ ;; Script to read a 3-D variable from hycom archive file
+ ;;----------------------------------------------------------------------
+ ;; Input:
+ ;; fName : file name '.a'
+ ;; im, jm, km : dimension for full domain
+ ;; num2/3 : number of 2d/3d variables -- .b
+ ;; ivar : index of the 3d variable (starting from 1st num3)
+ ;;----------------------------------------------------------------------
+ ;;
+ ;; A. Bozec May, 2013
+
+ close,/all
+
+ ;; Dimensions of the domain
+ idm = im
+ jdm = jm
+ idm1 = float(im)
+ ijdm = idm1*jdm
+ kdm = km
+
+ tt = fltarr(idm, jdm, num2)
+ tt1 = fltarr(idm, jdm, num3)
+
+ si_2d = num2
+ si_3d = num3
+
+ ;; NPAD size
+ npad=4096. - ijdm MOD 4096
+ rr2 = fltarr(ijdm)
+ toto = fltarr(npad)
+
+ ;; Directory and file
+ iodir = fName
+
+ ;; Tab Declaration
+ var = fltarr(idm, jdm, kdm)
+
+ ;; Open file
+ openr, 1, iodir, /swap_endian
+
+ ;; Read 2D fields
+ FOR jk = 0, si_2d-1 DO BEGIN
+ readu, 1, rr2, toto
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO tt(i, j, jk) = rr2(j*idm1+i)
+ ENDFOR
+ ENDFOR
+
+ ;; Read 3D fields
+ FOR ll = 0, kdm-1 DO BEGIN
+ FOR jk = 0, si_3d-1 DO BEGIN
+ readu, 1, rr2, toto
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO tt1(i, j, jk) = rr2(j*idm1+i)
+ ENDFOR
+ ENDFOR
+ var(*, *, ll) = tt1(*, *, ivar-1)
+ ENDFOR
+ close, 1
+ ;; Put nan on missing values
+ var(where(var GT 1e20)) = !values.f_nan
+
+
+END
+
diff --git a/IDL/UTILITIES/tofsig.pro b/IDL/UTILITIES/tofsig.pro
new file mode 100755
index 0000000..a3930f1
--- /dev/null
+++ b/IDL/UTILITIES/tofsig.pro
@@ -0,0 +1,42 @@
+FUNCTION tofsig, S, R, sig
+
+ IF (sig EQ 2.) THEN BEGIN
+;; --- coefficients for sigma-2 (based on Brydon & Sun fit)
+ C1= 9.77093E+00 & C2=-2.26493E-02
+ C3= 7.89879E-01 & C4=-6.43205E-03
+ C5=-2.62983E-03 & C6= 2.75835E-05
+ C7= 3.15235E-05
+ ENDIF
+ IF (sig EQ 0.) THEN BEGIN
+;; --- coefficients for sigma-0 (based on Brydon & Sun fit)
+ C1=-1.36471E-01 & C2= 4.68181E-02
+ C3= 8.07004E-01 & C4=-7.45353E-03
+ C5=-2.94418E-03 & C6= 3.43570E-05
+ C7= 3.48658E-05
+ ENDIF
+
+
+ AZERO =0.d
+ AHALF =1/2.d
+ ATHIRD =1/3.d
+ A1P5 =3.0/2d
+;; --- auxiliary statements for finding root of 3rd degree polynomial
+ A0=(C1+C3*S -R)/C6
+ A1=(C2+C5*S)/C6
+ A2=(C4+C7*S)/C6
+ CUBQ=ATHIRD*A1-(ATHIRD*A2)^2
+ CUBR=ATHIRD*(AHALF*A1*A2-A1P5*A0) -(ATHIRD*A2)^3
+;; --- if q**3+r**2>0, water is too dense to yield real root at given
+;; --- salinitiy. setting q**3+r**2=0 in that case is equivalent to
+;; --- lowering sigma until a double real root is obtained.
+ CUBAN=ATHIRD*ATAN(SQRT(MAX([AZERO,-(CUBQ^3+CUBR^2)])),CUBR)
+ CUBRL=SQRT(-CUBQ)*COS(CUBAN)
+ CUBIM=SQRT(-CUBQ)*SIN(CUBAN)
+
+; --- temp (deg c) as a function of sigma and salinity (mil)
+ TOF=-CUBRL+SQRT(3.)*CUBIM-ATHIRD*A2
+
+
+
+return,TOF
+end
diff --git a/IDL/UTILITIES/write_depth_hycom.pro b/IDL/UTILITIES/write_depth_hycom.pro
new file mode 100755
index 0000000..75dd1e4
--- /dev/null
+++ b/IDL/UTILITIES/write_depth_hycom.pro
@@ -0,0 +1,47 @@
+PRO write_depth_hycom, im, jm, file, bathy
+
+
+ close,/all
+ ;; Dimensions of the domain
+ idm = im
+ jdm = jm
+ idm1 = float(idm)
+ ijdm = idm1*jdm
+
+ ;; NPAD size
+ npad=4096. - ijdm MOD 4096
+ rr2 = fltarr(ijdm)
+ toto = fltarr(npad)
+
+ ;; mask for min max
+ tt = bathy
+ ind = where(tt GT 1e20)
+ IF (ind NE [-1] ) THEN tt(ind) = !values.f_nan
+
+ file1 = file
+
+ ;; READING the file
+ openw, 1, file+'.a', /swap_endian
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO rr2(j*idm1+i) = bathy(i, j)
+ ENDFOR
+ writeu, 1, rr2, toto
+ close, 1
+
+ ;; REWRITE .B
+
+ openw,1,file+'.b'
+ printf, 1, format = '(A10)', 'Bathymetry'
+ printf, 1, format = '(A5,1x,i4,1x,i3)', 'i/jdm ', idm, jdm
+ printf, 1, format = '(A1)', ' '
+ printf, 1, format = '(A1)', ''
+ printf, 1, format = '(A1)', ''
+ printf, 1, format = '(A18,1x,f8.3,2x,f8.3)','min,max depth = ', min(tt, /nan), max(tt, /nan)
+
+ close,1
+
+
+
+
+
+END
diff --git a/IDL/UTILITIES/write_grid_hycom.pro b/IDL/UTILITIES/write_grid_hycom.pro
new file mode 100755
index 0000000..d7dd7fd
--- /dev/null
+++ b/IDL/UTILITIES/write_grid_hycom.pro
@@ -0,0 +1,100 @@
+PRO write_grid_hycom, im, jm, io, file, plon, plat, ulon, ulat, vlon, vlat, qlon, qlat, pang, pscx, pscy, qscx, qscy, uscx, uscy, vscx, vscy, cori, pasp
+
+
+ close,/all
+
+; im = 271 & jm = 193
+; im = 541 & jm = 385
+; io = '/Users/abozec/IDL/IDL_DATA/GOMl0.08/topo/'
+; file = 'regional.grid.a'
+; file = 'regional.grid.GOMl0.04.a'
+
+ ;; Dimensions of the domain
+ idm = im
+ jdm = jm
+ idm1 = float(im)
+ ijdm = idm1*jdm
+
+ tt2 = fltarr(idm, jdm, 19)
+
+ ;; NPAD size
+ npad=4096. - ijdm MOD 4096
+ rr2 = fltarr(ijdm)
+ if (npad NE 4096) then toto = fltarr(npad)
+
+ ;; Grid Directory and file
+ iodir = io
+; file = 'regional.grid.a'
+
+ tt2(*, *, 0) = plon(*, *)
+ tt2(*, *, 1) = plat(*, *)
+
+ tt2(*, *, 2) = qlon(*, *)
+ tt2(*, *, 3) = qlat(*, *)
+
+ tt2(*, *, 4) = ulon(*, *)
+ tt2(*, *, 5) = ulat(*, *)
+
+ tt2(*, *, 6) = vlon(*, *)
+ tt2(*, *, 7) = vlat(*, *)
+
+ tt2(*, *, 8) = pang(*, *)
+
+ tt2(*, *, 9) = pscx(*, *)
+ tt2(*, *, 10) = pscy(*, *)
+
+ tt2(*, *, 11) = qscx(*, *)
+ tt2(*, *, 12) = qscy(*, *)
+
+ tt2(*, *, 13) = uscx(*, *)
+ tt2(*, *, 14) = uscy(*, *)
+
+ tt2(*, *, 15) = vscx(*, *)
+ tt2(*, *, 16) = vscy(*, *)
+
+ tt2(*, *, 17) = cori(*, *)
+ tt2(*, *, 18) = pasp(*, *)
+
+ openw, 1, io+file+'.a', /swap_endian
+ FOR jk = 0, 18 DO BEGIN
+ FOR j = 0, jm-1 DO BEGIN
+ FOR i = 0, im-1 DO rr2(j*idm1+i) =tt2(i, j, jk)
+ ENDFOR
+ if (npad NE 4096) then begin
+ writeu, 1, rr2, toto
+ endif else begin
+ writeu, 1, rr2
+ endelse
+ ENDFOR
+ close, 1
+
+
+ ;; Writing .b file
+ openw,1,io+file+'.b'
+ printf, 1, format = '(i8,1x,A33)', im, '''idm '' = longitudinal array size'
+ printf, 1, format = '(i8,1x,A32)', jm, '''jdm '' = latitudinal array size'
+ printf, 1, format = '(i8,1x,A53)', 0, '''mapflg'' = map flag (0=mercator,10=panam,12=ulon-panam)'
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','plon: min,max = ', min(tt2(*,*,0)), max(tt2(*,*,0))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','plat: min,max = ', min(tt2(*,*,1)), max(tt2(*,*,1))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','qlon: min,max = ', min(tt2(*,*,2)), max(tt2(*,*,2))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','qlat: min,max = ', min(tt2(*,*,3)), max(tt2(*,*,3))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','ulon: min,max = ', min(tt2(*,*,4)), max(tt2(*,*,4))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','ulat: min,max = ', min(tt2(*,*,5)), max(tt2(*,*,5))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','vlon: min,max = ', min(tt2(*,*,6)), max(tt2(*,*,6))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','vlat: min,max = ', min(tt2(*,*,7)), max(tt2(*,*,7))
+ printf, 1, format = '(A18,1x,E14.5,1x,E14.5)','pang: min,max = ', min(tt2(*,*,8)), max(tt2(*,*,8))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','pscx: min,max = ', min(tt2(*,*,9)), max(tt2(*,*,9))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','pscy: min,max = ', min(tt2(*,*,10)), max(tt2(*,*,10))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','qscx: min,max = ', min(tt2(*,*,11)), max(tt2(*,*,11))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','qscy: min,max = ', min(tt2(*,*,12)), max(tt2(*,*,12))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','uscx: min,max = ', min(tt2(*,*,13)), max(tt2(*,*,13))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','uscy: min,max = ', min(tt2(*,*,14)), max(tt2(*,*,14))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','vscx: min,max = ', min(tt2(*,*,15)), max(tt2(*,*,15))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','vscy: min,max = ', min(tt2(*,*,16)), max(tt2(*,*,16))
+ printf, 1, format = '(A18,1x,E14.5,1x,E14.5)','cori: min,max = ', min(tt2(*,*,17)), max(tt2(*,*,17))
+ printf, 1, format = '(A18,1x,f14.5,1x,f14.5)','pasp: min,max = ', min(tt2(*,*,18)), max(tt2(*,*,18))
+ close,1
+
+
+END
+
diff --git a/IDL/UTILITIES/write_relax_hycom.pro b/IDL/UTILITIES/write_relax_hycom.pro
new file mode 100755
index 0000000..2641ea9
--- /dev/null
+++ b/IDL/UTILITIES/write_relax_hycom.pro
@@ -0,0 +1,93 @@
+PRO write_relax_hycom, im, jm, km, io, file, field, d, res
+
+
+ ;; field='intf'
+ ;; field='temp'
+ ;; field='saln'
+ ;; d(kdm); target density
+
+ CASE (field) OF
+ 'intf': BEGIN
+ long_name = 'Interface Depths'
+ short_name = 'int'
+ END
+ 'temp': BEGIN
+ long_name = 'Potential Temperature'
+ short_name = 'tem'
+ END
+ 'saln': BEGIN
+ long_name = 'Salinity'
+ short_name = 'sal'
+ END
+
+ ENDCASE
+
+ close,/all
+
+ ;; Dimensions of the domain
+ kdm = km
+ idm = im
+ jdm = jm
+ idm1 = float(idm)
+ ijdm = idm1*jdm
+
+ ;; NPAD size
+ npad=4096. - ijdm MOD 4096
+ rr2 = fltarr(ijdm)
+ if (npad NE 4096) then toto = fltarr(npad)
+
+ ;; Grid Directory and file
+ file1 = io+file
+
+ ;; WRITING .a binary file
+ openw, 1, file1+'.a', /swap_endian
+ For t=0,11 do begin
+ FOR k = 0, kdm-1 DO BEGIN
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO rr2(j*idm1+i) = res(i, j, k, t)
+ ENDFOR
+ if (npad NE 4096) then begin
+ writeu, 1, rr2, toto
+ endif else begin
+ writeu, 1, rr2
+ endelse
+ ENDFOR
+ ENDFOR
+ close, 1
+
+
+ ;; WRITING .b text file
+ mo = findgen(12)+1
+ months = string(mo, format ='(i2.2)')
+ l = findgen(kdm)+1
+ layer = string(l, format ='(i2.2)')
+ density = d
+
+ ;; mask the field by nan
+ index = where(res GT 1e20)
+ IF (index NE [-1]) THEN res(index) = !values.f_nan
+
+ openw,1,file1+'.b'
+ printf, 1, format = '(A)', ''+long_name
+ printf, 1, format = '(A)', ''
+ printf, 1, format = '(A)', ''
+ printf, 1, format = '(A)', ''
+ printf, 1, format = '(A5,1x,i3,1x,i3)', 'i/jdm ', idm, jdm
+
+
+ FOR m = 0, 11 DO BEGIN
+ FOR k = 0, kdm-1 DO BEGIN
+ printf, 1, format = '(A,1x,i2.2,1x,i2.2,2x,f6.3,2x,E14.7,2x,E14.7)',' '+short_name+': month,layer,dens,range =', m+1, k+1, density(k), min(res(*, *, k), /nan), max(res(*, *, k), /nan)
+
+ ENDFOR
+ ENDFOR
+ close,1
+
+
+
+
+
+END
+
+
+
diff --git a/IDL/plot_res_bb86.pro b/IDL/plot_res_bb86.pro
new file mode 100755
index 0000000..8bbf1dd
--- /dev/null
+++ b/IDL/plot_res_bb86.pro
@@ -0,0 +1,256 @@
+PRO plot_res_bb86
+
+ close, /all
+ ;; include the Utilities function
+ iodir = '/Net/yucatan/abozec/BB86_PACKAGE/IDL/' ;; where you are
+ !path=expand_path('+/'+iodir+'UTILITIES')+':'+expand_path('+'+!dir)
+
+ ;; PATH
+ io = '/Net/yucatan/abozec/BB86_PACKAGE/'
+ ;; domain
+ idm = 101 & jdm = 101 ;; size of the domain
+ kdm = 2 ;; number of vertical layer in BB86
+ tdm = 1800 ;; number of time-stamp in bb86
+ dp0 = 500. ;; thickness of the 1st layer (m)
+ eps = 0.0001 ;; epsilon to avoid dividing by 0.
+ tplot1 = 1800 & tplot2 = 1800 ;; time-stamp to plot (starts from 1.)
+
+ ;; postscript parameters
+ PS = 1 ;; save as postscript
+ key_portrait = 0
+ page_size = [21.5900, 27.9400] ;; letter size
+ file_ps = '../PS/uv_dp_d'+string(tplot2, format = '(i4.4)')+'_bb86-hycom.ps'
+
+ ;; constants
+ rho = 1000. ;; reference density
+ g = 9.806 ;; gravity
+
+
+ ;; Read grid
+ file_grid = 'regional.grid.BB86.a'
+ read_grid_hycom, idm, jdm, io+'topo/', file_grid, plon, plat
+
+
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ ;; READ the HYCOM files
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ io_hycom = io+'expt_01.0/data/output/'
+
+ uhyc = fltarr(idm, jdm, kdm+1, tdm) ;; 1 more layer for the hybrid!!
+ vhyc = fltarr(idm, jdm, kdm+1, tdm)
+ dphyc = fltarr(idm, jdm, kdm+1, tdm)
+
+ FOR t = tplot1, tplot2 DO BEGIN
+ CASE 1 OF
+ (t LE 344): BEGIN
+ year = '0001'
+ day = string(t+16, format = '(i3.3)') ;; 16 u and v == 0. so we start at day 17.
+ END
+ (t GT 344) AND (t LE 704) : BEGIN
+ year = '0002'
+ day = string(t-344, format = '(i3.3)')
+ END
+ (t GT 704) AND (t LE 1064) : BEGIN
+ year = '0003'
+ day = string(t-704, format = '(i3.3)')
+ END
+ (t GT 1064) AND (t LE 1424) : BEGIN
+ year = '0004'
+ day = string(t-1064, format = '(i3.3)')
+ END
+ (t GT 1424) AND (t LE 1784) : BEGIN
+ year = '0005'
+ day = string(t-1424, format = '(i3.3)')
+ END
+ (t GT 1784) AND (t LE 2144) : BEGIN
+ year = '0006'
+ day = string(t-1784, format = '(i3.3)')
+ END
+ ENDCASE
+ file = 'archv.'+year+'_'+day+'_00.a'
+ print, file, t
+
+ ;; archive files 2D variable units (see archv.*.b for the list of available var.)
+ ;; montg1 : *1./g to get in m
+ ;; srfhgt : *1./g to get in m
+ ;; surflx : W/m2
+ ;; salflx : kg/m2/s
+ ;; bl_dpth : *1./(rho*g) to get in m
+ ;; mix_dpth: *1./(rho*g) to get in m
+ ;; u_btrop : m/s
+ ;; v_btrop : m/s
+
+ ;; extract barotropic velocities (ubarot & vbarot)
+ num2 = 8 ;; number of 2D variables in the archive file
+ ivar_ub = 7 ;; index of ubaro (7th 2D variable)
+ ivar_vb = 8 ;; index of vbaro (8th 2D variable)
+ sub_var2, idm, jdm, io_hycom+file, num2, ivar_ub, ubaro
+ sub_var2, idm, jdm, io_hycom+file, num2, ivar_vb, vbaro
+
+
+ ;; archive files 3D variable units (see archv.*.b for the list of available var.)
+ ;; u-vel. : m/s
+ ;; v-vel. : m/s
+ ;; thknss : *1./(rho*g) to get in m
+ ;; temp : C
+ ;; salin : psu
+
+ ;; extract velocities (ubaroc & vbaroc)
+ num3 = 5 ;; number of 3D variables in the archive file
+ ivar_u = 1 ;; index of u baroclinic
+ ivar_v = 2 ;; index of v baroclinic
+ sub_var3, idm, jdm, kdm+1, io_hycom+file, num2, num3, ivar_u, ubac
+ sub_var3, idm, jdm, kdm+1, io_hycom+file, num2, num3, ivar_v, vbac
+
+ ;; Get utot & vtot
+ FOR k = 0, kdm DO uhyc(*, *, k, t-1) = ubaro(*, *)+ubac(*, *, k)
+ FOR k = 0, kdm DO vhyc(*, *, k, t-1) = vbaro(*, *)+vbac(*, *, k)
+
+
+ ;; extract the layer thickness
+ ivar_dp = 3
+ sub_var3, idm, jdm, kdm+1, io_hycom+file, num2, num3, ivar_dp, dp
+ dphyc(*, *, *, t-1) = dp/(rho*g)
+
+
+ ;; put the u on the p-grid
+
+ ;; get the umask
+ index = where(finite(uhyc) EQ 0.)
+ maskt = fltarr(idm, jdm, kdm+1, tdm)+1
+ if (index NE [-1]) then maskt(index) = 0.
+ maxval = maskt+shift(maskt, -1, 0, 0, 0)
+ maxval(where(maxval EQ 0.)) = !values.f_nan
+
+ ;; get the average value of u at the p-point
+ uthyc = (uhyc+shift(uhyc, -1, 0, 0, 0))/maxval
+ uthyc(idm-1, *, *, *) = uthyc(idm-2, *, *, *)
+
+ ;; put the v on the p-grid
+
+ ;; get the vmask
+ index = where(finite(vhyc) EQ 0.)
+ maskt = fltarr(idm, jdm, kdm+1, tdm)+1
+ if (index NE [-1]) then maskt(index) = 0.
+ maxval = maskt+shift(maskt, 0, -1, 0, 0)
+ maxval(where(maxval EQ 0.)) = !values.f_nan
+
+ ;; get the average value of v at the p-point
+ vthyc = (vhyc+shift(vhyc, 0, -1, 0, 0))/maxval
+ vthyc(*, jdm-1, *, *) = vthyc(*, jdm-2, *, *)
+
+
+ ENDFOR
+
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ ;; plot
+ for t = tplot1, tplot2 do begin
+
+ ;; norme, min and max of the plots
+ normeref_hyc = 0.05 ;; vector norm of HYCOM-BB86 (in m)
+ onevectout = 2 ;; plot one vector out of 'onevectorout'
+ min_dp = -450. & max_dp = 450. ;; layer thickness anomaly in m (min and max)
+
+
+ device, true_color = 24, decomposed = 0
+ IF (PS EQ 0 ) THEN BEGIN
+ dimensions = get_screen_size(RESOLUTION=resolution)
+ coef = floor(1./resolution[0])
+ windowsize_scale = 1.
+ coef = windowsize_scale * coef
+
+ mipgsz = min(page_size, max = mapgsz)
+
+ xsize = coef * (mipgsz*key_portrait + mapgsz*(1-key_portrait))
+ ysize = coef * (mipgsz*(1-key_portrait) + mapgsz*key_portrait)
+
+ window, 1, xsize = xsize, ysize = ysize
+ foreground = !P.Background & background = !P.Color
+ char = 1.
+ ENDIF
+ IF (PS EQ 1 ) THEN BEGIN
+ IF !d.name EQ 'PS' then device,/close
+ set_plot,'ps'
+ device, /color, /helvetica, filename = file_ps $
+ , LANDSCAPE = 1 - key_portrait, PORTRAIT = key_portrait $
+ , xsize = max(page_size), ysize = min(page_size), xoffset = 0., yoffset = max(page_size) $
+ , bits_per_pixel = 8
+ foreground = !P.Color & background = !P.Background
+ char = 0.75
+ ENDIF
+
+
+
+
+ loadct, 39 ;; color palette
+
+
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ ;; HYCOM-BB86
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ ;; get a blank plot
+ contour, reform(uthyc(*, *, 1, 0)), plon, plat, xstyle = 1, ystyle = 1, $
+ Color = foreground, Background = background, position = [0.1, 0.6, 0.45, 0.90], $
+ title = 'HYCOM-BB86 Velocity field day = '+string(t, format = '(i4.4)'), /nodata, $
+ xtitle = 'Longitude (E)', ytitle = 'Latitude (N)', charsize = char
+
+ ;; add the velocities vectors
+ ;; definition of ref vector (legend)
+ uref = fltarr(2, 2) & vref =fltarr(2, 2)
+ uref(0, 0) = 1
+
+ ;; get the vectors to plot
+ uu = reform(uthyc(0:idm-1:onevectout, 0:jdm-1:onevectout, 1, t-1))
+ vv = reform(vthyc(0:idm-1:onevectout, 0:jdm-1:onevectout, 1, t-1))
+ lon = reform(plon(0:idm-1:onevectout, 0))
+ lat = reform(plat(0, 0:jdm-1:onevectout))
+
+ ;; we normalize the vectors
+ normeref = normeref_hyc ;; in m
+ norme =sqrt(uu^2.+vv^2.)
+ normemax = max(norme, /nan)/normeref
+
+ ;; plotting
+ velovect, uu, vv, lon, lat, /overplot, color = 0., length = 3*normemax ;; ref vector over 3*dx
+
+ ;; add the ref vector in the legend take 3*dx (= 1.2º) as reference
+ velovect, uref, vref, [lon(3, 0), lon(4, 0)], [-1.2, 0.], /overplot, color = 0, length = 3
+ xyouts, 1.2, -2.5, string(normeref, format = '(f4.2)')+' m', color = 0
+
+
+
+ ;; plot the dp's
+ ;; defined colors
+ levels = 40
+ Minss = min_dp & Maxss = max_dp
+ step = (Maxss - Minss) / levels
+ num_level = IndGen(levels) * step + Minss
+ loadct, 33, ncolors = levels, bottom = 1
+
+ ;; get anomaly dp
+ diff_dp = reform(dphyc(*, *, 1, t-1)) -(dp0-1.)
+ diff_dp(where(finite(diff_dp) EQ 0)) = 0.
+ contour, diff_dp, plon, plat, xstyle = 1, ystyle = 1, levels = num_level, c_colors = indgen(levels), /fill, $
+ Color = foreground, Background = background, /follow, position = [0.5, 0.6, 0.85, 0.90], $
+ title = 'HYCOM-BB86 thickness ano. day = '+string(t, format = '(i4.4)'), $
+ xtitle = 'Longitude (E)', ytitle = 'Latitude (N)', /noerase, charsize = char
+ contour, diff_dp, plon, plat,levels = num_level, /overplot, color = 0
+
+ colorbar2, ncolors = levels, divisions = levels/4. , color = 0, range = [Minss, Maxss], $
+ position = [0.89, 0.60, 0.92, 0.9], format = '(f7.1)', /vertical, charsize = char
+
+
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ IF (PS EQ 1 ) THEN BEGIN
+ device, /close
+ set_plot, 'x'
+ ENDIF
+
+ device, decomposed = 1
+ endfor
+ stop
+
+END
diff --git a/IDL/write_depth_bb86.pro b/IDL/write_depth_bb86.pro
new file mode 100755
index 0000000..d830473
--- /dev/null
+++ b/IDL/write_depth_bb86.pro
@@ -0,0 +1,84 @@
+PRO write_depth_bb86
+
+ ;; include the Utilities functions
+ iodir = '/Net/yucatan/abozec/BB86_PACKAGE/IDL/' ;; where you are
+ !path=expand_path('+/'+iodir+'UTILITIES')+':'+expand_path('+'+!dir)
+
+ close, /all
+ ;; PATH
+ io = iodir+'/../topo/'
+ file_bat_new = 'depth_BB86_01' ;; !! without .a or .b !!
+ pl = 0 ;; 1 or 0 for plot or not
+
+ ;; size of the domain
+ idm = 101
+ jdm = 101
+
+ ;; definition of the bathymetry
+ depth = 5000. ;; constant bathy everywhere
+
+ ;; closed boundary (latbdy=0) or open boundaries (latbdy=1) or cyclic (latbdy =2)
+ latbdy = 0
+
+ ;;;;;;; END of the USER inputs ;;;;;;;;;;;;;;;
+
+ idm_hd = idm
+ jdm_hd = jdm
+ vmiss = 2.^100 ;; HYCOM missing values
+
+ ;; get the Depth
+ bathy_hd = fltarr(idm, jdm)
+ bathy_hd(*, *) = depth
+ print, 'Depth Ok'
+
+ ;; Plot
+ IF (pl EQ 1) THEN BEGIN
+ device, decomposed = 0
+
+ ;; defined colors
+ levels = 12
+ Minss = 4000. & Maxss = 6000.
+ step = (Maxss - Minss) / levels
+ num_level = IndGen(levels) * step + Minss
+ loadct, 33, ncolors = levels
+
+ ;; let's make a plot
+ window, 1, xsize = 800, ysize = 800
+ contour, bathy_hd, xstyle = 1, ystyle = 1, levels = num_level, c_colors = indgen(levels), /fill, $
+ Color = !P.Background, Background = !P.color, /follow, position = [0.15, 0.15, 0.85, 0.85]
+ colorbar2, ncolors = levels, divisions = levels, color = 0, range = [Minss, Maxss], $
+ position = [0.17, 0.08, 0.83, 0.10], format = '(f7.1)'
+
+ device, decomposed = 1
+ ENDIF
+
+ ;; Mask by missing values if any
+ ind = where(bathy_hd EQ 0.)
+ IF (ind NE [-1]) THEN bathy_hd (ind) = vmiss
+
+
+ ;; Get the edge of the domain right
+ CASE (latbdy) OF
+ 0: BEGIN
+ bathy_hd(*, jdm_hd-1) = vmiss
+ bathy_hd(idm_hd-1, *) = vmiss
+ bathy_hd(*, 0) = vmiss
+ bathy_hd(0, *) = vmiss
+ END
+ 1: BEGIN
+ bathy_hd(*, jdm_hd-1) = vmiss
+ bathy_hd(idm_hd-1, *) = vmiss
+ END
+ 2: BEGIN
+ bathy_hd(*, jdm_hd-1) = vmiss
+ bathy_hd(*, 0) = vmiss
+ END
+ ENDCASE
+
+
+ ;; write the file
+ write_depth_hycom, idm_hd, jdm_hd, io+file_bat_new, bathy_hd
+ print, 'Writing depth file done '
+
+ stop
+END
diff --git a/IDL/write_grid_bb86.pro b/IDL/write_grid_bb86.pro
new file mode 100755
index 0000000..253f1c5
--- /dev/null
+++ b/IDL/write_grid_bb86.pro
@@ -0,0 +1,134 @@
+PRO write_grid_bb86
+
+ ;; include the Utilities functions
+ iodir = '/Net/yucatan/abozec/BB86_PACKAGE/IDL/' ;; where you are
+ !path=expand_path('+/'+iodir+'UTILITIES')+':'+expand_path('+'+!dir)
+
+ close, /all
+ ;; PATH
+ io = iodir+'/../topo/'
+ file_grid_new = 'regional.grid.BB86' ;; !! without .a or .b !!
+
+ ;; size of the domain
+ idm = 101
+ jdm = 101
+
+ ;; longitude/latitude starting point + resolution (in degrees) (NB: those
+ ;; variables are not used in HYCOM)
+ ini_lon = 0.
+ ini_lat = 0.
+ res = 0.20
+
+ ;; scale dx and dy (in m) (used in HYCOM)
+ dx = 20e3
+ dy = dx
+
+
+ ;;;;;;; END of the USER inputs ;;;;;;;;;;;;;;;
+
+ ;; missing value in HYCOM
+ vmiss = 2.^100
+
+ ;; Get the p-point the grid
+ plon = fltarr(idm, jdm)
+ plat = fltarr(idm, jdm)
+
+ ;; Longitude
+ plon(0, *) = ini_lon
+ FOR i = 1, idm-1 DO plon(i, *) = plon(i-1, *) + res
+ ;; Latitude
+ plat(*, 0) = ini_lat
+ FOR j = 1, jdm-1 DO plat(*, j) = plat(*, j-1) + res
+
+ print, 'p-points grid OK'
+
+
+ ;; Declaration of the grid tabs
+ idm_hd = idm
+ jdm_hd = jdm
+
+ plon_hd = plon
+ plat_hd = plat
+
+ qlon_hd = fltarr(idm_hd, jdm_hd)
+ qlat_hd = fltarr(idm_hd, jdm_hd)
+ ulon_hd = fltarr(idm_hd, jdm_hd)
+ ulat_hd = fltarr(idm_hd, jdm_hd)
+ vlon_hd = fltarr(idm_hd, jdm_hd)
+ vlat_hd = fltarr(idm_hd, jdm_hd)
+
+ pang_hd = fltarr(idm_hd, jdm_hd)
+
+ pscx_hd = fltarr(idm_hd, jdm_hd)
+ pscy_hd = fltarr(idm_hd, jdm_hd)
+
+ qscx_hd = fltarr(idm_hd, jdm_hd)
+ qscy_hd = fltarr(idm_hd, jdm_hd)
+
+ uscx_hd = fltarr(idm_hd, jdm_hd)
+ uscy_hd = fltarr(idm_hd, jdm_hd)
+
+ vscx_hd = fltarr(idm_hd, jdm_hd)
+ vscy_hd = fltarr(idm_hd, jdm_hd)
+
+ cori_hd = fltarr(idm_hd, jdm_hd)
+ pasp_hd = fltarr(idm_hd, jdm_hd)
+
+
+ ;; Longitude/Latitude for each point
+ ;; longitude
+ vlon_hd = plon_hd
+ FOR i = 1, idm-1 DO BEGIN
+ qlon_hd(i, *) = 0.5*(plon_hd(i, *)+plon_hd(i-1, *))
+ ENDFOR
+ diff = plon_hd(2, 0)-plon_hd(1, 0)
+ qlon_hd(0, *) = plon_hd(0, *)-0.5*diff
+ ulon_hd = qlon_hd
+
+ ;; latitude
+ ulat_hd = plat_hd
+ FOR j = 1, jdm-1 DO BEGIN
+ qlat_hd(*, j) = 0.5*(plat_hd(*, j)+plat_hd(*, j-1))
+ ENDFOR
+ diff = plat_hd(0, 2)-plat_hd(0, 1)
+ qlat_hd(*, 0) = plat_hd(*, 0)-0.5*diff
+ vlat_hd = qlat_hd
+
+ ;; simplified grid with prescribed dx and dy
+ pscx_hd(*, *) = dx & pscy_hd(*, *) = dy
+ uscx_hd(*, *) = dx & uscy_hd(*, *) = dy
+ vscx_hd(*, *) = dx & vscy_hd(*, *) = dy
+ qscx_hd(*, *) = dx & qscy_hd(*, *) = dy
+
+ ;; Coriolis
+ beta = 2.E-11
+ FOR j= 0,jdm_hd-1 DO BEGIN
+ FOR i= 0,idm_hd-1 DO BEGIN
+ cori_hd(i, j)=.93e-4+float(j-(jdm_hd-2)/2)*dx*beta
+ ENDFOR
+ ENDFOR
+
+
+ ;; pang ( p-angle for rotated grid)
+ ;; here uniform or mercator so pang = 0.
+
+
+ ;; pasp= paspect: pscx/pscy
+
+ FOR j= 0,jdm_hd-1 DO BEGIN
+ FOR i= 0,idm_hd-1 DO BEGIN
+ pasp_hd(i,j) = pscx_hd(i,j)/pscy_hd(i,j)
+ ENDFOR
+ ENDFOR
+
+
+ ;; Writing new grid file
+ write_grid_hycom, idm_hd, jdm_hd, io, file_grid_new, plon_hd, plat_hd, ulon_hd, ulat_hd, vlon_hd, vlat_hd, qlon_hd, qlat_hd, pang_hd,pscx_hd, pscy_hd, qscx_hd, qscy_hd, uscx_hd, uscy_hd, vscx_hd, vscy_hd, cori_hd, pasp_hd
+
+ print, 'Writing grid file done '
+
+
+
+ stop
+
+END
diff --git a/IDL/write_relax_bb86.pro b/IDL/write_relax_bb86.pro
new file mode 100755
index 0000000..2ed4454
--- /dev/null
+++ b/IDL/write_relax_bb86.pro
@@ -0,0 +1,136 @@
+Forward_FUNCTION tofsig
+
+PRO write_relax_bb86
+
+ ;; include the Utilities functions
+ iodir = '/Net/yucatan/abozec/BB86_PACKAGE/IDL/' ;; where you are
+ !path=expand_path('+'+!dir)+':'+expand_path('+/'+iodir+'UTILITIES')
+
+ close, /all
+ ;; PATH
+ io = iodir+'../relax/010/'
+ file_topo = 'depth_BB86_01.a'
+ file_int_new = 'relax_int_BB86' ;; !! without .a or .b !!
+ file_tem_new = 'relax_tem_BB86'
+ file_sal_new = 'relax_sal_BB86'
+ pl = 0 ;; 1 or 0 for plot or not
+
+ ;; size of the domain
+ idm = 101
+ jdm = 101
+ kdm = 3 ;; number of layers (first layer very thin)
+ tdm = 12 ;; 12 month climatology
+
+ ;; interface depth
+ id = fltarr(kdm)
+ id = [0., 1.0, 500.] ;; first interface depth always 0.
+
+
+ ;; target density
+ ;; from bb86: rho=27.01037, rho=27.22136
+ d = fltarr(kdm)
+ d = [27.0100, 27.01037,27.22136]
+
+ ;; salinity profile
+ sa = fltarr(kdm)
+ sa = [37., 37., 37.]
+
+ ;;;;;;; END of the USER inputs ;;;;;;;;;;;;;;;
+
+ ;; constants
+ rho = 1000.
+ g = 9.806
+ vmiss = 2.^100
+
+ ;; temperature profile for sigma0
+ sigma = 0
+ te = fltarr(kdm)
+ FOR k = 0, kdm-1 DO te(k) = tofsig(sa(k), d(k), sigma)
+ print, te
+
+
+ ;; read bathy for mask
+ read_depth_hycom, idm, jdm, io+'../../topo/'+file_topo, bathy
+ ind = where(bathy GT 1e20)
+ IF (ind NE [-1]) THEN bathy(ind) = 0.
+ ;; create mask
+ mask2d = fltarr(idm, jdm)+1
+ mask2d(ind) = 0.
+ mask = fltarr(idm, jdm, kdm, tdm)
+ FOR t = 0, tdm-1 DO BEGIN
+ FOR k = 0, kdm-1 DO mask(*, *, k, t) = mask2d
+ ENDFOR
+
+ ;; interface depth files (first layer always the surface i.e. 0.)
+ int = fltarr(idm, jdm, kdm, tdm)
+ FOR k= 1, kdm-1 DO int(*, *, k, *) = rho*g * id(k) ;; 1st layer tiny to fake a two layer config
+
+ ;; make sure that the interface depths are not lower than the bathy
+ FOR t = 0, tdm-1 DO BEGIN
+ FOR k = 0, kdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO BEGIN
+ FOR j = 0, jdm-1 DO BEGIN
+ IF (int(i, j, k, t)/9806. GT bathy(i, j)) THEN int(i, j, k, t) = bathy(i,j)*9806.
+ ENDFOR
+ ENDFOR
+ ENDFOR
+ ENDFOR
+
+ ;; mask
+ ind3d = where(mask EQ 0.)
+ IF (ind3d NE [-1]) THEN int(ind3d) = vmiss
+
+ ;; write the field in relax file
+ write_relax_hycom, idm, jdm, kdm, io, file_int_new, 'intf', d, int
+ print, 'Interface depth OK'
+
+ ;; Temperature
+ tem = fltarr(idm, jdm, kdm, tdm)
+ FOR k = 0, kdm-1 DO tem(*, *, k, *) = te(k)
+
+ ;; mask
+ IF (ind3d NE [-1]) THEN tem(ind3d) = vmiss
+
+ ;; write the field in relax file
+ write_relax_hycom, idm, jdm, kdm, io, file_tem_new, 'temp', d, tem
+ print, 'Temperature OK'
+
+ ;; Salinity
+ sal = fltarr(idm, jdm, kdm, tdm)
+ FOR k = 0, kdm-1 DO sal(*, *, k, *) = sa(k)
+
+ ;; mask
+ IF (ind3d NE [-1]) THEN sal(ind3d) = vmiss
+
+ ;; write the field in relax file
+ write_relax_hycom, idm, jdm, kdm, io, file_sal_new, 'saln', d, sal
+ print, 'Salinity OK'
+
+
+
+ ;; Plot
+ IF (pl EQ 1) THEN BEGIN
+
+
+ device, decomposed = 0
+
+ ;; defined colors
+ levels = 15
+ Minss = 15. & Maxss = 18.
+ step = (Maxss - Minss) / levels
+ num_level = IndGen(levels) * step + Minss
+ loadct, 33, ncolors = levels
+
+ ;; let's make a plot
+ window, 1, xsize = 800, ysize = 800
+ contour, reform(tem(*, *, 1, 0)), xstyle = 1, ystyle = 1, levels = num_level, c_colors = indgen(levels), /fill, $
+ Color = !P.Background, Background = !P.color, /follow, position = [0.15, 0.15, 0.85, 0.85], title = 'Temperature 2st layer'
+ colorbar2, ncolors = levels, divisions = levels, color = 0, range = [Minss, Maxss], $
+ position = [0.17, 0.08, 0.83, 0.10], format = '(f7.1)'
+
+ device, decomposed = 1
+ ENDIF
+
+ stop
+
+END
diff --git a/IDL/write_windstress_bb86.pro b/IDL/write_windstress_bb86.pro
new file mode 100755
index 0000000..548f31f
--- /dev/null
+++ b/IDL/write_windstress_bb86.pro
@@ -0,0 +1,121 @@
+PRO write_windstress_bb86
+
+ ;; include the Utilities function
+ iodir = '/Net/yucatan/abozec/BB86_PACKAGE/IDL/' ;; where you are
+ !path=expand_path('+/'+iodir+'UTILITIES')+':'+expand_path('+'+!dir)
+
+ close, /all
+ ;; PATH
+ io = iodir+'/../force/'
+ file_grid = 'regional.grid.BB86.a'
+
+ ;; domain
+ idm = 101 & jdm = 101
+ tdm = 12 ;; monthly files
+
+ ;; name the new files
+ file_E = 'forcing.tauewd.BB86' ;; !! without .a or .b !!
+ file_N = 'forcing.taunwd.BB86'
+
+
+ ;; Read grid
+ read_grid_hycom, idm, jdm, io+'../topo/', file_grid, plon, plat
+
+ ;; Calculation of the analytical wind-stress (N/m2)
+ ustress = fltarr(jdm)
+ ustressb = fltarr(jdm)
+ stressa = -1.
+ sconv = 1.e-1 ;; scale factor form dyn/cm2 to N/m2
+
+ ;; BB86 formulation
+ FOR j = 0, jdm-1 DO ustress(j) = stressa*cos(float(j)/float(jdm-1)*6.28318530718)*sconv
+
+
+ ;; plot the stress
+ device, decomposed = 0
+ zeros = fltarr(jdm)
+ window, 1, xsize = 800, ysize = 800
+ plot, ustress, reform(plat(0, *)), xstyle = 1, ystyle = 1, ytitle = 'Latitude (N) ', xrange = [-0.2, 0.2], xtitle = 'Taux (N/m2)', $
+ Color = !P.Background, Background = !P.color
+ oplot, zeros, reform(plat(0, *)), linestyle = 1, color = 0
+
+
+ device, decomposed = 1
+
+
+ ;; Write the wind-stress files
+ tte = fltarr(idm, jdm, tdm)
+ ttn = fltarr(idm, jdm, tdm)
+
+ ijdm = float(idm)*jdm
+ idm1 = float(idm)
+ npad=4096. - ijdm MOD 4096
+ rr2 = fltarr(ijdm)
+ toto = fltarr(npad)
+
+ ;; we apply a taux , no tauy
+ FOR j = 0, jdm-1 DO tte(*, j, *) = ustress(j)
+
+ ;; Taux
+ openw, 1, io+file_E+'.a', /swap_endian
+
+ FOR ll = 0, tdm-1 DO BEGIN
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO rr2(j*idm1+i) = tte(i, j, ll)
+ ENDFOR
+ writeu, 1, rr2, toto
+ print, 'll= ', ll
+ ENDFOR
+ close, 1
+
+ ;; Tauy
+ openw, 1, io+file_N+'.a', /swap_endian
+ FOR ll = 0, tdm-1 DO BEGIN
+ FOR j = 0, jdm-1 DO BEGIN
+ FOR i = 0, idm-1 DO rr2(j*idm1+i) = ttn(i, j, ll)
+ ENDFOR
+ writeu, 1, rr2, toto
+ print, 'll= ', ll
+ ENDFOR
+ close, 1
+
+
+ ;; create .b file
+ mo = findgen(12)+1
+ months = string(mo, format ='(i2.2)')
+ time = findgen(12)+1
+ span = 0.250
+
+
+; openw,1,io+'tauewd_agul05_42S.b'
+ openw,1,io+file_E+'.b'
+ printf, 1, format = '(A22)', 'Analytical Wind-stress'
+ printf, 1, format = '(A1)', ''
+ printf, 1, format = '(A1)', ''
+ printf, 1, format = '(A1)', ''
+ printf, 1, format = '(A5,1x,i3,1x,i3)', 'i/jdm ', idm, jdm
+ FOR m = 0, tdm-1 DO BEGIN
+ printf,1,format = '(A23,1x,i2.2,1x,E14.7,2x,E14.7)',' tauewd: month,range =', time(m), min(tte(*, *, m)), max(tte(*, *, m))
+
+ ENDFOR
+;; tau_nwd: month,range = 01 -1.5917161E-01 1.5640029E-01
+
+ close,1
+
+ openw,1,io+file_N+'.b'
+ printf, 1, format = '(A22)', 'Analytical Wind-stress'
+ printf, 1, format = '(A1)', ''
+ printf, 1, format = '(A1)', ''
+ printf, 1, format = '(A1)', ''
+ printf, 1, format = '(A5,1x,i3,1x,i3)', 'i/jdm ', idm, jdm
+ FOR m = 0, tdm-1 DO BEGIN
+ printf,1,format = '(A23,1x,i2.2,1x,E14.7,2x,E14.7)',' taunwd: month,range =', time(m), min(ttn(*, *, m)), max(ttn(*, *, m))
+
+ ENDFOR
+
+ close,1
+
+
+stop
+
+END
diff --git a/MATLAB/UTILITIES/draw_arrowF.m b/MATLAB/UTILITIES/draw_arrowF.m
new file mode 100755
index 0000000..2f76e9a
--- /dev/null
+++ b/MATLAB/UTILITIES/draw_arrowF.m
@@ -0,0 +1,47 @@
+ function draw_arrowF(x1,x2,y1,y2,cf,beta,v_col,lwd);
+% ----------------------------------
+% draw_arrowF(x1,x2,y1,y2,cf,beta,v_col,lwd);
+%
+% draws arrow with filled "head"
+% Note: first X-coordinates x1, x2, then Y-coordinates, Y1,y2, ...
+% Draws an arrow between pnt (x1,y1) and pnt (x2,y2)
+% cf - scaling coefficient of the arrowhead (0 to 1)
+% beta - angle between vector and arrow head beams (degrees)
+% v_col - color ([R G B]) % default color is black
+% lwd - line width, default = 1
+%
+ if (isempty(v_col)); v_col=[0,0,0]; end; % default color is black
+ if (isempty(lwd)); lwd=1.; end; % default line width
+
+ hold on
+ uu=x2-x1;
+ vv=y2-y1;
+ sp=sqrt(uu.*uu+vv.*vv);
+ alfa=atan2(uu,vv); % vector angle from Y
+ beta=beta*pi/180;
+ var=cf*sp; % scaling of the arrow head
+ dX2=var.*sin(alfa-beta); % arrow head coordinates
+ dX3=var.*sin(alfa+beta); %
+ dY2=var.*cos(alfa-beta);
+ dY3=var.*cos(alfa+beta);
+ ax2=x2-dX2;
+ ax3=x2-dX3;
+ ay2=y2-dY2;
+ ay3=y2-dY3;
+%keyboard
+ x2v=x1+(1-cf)*uu;
+ y2v=y1+(1-cf)*vv;
+ p1=plot([x1 x2v],[y1 y2v],'Color',v_col); %vector
+% p2=plot([x2 ax2],[y2 ay2],'Color',v_col); % arrow head
+% p3=plot([x2 ax3],[y2 ay3],'Color',v_col);
+
+ set(p1,'linewidth',lwd);
+% set([p2,p3],'linewidth',0.5);
+
+ X=[x2,ax2,ax3,x2];
+ Y=[y2,ay2,ay3,y2];
+ H=fill(X,Y,v_col);
+ set(H,'edgecolor',v_col);
+
+
+% hold off
diff --git a/MATLAB/UTILITIES/read_depth_hycom.m b/MATLAB/UTILITIES/read_depth_hycom.m
new file mode 100755
index 0000000..de30143
--- /dev/null
+++ b/MATLAB/UTILITIES/read_depth_hycom.m
@@ -0,0 +1,29 @@
+function bathy=read_depth_hycom(im,jm,file)
+
+ %% Script to read the HYCOM bathymetry file
+ %% A. Bozec & D. Dukhovskoy Aug, 2011
+
+ %% Get the id of the bathymetry file
+ depth_fid=fopen(file,'r');
+ IDM=im;
+ JDM=jm;
+ IJDM=IDM*JDM;
+ npad=4096-mod(IJDM,4096);
+
+ %% Read bathymetry
+ [bathy,count]=fread(depth_fid,IJDM,'float32','ieee-be');
+
+ %% Mask bathymetry
+ y=find(bathy>1e20);
+ bathy(y)=NaN;
+ bathy=reshape(bathy,IDM,JDM)';
+
+ fclose(depth_fid);
+
+
+
+
+
+
+
+
diff --git a/MATLAB/UTILITIES/read_grid_hycom.m b/MATLAB/UTILITIES/read_grid_hycom.m
new file mode 100755
index 0000000..3737a44
--- /dev/null
+++ b/MATLAB/UTILITIES/read_grid_hycom.m
@@ -0,0 +1,96 @@
+function [plon, plat, ulon, ulat, vlon, vlat, qlon, qlat, pang, ...
+ pscx, pscy, qscx, qscy, uscx, uscy, vscx, vscy, cori, pasp]=read_grid_hycom(im, jm, io, file)
+
+ %% Script to read the HYCOM grid file
+ %% A. Bozec & D. Dukhovskoy Aug, 2011
+
+ %% Get the id of the grid file
+ flgr=[io,file];
+ grid_fid=fopen(flgr,'r');
+ IDM=im;
+ JDM=jm;
+ IJDM=IDM*JDM;
+ npad=4096-mod(IJDM,4096);
+
+ %% Read the grid
+
+ [plon,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+ fseek(grid_fid,4*(npad+IJDM),-1);
+ [plat,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,2*4*(npad+IJDM),-1);
+ [qlon,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+ fseek(grid_fid,3*4*(npad+IJDM),-1);
+ [qlat,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,4*4*(npad+IJDM),-1);
+ [ulon,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+ fseek(grid_fid,5*4*(npad+IJDM),-1);
+ [ulat,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,6*4*(npad+IJDM),-1);
+ [vlon,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+ fseek(grid_fid,7*4*(npad+IJDM),-1);
+ [vlat,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,8*4*(npad+IJDM),-1);
+ [pang,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,9*4*(npad+IJDM),-1);
+ [pscx,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+ fseek(grid_fid,10*4*(npad+IJDM),-1);
+ [pscy,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,11*4*(npad+IJDM),-1);
+ [qscx,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+ fseek(grid_fid,12*4*(npad+IJDM),-1);
+ [qscy,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,13*4*(npad+IJDM),-1);
+ [uscx,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+ fseek(grid_fid,14*4*(npad+IJDM),-1);
+ [uscy,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,15*4*(npad+IJDM),-1);
+ [vscx,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+ fseek(grid_fid,16*4*(npad+IJDM),-1);
+ [vscy,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,17*4*(npad+IJDM),-1);
+ [cori,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+ fseek(grid_fid,18*4*(npad+IJDM),-1);
+ [pasp,count]=fread(grid_fid,IJDM,'float32','ieee-be');
+
+
+ plon=reshape(plon,IDM,JDM)';
+ plat=reshape(plat,IDM,JDM)';
+
+ qlon=reshape(qlon,IDM,JDM)';
+ qlat=reshape(qlat,IDM,JDM)';
+
+ ulon=reshape(ulon,IDM,JDM)';
+ ulat=reshape(ulat,IDM,JDM)';
+
+ vlon=reshape(vlon,IDM,JDM)';
+ vlat=reshape(vlat,IDM,JDM)';
+
+ pang=reshape(pang,IDM,JDM)';
+
+ pscx=reshape(pscx,IDM,JDM)';
+ pscy=reshape(pscy,IDM,JDM)';
+ qscx=reshape(qscx,IDM,JDM)';
+ qscy=reshape(qscy,IDM,JDM)';
+
+ uscx=reshape(uscx,IDM,JDM)';
+ uscy=reshape(uscy,IDM,JDM)';
+ vscx=reshape(vscx,IDM,JDM)';
+ vscy=reshape(vscy,IDM,JDM)';
+
+ cori=reshape(cori,IDM,JDM)';
+
+ pasp=reshape(pasp,IDM,JDM)';
+
+ %% Close file
+ fclose(grid_fid);
+
diff --git a/MATLAB/UTILITIES/sigma0_hycom.m b/MATLAB/UTILITIES/sigma0_hycom.m
new file mode 100755
index 0000000..bf13f4f
--- /dev/null
+++ b/MATLAB/UTILITIES/sigma0_hycom.m
@@ -0,0 +1,14 @@
+function sig=sigma0_hycom(T,S)
+%%
+%% --- coefficients for sigma-0 (based on Brydon & Sun fit)
+ C1= -1.36471E-01 ;
+ C2= 4.68181E-02 ;
+ C3= 8.07004E-01 ;
+ C4= -7.45353E-03 ;
+ C5= -2.94418E-03 ;
+ C6= 3.43570E-05 ;
+ C7= 3.48658E-05 ;
+
+%% --- sigma-theta as a function of temp (deg c) and salinity (mil)
+ sig=(C1+C3*S+T.*(C2+C5*S+T.*(C4+C7*S+C6*T)))
+
diff --git a/MATLAB/UTILITIES/sigma2_hycom.m b/MATLAB/UTILITIES/sigma2_hycom.m
new file mode 100755
index 0000000..0ad262a
--- /dev/null
+++ b/MATLAB/UTILITIES/sigma2_hycom.m
@@ -0,0 +1,13 @@
+function sig=sigma2_hycom(T,S)
+%%
+%% --- coefficients for sigma-2 (based on Brydon & Sun fit)
+ C1= 9.77093E+00 ;
+ C2=-2.26493E-02 ;
+ C3= 7.89879E-01 ;
+ C4=-6.43205E-03 ;
+ C5=-2.62983E-03 ;
+ C6= 2.75835E-05 ;
+ C7= 3.15235E-05 ;
+
+%% --- sigma-theta as a function of temp (deg c) and salinity (mil)
+ sig=(C1+C3*S+T.*(C2+C5*S+T.*(C4+C7*S+C6*T)))
diff --git a/MATLAB/UTILITIES/sofsig.m b/MATLAB/UTILITIES/sofsig.m
new file mode 100755
index 0000000..a3b2ab5
--- /dev/null
+++ b/MATLAB/UTILITIES/sofsig.m
@@ -0,0 +1,25 @@
+function sof=sofsig(T,R,sig)
+
+ if (sig == 2.)
+%% --- coefficients for sigma-2 (based on Brydon & Sun fit)
+ C1= 9.77093E+00;
+ C2=-2.26493E-02;
+ C3= 7.89879E-01;
+ C4=-6.43205E-03;
+ C5=-2.62983E-03;
+ C6= 2.75835E-05;
+ C7= 3.15235E-05;
+ end
+ if (sig == 0.)
+%% --- coefficients for sigma-0 (based on Brydon & Sun fit)
+ C1=-1.36471E-01;
+ C2= 4.68181E-02;
+ C3= 8.07004E-01;
+ C4=-7.45353E-03;
+ C5=-2.94418E-03;
+ C6= 3.43570E-05;
+ C7= 3.48658E-05;
+ end
+
+%% --- salinity (mil) as a function of sigma and temperature (deg c)
+ sof=(R-C1-T*(C2+T*(C4+C6*T)))/(C3+T*(C5+C7*T))
diff --git a/MATLAB/UTILITIES/sub_var2.m b/MATLAB/UTILITIES/sub_var2.m
new file mode 100755
index 0000000..9605ed5
--- /dev/null
+++ b/MATLAB/UTILITIES/sub_var2.m
@@ -0,0 +1,64 @@
+%
+ function [aout]=sub_var2(fName,dims,num2,ivar,jj,ii)
+%
+% Read/extract a 2-D variable from hycom archive file
+%----------------------------------------------------------------------
+% Input:
+% fName = [file Name]
+% dims = dimensions jdm idm [kdm]
+% num2 = numer of 2d variable [check .b file]
+% ivar = index of var (2d)
+%
+% optional subset parameters
+% jj = j index
+% ii = i index
+%
+% Output:
+% aout
+%----------------------------------------------------------------------
+% Xiaobiao Xu, 2007
+%
+ aout = [];
+ if (nargin~=4 & nargin~=6)
+ display('W r o n g n a r g i n ');
+ elseif (ivar>num2 | ivar<1);
+ display('1 <= ivar <= num2 ');
+ else
+ fid = fopen(fName,'r','ieee-be');
+ if (fid<0); display(['error in opening ' fName]);
+ else
+
+ jdm = dims(1);
+ idm = dims(2);
+ nn = ceil(jdm*idm/4096)*4096;
+%============================================================
+ if nargin==6 % subregion
+%============================================================
+ nj = length(jj);
+ ni = length(ii);
+
+ offs= (ivar-1);
+ aout = nan*ones(nj,ni);
+ for j=1:nj
+ offset = (offs*nn + (jj(j)-1)*idm + ii(1)-1)*4;
+ status = fseek(fid,offset,'bof');
+ if status~=0; display('error in seek'); end
+ aout(j,:) = fread(fid,[1,ni],'real*4');
+ end
+%============================================================
+ else % whole domain
+%============================================================
+ offs = (ivar-1)*nn*4;
+ status = fseek(fid,offs,'bof');
+ if status~=0; display('error in seek'); end
+ aone = fread(fid,[1,jdm*idm],'real*4');
+ aout = reshape(aone,idm,jdm)';
+ clear status aone
+ end
+ aout(aout>=2^100)=nan;
+ fclose(fid);
+ end
+ clear fid
+
+ end
+%
diff --git a/MATLAB/UTILITIES/sub_var3.m b/MATLAB/UTILITIES/sub_var3.m
new file mode 100755
index 0000000..3716e69
--- /dev/null
+++ b/MATLAB/UTILITIES/sub_var3.m
@@ -0,0 +1,67 @@
+%
+ function [aout] = sub_var3(fName,dims,num2,num3,ivar,jj,ii,kk)
+%
+% read/extract a 3-D variable from hycom archive file
+%----------------------------------------------------------------------
+% Input:
+% fName : file name '.a'
+% dims : dimension for full domain [jdm idm kdm]
+% num2/3 : number of 2d/3d variables -- .b
+% ivar : index of the 3d variable (1-num3)
+% [jj ii kk]: dimension for sub domain [optional]
+%----------------------------------------------------------------------
+% Xiaobiao Xu, 2007
+%
+
+ aout = [];
+ if (nargin~=5 & nargin~=8)
+ display('W r o n g n a r g i n ');
+ elseif (ivar>num3 | ivar<1);
+ display('1 <= ivar <= num3 ');
+ else
+
+ fid = fopen(fName,'r','ieee-be');
+ if (fid<0); display(['error in opening ' fName]);
+ else
+ jdm = dims(1);
+ idm = dims(2);
+ kdm = dims(3);
+ nn = ceil(jdm*idm/4096)*4096;
+% ========================================================================
+ if nargin==8 % subset of the variable --
+% ========================================================================
+ nj = length(jj);
+ ni = length(ii);
+ nk = length(kk);
+
+ aout = nan(nj,ni,nk);
+ for k=1:nk
+ offs = num2+num3*(kk(k)-1)+ivar-1;
+ for j=1:nj
+ offset = (offs*nn + (jj(j)-1)*idm + ii(1)-1)*4;
+ status = fseek(fid,offset,'bof');
+ if status~=0; display('error in seek'); end
+ aout(j,:,k) = fread(fid,[1,ni],'real*4');
+ end
+ end
+ clear aone k offset status
+% ========================================================================
+ else %full domain
+% ========================================================================
+ aout = nan(jdm,idm,kdm);
+ for k=1:kdm
+ offset = (num2+num3*(k-1)+ivar-1)*nn*4;
+ status = fseek(fid,offset,'bof');
+ if status~=0; display('error in seek'); end
+ aone = fread(fid,[1,jdm*idm],'real*4');
+ aout(:,:,k) = reshape(aone,idm,jdm)';
+ end
+ clear aone k offset status
+ end
+ aout(aout>=2^100)=nan;
+ fclose(fid);
+ end
+ clear fid
+
+ end
+%
diff --git a/MATLAB/UTILITIES/tofsig.m b/MATLAB/UTILITIES/tofsig.m
new file mode 100755
index 0000000..d773d1b
--- /dev/null
+++ b/MATLAB/UTILITIES/tofsig.m
@@ -0,0 +1,45 @@
+function tof=tofsig(S,R,sig)
+ if (sig == 2.)
+%% --- coefficients for sigma-2 (based on Brydon & Sun fit)
+ C1= 9.77093E+00;
+ C2=-2.26493E-02;
+ C3= 7.89879E-01;
+ C4=-6.43205E-03;
+ C5=-2.62983E-03;
+ C6= 2.75835E-05;
+ C7= 3.15235E-05;
+ end
+ if (sig == 0.)
+%% --- coefficients for sigma-0 (based on Brydon & Sun fit)
+ C1=-1.36471E-01;
+ C2= 4.68181E-02;
+ C3= 8.07004E-01;
+ C4=-7.45353E-03;
+ C5=-2.94418E-03;
+ C6= 3.43570E-05;
+ C7= 3.48658E-05;
+ end
+
+
+ AZERO = 0.;
+ AHALF = 1/2.;
+ ATHIRD = 1/3.;
+ A1P5 = 3.0/2;
+%% --- auxiliary statements for finding root of 3rd degree polynomial
+ A0=(C1+C3.*S -R)/C6;
+ A1=(C2+C5.*S)/C6;
+ A2=(C4+C7.*S)/C6;
+ CUBQ=ATHIRD.*A1-(ATHIRD.*A2)^2;
+ CUBR=ATHIRD.*(AHALF.*A1.*A2-A1P5.*A0) -(ATHIRD.*A2)^3;
+%% --- if q**3+r**2>0, water is too dense to yield real root at given
+%% --- salinitiy. setting q**3+r**2=0 in that case is equivalent to
+%% --- lowering sigma until a double real root is obtained.
+ CUBAN=ATHIRD.*atan2(sqrt(max([AZERO,-(CUBQ.^3+CUBR.^2)])),CUBR);
+ CUBRL=sqrt(-CUBQ).*cos(CUBAN);
+ CUBIM=sqrt(-CUBQ).*sin(CUBAN);
+
+%% --- temp (deg c) as a function of sigma and salinity (mil)
+ tof=-CUBRL+sqrt(3.)*CUBIM-ATHIRD.*A2;
+
+
+
diff --git a/MATLAB/UTILITIES/write_depth_hycom.m b/MATLAB/UTILITIES/write_depth_hycom.m
new file mode 100755
index 0000000..91ff902
--- /dev/null
+++ b/MATLAB/UTILITIES/write_depth_hycom.m
@@ -0,0 +1,39 @@
+function write_depth_hycom(im, jm, file, bathy)
+
+ %% Script to write the bathymetry in the HYCOM format
+ %% file is the name of the file WITHOUT the extension .a or .b
+ %% A. Bozec & D. Dukhovskoy Aug, 2011
+
+ %% Get the id of the bathymetry file
+ flda=[file,'.a'];
+ depth_fid=fopen(flda,'w');
+ IDM=im;
+ JDM=jm;
+ IJDM=IDM*JDM;
+ npad=4096-mod(IJDM,4096);
+ toto=zeros(npad,1);
+
+ %% Writing .a file:
+ A=bathy';
+ A=reshape(A,IJDM,1);
+% Writing the bathy:
+ fwrite(depth_fid,A,'float32','ieee-be');
+% Writing the padding at the end of the record:
+ fwrite(depth_fid,toto,'float32','ieee-be');
+ fclose(depth_fid);
+
+ %%find mask value
+ ind=find(A > 1e10);
+ A(ind)=NaN;
+
+ %% Writing .b file;
+ fldb=[file,'.b'];
+ fid1=fopen(fldb,'wt');
+ fprintf(fid1,'Bathymetry\n');
+ fprintf(fid1,'i/jdm = %i %i \n',IDM,JDM);
+ fprintf(fid1,'\n');
+ fprintf(fid1,'\n');
+ fprintf(fid1,'\n');
+% fprintf(fid1,'min,max depth = %10.5f %10.5f \n',nanmin(nanmin(A)), nanmax(nanmax(A)) );
+ fprintf(fid1,'min,max depth = %10.5f %10.5f \n',min(A(find(~isnan(A)))), max(A(find(~isnan(A)))) );
+ fclose(fid1);
diff --git a/MATLAB/UTILITIES/write_depth_hycom.m~ b/MATLAB/UTILITIES/write_depth_hycom.m~
new file mode 100755
index 0000000..41c688d
--- /dev/null
+++ b/MATLAB/UTILITIES/write_depth_hycom.m~
@@ -0,0 +1,38 @@
+function write_depth_hycom(im, jm, file, bathy)
+
+ %% Script to write the bathymetry in the HYCOM format
+ %% file is the name of the file WITHOUT the extension .a or .b
+ %% A. Bozec & D. Dukhovskoy Aug, 2011
+
+ %% Get the id of the bathymetry file
+ flda=[file,'.a'];
+ depth_fid=fopen(flda,'w');
+ IDM=im;
+ JDM=jm;
+ IJDM=IDM*JDM;
+ npad=4096-mod(IJDM,4096);
+ toto=zeros(npad,1);
+
+ %% Writing .a file:
+ A=bathy';
+ A=reshape(A,IJDM,1);
+% Writing the bathy:
+ fwrite(depth_fid,A,'float32','ieee-be');
+% Writing the padding at the end of the record:
+ fwrite(depth_fid,toto,'float32','ieee-be');
+ fclose(depth_fid);
+
+ %%find mask value
+ ind=find(A > 1e10);
+ A(ind)=NaN;
+
+ %% Writing .b file;
+ fldb=[file,'.b'];
+ fid1=fopen(fldb,'wt');
+ fprintf(fid1,'Bathymetry\n');
+ fprintf(fid1,'i/jdm = %i %i \n',IDM,JDM);
+ fprintf(fid1,'\n');
+ fprintf(fid1,'\n');
+ fprintf(fid1,'\n');
+ fprintf(fid1,'min,max depth = %10.5f %10.5f \n',nanmin(nanmin(A)), nanmax(nanmax(A)) );
+ fclose(fid1);
diff --git a/MATLAB/UTILITIES/write_grid_hycom.m b/MATLAB/UTILITIES/write_grid_hycom.m
new file mode 100755
index 0000000..ae712c2
--- /dev/null
+++ b/MATLAB/UTILITIES/write_grid_hycom.m
@@ -0,0 +1,152 @@
+function write_grid_hycom(im, jm, io, file,plon, plat, ulon, ulat, vlon, vlat, qlon, qlat, pang, ...
+ pscx, pscy, qscx, qscy, uscx, uscy, vscx, vscy, cori, pasp, mapflg)
+
+ %% Script to write the grid in the HYCOM format
+ %% file is the name of the file WITHOUT the extension .a or .b
+ %% A. Bozec & D. Dukhovskoy Aug, 2011
+
+ %% Get the id of the .a grid file
+ flga=[io,file,'.a'];
+ grid_fid=fopen(flga,'w');
+ IDM=im;
+ JDM=jm;
+ IJDM=IDM*JDM;
+ npad=4096-mod(IJDM,4096);
+ toto=zeros(npad,1);
+
+ %% Writing .a file:
+ A=plon';
+ A=reshape(A,IJDM,1);
+% Writing the field
+ fwrite(grid_fid,A,'float32','ieee-be');
+% Writing the padding at the end of the record:
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=plat';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=qlon';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=qlat';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=ulon';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=ulat';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=vlon';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=vlat';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+
+ A=pang';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+
+ A=pscx';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=pscy';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=qscx';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=qscy';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+
+ A=uscx';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=uscy';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=vscx';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+ A=vscy';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+
+ A=cori';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+
+ A=pasp';
+ A=reshape(A,IJDM,1);
+ fwrite(grid_fid,A,'float32','ieee-be');
+ fwrite(grid_fid,toto,'float32','ieee-be');
+
+
+ fclose(grid_fid);
+
+
+
+ %% Writing .b file;
+ fldb=[io,file,'.b'];
+ fid1=fopen(fldb,'wt');
+ fprintf(fid1,' %i ''idm '' = longitudinal array size\n',IDM);
+ fprintf(fid1,' %i ''jdm '' = latitudinal array size\n', JDM);
+ fprintf(fid1,' %i ''mapflg'' = map flag (0=mercator,10=panam,12=ulon-panam)\n',mapflg);
+ fprintf(fid1,'plon: min,max = %12.5f %12.5f\n', min(min(plon')), max(max(plon')) );
+ fprintf(fid1,'plat: min,max = %12.5f %12.5f\n', min(min(plat')), max(max(plat')) );
+ fprintf(fid1,'qlon: min,max = %12.5f %12.5f\n', min(min(qlon')), max(max(qlon')) );
+ fprintf(fid1,'qlat: min,max = %12.5f %12.5f\n', min(min(qlat')), max(max(qlat')) );
+ fprintf(fid1,'ulon: min,max = %12.5f %12.5f\n', min(min(ulon')), max(max(ulon')) );
+ fprintf(fid1,'ulat: min,max = %12.5f %12.5f\n', min(min(ulat')), max(max(ulat')) );
+ fprintf(fid1,'vlon: min,max = %12.5f %12.5f\n', min(min(vlon')), max(max(vlon')) );
+ fprintf(fid1,'vlat: min,max = %12.5f %12.5f\n', min(min(vlat')), max(max(vlat')) );
+ fprintf(fid1,'pang: min,max = %12.5f %12.5f\n', min(min(pang')), max(max(pang')) );
+ fprintf(fid1,'pscx: min,max = %12.5f %12.5f\n', min(min(pscx')), max(max(pscx')) );
+ fprintf(fid1,'pscy: min,max = %12.5f %12.5f\n', min(min(pscy')), max(max(pscy')) );
+ fprintf(fid1,'qscx: min,max = %12.5f %12.5f\n', min(min(qscx')), max(max(qscx')) );
+ fprintf(fid1,'qscy: min,max = %12.5f %12.5f\n', min(min(qscy')), max(max(qscy')) );
+ fprintf(fid1,'uscx: min,max = %12.5f %12.5f\n', min(min(uscx')), max(max(uscx')) );
+ fprintf(fid1,'uscy: min,max = %12.5f %12.5f\n', min(min(uscy')), max(max(uscy')) );
+ fprintf(fid1,'vscx: min,max = %12.5f %12.5f\n', min(min(vscx')), max(max(vscx')) );
+ fprintf(fid1,'vscy: min,max = %12.5f %12.5f\n', min(min(vscy')), max(max(vscy')) );
+ fprintf(fid1,'cori: min,max = %10.5E %10.5E\n', min(min(cori')), max(max(cori')) );
+ fprintf(fid1,'pasp: min,max = %12.5f %12.5f\n', min(min(pasp')), max(max(pasp')) );
+
+ fclose(fid1);
+
diff --git a/MATLAB/UTILITIES/write_relax_hycom.m b/MATLAB/UTILITIES/write_relax_hycom.m
new file mode 100755
index 0000000..1fe72d7
--- /dev/null
+++ b/MATLAB/UTILITIES/write_relax_hycom.m
@@ -0,0 +1,78 @@
+function write_relax_hycom(im, jm, km, io, file, field, d, res)
+
+ %% Script to write relax files in the HYCOM format (initial conditions)
+ %% file is the name of the file WITHOUT the extension .a or .b
+ %% field='intf'
+ %% field='temp'
+ %% field='saln'
+ %% d(kdm); target density
+
+ switch field
+ case 'intf'
+ long_name = 'Interface Depths' ;
+ short_name = 'int' ;
+
+ case 'temp'
+ long_name = 'Potential Temperature' ;
+ short_name = 'tem' ;
+
+ case 'saln'
+ long_name = 'Salinity' ;
+ short_name = 'sal' ;
+ otherwise
+ disp('Should be intf, temp or saln');
+ end
+
+ %% Dimensions of the domain
+ kdm = km ;
+ idm = im ;
+ jdm = jm ;
+ tdm = 12 ;
+ ijdm = idm*jdm ;
+
+ %% NPAD size
+ npad=4096-mod(ijdm,4096);
+ toto=zeros(npad,1);
+
+ %% Grid Directory and file
+ file1 = [io,file];
+
+ %% WRITING .a binary file
+ flga=[file1,'.a'];
+ relax_fid=fopen(flga,'w');
+
+ for t=1:tdm
+ for k = 1:kdm
+ A=res(:,:,k,t)';
+ A=reshape(A,ijdm,1);
+ %% Writing the field
+ fwrite(relax_fid,A,'float32','ieee-be');
+ %% Writing the padding at the end of the record:
+ fwrite(relax_fid,toto,'float32','ieee-be');
+ end
+ end
+ fclose(relax_fid);
+
+ %% mask the field by nan
+ index = find(res > 1e10) ;
+ res(index) = NaN ;
+
+
+ %% WRITING .b text file
+ density = d ;
+
+ fldb=[file1,'.b'];
+ fid1=fopen(fldb,'wt');
+ fprintf( fid1, ' %s \n',long_name );
+ fprintf( fid1, '\n');
+ fprintf( fid1, '\n');
+ fprintf( fid1, '\n');
+ fprintf( fid1, 'i/jdm = %i %i \n', idm, jdm);
+ for m = 1:tdm
+ for k = 1:kdm
+ fprintf( fid1, ' %s : month,layer,dens,range = %2.2i %2.2i %7.3f %10.5E %10.5E\n', short_name, m, k, density(k), nanmin(nanmin(res(:, :, k,m)')), nanmax(nanmax(res(:,:, k,m)')));
+
+ end
+ end
+
+ fclose(fid1);
diff --git a/MATLAB/plot_res_bb86.m b/MATLAB/plot_res_bb86.m
new file mode 100755
index 0000000..0b9ce2b
--- /dev/null
+++ b/MATLAB/plot_res_bb86.m
@@ -0,0 +1,217 @@
+%% plot results from bb86 and HYCOM-bb86
+
+ clear all,clf, close all
+ iodir='/Net/yucatan/abozec/BB86_PACKAGE/MATLAB/';
+ addpath(genpath(['',iodir,'/UTILITIES/']));
+
+ %% PATH
+ io = [iodir,'../'];
+
+ %% size of the domain
+ idm = 101 ; %% size of the domain
+ jdm = 101 ; %% size of the domain
+ kdm = 2 ; %% number of layer in bb86
+ dp0 = 500.; %% thickness of the first layer (m)
+ tdm = 1800 ; %% 12 month climatology
+ tplot1 = 5 ; tplot2 = 5 ; %% time-stamp to plot (starts from 1)
+
+ %% Postscript
+ PS=0;
+ file_ps='../PS/test.eps'
+
+ %% constants
+ rho = 1000.; %% reference density
+ g = 9.806 ; %% gravity
+
+
+ %% Read grid
+ file_grid = 'regional.grid.BB86.a'
+ [plon,plat]=read_grid_hycom(idm, jdm, ([io,'topo/']), file_grid);
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %% READ the HYCOM files
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ io_hycom = [io,'expt_01.0/data/output/'];
+
+ for t = tplot1:tplot2
+ if (t <= 344)
+ year = '0001' ;
+ day = sprintf('%3.3d',t+16) ; %% 16 u and v == 0. so we start at day 17.
+ elseif (t > 344) && (t <= 704)
+ year = '0002' ;
+ day = sprintf('%3.3d',t-344) ;
+ elseif (t > 704) && (t <= 1064)
+ year = '0003' ;
+ day = sprintf('%3.3d',t-704) ;
+ elseif (t > 1064) && (t <= 1424)
+ year = '0004' ;
+ day = sprintf('%3.3d',t-1064) ;
+ elseif (t > 1424) && (t <= 1784)
+ year = '0005' ;
+ day = sprintf('%3.3d',t-1424) ;
+ elseif (t > 1784) && (t <= 2144)
+ year = '0006' ;
+ day = sprintf('%3.3d',t-1784) ;
+ end
+ file = ['archv.',year,'_',day,'_00.a']
+
+
+ %% archive files 2D variable units (see archv.*.b for the list of available var.)
+ %% montg1 : *1./g to get in m
+ %% srfhgt : *1./g to get in m
+ %% surflx : W/m2
+ %% salflx : kg/m2/s
+ %% bl_dpth : *1./(rho*g) to get in m
+ %% mix_dpth: *1./(rho*g) to get in m
+ %% u_btrop : m/s
+ %% v_btrop : m/s
+
+ %% extract barotropic velocities (ubarot)
+ num2 = 8 ; %% number of 2D variables in the archive file
+ ivar_ub = 7; %% index of ubaro (7th 2D variable)
+ ivar_vb = 8; %% index of vbaro (8th 2D variable)
+ ubaro=sub_var2([io_hycom,file],[jdm, idm], num2, ivar_ub) ;
+ vbaro=sub_var2([io_hycom,file],[jdm, idm], num2, ivar_vb) ;
+
+
+
+ %% archive files 3D variable units (see archv.*.b for the list of available var.)
+ %% u-vel. : m/s
+ %% v-vel. : m/s
+ %% thknss : *1./(rho*g) to get in m
+ %% temp : C
+ %% salin : psu
+
+ %% extract velocities (ubaroc)
+ num3 = 5 ; %% number of 3D variables in the archive file
+ ivar_u = 1; %% index of u baroclinic
+ ivar_v = 2; %% index of v baroclinic
+ ubac=sub_var3([io_hycom,file],[jdm, idm, kdm+1], num2, num3, ivar_u) ;
+ vbac=sub_var3([io_hycom,file],[jdm, idm, kdm+1], num2, num3, ivar_v) ;
+
+ %% Get utot & vtot
+ uhyc=zeros(jdm,idm,kdm+1,tdm) ;
+ for k = 1:kdm+1
+ uhyc(:, :, k, t) = ubaro(:, :)+ubac(:, :,k) ;
+ end
+ vhyc=zeros(jdm,idm,kdm+1,tdm) ;
+ for k = 1:kdm+1
+ vhyc(:, :, k, t) = vbaro(:, :)+vbac(:, :, k) ;
+ end
+
+
+ %% extract the layer thickness
+ ivar_dp = 3 ;
+ dp=sub_var3([io_hycom,file],[jdm, idm, kdm+1], num2, num3, ivar_dp) ;
+ dphyc=zeros(jdm,idm,kdm+1,tdm) ;
+ dphyc(:, :, :, t) = dp/(rho*g) ;
+
+ %% put the u vel on the p-grid
+ %%get the umask
+ maskt = ones(jdm, idm, kdm+1, tdm) ;
+ maskt(find(uhyc == 0.)) = 0. ;
+ maxval = maskt+circshift(maskt, [0, -1, 0, 0]) ;
+ maxval(find(maxval == 0.)) = NaN ;
+
+ %% get the average value of u at the p-point
+ uthyc = (uhyc+circshift(uhyc, [0, -1, 0, 0]))./maxval ;
+ uthyc(:,idm, :, :) = uthyc(:,idm-1, :, :) ;
+
+ %% put the v vel on the p-grid
+ %%get the vmask
+ maskt = ones(jdm, idm, kdm+1, tdm) ;
+ maskt(find(vhyc == 0.)) = 0. ;
+ maxval = maskt+circshift(maskt, [-1, 0, 0, 0]) ;
+ maxval(find(maxval == 0.)) = NaN ;
+
+ %% get the average value of v at the p-point
+ vthyc = (vhyc+circshift(vhyc, [-1, 0, 0, 0]))./maxval ;
+ vthyc(jdm, :, :, :) = vthyc(jdm-1,:, :, :) ;
+
+ end
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %% plot
+ for t = tplot1:tplot2
+
+ %% norme, min and max of the plots
+ normeref_hyc = 0.02 ; %% vector norm of HYCOM-BB86 (in m)
+ onevectout = 2 ; %% plot one vector out of 'onevectorout'
+ min_dp = -5. ;
+ max_dp = 5. ; %% layer thickness anomaly in m (min and max)
+
+ %% Define the figure dimensions
+ set(gcf,'Units','normalized');
+ set(gcf,'position',[0.1 0.08,0.5,0.7])
+ set(gcf,'PaperType', 'usletter');
+ set(gcf,'PaperUnits','normalized');
+ set(gcf,'PaperPosition',[0,0,1,1]);
+ set(gcf,'PaperOrientation', 'landscape');
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %% HYCOM-BB86
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+ subplot(2,2,1)
+ uu = uthyc(1:onevectout:jdm, 1:onevectout:idm, 2, t);
+ vv = vthyc(1:onevectout:jdm, 1:onevectout:idm, 2, t);
+ lon = plon(1:onevectout:jdm, 1:onevectout:idm);
+ lat = plat(1:onevectout:jdm, 1:onevectout:idm);
+ [m,n] = size(uu);
+
+ %% we normalize the vectors
+ normeref = normeref_hyc ; %% in m
+ norme =sqrt(uu.^2+vv.^2) ;
+ normemax = nanmax(nanmax(norme))/normeref ;
+
+ quiver(lon, lat, uu,vv,3*normemax,'k') %% ref vector over 3*dx
+ axis;
+ set(gca,'xlim',[0, 20],'ylim',[0,20]);
+ title(['HYCOM-BB86 Velocity field t = ',sprintf('%4.4d',t)]);
+ xlabel('Longitude (E)')
+ ylabel('Latitude (N)')
+
+ %% draw a reference vector
+ framelim = get(gca,'Position');
+ x=framelim(1) ; y=framelim(2) ; %% (x,y) position of the arrow in the figure(normalized) units
+ xpl=1.2 ; ypl=-1.8 ; %% (x,y) position of the arrow in the plot units
+
+ x1=x+xpl*framelim(3)/(lon(1,n)-lon(1,1));
+ y1=y+ypl*framelim(4)/(lat(m,1)-lat(1,1));
+ dx=3*(lon(1,2)-lon(1,1))*framelim(3)/(lon(1,n)-lon(1,1));
+ dy=0.;
+ annotation(figure(1),'arrow','Position',[x1,y1,dx,dy],'headstyle','vback3','headwidth',5,'headlength',5)
+ text(xpl,ypl-1.,[sprintf('%3.2f',normeref),'m'])
+
+
+
+ subplot(2,2,2)
+
+ levels = 40 ;
+ Minss = min_dp ;
+ Maxss = max_dp ;
+ step = (Maxss - Minss) / levels ;
+ toto = 1:levels;
+ num_level = toto * step + Minss ;
+
+ caxis([min_dp max_dp]);hold on;
+ diff_dp = dphyc(:, :, 2, t) - (dp0+1.) ;
+ contourf(plon,plat,diff_dp,num_level);hold on;
+ colorbar;
+ axis;
+ title(['HYCOM-BB86 thickness ano. t = ',sprintf('%4.4d',t)]);
+ xlabel('Longitude (E)')
+ ylabel('Latitude (N)')
+
+ end
+ if (PS == 1)
+ print('-depsc2',file_ps);
+ end
+ % end
+
+
+
diff --git a/MATLAB/write_depth_bb86.m b/MATLAB/write_depth_bb86.m
new file mode 100755
index 0000000..939589a
--- /dev/null
+++ b/MATLAB/write_depth_bb86.m
@@ -0,0 +1,70 @@
+%% write bathy double gyre
+
+ clear all,clf, close all
+ iodir='/Net/yucatan/abozec/BB86_PACKAGE/MATLAB/';
+ addpath(genpath([iodir,'/UTILITIES/']));
+
+ %% PATH
+ io = [iodir,'/../topo/'];
+ file_bat_new = 'depth_BB86_01' ; %% !! without .a or .b !!
+ pl = 0; %% 1 or 0 for plot or not
+
+ %% size of the domain
+ idm = 101 ;
+ jdm = 101 ;
+
+ %% definition of the bathymetry
+ depth = 5000. ;%% constant bathy everywhere
+
+ %% closed boundary (latbdy=0) or open boundaries (latbdy=1) or cyclic (latbdy =2)
+ latbdy = 0;
+
+ %%%%%%; END of the USER inputs %%%%%%%%%%%%%%;
+
+ idm_hd = idm;
+ jdm_hd = jdm;
+ vmiss = 2.^100; %% HYCOM missing values
+
+ %% get the Depth
+ bathy_hd = zeros(jdm_hd, idm_hd);
+ bathy_hd(:, :) = depth;
+% bathy_hd(:,1)=0.;
+% for i=2:50
+% bathy_hd(:,i)=bathy_hd(:,i-1) + 10.;
+% end
+ disp('Depth Ok')
+
+ %% Plot
+ if (pl == 1)
+ figure(1)
+ pcolor(bathy_hd(:,:));colormap(jet(length(1:32)));
+ colorbar;shading flat
+ end
+
+ %% Mask by missing values if any
+ ind = find(bathy_hd == 0.);
+ bathy_hd (ind) = vmiss;
+
+
+ %% Get the edge of the domain right
+ switch latbdy
+ case 0
+ bathy_hd(jdm_hd, :) = vmiss ;
+ bathy_hd(:, idm_hd) = vmiss ;
+ bathy_hd(1, :) = vmiss ;
+ bathy_hd(:, 1) = vmiss ;
+
+ case 1
+ bathy_hd(jdm_hd, :) = vmiss ;
+ bathy_hd(:, idm_hd) = vmiss ;
+
+ case 2
+ bathy_hd(jdm_hd, :) = vmiss ;
+ bathy_hd( 1, :) = vmiss ;
+ end
+
+
+ %% write the file
+ write_depth_hycom(idm_hd, jdm_hd, [io,file_bat_new], bathy_hd)
+ disp('Writing depth file done ')
+
diff --git a/MATLAB/write_depth_bb86.m~ b/MATLAB/write_depth_bb86.m~
new file mode 100755
index 0000000..cf7eb4a
--- /dev/null
+++ b/MATLAB/write_depth_bb86.m~
@@ -0,0 +1,70 @@
+%% write bathy double gyre
+
+ clear all,clf, close all
+ iodir='/Net/yucatan/abozec/BB86_PACKAGE/MATLAB/';
+ addpath(genpath([iodir,'/UTILITIES/']));
+
+ %% PATH
+ io = [iodir,'/../topo/'];
+ file_bat_new = 'depth_BB86_03' ; %% !! without .a or .b !!
+ pl = 0; %% 1 or 0 for plot or not
+
+ %% size of the domain
+ idm = 101 ;
+ jdm = 101 ;
+
+ %% definition of the bathymetry
+ depth = 3000. ;%% constant bathy everywhere
+
+ %% closed boundary (latbdy=0) or open boundaries (latbdy=1) or cyclic (latbdy =2)
+ latbdy = 0;
+
+ %%%%%%; END of the USER inputs %%%%%%%%%%%%%%;
+
+ idm_hd = idm;
+ jdm_hd = jdm;
+ vmiss = 2.^100; %% HYCOM missing values
+
+ %% get the Depth
+ bathy_hd = zeros(jdm_hd, idm_hd);
+ bathy_hd(:, :) = depth;
+% bathy_hd(:,1)=0.;
+% for i=2:50
+% bathy_hd(:,i)=bathy_hd(:,i-1) + 10.;
+% end
+ disp('Depth Ok')
+
+ %% Plot
+ if (pl == 1)
+ figure(1)
+ pcolor(bathy_hd(:,:));colormap(jet(length(1:32)));
+ colorbar;shading flat
+ end
+
+ %% Mask by missing values if any
+ ind = find(bathy_hd == 0.);
+ bathy_hd (ind) = vmiss;
+
+
+ %% Get the edge of the domain right
+ switch latbdy
+ case 0
+ bathy_hd(jdm_hd, :) = vmiss ;
+ bathy_hd(:, idm_hd) = vmiss ;
+ bathy_hd(1, :) = vmiss ;
+ bathy_hd(:, 1) = vmiss ;
+
+ case 1
+ bathy_hd(jdm_hd, :) = vmiss ;
+ bathy_hd(:, idm_hd) = vmiss ;
+
+ case 2
+ bathy_hd(jdm_hd, :) = vmiss ;
+ bathy_hd( 1, :) = vmiss ;
+ end
+
+
+ %% write the file
+ write_depth_hycom(idm_hd, jdm_hd, [io,file_bat_new], bathy_hd)
+ disp('Writing depth file done ')
+
diff --git a/MATLAB/write_grid_bb86.m b/MATLAB/write_grid_bb86.m
new file mode 100755
index 0000000..58810c8
--- /dev/null
+++ b/MATLAB/write_grid_bb86.m
@@ -0,0 +1,142 @@
+%% write grid double gyre
+
+ clear all,clf, close all
+ iodir='/Net/yucatan/abozec/BB86_PACKAGE/MATLAB/';
+ addpath(genpath(['',iodir,'/UTILITIES/']));
+
+ %% PATH
+ io = [iodir,'/../topo/'];
+ file_grid_new = 'regional.grid.BB86'; %% !! without .a or .b !!
+
+ %% size of the domain
+ idm = 101 ;
+ jdm = 101 ;
+
+ %% longitude/latitude starting point + resolution (in degrees) (NB: those
+ %% variables are not used in HYCOM)
+ ini_lon = 0. ;
+ ini_lat = 0. ;
+ res = 0.20 ;
+
+ %% scale dx and dy (in m) (used in HYCOM)
+ dx = 20e3 ;
+ dy = dx ;
+
+ %% grid type
+ mapflg=0 ; %% uniform or mercator
+
+
+ %%%%%%; END of the USER inputs %%%%%%%%%%%%%%;
+
+ %% missing value in HYCOM
+ vmiss = 2.^100 ;
+
+ %% Get the p-point the grid
+ plon = zeros(jdm, idm) ;
+ plat = zeros(jdm, idm) ;
+
+ %% Longitude
+ plon(:, 1) = ini_lon ;
+ for i = 2:idm
+ plon(:, i) = plon(:, i-1) + res;
+ end
+ %% Latitude
+ plat(1, :) = ini_lat ;
+ for j = 2:jdm
+ plat(j, :) = plat(j-1, :) + res;
+ end
+
+ disp('p-points grid OK')
+
+
+ %% Declaration of the grid tabs
+ idm_hd = idm ;
+ jdm_hd = jdm ;
+
+ plon_hd = plon ;
+ plat_hd = plat ;
+
+ qlon_hd = zeros(jdm_hd, idm_hd) ;
+ qlat_hd = zeros(jdm_hd, idm_hd) ;
+ ulon_hd = zeros(jdm_hd, idm_hd) ;
+ ulat_hd = zeros(jdm_hd, idm_hd) ;
+ vlon_hd = zeros(jdm_hd, idm_hd) ;
+ vlat_hd = zeros(jdm_hd, idm_hd) ;
+
+ pang_hd = zeros(jdm_hd, idm_hd) ;
+
+ pscx_hd = zeros(jdm_hd, idm_hd) ;
+ pscy_hd = zeros(jdm_hd, idm_hd) ;
+
+ qscx_hd = zeros(jdm_hd, idm_hd) ;
+ qscy_hd = zeros(jdm_hd, idm_hd) ;
+
+ uscx_hd = zeros(jdm_hd, idm_hd) ;
+ uscy_hd = zeros(jdm_hd, idm_hd) ;
+
+ vscx_hd = zeros(jdm_hd, idm_hd) ;
+ vscy_hd = zeros(jdm_hd, idm_hd) ;
+
+ cori_hd = zeros(jdm_hd, idm_hd) ;
+ pasp_hd = zeros(jdm_hd, idm_hd) ;
+
+
+ %% Longitude/Latitude for each point (Q-points stay at the same location)
+ %% longitude
+ vlon_hd = plon_hd ;
+ for i = 2:idm
+ qlon_hd(:, i) = 0.5*(plon_hd(:, i)+plon_hd(:, i-1));
+ end
+ diff = plon_hd(1, 3)-plon_hd(1, 2) ;
+ qlon_hd(:, 1) = plon_hd(:, 1)-0.5*diff ;
+ ulon_hd = qlon_hd ;
+
+ %% latitude
+ ulat_hd = plat_hd ;
+ for j = 2:jdm
+ qlat_hd(j, :) = 0.5*(plat_hd(j, :)+plat_hd(j-1, :));
+ end
+ diff = plat_hd(3, 1)-plat_hd(2, 1) ;
+ qlat_hd(1, :) = plat_hd(1, :)-0.5*diff ;
+ vlat_hd = qlat_hd ;
+
+ %% simplified grid with prescribed dx and dy
+ pscx_hd(:, :) = dx;
+ pscy_hd(:, :) = dy;
+ uscx_hd(:, :) = dx;
+ uscy_hd(:, :) = dy;
+ vscx_hd(:, :) = dx;
+ vscy_hd(:, :) = dy;
+ qscx_hd(:, :) = dx;
+ qscy_hd(:, :) = dy;
+
+ %% Coriolis
+ beta = 2.e-11 ;
+ for j= 1:jdm_hd
+ for i= 1:idm_hd
+ cori_hd(j, i)=.93e-4+double(j-(jdm_hd-1)/2)*dx*beta ;
+ end
+ end
+
+ %% pang ( p-angle for rotated grid)
+ %% here uniform or mercator so pang = 0.
+
+
+ %% pasp= paspect: pscx/pscy
+
+ for j= 1:jdm_hd
+ for i= 1:idm_hd
+ pasp_hd(j,i) = pscx_hd(j,i)/pscy_hd(j,i) ;
+ end
+ end
+
+
+ %% Writing new grid file
+ write_grid_hycom(idm_hd, jdm_hd, io, file_grid_new, plon_hd, plat_hd, ulon_hd, ulat_hd, vlon_hd, vlat_hd, ...
+ qlon_hd, qlat_hd, pang_hd,pscx_hd, pscy_hd, qscx_hd, qscy_hd, uscx_hd, uscy_hd, vscx_hd, vscy_hd, cori_hd, pasp_hd,mapflg)
+
+ disp('Writing grid file done ')
+
+
+
+
diff --git a/MATLAB/write_relax_bb86.m b/MATLAB/write_relax_bb86.m
new file mode 100755
index 0000000..9dd769b
--- /dev/null
+++ b/MATLAB/write_relax_bb86.m
@@ -0,0 +1,128 @@
+%% write relax files (initial condition of T, S and interface
+%depth)
+
+
+ clear all,clf, close all
+ iodir='/Net/yucatan/abozec/BB86_PACKAGE/MATLAB/';
+ addpath(genpath(['',iodir,'/UTILITIES/']));
+
+ %% PATH
+ io = [iodir,'../relax/010/'];
+ file_topo = 'depth_BB86_01.a';
+ file_int_new = 'relax_int_BB86' ; %% !! without .a or .b !!
+ file_tem_new = 'relax_tem_BB86' ;
+ file_sal_new = 'relax_sal_BB86' ;
+ pl = 0; %% 1 or 0 for plot or not
+
+ %% size of the domain
+ idm = 101 ;
+ jdm = 101 ;
+ kdm = 3 ; %% number of layers (first layer very thin)
+ tdm = 12 ; %% 12 month climatology
+
+ %% interface depth (!!!first interface depth always 0. !!!)
+ id = zeros(kdm) ;
+ id = [0., 1., 500.] ;
+
+
+ %% target density
+ %% from bb86: rho=27.01037, rho=27.22136
+ d = zeros(kdm) ;
+ d = [27.0100, 27.01037,27.22136] ;
+
+ %% salinity profile
+ sa = zeros(kdm) ;
+ sa = [37., 37., 37.] ;
+
+ %%%%%%; END of the USER inputs %%%%%%%%%%%%%%;
+
+ %% constants
+ rho = 1000.;
+ g = 9.806;
+ vmiss = 2.^100;
+
+ %% temperature profile for sigma0
+ sigma = 0 ;
+ te = 1:kdm ;
+ for k = 1:kdm
+ te(k) = tofsig(sa(k), d(k), sigma) ;
+ end
+ disp(te)
+
+
+ %% read bathy for mask
+ bathy=read_depth_hycom(idm, jdm, [io,'../../topo/',file_topo]);
+ ind = isnan(bathy) ;
+ bathy(ind) = 0. ;
+ %% create mask
+ mask2d = ones(jdm, idm) ;
+ mask2d(ind) = 0. ;
+ mask = zeros(jdm, idm, kdm, tdm) ;
+ for t = 1:tdm
+ for k = 1:kdm
+ mask(:, :, k, t) = mask2d ;
+ end
+ end
+
+ %% interface depth files (first layer always the surface i.e. 0.)
+ int = zeros(jdm, idm, kdm, tdm) ;
+ for k= 2:kdm
+ int(:, :, k,:) = rho*g * id(k) ; %% 1st layer tiny to fake a two layer config
+ end
+
+ %% make sure that the interface depths are not lower than the bathy
+ for t = 1:tdm
+ for k = 1:kdm
+ for i = 1:idm
+ for j = 1:jdm
+ if (int(j, i, k)/9806. > bathy(j, i))
+ int(j, i, k) = bathy(j,i)*9806. ;
+ end
+ end
+ end
+ end
+ end
+
+ %% mask
+ ind3d = find(mask == 0.) ;
+ int(ind3d) = vmiss ;
+
+
+ %% write the field in relax file
+ write_relax_hycom(idm, jdm, kdm, io, file_int_new, 'intf', d, int) ;
+ disp('Interface depth OK')
+
+ %% Temperature
+ tem = zeros(jdm, idm, kdm, tdm) ;
+ for k = 1:kdm
+ tem(:, :, k,:) = te(k) ;
+ end
+
+ %% mask
+ tem(ind3d) = vmiss;
+
+ %% write the field in relax file
+ write_relax_hycom(idm, jdm, kdm, io, file_tem_new, 'temp', d, tem) ;
+ disp('Temperature OK')
+
+ %% Salinity
+ sal = zeros(jdm, idm, kdm, tdm) ;
+ for k = 1:kdm
+ sal(:,:, k,:) = sa(k) ;
+ end
+
+ %% mask
+ sal(ind3d) = vmiss ;
+
+ %% write the field in relax file
+ write_relax_hycom(idm, jdm, kdm, io, file_sal_new, 'saln', d, sal);
+ disp('Salinity OK')
+
+
+
+ %% Plot
+ if (pl == 1)
+ figure(1)
+ pcolor(tem(:,:,1));colormap(jet(length(1:32)));
+ colorbar;shading flat
+ end
diff --git a/MATLAB/write_windstress_bb86.m b/MATLAB/write_windstress_bb86.m
new file mode 100755
index 0000000..6f588ef
--- /dev/null
+++ b/MATLAB/write_windstress_bb86.m
@@ -0,0 +1,118 @@
+%% write windstress double gyre
+
+ clear all,clf, close all
+ iodir='/Net/yucatan/abozec/BB86_PACKAGE/MATLAB/';
+ addpath(genpath(['',iodir,'/UTILITIES/']));
+
+ %% PATH
+ io = [iodir,'/../topo/'];
+ file_grid = 'regional.grid.BB86.a'
+
+ %% domain
+ idm = 101 ;
+ jdm = 101 ;
+ tdm = 12 ;%% monthly files
+
+ %% name the new files
+ file_E = 'forcing.tauewd.BB86'; %% without .a or .b %%
+ file_N = 'forcing.taunwd.BB86';
+
+
+ %% Read grid
+ [plon,plat]=read_grid_hycom(idm, jdm, ([io,'../topo/']), file_grid);
+
+ %% Calculation of the analytical wind-stress (N/m2)
+ ustress = zeros(jdm);
+ stressa = -1.;
+ sconv = 1.e-1; %% scale factor form dyn/cm2 to N/m2
+
+ %% BB86 formulation
+ for j = 1:jdm
+ ustress(j) = stressa*cos(double(j-1)/double(jdm-1)*6.28318530718)*sconv;
+ end
+
+ %% plot the stress
+ figure(1)
+ plot(ustress,plat);
+ ylim([0 20]);
+ xlim([-0.2 0.2]);
+ grid on;
+
+
+ %% Write the wind-stress files
+ tte = zeros(jdm, idm, tdm);
+ ttn = zeros(jdm, idm, tdm);
+
+ IJDM=idm*jdm;
+ npad=4096-mod(IJDM,4096);
+ toto=zeros(npad,1);
+
+
+ %% we apply a taux , no tauy
+ for j = 1:jdm
+ tte(j, :, :) = ustress(j);
+ end
+
+ %% Taux
+ taux_fid=fopen([io,'../force/',file_E,'.a'],'w');
+
+ for ll = 1:tdm
+ A=tte(:,:,ll)';
+ A=reshape(A,IJDM,1);
+ %% Writing the field
+ fwrite(taux_fid,A,'float32','ieee-be');
+ %% Writing the padding at the end of the record:
+ fwrite(taux_fid,toto,'float32','ieee-be');
+ end
+ fclose(taux_fid);
+
+ %% Tauy
+ tauy_fid=fopen([io,'../force/',file_N,'.a'],'w');
+
+ for ll = 1:tdm
+ A=ttn(:,:,ll)';
+ A=reshape(A,IJDM,1);
+ %% Writing the field
+ fwrite(tauy_fid,A,'float32','ieee-be');
+ %% Writing the padding at the end of the record:
+ fwrite(tauy_fid,toto,'float32','ieee-be');
+ end
+ fclose(tauy_fid);
+
+
+ %% create .b file
+ time = 1:12;
+
+ %% Write Eastward Wind stress file
+ fldb=[io,'../force/',file_E,'.b'];
+ fid1=fopen(fldb,'wt');
+
+ fprintf(fid1, 'Analytical Eastward Wind-stress\n');
+ fprintf(fid1, '\n');
+ fprintf(fid1, '\n');
+ fprintf(fid1, '\n');
+ fprintf(fid1, 'i/jdm = %i %i \n',idm,jdm);
+ for m = 1:tdm
+ fprintf(fid1,' tauewd: month,range = %2.2i %10.5E %10.5E\n', ...
+ time(m), min(min(tte(:, :, m)')), max(max(tte(:, :, m)')));
+ end
+
+ fclose(fid1);
+
+ %% Write Northward Wind stress file
+ fldb=[io,'../force/',file_N,'.b'];
+ fid1=fopen(fldb,'wt');
+
+ fprintf(fid1, 'Analytical Northward Wind-stress\n');
+ fprintf(fid1, '\n');
+ fprintf(fid1, '\n');
+ fprintf(fid1, '\n');
+ fprintf(fid1, 'i/jdm = %i %i \n',idm,jdm);
+ for m = 1:tdm
+ fprintf(fid1,' taunwd: month,range = %2.2i %10.5E %10.5E\n', ...
+ time(m), min(min(ttn(:, :, m)')), max(max(ttn(:, :, m)')));
+ end
+
+ fclose(fid1);
+
+
\ No newline at end of file
diff --git a/PS/uv_dp_d1800_bb86-hycom.ps b/PS/uv_dp_d1800_bb86-hycom.ps
new file mode 100755
index 0000000..0d88584
Binary files /dev/null and b/PS/uv_dp_d1800_bb86-hycom.ps differ
diff --git a/config/alphaL_one b/config/alphaL_one
new file mode 100755
index 0000000..f74adbe
--- /dev/null
+++ b/config/alphaL_one
@@ -0,0 +1,46 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for Compaq Alpha, Linux, one processor, real*8
+# see http://www.compaq.com/fortran/linux/ for Compaq f90 compiler
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = fort
+FCFFLAGS = -g3 -fast -O5 -convert big_endian -assume byterecl -warn nouncalled -real_size 64 -double_size 64 -integer_size 32
+CC = gcc
+CCFLAGS = -O
+CPP = cpp -P
+CPPFLAGS = -DALPHA -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS) -version
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/alpha_one b/config/alpha_one
new file mode 100755
index 0000000..81b184f
--- /dev/null
+++ b/config/alpha_one
@@ -0,0 +1,45 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for Compaq Alpha, one processor, real*8
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = f90
+FCFFLAGS = -g3 -fpe1 -fast -O5 -convert big_endian -assume byterecl -warn nouncalled -real_size 64 -double_size 64 -integer_size 32
+CC = cc
+CCFLAGS = -g3 -fast
+CPP = cpp -P
+CPPFLAGS = -DALPHA -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS) -version
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/amd64_one b/config/amd64_one
new file mode 100755
index 0000000..185c059
--- /dev/null
+++ b/config/amd64_one
@@ -0,0 +1,47 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for AMD64 Linux/PGI, single processor, real*8
+# see http://www.pgroup.com/ for Portland Group f90 compiler
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = pgf90
+FCFFLAGS = -g -w -fastsse -tp k8-64 -mcmodel=medium -byteswapio -r8
+CC = gcc
+CCFLAGS = -g -O -march=k8 -m64 -mcmodel=medium
+CPP = cpp -P
+#CPPFLAGS = -DIA32 -DREAL8
+CPPFLAGS = -DIA32 -DREAL8 -DTIMER
+LD = $(FC)
+LDFLAGS = -V $(FCFFLAGS)
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/gfortran_one b/config/gfortran_one
new file mode 100755
index 0000000..01855f1
--- /dev/null
+++ b/config/gfortran_one
@@ -0,0 +1,46 @@
+#
+# ---------------------------------------------------------------------------
+# common definitions for gfortran version 8+, single processor, real*8
+# IFC version 8 has -convert big_endian, and does not need -DENDIAN_IO
+# ---------------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = gfortran
+FCFFLAGS = -g -O3 -w -static-libgfortran -fno-second-underscore -fconvert=big-endian -fdefault-real-8
+CC = gcc
+CCFLAGS = -O -static-libgfortran -fno-second-underscore
+CPP = cpp -P
+#CPPFLAGS = -DIA32 -DREAL8
+CPPFLAGS = -DIA32 -DREAL8 -DTIMER
+LD = $(FC)
+LDFLAGS = -v $(FCFFLAGS)
+EXTRALIBS =
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/hp_one b/config/hp_one
new file mode 100755
index 0000000..495f185
--- /dev/null
+++ b/config/hp_one
@@ -0,0 +1,47 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for HP, single processor, real*8
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = f90
+#FCFFLAGS = +O3 +r8 +DD64
+FCFFLAGS = +O3 +r8
+CC = cc
+#CCFLAGS = -O +DD64
+CCFLAGS = -O
+CPP = cpp -P
+CPPFLAGS = -DHPUX -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS)
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/intelIFC7_one b/config/intelIFC7_one
new file mode 100755
index 0000000..afbd92a
--- /dev/null
+++ b/config/intelIFC7_one
@@ -0,0 +1,45 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for Intel Linux/IFC, single processor, real*8
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = ifc
+FCFFLAGS = -g -cm -vec_report0 -w -O3 -tpp7 -xW -r8
+CC = gcc
+CCFLAGS = -O
+CPP = cpp -P
+CPPFLAGS = -DIA32 -DIFC -DREAL8 -DENDIAN_IO
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS) -Vaxlib -Bstatic
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/intelIFC_one b/config/intelIFC_one
new file mode 100755
index 0000000..f8a48f4
--- /dev/null
+++ b/config/intelIFC_one
@@ -0,0 +1,46 @@
+#
+# ---------------------------------------------------------------------------
+# common definitions for Intel Linux/IFC version 8+, single processor, real*8
+# IFC version 8 has -convert big_endian, and does not need -DENDIAN_IO
+# ---------------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = ifort
+FCFFLAGS = -g -convert big_endian -assume byterecl -cm -vec_report0 -w -O3 -tpp7 -xW -r8
+CC = gcc
+CCFLAGS = -O
+CPP = cpp -P
+CPPFLAGS = -DIA32 -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS) -Bstatic
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/intel_one b/config/intel_one
new file mode 100755
index 0000000..2befae6
--- /dev/null
+++ b/config/intel_one
@@ -0,0 +1,46 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for Intel Linux/PGI, single processor, real*8
+# see http://www.pgroup.com/ for Portland Group f90 compiler
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = pgf90
+FCFFLAGS = -g -fast -byteswapio -r8
+CC = gcc
+CCFLAGS = -O
+CPP = cpp -P
+CPPFLAGS = -DIA32 -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS) -Wl,-Bstatic
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/o2k_one b/config/o2k_one
new file mode 100755
index 0000000..1bdb183
--- /dev/null
+++ b/config/o2k_one
@@ -0,0 +1,46 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for SGI Origin 2000, single processor, real*8
+# using -O3 instead of -Ofast=ip27 because of a bug in 7.3+ compilers
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = f90
+FCFFLAGS = -g3 -64 -O3 -r8 -d8 -i4 -macro_expand
+CC = cc
+CCFLAGS = -g3 -64 -O3
+CPP = /usr/lib/acpp -P
+CPPFLAGS = -DSGI -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS)
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) -nocpp $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) -cpp $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/sp3_one b/config/sp3_one
new file mode 100755
index 0000000..349e400
--- /dev/null
+++ b/config/sp3_one
@@ -0,0 +1,49 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for IBM SMP Power3, single processor, real*8.
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = xlf95
+FCFFLAGS = -qfixed -O3 -qstrict -qarch=pwr3 -qtune=pwr3 -qcache=auto -qspillsize=32000 -qrealsize=8 -qintsize=4
+CC = cc
+CCFLAGS =
+CPP = /usr/lib/cpp -P
+CPPFLAGS = -DAIX -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS) -bmaxdata:2000000000 -bmaxstack:256000000
+EXTRALIBS = -lmass
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(RM) $<.f
+ $(CPP) $(CPPFLAGS) $< | sed -e '/^ *$$/d' > $<.f
+ $(FC) $(FCFFLAGS) -c $<.f
+ -\mv $<.o $*.o
+ $(RM) $<.f
diff --git a/config/sp4_one b/config/sp4_one
new file mode 100755
index 0000000..b62612d
--- /dev/null
+++ b/config/sp4_one
@@ -0,0 +1,49 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for IBM SMP Power4, single processor, real*8.
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = xlf95
+FCFFLAGS = -qfixed -O3 -qstrict -qarch=pwr4 -qtune=pwr4 -qcache=auto -qspillsize=32000 -qrealsize=8 -qintsize=4
+CC = cc
+CCFLAGS =
+CPP = /usr/lib/cpp -P
+CPPFLAGS = -DAIX -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS) -bmaxdata:2000000000 -bmaxstack:256000000
+EXTRALIBS = -lmass
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(RM) $<.f
+ $(CPP) $(CPPFLAGS) $< | sed -e '/^ *$$/d' > $<.f
+ $(FC) $(FCFFLAGS) -c $<.f
+ -\mv $<.o $*.o
+ $(RM) $<.f
diff --git a/config/sp5_one b/config/sp5_one
new file mode 100755
index 0000000..c888629
--- /dev/null
+++ b/config/sp5_one
@@ -0,0 +1,49 @@
+#
+# ------------------------------------------------------------------------
+# common definitions for IBM SMP Power5, single processor, real*8, 64-bit
+# ------------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = xlf95
+FCFFLAGS = -qfixed -O3 -qstrict -qarch=pwr5 -qtune=pwr5 -qcache=auto -qspillsize=32000 -qrealsize=8 -qintsize=4 -q64 -qwarn64
+CC = cc
+CCFLAGS = -q64
+CPP = /usr/lib/cpp -P
+CPPFLAGS = -DAIX -DREAL8 -DTIMER
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS) -b64
+EXTRALIBS = -lmass
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(RM) $<.f
+ $(CPP) $(CPPFLAGS) $< | sed -e '/^ *$$/d' > $<.f
+ $(FC) $(FCFFLAGS) -c $<.f
+ -\mv $<.o $*.o
+ $(RM) $<.f
diff --git a/config/sun64_one b/config/sun64_one
new file mode 100755
index 0000000..8187961
--- /dev/null
+++ b/config/sun64_one
@@ -0,0 +1,45 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for Sun E10000, single processor, real*8, 64-bit
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = f95
+FCFFLAGS = -g -fast -xarch=native64 -xpp=cpp -xtypemap=real:64,double:64,integer:32
+CC = cc
+CCFLAGS = -g -fast -xarch=native64
+CPP = /usr/ccs/lib/cpp -P
+CPPFLAGS = -DSUN -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS)
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/sun_one b/config/sun_one
new file mode 100755
index 0000000..9081302
--- /dev/null
+++ b/config/sun_one
@@ -0,0 +1,45 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for Sun, single processor, real*8
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = f95
+FCFFLAGS = -g -fast -xpp=cpp -xtypemap=real:64,double:64,integer:32
+CC = cc
+CCFLAGS = -g -fast
+CPP = /usr/ccs/lib/cpp -P
+CPPFLAGS = -DSUN -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS)
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(FC) $(CPPFLAGS) $(FCFFLAGS) -c $*.F
diff --git a/config/t3e_one b/config/t3e_one
new file mode 100755
index 0000000..ed89a0a
--- /dev/null
+++ b/config/t3e_one
@@ -0,0 +1,50 @@
+#
+# ---------------------------------------------------------------------
+# common definitions for Cray T3E, single processor.
+# ---------------------------------------------------------------------
+#
+# MACROS DESCRIPTIONS:
+#
+# FC: Fortran 90 compiler.
+# FCFFLAGS: Fortran 90 compilation flags.
+# CC: C compiler.
+# CCFLAGS: C compilation flags.
+# CPP: cpp preprocessor (may be implied by FC).
+# CPPFLAGS: cpp -D macro flags.
+# LD: Loader.
+# LDFLAGS: Loader flags.
+# EXTRALIBS: Extra local libraries (if any).
+#
+FC = f90
+FCFFLAGS = -X 1 -V -f fixed -O scalar2,unroll2,pipeline1,vector3 -d p -M 801
+CC = cc
+CCFLAGS =
+CPP = cpp -P
+CPPFLAGS = -Ucray -DT3E -DREAL8
+LD = $(FC)
+LDFLAGS = $(FCFFLAGS)
+EXTRALIBS =
+
+#
+# --- generic make definitions
+#
+SHELL = /bin/sh
+RM = \rm -f
+
+#
+# rules.
+#
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CCFLAGS) -c $*.c
+
+.f.o:
+ $(FC) $(FCFFLAGS) -c $*.f
+
+.F.o:
+ $(RM) $<.f $<.C
+ sed -e 's? */// *?/ / /?g' -e 's? *// *?/ /?g' $< > $<.C
+ $(CPP) $(CPPFLAGS) $<.C | sed -e '/^ *$$/d' > $<.f
+ $(FC) $(FCFFLAGS) -c $<.f
+ -\mv $<.o $*.o
+ $(RM) $<.f $<.C
diff --git a/expt_01.0/blkdat.input b/expt_01.0/blkdat.input
new file mode 100755
index 0000000..a0bd939
--- /dev/null
+++ b/expt_01.0/blkdat.input
@@ -0,0 +1,159 @@
+BB86 config ; analytic wind-stress
+3 layers (first one very thinto mimick a 2 layers config);
+src_2.2.18;
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
+ 22 'iversn' = hycom version number x10
+ 010 'iexpt ' = experiment number x10
+ 101 'idm ' = longitudinal array size
+ 101 'jdm ' = latitudinal array size
+ 6 'itest ' = grid point where detailed diagnostics are desired
+ 6 'jtest ' = grid point where detailed diagnostics are desired
+ 3 'kdm ' = number of layers
+ 3 'nhybrd' = number of hybrid levels (0=all isopycnal)
+ 0 'nsigma' = number of sigma levels (nhybrd-nsigma z-levels)
+ 1.0 'dp00 ' = deep z-level spacing minimum thickness (m)
+ 1.0 'dp00x ' = deep z-level spacing maximum thickness (m)
+ 1.0 'dp00f ' = deep z-level spacing stretching factor (1.0=const.space)
+ 1.0 'ds00 ' = shallow z-level spacing minimum thickness (m)
+ 1.0 'ds00x ' = shallow z-level spacing maximum thickness (m)
+ 1.0 'ds00f ' = shallow z-level spacing stretching factor (1.0=const.space)
+ 1.0 'dp00i ' = deep iso-pycnal spacing minimum thickness (m)
+ 1.0 'isotop' = shallowest depth for isopycnal layers (m), <0 from file
+ 37.0 'saln0 ' = initial salinity value (psu), only used for iniflg<2
+ 1 'locsig' = locally-referenced pot. density for stability (0=F,1=T)
+ 0 'kapref' = thermobaric ref. state (-1=input,0=none,1,2,3=constant)
+ 0 'thflag' = reference pressure flag (0=Sigma-0, 2=Sigma-2)
+ 27.01037 'thbase' = reference density (sigma units)
+ 0 'vsigma' = spacially varying isopycnal target densities (0=F,1=T)
+ 27.01000 'sigma ' = layer 1 isopycnal target density (sigma units)
+ 27.01037 'sigma ' = layer 2 isopycnal target density (sigma units)
+ 27.22136 'sigma ' = layer 3 isopycnal target density (sigma units)
+ 2 'iniflg' = initial state flag (0=levl, 1=zonl, 2=clim)
+ 0 'jerlv0' = initial jerlov water type (1 to 5; 0 to use KPAR)
+ 0 'yrflag' = days in year flag (0=360, 1=366, 2=366J1, 3=actual)
+ 0 'sshflg' = diagnostic SSH flag (0=SSH,1=SSH&stericSSH)
+ 1.0 'dsurfq' = number of days between model diagnostics at the surface
+ 1.0 'diagfq' = number of days between model diagnostics
+ 0.0 'tilefq' = number of days between model diagnostics on selected tiles
+ 0.0 'meanfq' = number of days between model diagnostics (time averaged)
+ 10.0 'rstrfq' = number of days between model restart output
+ 0.0 'bnstfq' = number of days between baro nesting archive input
+ 0.0 'nestfq' = number of days between 3-d nesting archive input
+ 0.125 'cplifq' = number of days (or time steps) between sea ice coupling
+ 900.0 'baclin' = baroclinic time step (seconds), int. divisor of 86400
+ 45. 'batrop' = barotropic time step (seconds), int. div. of baclin/2
+ 0 'incflg' = incremental update flag (0=no, 1=yes, 2=full-velocity)
+ 12 'incstp' = no. timesteps for full update (1=direct insertion)
+ 1 'incupf' = number of days of incremental updating input
+ 0.125 'wbaro ' = barotropic time smoothing weight
+ 1 'btrlfr' = leapfrog barotropic time step (0=F,1=T)
+ 0 'btrmas' = barotropic is mass conserving (0=F,1=T)
+ 8.0 'hybrlx' = HYBGEN: inverse relaxation coefficient (time steps)
+ 0.01 'hybiso' = HYBGEN: Use PCM if layer is within hybiso of target density
+ 3 'hybmap' = hybrid remapper flag (0=PCM, 1=PLM, 2=PPM, 3=WENO-like)
+ 0 'hybflg' = hybrid generator flag (0=T&S, 1=th&S, 2=th&T)
+ 0 'advflg' = thermal advection flag (0=T&S, 1=th&S, 2=th&T)
+ 2 'advtyp' = scalar advection type (0=PCM,1=MPDATA,2=FCT2,4=FCT4)
+ 2 'momtyp' = momentum advection type (2=2nd order, 4=4th order)
+ -1.0 'slip ' = +1 for free-slip, -1 for non-slip boundary conditions
+ 0.005 'visco2' = deformation-dependent Laplacian viscosity factor
+ 0.0 'visco4' = deformation-dependent biharmonic viscosity factor
+ 0.0 'facdf4' = speed-dependent biharmonic viscosity factor
+ 0.005 'veldf2' = diffusion velocity (m/s) for Laplacian momentum dissip.
+ 0.00 'veldf4' = diffusion velocity (m/s) for biharmonic momentum dissip.
+ 0.0 'thkdf2' = diffusion velocity (m/s) for Laplacian thickness diffus.
+ 0.01 'thkdf4' = diffusion velocity (m/s) for biharmonic thickness diffus.
+ 0.015 'temdf2' = diffusion velocity (m/s) for Laplacian temp/saln diffus.
+ 1.0 'temdfc' = temp diffusion conservation (0.0,1.0 all dens,temp resp.)
+ 0.e-5 'vertmx' = diffusion velocity (m/s) for momentum at MICOM M.L.base
+ 0.02 'cbar ' = rms flow speed (m/s) for bottom friction
+ 0.e-3 'cb ' = coefficient of quadratic bottom friction
+ 1.e-7 'cbar2 ' = linear bottom drag (bb86)
+ 0.0 'drglim' = limiter for explicit friction (1.0 none, 0.0 implicit)
+ 0.0 'drgscl' = scale factor for tidal drag (0.0 for no tidal drag)
+ 500.0 'thkdrg' = thickness of bottom boundary layer for tidal drag (m)
+ 10.0 'thkbot' = thickness of bottom boundary layer (m)
+ 0.02 'sigjmp' = minimum density jump across interfaces (kg/m**3)
+ 0.3 'tmljmp' = equivalent temperature jump across mixed-layer (degC)
+ 15.0 'thkmls' = reference mixed-layer thickness for SSS relaxation (m)
+ 0.0 'thkmlt' = reference mixed-layer thickness for SST relaxation (m)
+ 6.0 'thkriv' = nominal thickness of river inflow (m)
+ 20.0 'thkfrz' = maximum thickness of near-surface freezing zone (m)
+ 0 'iceflg' = sea ice model flag (0=none,1=energy loan,2=coupled/esmf)
+ 0.0 'tfrz_0' = ENLN: ice melting point (degC) at S=0psu
+ -0.054 'tfrz_s' = ENLN: gradient of ice melting point (degC/psu)
+ 0.0 'ticegr' = ENLN: temp. grad. inside ice (deg/m); =0 use surtmp
+ 0.5 'hicemn' = ENLN: minimum ice thickness (m)
+ 10.0 'hicemx' = ENLN: maximum ice thickness (m)
+ 0 'ntracr' = number of tracers (0=none,negative to initialize)
+ 0 'trcflg' = tracer flags (one digit per tr, most sig. replicated)
+ 64 'tsofrq' = number of time steps between anti-drift offset calcs
+ 0.0 'tofset' = temperature anti-drift offset (degC/century)
+ 0.0 'sofset' = salnity anti-drift offset (psu/century)
+ 0 'mlflag' = mixed layer flag (0=none,1=KPP,2-3=KT,4=PWP,5=MY,6=GISS)
+ 0 'pensol' = KT: activate penetrating solar rad. (0=F,1=T)
+ 999.0 'dtrate' = KT: maximum permitted m.l. detrainment rate (m/day)
+ 19.2 'thkmin' = KT/PWP: minimum mixed-layer thickness (m)
+ 0 'dypflg' = KT/PWP: diapycnal mixing flag (0=none, 1=KPP, 2=explicit)
+99999 'mixfrq' = KT/PWP: number of time steps between diapycnal mix calcs
+ 1.e-7 'diapyc' = KT/PWP: diapycnal diffusivity x buoyancy freq. (m**2/s**2)
+ 0.25 'rigr ' = PWP: critical gradient richardson number
+ 0.65 'ribc ' = PWP: critical bulk richardson number
+ 0.7 'rinfty' = KPP: maximum gradient richardson number (shear inst.)
+ 0.25 'ricr ' = KPP: critical bulk richardson number
+ 0.0 'bldmin' = KPP: minimum surface boundary layer thickness (m)
+1200.0 'bldmax' = K-PROF: maximum surface boundary layer thickness (m)
+ 0.7 'cekman' = KPP/KT: scale factor for Ekman depth
+ 1.0 'cmonob' = KPP: scale factor for Monin-Obukov depth
+ 0 'bblkpp' = KPP: activate bottom boundary layer (0=F,1=T)
+ 1 'shinst' = KPP: activate shear instability mixing (0=F,1=T)
+ 1 'dbdiff' = KPP: activate double diffusion mixing (0=F,1=T)
+ 1 'nonloc' = KPP: activate nonlocal b. layer mixing (0=F,1=T)
+ 0 'latdiw' = K-PROF: activate lat.dep. int.wave mixing (0=F,1=T)
+ 0 'botdiw' = GISS: activate bot.enhan.int.wav mixing (0=F,1=T)
+ 0 'difout' = K-PROF: output visc/diff coffs in archive (0=F,1=T)
+ 13 'difsmo' = K-PROF: number of layers with horiz smooth diff coeffs
+ 50.0e-4 'difm0 ' = KPP: max viscosity due to shear instability (m**2/s)
+ 50.0e-4 'difs0 ' = KPP: max diffusivity due to shear instability (m**2/s)
+ 1.0e-4 'difmiw' = KPP: background/internal wave viscosity (m**2/s)
+ 0.1e-4 'difsiw' = KPP: background/internal wave diffusivity (m**2/s)
+ 10.0e-4 'dsfmax' = KPP: salt fingering diffusivity factor (m**2/s)
+ 1.9 'rrho0 ' = KPP: salt fingering rp=(alpha*delT)/(beta*delS)
+ 98.96 'cs ' = KPP: value for nonlocal flux term
+ 10.0 'cstar ' = KPP: value for nonlocal flux term
+ 0.0 'cv ' = KPP: buoyancy frequency ratio (0.0 to use a fn. of N)
+ 5.0 'c11 ' = KPP: value for turb velocity scale
+ 2 'hblflg' = KPP: b. layer interp. flag (0=const.,1=linear,2=quad.)
+ 2 'niter ' = KPP: iterations for semi-implicit soln. (2 recomended)
+ 0 'fltflg' = FLOATS: synthetic float flag (0=no; 1=yes)
+ 4 'nfladv' = FLOATS: advect every nfladv bacl. time steps (even, >=4)
+ 1 'nflsam' = FLOATS: output (0=every nfladv steps; >0=no. of days)
+ 0 'intpfl' = FLOATS: horiz. interp. (0=2nd order+n.n.; 1=n.n. only)
+ 0 'iturbv' = FLOATS: add horiz. turb. advection velocity (0=no; 1=yes)
+ 1 'ismpfl' = FLOATS: sample water properties at float (0=no; 1=yes)
+4.63e-6 'tbvar ' = FLOATS: horizontal turb. vel. variance scale (m**2/s**2)
+ 0.4 'tdecri' = FLOATS: inverse decorrelation time scale (1/day)
+ 0 'lbflag' = lateral barotropic bndy flag (0=none, 1=port, 2=input)
+ 0 'tidflg' = TIDES: tidal forcing flag (0=none,1=open-bdy,2=bdy&body)
+00000001 'tidcon' = TIDES: 1 digit per (Q1K2P1N2O1K1S2M2), 0=off,1=on
+ 0.06 'tidsal' = TIDES: scalar self attraction and loading factor
+ 1 'tidgen' = TIDES: generic time (0=F,1=T)
+ 1.0 'tidrmp' = TIDES: ramp time (days)
+ 0.0 'tid_t0' = TIDES: origin for ramp time (model day)
+ 12 'clmflg' = climatology frequency flag (6=bimonthly, 12=monthly)
+ 2 'wndflg' = wind stress input flag (0=none,1=u/v-grid,2,3=p-grid)
+ 50. 'pstrsi' = depth over which the wind is apply (m) (> 0 for bb86 only )
+ 4 'ustflg' = ustar forcing flag (3=input,1,2=wndspd,4=stress)
+ 0 'flxflg' = thermal forcing flag (0=none,3=net-flux,1,2,4=sst-based)
+ 0 'empflg' = E-P forcing flag (0=none,3=net_E-P, 1,2,4=sst-bas_E)
+ 0 'dswflg' = diurnal shortwave flag (0=none,1=daily to diurnal corr.)
+ 0 'sssflg' = SSS relaxation flag (0=none,1=clim)
+ 0 'lwflag' = longwave (SST) flag (0=none,1=clim,2=atmos)
+ 0 'sstflg' = SST relaxation flag (0=none,1=clim,2=atmos,3=observed)
+ 0 'icmflg' = ice mask flag (0=none,1=clim,2=atmos,3=obs/coupled)
+ 0 'flxoff' = net flux offset flag (0=F,1=T)
+ 0 'flxsmo' = smooth surface fluxes (0=F,1=T)
+ 0 'relax ' = activate lateral boundary nudging (0=F,1=T)
+ 0 'trcrlx' = activate lat. bound. tracer nudging (0=F,1=T)
+ 0 'priver' = rivers as a precipitation bogas (0=F,1=T)
+ 0 'epmass' = treat evap-precip as a mass exchange (0=F,1=T)
diff --git a/expt_01.0/gfortran.log b/expt_01.0/gfortran.log
new file mode 100755
index 0000000..4f0bce0
--- /dev/null
+++ b/expt_01.0/gfortran.log
@@ -0,0 +1,714 @@
+/Net/yucatan/abozec/BB86_PACKAGE/expt_01.0/data
+
+BB86 config ; analytic wind-stress
+3 layers (first one very thinto mimick a 2 layers config);
+src_2.2.18;
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
+
+iversn = 22
+iexpt = 10
+
+idm = 101
+jdm = 101
+
+itest = 6
+jtest = 6
+
+kdm = 3
+nhybrd = 3
+nsigma = 0
+dp00 = 1.0000 m
+dp00x = 1.0000 m
+dp00f = 1.0000
+ds00 = 1.0000 m
+ds00x = 1.0000 m
+ds00f = 1.0000
+dp00i = 1.0000 m
+isotop = 1.0000 m
+
+saln0 = 37.0000 psu
+locsig = T
+kapref = 0
+thflag = 0
+
+equation of state is 7-term sigma-0
+
+thbase = 27.0104 sigma-0
+
+vsigma = F
+sigma = 27.0100 sigma-0
+sigma = 27.0104 sigma-0
+sigma = 27.2214 sigma-0
+
+iniflg = 2
+jerlv0 = 0
+
+yrflag = 0
+sshflg = 0
+dsurfq = 1.0000 days
+diagfq = 1.0000 days
+tilefq = 0.0000 days
+meanfq = 0.0000 days
+rstrfq = 10.0000 days
+bnstfq = 0.0000 days
+nestfq = 0.0000 days
+cplifq = 0.1250 days (-ve time steps)
+baclin = 900.0000 sec
+batrop = 45.0000 sec
+
+icefrq = 12
+
+incflg = 0
+incstp = 12
+incupf = 1
+
+wbaro = 0.1250
+btrlfr = T
+btrmas = F
+hybrlx = 8.0000 time steps
+hybiso = 0.0100 kg/m^3
+hybmap = 3
+hybflg = 0
+advflg = 0
+advtyp = 2
+momtyp = 2
+slip = -1.0000 (-1=no-slip, +1=free-slip)
+visco2 = 0.0050
+visco4 = 0.0000
+facdf4 = 0.0000
+veldf2 = 0.0050 m/s
+veldf4 = 0.0000 m/s
+thkdf2 = 0.0000 m/s
+thkdf4 = 0.0100 m/s (-ve if variable)
+temdf2 = 0.0150 m/s
+temdfc = 1.0000 (0.0,1.0 conserve dens,temp resp.)
+vertmx = 0.0000 m/s
+cbar = 0.0200 m/s
+cb = 0.0000
+cbar2 = 0.0000
+drglim = 0.0000
+drgscl = 0.0000
+thkdrg = 500.0000 m
+
+thkbot = 10.0000 m
+sigjmp = 0.0200 kg/m**3
+tmljmp = 0.3000 degC
+thkmls = 15.0000 m
+thkmlt = 0.0000 m
+thkriv = 6.0000 m
+
+thkfrz = 20.0000 m
+iceflg = 0
+tfrz_0 = 0.0000 degC
+tfrz_s = -0.0540 degC/psu
+ticegr = 0.0000 degC/m
+hicemn = 0.5000 m
+hicemx = 10.0000 m
+
+ntracr = 0
+trcflg = 0
+
+tsofrq = 64
+tofset = 0.0000 degC/century
+sofset = 0.0000 psu/century
+
+mlflag = 0
+pensol = F
+dtrate = 999.0000 m/day
+thkmin = 19.2000 m
+dypflg = 0
+mixfrq = 99999
+diapyc = 0.0000 m**2/s**2
+rigr = 0.2500
+ribc = 0.6500
+rinfty = 0.7000
+ricr = 0.2500
+bldmin = 0.0000 m
+bldmax = 1200.0000 m
+cekman = 0.7000
+cmonob = 1.0000
+bblkpp = F
+shinst = T
+dbdiff = T
+nonloc = T
+latdiw = F
+botdiw = F
+difout = F
+difsmo = 13
+difm0 = 0.0050 m**2/s
+difs0 = 0.0050 m**2/s
+difmiw = 0.0001 m**2/s
+difsiw = 0.0000 m**2/s
+dsfmax = 0.0010 m**2/s
+rrho0 = 1.9000
+cs = 98.9600
+cstar = 10.0000
+cv = 0.0000
+c11 = 5.0000
+hblflg = 2
+niter = 2
+fltflg = 0
+nfladv = 4
+nflsam = 1
+intpfl = 0
+iturbv = 0
+ismpfl = 1
+tbvar = 0.0000 m**2/s**2
+tdecri = 0.4000 1/day
+
+lbflag = 0
+tidflg = 0
+tidcon = 1
+tidsal = 0.0600
+tidgen = T
+tidrmp = 1.0000 days
+tid_t0 = 0.0000 model day
+
+clmflg = 12
+wndflg = 2
+pstrsi = 50.0000 m
+ustflg = 4
+flxflg = 0
+empflg = 0
+dswflg = 0
+sssflg = 0
+lwflag = 0
+sstflg = 0
+icmflg = 0
+flxoff = F
+flxsmo = F
+
+ !!!! BB86 Configuration !!!!
+
+
+relax = F
+trcrlx = F
+priver = F
+epmass = F
+
+
+ ddsurf = 1.0000000000000000 96
+ ddiagf = 1.0000000000000000 96
+ dtilef = 1.32046937523773889E+028 0
+ dmeanf = 1.32046937523773889E+028 0
+ drstrf = 10.000000000000000 960
+
+ turb. flux parameters:
+ thkdf2,temdf2 = 0.00E+00 1.50E-02
+ thkdf4 = 1.00E-02
+ veldf2,visco2 = 5.00E-03 5.00E-03
+ veldf4,visco4 = 0.00E+00 0.00E+00
+ diapyc,vertmx = 1.00E-07 0.00E+00
+
+ 20 barotropic steps per baroclinic time step
+
+ reading grid file from regional.grid.[ab]
+ 0 'mapflg' = map flag (0=mercator,10=panam,12=ulon-panam)
+plon: min,max = 0.00000 20.00000
+plat: min,max = 0.00000 20.00000
+ulon: min,max = -0.10000 19.90000
+ulat: min,max = 0.00000 20.00000
+vlon: min,max = 0.00000 20.00000
+vlat: min,max = -0.10000 19.90000
+pscx: min,max = 20000.00000 20000.00000
+pscy: min,max = 20000.00000 20000.00000
+qscx: min,max = 20000.00000 20000.00000
+qscy: min,max = 20000.00000 20000.00000
+uscx: min,max = 20000.00000 20000.00000
+uscy: min,max = 20000.00000 20000.00000
+vscx: min,max = 20000.00000 20000.00000
+vscy: min,max = 20000.00000 20000.00000
+cori: min,max = 7.34000E-05 1.13400E-04
+
+ i,j= 6 6 plat= 1.000 corio,scux,vy= 0.000075400 20000.00 20000.00
+
+ reading bathymetry file from regional.depth.[ab]
+
+ Bathymetry
+ i/jdm = 101 101
+
+
+
+ min,max depth = 5000.00000 5000.00000
+
+bigrid: nreg = 0
+bigrid: closed basin
+
+ip array, cols 1 -- 101
+ 101 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+ 100 0***************************************************************************************************0
+ 99 0***************************************************************************************************0
+ 98 0***************************************************************************************************0
+ 97 0***************************************************************************************************0
+ 96 0***************************************************************************************************0
+ 95 0***************************************************************************************************0
+ 94 0***************************************************************************************************0
+ 93 0***************************************************************************************************0
+ 92 0***************************************************************************************************0
+ 91 0***************************************************************************************************0
+ 90 0***************************************************************************************************0
+ 89 0***************************************************************************************************0
+ 88 0***************************************************************************************************0
+ 87 0***************************************************************************************************0
+ 86 0***************************************************************************************************0
+ 85 0***************************************************************************************************0
+ 84 0***************************************************************************************************0
+ 83 0***************************************************************************************************0
+ 82 0***************************************************************************************************0
+ 81 0***************************************************************************************************0
+ 80 0***************************************************************************************************0
+ 79 0***************************************************************************************************0
+ 78 0***************************************************************************************************0
+ 77 0***************************************************************************************************0
+ 76 0***************************************************************************************************0
+ 75 0***************************************************************************************************0
+ 74 0***************************************************************************************************0
+ 73 0***************************************************************************************************0
+ 72 0***************************************************************************************************0
+ 71 0***************************************************************************************************0
+ 70 0***************************************************************************************************0
+ 69 0***************************************************************************************************0
+ 68 0***************************************************************************************************0
+ 67 0***************************************************************************************************0
+ 66 0***************************************************************************************************0
+ 65 0***************************************************************************************************0
+ 64 0***************************************************************************************************0
+ 63 0***************************************************************************************************0
+ 62 0***************************************************************************************************0
+ 61 0***************************************************************************************************0
+ 60 0***************************************************************************************************0
+ 59 0***************************************************************************************************0
+ 58 0***************************************************************************************************0
+ 57 0***************************************************************************************************0
+ 56 0***************************************************************************************************0
+ 55 0***************************************************************************************************0
+ 54 0***************************************************************************************************0
+ 53 0***************************************************************************************************0
+ 52 0***************************************************************************************************0
+ 51 0***************************************************************************************************0
+ 50 0***************************************************************************************************0
+ 49 0***************************************************************************************************0
+ 48 0***************************************************************************************************0
+ 47 0***************************************************************************************************0
+ 46 0***************************************************************************************************0
+ 45 0***************************************************************************************************0
+ 44 0***************************************************************************************************0
+ 43 0***************************************************************************************************0
+ 42 0***************************************************************************************************0
+ 41 0***************************************************************************************************0
+ 40 0***************************************************************************************************0
+ 39 0***************************************************************************************************0
+ 38 0***************************************************************************************************0
+ 37 0***************************************************************************************************0
+ 36 0***************************************************************************************************0
+ 35 0***************************************************************************************************0
+ 34 0***************************************************************************************************0
+ 33 0***************************************************************************************************0
+ 32 0***************************************************************************************************0
+ 31 0***************************************************************************************************0
+ 30 0***************************************************************************************************0
+ 29 0***************************************************************************************************0
+ 28 0***************************************************************************************************0
+ 27 0***************************************************************************************************0
+ 26 0***************************************************************************************************0
+ 25 0***************************************************************************************************0
+ 24 0***************************************************************************************************0
+ 23 0***************************************************************************************************0
+ 22 0***************************************************************************************************0
+ 21 0***************************************************************************************************0
+ 20 0***************************************************************************************************0
+ 19 0***************************************************************************************************0
+ 18 0***************************************************************************************************0
+ 17 0***************************************************************************************************0
+ 16 0***************************************************************************************************0
+ 15 0***************************************************************************************************0
+ 14 0***************************************************************************************************0
+ 13 0***************************************************************************************************0
+ 12 0***************************************************************************************************0
+ 11 0***************************************************************************************************0
+ 10 0***************************************************************************************************0
+ 9 0***************************************************************************************************0
+ 8 0***************************************************************************************************0
+ 7 0***************************************************************************************************0
+ 6 0***************************************************************************************************0
+ 5 0***************************************************************************************************0
+ 4 0***************************************************************************************************0
+ 3 0***************************************************************************************************0
+ 2 0***************************************************************************************************0
+ 1 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+
+ mean basin depth (m) and area (10^6 km^2): 5000.0 3.92
+
+dp0k( 1) = 1.00 m thkns = 1.00 m depth = 1.00 m
+dp0k( 2) = 1.00 m thkns = 1.00 m depth = 2.00 m
+dp0k( 3) = 1.00 m thkns = 1.00 m depth = 3.00 m
+
+ds0k( 1) = 1.00 m thkns = 1.00 m depth = 1.00 m
+
+ now opening forcing fields ...
+
+Analytical Eastward Wind-stress
+i/jdm = 101 101
+ tauewd: month,range = 01 -1.00000E-01 1.00000E-01
+
+Analytical Northward Wind-stress
+i/jdm = 101 101
+ taunwd: month,range = 01 0.00000E+00 0.00000E+00
+ ...finished opening forcing fields
+ now opening kpar field ...
+ ...finished opening kpar field
+ now opening rivers field ...
+ ...finished opening river field
+ now opening relaxation fields ...
+ No thermal relaxation mask.
+
+ Potential Temperature
+i/jdm = 101 101
+ tem : month,layer,dens,range = 01 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 01 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 01 03 27.221 1.63001E+01 1.63001E+01
+
+ Salinity
+i/jdm = 101 101
+ sal : month,layer,dens,range = 01 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 03 27.221 3.70000E+01 3.70000E+01
+
+ Interface Depths
+i/jdm = 101 101
+ int : month,layer,dens,range = 01 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 01 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 01 03 27.221 4.90300E+06 4.90300E+06
+ ...finished opening relaxation fields
+ rdrlax - month = 1 1
+ tem : month,layer,dens,range = 01 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 01 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 01 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 01 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 01 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 01 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 01 03 27.221 4.90300E+06 4.90300E+06
+rdrlax: pwall.2 ok; expected,input min depth = 1.00 1.00
+rdrlax: pwall.3 NOT ok; expected,input min depth = 2.00 500.00 (bad climatology?)
+rdrlax: continuing because file ./relax.weird exists (ignore the "bad" climatology)
+ relaxation fields for month 1 written into slot 1
+ sigma(k): 27.01 27.01 27.22
+ 0 6 6 istate: temp saln thstar thkns dpth montg
+ mxl 19.2
+ 1 17.18 37.00 27.01 1.0 0.5 0.000
+ 2 17.18 37.00 27.01 499.0 250.5 -0.000
+ 3 16.30 37.00 27.22 4500.0 2750.0 -0.106
+ bot 5000.0
+ 0 6 6 istate: temp saln thstar thkns dpth montg
+ mxl 19.2
+ 1 17.18 37.00 27.01 1.0 0.5 0.000
+ 2 17.18 37.00 27.01 499.0 250.5 -0.000
+ 3 16.30 37.00 27.22 4500.0 2750.0 -0.106
+ bot 5000.0
+
+model starts at day 0.0, goes to day 11.0 (steps 0 -- 1056)
+
+ tauewd: month,range = 12 -1.00000E-01 1.00000E-01
+ taunwd: month,range = 12 0.00000E+00 0.00000E+00
+ forcing functions for month 12 written into slot 1
+ tauewd: month,range = 01 -1.00000E-01 1.00000E-01
+ taunwd: month,range = 01 0.00000E+00 0.00000E+00
+ forcing functions for month 1 written into slot 2
+ tauewd: month,range = 02 -1.00000E-01 1.00000E-01
+ taunwd: month,range = 02 0.00000E+00 0.00000E+00
+ forcing functions for month 2 written into slot 3
+ tauewd: month,range = 03 -1.00000E-01 1.00000E-01
+ taunwd: month,range = 03 0.00000E+00 0.00000E+00
+ forcing functions for month 3 written into slot 4
+ rdrlax - month = 12 12
+ tem : month,layer,dens,range = 12 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 12 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 12 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 12 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 12 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 12 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 12 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 12 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 12 03 27.221 4.90300E+06 4.90300E+06
+rdrlax: pwall.2 ok; expected,input min depth = 1.00 1.00
+rdrlax: pwall.3 NOT ok; expected,input min depth = 2.00 500.00 (bad climatology?)
+rdrlax: continuing because file ./relax.weird exists (ignore the "bad" climatology)
+ relaxation fields for month 12 written into slot 1
+ rdrlax - month = 1 1
+ tem : month,layer,dens,range = 01 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 01 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 01 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 01 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 01 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 01 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 01 03 27.221 4.90300E+06 4.90300E+06
+ relaxation fields for month 1 written into slot 2
+ rdrlax - month = 2 2
+ tem : month,layer,dens,range = 02 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 02 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 02 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 02 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 02 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 02 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 02 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 02 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 02 03 27.221 4.90300E+06 4.90300E+06
+ relaxation fields for month 2 written into slot 3
+ rdrlax - month = 3 3
+ tem : month,layer,dens,range = 03 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 03 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 03 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 03 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 03 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 03 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 03 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 03 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 03 03 27.221 4.90300E+06 4.90300E+06
+ relaxation fields for month 3 written into slot 4
+
+
+ timer statistics
+ ------------------
+
+ xceget calls = 1 time = 0.00000 time/call = 0.00000000
+ xclget calls = 101 time = 0.00000 time/call = 0.00000000
+ xcsum calls = 2 time = 0.00000 time/call = 0.00000000
+ xcmaxr calls = 5 time = 0.00000 time/call = 0.00000000
+ xctilr calls = 79 time = 0.00000 time/call = 0.00000000
+ zaio** calls = 191 time = 0.00100 time/call = 0.00000524
+ zaiord calls = 21 time = 0.01100 time/call = 0.00052381
+ zaiowr calls = 26 time = 0.01200 time/call = 0.00046154
+ total calls = 1 time = 0.08700 time/call = 0.08700000
+
+
+
+ 1 (0001/016 00) mean SSH (mm): -0.00 (-4.9E-05 to -4.9E-05)
+ 1 (0001/016 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 1 (0001/016 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 1 (0001/016 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 1 (0001/016 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 1 (0001/016 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 1 (0001/016 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 1 (0001/016 00) region-wide mean Kin. Energy: 0.0046712813
+ 1 (0001/016 00) region-wide mean Temperature: 16.3881703000
+ 1 (0001/016 00) region-wide mean Salinity: 37.0000000000
+ 1 (0001/016 00) region-wide mean Density Dev: 0.1898957149
+ 96 1 min/max of s after advection: 37.000 37.000 (range: 1.21E-13)
+ 96 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 96 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 96 (0001/017 00) mean SSH (mm): -0.00 (-5.2E+00 to 4.7E+00)
+ 96 (0001/017 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 96 (0001/017 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 96 (0001/017 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 96 (0001/017 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 96 (0001/017 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 96 (0001/017 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 96 (0001/017 00) region-wide mean Kin. Energy: 4.1435491705
+ 96 (0001/017 00) region-wide mean Temperature: 16.3881703000
+ 96 (0001/017 00) region-wide mean Salinity: 37.0000000000
+ 96 (0001/017 00) region-wide mean Density Dev: 0.1898957164
+ step 96 day 1.00 -- archiving completed --
+ 192 1 min/max of s after advection: 37.000 37.000 (range: 1.63E-13)
+ 192 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 192 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 192 (0001/018 00) mean SSH (mm): -0.00 (-1.0E+01 to 9.3E+00)
+ 192 (0001/018 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 192 (0001/018 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 192 (0001/018 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 192 (0001/018 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 192 (0001/018 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 192 (0001/018 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 192 (0001/018 00) region-wide mean Kin. Energy: 13.4000676946
+ 192 (0001/018 00) region-wide mean Temperature: 16.3881703000
+ 192 (0001/018 00) region-wide mean Salinity: 37.0000000000
+ 192 (0001/018 00) region-wide mean Density Dev: 0.1898957164
+ step 192 day 2.00 -- archiving completed --
+ 288 1 min/max of s after advection: 37.000 37.000 (range: 1.99E-13)
+ 288 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 288 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 288 (0001/019 00) mean SSH (mm): -0.00 (-1.6E+01 to 1.4E+01)
+ 288 (0001/019 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 288 (0001/019 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 288 (0001/019 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 288 (0001/019 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 288 (0001/019 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 288 (0001/019 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 288 (0001/019 00) region-wide mean Kin. Energy: 28.1775874769
+ 288 (0001/019 00) region-wide mean Temperature: 16.3881702999
+ 288 (0001/019 00) region-wide mean Salinity: 37.0000000000
+ 288 (0001/019 00) region-wide mean Density Dev: 0.1898957164
+ step 288 day 3.00 -- archiving completed --
+ 384 1 min/max of s after advection: 37.000 37.000 (range: 1.99E-13)
+ 384 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 384 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 384 (0001/020 00) mean SSH (mm): -0.00 (-2.1E+01 to 1.9E+01)
+ 384 (0001/020 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 384 (0001/020 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 384 (0001/020 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 384 (0001/020 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 384 (0001/020 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 384 (0001/020 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 384 (0001/020 00) region-wide mean Kin. Energy: 48.4792337492
+ 384 (0001/020 00) region-wide mean Temperature: 16.3881702999
+ 384 (0001/020 00) region-wide mean Salinity: 37.0000000000
+ 384 (0001/020 00) region-wide mean Density Dev: 0.1898957164
+ step 384 day 4.00 -- archiving completed --
+ 480 1 min/max of s after advection: 37.000 37.000 (range: 2.06E-13)
+ 480 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 480 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 480 (0001/021 00) mean SSH (mm): -0.00 (-2.6E+01 to 2.3E+01)
+ 480 (0001/021 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 480 (0001/021 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 480 (0001/021 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 480 (0001/021 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 480 (0001/021 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 480 (0001/021 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 480 (0001/021 00) region-wide mean Kin. Energy: 74.1010188713
+ 480 (0001/021 00) region-wide mean Temperature: 16.3881702998
+ 480 (0001/021 00) region-wide mean Salinity: 37.0000000000
+ 480 (0001/021 00) region-wide mean Density Dev: 0.1898957164
+ step 480 day 5.00 -- archiving completed --
+ 576 1 min/max of s after advection: 37.000 37.000 (range: 2.34E-13)
+ 576 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 576 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 576 (0001/022 00) mean SSH (mm): -0.00 (-3.1E+01 to 2.8E+01)
+ 576 (0001/022 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 576 (0001/022 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 576 (0001/022 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 576 (0001/022 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 576 (0001/022 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 576 (0001/022 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 576 (0001/022 00) region-wide mean Kin. Energy: 103.6767480728
+ 576 (0001/022 00) region-wide mean Temperature: 16.3881702998
+ 576 (0001/022 00) region-wide mean Salinity: 37.0000000000
+ 576 (0001/022 00) region-wide mean Density Dev: 0.1898957164
+ step 576 day 6.00 -- archiving completed --
+ 672 1 min/max of s after advection: 37.000 37.000 (range: 2.49E-13)
+ 672 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 672 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 672 (0001/023 00) mean SSH (mm): -0.00 (-3.7E+01 to 3.2E+01)
+ 672 (0001/023 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 672 (0001/023 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 672 (0001/023 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 672 (0001/023 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 672 (0001/023 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 672 (0001/023 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 672 (0001/023 00) region-wide mean Kin. Energy: 137.1932721004
+ 672 (0001/023 00) region-wide mean Temperature: 16.3881702997
+ 672 (0001/023 00) region-wide mean Salinity: 37.0000000000
+ 672 (0001/023 00) region-wide mean Density Dev: 0.1898957164
+ step 672 day 7.00 -- archiving completed --
+ 768 1 min/max of s after advection: 37.000 37.000 (range: 2.56E-13)
+ 768 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 768 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 768 (0001/024 00) mean SSH (mm): -0.00 (-4.2E+01 to 3.7E+01)
+ 768 (0001/024 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 768 (0001/024 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 768 (0001/024 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 768 (0001/024 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 768 (0001/024 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 768 (0001/024 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 768 (0001/024 00) region-wide mean Kin. Energy: 174.0606716237
+ 768 (0001/024 00) region-wide mean Temperature: 16.3881702996
+ 768 (0001/024 00) region-wide mean Salinity: 37.0000000000
+ 768 (0001/024 00) region-wide mean Density Dev: 0.1898957165
+ step 768 day 8.00 -- archiving completed --
+ 864 1 min/max of s after advection: 37.000 37.000 (range: 2.56E-13)
+ 864 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 864 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 864 (0001/025 00) mean SSH (mm): -0.00 (-4.7E+01 to 4.1E+01)
+ 864 (0001/025 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 864 (0001/025 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 864 (0001/025 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 864 (0001/025 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 864 (0001/025 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 864 (0001/025 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 864 (0001/025 00) region-wide mean Kin. Energy: 213.4808462973
+ 864 (0001/025 00) region-wide mean Temperature: 16.3881702995
+ 864 (0001/025 00) region-wide mean Salinity: 37.0000000000
+ 864 (0001/025 00) region-wide mean Density Dev: 0.1898957165
+ step 864 day 9.00 -- archiving completed --
+ 960 1 min/max of s after advection: 37.000 37.000 (range: 2.77E-13)
+ 960 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 960 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 960 (0001/026 00) mean SSH (mm): -0.00 (-5.2E+01 to 4.5E+01)
+ 960 (0001/026 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 960 (0001/026 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 960 (0001/026 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 960 (0001/026 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 960 (0001/026 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 960 (0001/026 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 960 (0001/026 00) region-wide mean Kin. Energy: 255.1225661207
+ 960 (0001/026 00) region-wide mean Temperature: 16.3881702995
+ 960 (0001/026 00) region-wide mean Salinity: 37.0000000000
+ 960 (0001/026 00) region-wide mean Density Dev: 0.1898957165
+ time step 960 y e a r 0001 d a y 026 h o u r 00
+ creating a new backup restart file
+ restart created at model day 10.000
+ step 960 day 10.00 -- archiving completed --
+ 1056 1 min/max of s after advection: 37.000 37.000 (range: 1.35E-13)
+ 1056 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 1056 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 1056 (0001/027 00) mean SSH (mm): -0.00 (-5.6E+01 to 4.9E+01)
+ 1056 (0001/027 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 1056 (0001/027 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 1056 (0001/027 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 1056 (0001/027 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 1056 (0001/027 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 1056 (0001/027 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 1056 (0001/027 00) region-wide mean Kin. Energy: 298.0232597882
+ 1056 (0001/027 00) region-wide mean Temperature: 16.3881704135
+ 1056 (0001/027 00) region-wide mean Salinity: 37.0000000000
+ 1056 (0001/027 00) region-wide mean Density Dev: 0.1898956897
+ northward heat flux (petawatts):
+ 0.000 0.000 0.006 0.010 0.012 0.012 0.012 0.011 0.009 0.007 0.004
+ 0.002 0.001 0.001 0.000 0.000 0.001 0.001 0.001 0.002 0.002 0.001
+ 0.001 -0.000 -0.001 -0.001 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002
+ -0.003 -0.004 -0.005 -0.007 -0.008 -0.009 -0.010 -0.010 -0.009 -0.009 -0.007
+ -0.006 -0.005 -0.004 -0.004 -0.004 -0.004 -0.005 -0.007 -0.008 -0.009 -0.010
+ -0.010 -0.010 -0.010 -0.009 -0.008 -0.006 -0.005 -0.004 -0.003 -0.003 -0.003
+ -0.003 -0.003 -0.004 -0.004 -0.004 -0.004 -0.003 -0.003 -0.002 -0.001 -0.001
+ -0.001 -0.000 -0.000 -0.000 -0.000 0.000 0.001 0.001 0.002 0.003 0.004
+ 0.004 0.005 0.005 0.005 0.005 0.004 0.002 0.002 0.001 0.001 0.002
+ 0.001
+ time step 1056 y e a r 0001 d a y 027 h o u r 00
+ creating a new standard restart file
+ restart created & closed at model day 11.000
+ step 1056 day 11.00 -- archiving completed --
+
+
+ timer statistics
+ ------------------
+
+ xcsum calls = 2412 time = 0.13000 time/call = 0.00005390
+ xcmaxr calls = 1432 time = 0.00200 time/call = 0.00000140
+ xctilr calls = 111982 time = 1.97200 time/call = 0.00001761
+ zaio** calls = 27 time = 0.00200 time/call = 0.00007407
+ zaiowr calls = 374 time = 0.16900 time/call = 0.00045187
+ cnuity calls = 1056 time = 7.14000 time/call = 0.00676136
+ tsadvc calls = 1056 time = 14.14400 time/call = 0.01339394
+ momtum calls = 1056 time = 24.70100 time/call = 0.02339110
+ barotp calls = 1056 time = 14.23900 time/call = 0.01348390
+ thermf calls = 1056 time = 0.16000 time/call = 0.00015152
+ ic**** calls = 1056 time = 0.16100 time/call = 0.00015246
+ mx**** calls = 1056 time = 0.00000 time/call = 0.00000000
+ conv** calls = 1056 time = 5.00300 time/call = 0.00473769
+ diapf* calls = 1056 time = 0.00000 time/call = 0.00000000
+ hybgen calls = 1056 time = 19.23500 time/call = 0.01821496
+ restrt calls = 2 time = 0.04600 time/call = 0.02300000
+ overtn calls = 1 time = 0.00100 time/call = 0.00100000
+ archiv calls = 11 time = 0.14700 time/call = 0.01336364
+ incupd calls = 1056 time = 0.00000 time/call = 0.00000000
+ total calls = 1 time = 85.42300 time/call = 85.42300000
+
+
+
+ **************************************************
+ (normal)
+ **************************************************
+You are Done !
diff --git a/expt_01.0/intel.log b/expt_01.0/intel.log
new file mode 100755
index 0000000..cb00a32
--- /dev/null
+++ b/expt_01.0/intel.log
@@ -0,0 +1,701 @@
+/Net/yucatan/abozec/BB86_PACKAGE/expt_01.0/data
+
+BB86 config ; analytic wind-stress
+3 layers (first one very thinto mimick a 2 layers config);
+src_2.2.18;
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
+
+iversn = 22
+iexpt = 10
+
+idm = 101
+jdm = 101
+
+itest = 6
+jtest = 6
+
+kdm = 3
+nhybrd = 3
+nsigma = 0
+dp00 = 1.0000 m
+dp00x = 1.0000 m
+dp00f = 1.0000
+ds00 = 1.0000 m
+ds00x = 1.0000 m
+ds00f = 1.0000
+dp00i = 1.0000 m
+isotop = 1.0000 m
+
+saln0 = 37.0000 psu
+locsig = T
+kapref = 0
+thflag = 0
+
+equation of state is 7-term sigma-0
+
+thbase = 27.0104 sigma-0
+
+vsigma = F
+sigma = 27.0100 sigma-0
+sigma = 27.0104 sigma-0
+sigma = 27.2214 sigma-0
+
+iniflg = 2
+jerlv0 = 0
+
+yrflag = 0
+sshflg = 0
+dsurfq = 1.0000 days
+diagfq = 1.0000 days
+tilefq = 0.0000 days
+meanfq = 0.0000 days
+rstrfq = 10.0000 days
+bnstfq = 0.0000 days
+nestfq = 0.0000 days
+cplifq = 0.1250 days (-ve time steps)
+baclin = 900.0000 sec
+batrop = 45.0000 sec
+
+icefrq = 12
+
+incflg = 0
+incstp = 12
+incupf = 1
+
+wbaro = 0.1250
+btrlfr = T
+btrmas = F
+hybrlx = 8.0000 time steps
+hybiso = 0.0100 kg/m^3
+hybmap = 3
+hybflg = 0
+advflg = 0
+advtyp = 2
+momtyp = 2
+slip = -1.0000 (-1=no-slip, +1=free-slip)
+visco2 = 0.0050
+visco4 = 0.0000
+facdf4 = 0.0000
+veldf2 = 0.0050 m/s
+veldf4 = 0.0000 m/s
+thkdf2 = 0.0000 m/s
+thkdf4 = 0.0100 m/s (-ve if variable)
+temdf2 = 0.0150 m/s
+temdfc = 1.0000 (0.0,1.0 conserve dens,temp resp.)
+vertmx = 0.0000 m/s
+cbar = 0.0200 m/s
+cb = 0.0000
+cbar2 = 0.0000
+drglim = 0.0000
+drgscl = 0.0000
+thkdrg = 500.0000 m
+
+thkbot = 10.0000 m
+sigjmp = 0.0200 kg/m**3
+tmljmp = 0.3000 degC
+thkmls = 15.0000 m
+thkmlt = 0.0000 m
+thkriv = 6.0000 m
+
+thkfrz = 20.0000 m
+iceflg = 0
+tfrz_0 = 0.0000 degC
+tfrz_s = -0.0540 degC/psu
+ticegr = 0.0000 degC/m
+hicemn = 0.5000 m
+hicemx = 10.0000 m
+
+ntracr = 0
+trcflg = 0
+
+tsofrq = 64
+tofset = 0.0000 degC/century
+sofset = 0.0000 psu/century
+
+mlflag = 0
+pensol = F
+dtrate = 999.0000 m/day
+thkmin = 19.2000 m
+dypflg = 0
+mixfrq = 99999
+diapyc = 0.0000 m**2/s**2
+rigr = 0.2500
+ribc = 0.6500
+rinfty = 0.7000
+ricr = 0.2500
+bldmin = 0.0000 m
+bldmax = 1200.0000 m
+cekman = 0.7000
+cmonob = 1.0000
+bblkpp = F
+shinst = T
+dbdiff = T
+nonloc = T
+latdiw = F
+botdiw = F
+difout = F
+difsmo = 13
+difm0 = 0.0050 m**2/s
+difs0 = 0.0050 m**2/s
+difmiw = 0.0001 m**2/s
+difsiw = 0.0000 m**2/s
+dsfmax = 0.0010 m**2/s
+rrho0 = 1.9000
+cs = 98.9600
+cstar = 10.0000
+cv = 0.0000
+c11 = 5.0000
+hblflg = 2
+niter = 2
+fltflg = 0
+nfladv = 4
+nflsam = 1
+intpfl = 0
+iturbv = 0
+ismpfl = 1
+tbvar = 0.0000 m**2/s**2
+tdecri = 0.4000 1/day
+
+lbflag = 0
+tidflg = 0
+tidcon = 1
+tidsal = 0.0600
+tidgen = T
+tidrmp = 1.0000 days
+tid_t0 = 0.0000 model day
+
+clmflg = 12
+wndflg = 2
+pstrsi = 50.0000 m
+ustflg = 4
+flxflg = 0
+empflg = 0
+dswflg = 0
+sssflg = 0
+lwflag = 0
+sstflg = 0
+icmflg = 0
+flxoff = F
+flxsmo = F
+
+ !!!! BB86 Configuration !!!!
+
+
+relax = F
+trcrlx = F
+priver = F
+epmass = F
+
+
+ ddsurf = 1.00000000000000 96
+ ddiagf = 1.00000000000000 96
+ dtilef = 1.320469375237739E+028 -2147483648
+ dmeanf = 1.320469375237739E+028 -2147483648
+ drstrf = 10.0000000000000 960
+
+ turb. flux parameters:
+ thkdf2,temdf2 = 0.00E+00 1.50E-02
+ thkdf4 = 1.00E-02
+ veldf2,visco2 = 5.00E-03 5.00E-03
+ veldf4,visco4 = 0.00E+00 0.00E+00
+ diapyc,vertmx = 1.00E-07 0.00E+00
+
+ 20 barotropic steps per baroclinic time step
+
+ reading grid file from regional.grid.[ab]
+ 0 'mapflg' = map flag (0=mercator,10=panam,12=ulon-panam)
+plon: min,max = 0.00000 20.00000
+plat: min,max = 0.00000 20.00000
+ulon: min,max = -0.10000 19.90000
+ulat: min,max = 0.00000 20.00000
+vlon: min,max = 0.00000 20.00000
+vlat: min,max = -0.10000 19.90000
+pscx: min,max = 20000.00000 20000.00000
+pscy: min,max = 20000.00000 20000.00000
+qscx: min,max = 20000.00000 20000.00000
+qscy: min,max = 20000.00000 20000.00000
+uscx: min,max = 20000.00000 20000.00000
+uscy: min,max = 20000.00000 20000.00000
+vscx: min,max = 20000.00000 20000.00000
+vscy: min,max = 20000.00000 20000.00000
+cori: min,max = 7.34000E-05 1.13400E-04
+
+ i,j= 6 6 plat= 1.000 corio,scux,vy= 0.000075400 20000.00 20000.00
+
+ reading bathymetry file from regional.depth.[ab]
+
+ Bathymetry
+ i/jdm = 101 101
+
+
+
+ min,max depth = 5000.00000 5000.00000
+
+bigrid: nreg = 0
+bigrid: closed basin
+
+ip array, cols 1 -- 101
+ 101 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+ 100 0***************************************************************************************************0
+ 99 0***************************************************************************************************0
+ 98 0***************************************************************************************************0
+ 97 0***************************************************************************************************0
+ 96 0***************************************************************************************************0
+ 95 0***************************************************************************************************0
+ 94 0***************************************************************************************************0
+ 93 0***************************************************************************************************0
+ 92 0***************************************************************************************************0
+ 91 0***************************************************************************************************0
+ 90 0***************************************************************************************************0
+ 89 0***************************************************************************************************0
+ 88 0***************************************************************************************************0
+ 87 0***************************************************************************************************0
+ 86 0***************************************************************************************************0
+ 85 0***************************************************************************************************0
+ 84 0***************************************************************************************************0
+ 83 0***************************************************************************************************0
+ 82 0***************************************************************************************************0
+ 81 0***************************************************************************************************0
+ 80 0***************************************************************************************************0
+ 79 0***************************************************************************************************0
+ 78 0***************************************************************************************************0
+ 77 0***************************************************************************************************0
+ 76 0***************************************************************************************************0
+ 75 0***************************************************************************************************0
+ 74 0***************************************************************************************************0
+ 73 0***************************************************************************************************0
+ 72 0***************************************************************************************************0
+ 71 0***************************************************************************************************0
+ 70 0***************************************************************************************************0
+ 69 0***************************************************************************************************0
+ 68 0***************************************************************************************************0
+ 67 0***************************************************************************************************0
+ 66 0***************************************************************************************************0
+ 65 0***************************************************************************************************0
+ 64 0***************************************************************************************************0
+ 63 0***************************************************************************************************0
+ 62 0***************************************************************************************************0
+ 61 0***************************************************************************************************0
+ 60 0***************************************************************************************************0
+ 59 0***************************************************************************************************0
+ 58 0***************************************************************************************************0
+ 57 0***************************************************************************************************0
+ 56 0***************************************************************************************************0
+ 55 0***************************************************************************************************0
+ 54 0***************************************************************************************************0
+ 53 0***************************************************************************************************0
+ 52 0***************************************************************************************************0
+ 51 0***************************************************************************************************0
+ 50 0***************************************************************************************************0
+ 49 0***************************************************************************************************0
+ 48 0***************************************************************************************************0
+ 47 0***************************************************************************************************0
+ 46 0***************************************************************************************************0
+ 45 0***************************************************************************************************0
+ 44 0***************************************************************************************************0
+ 43 0***************************************************************************************************0
+ 42 0***************************************************************************************************0
+ 41 0***************************************************************************************************0
+ 40 0***************************************************************************************************0
+ 39 0***************************************************************************************************0
+ 38 0***************************************************************************************************0
+ 37 0***************************************************************************************************0
+ 36 0***************************************************************************************************0
+ 35 0***************************************************************************************************0
+ 34 0***************************************************************************************************0
+ 33 0***************************************************************************************************0
+ 32 0***************************************************************************************************0
+ 31 0***************************************************************************************************0
+ 30 0***************************************************************************************************0
+ 29 0***************************************************************************************************0
+ 28 0***************************************************************************************************0
+ 27 0***************************************************************************************************0
+ 26 0***************************************************************************************************0
+ 25 0***************************************************************************************************0
+ 24 0***************************************************************************************************0
+ 23 0***************************************************************************************************0
+ 22 0***************************************************************************************************0
+ 21 0***************************************************************************************************0
+ 20 0***************************************************************************************************0
+ 19 0***************************************************************************************************0
+ 18 0***************************************************************************************************0
+ 17 0***************************************************************************************************0
+ 16 0***************************************************************************************************0
+ 15 0***************************************************************************************************0
+ 14 0***************************************************************************************************0
+ 13 0***************************************************************************************************0
+ 12 0***************************************************************************************************0
+ 11 0***************************************************************************************************0
+ 10 0***************************************************************************************************0
+ 9 0***************************************************************************************************0
+ 8 0***************************************************************************************************0
+ 7 0***************************************************************************************************0
+ 6 0***************************************************************************************************0
+ 5 0***************************************************************************************************0
+ 4 0***************************************************************************************************0
+ 3 0***************************************************************************************************0
+ 2 0***************************************************************************************************0
+ 1 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+
+ mean basin depth (m) and area (10^6 km^2): 5000.0 3.92
+
+dp0k( 1) = 1.00 m thkns = 1.00 m depth = 1.00 m
+dp0k( 2) = 1.00 m thkns = 1.00 m depth = 2.00 m
+dp0k( 3) = 1.00 m thkns = 1.00 m depth = 3.00 m
+
+ds0k( 1) = 1.00 m thkns = 1.00 m depth = 1.00 m
+
+ now opening forcing fields ...
+
+Analytical Eastward Wind-stress
+i/jdm = 101 101
+ tauewd: month,range = 01 -1.00000E-01 1.00000E-01
+
+Analytical Northward Wind-stress
+i/jdm = 101 101
+ taunwd: month,range = 01 0.00000E+00 0.00000E+00
+ ...finished opening forcing fields
+ now opening kpar field ...
+ ...finished opening kpar field
+ now opening rivers field ...
+ ...finished opening river field
+ now opening relaxation fields ...
+ No thermal relaxation mask.
+
+ Potential Temperature
+i/jdm = 101 101
+ tem : month,layer,dens,range = 01 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 01 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 01 03 27.221 1.63001E+01 1.63001E+01
+
+ Salinity
+i/jdm = 101 101
+ sal : month,layer,dens,range = 01 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 03 27.221 3.70000E+01 3.70000E+01
+
+ Interface Depths
+i/jdm = 101 101
+ int : month,layer,dens,range = 01 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 01 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 01 03 27.221 4.90300E+06 4.90300E+06
+ ...finished opening relaxation fields
+ rdrlax - month = 1 1
+ tem : month,layer,dens,range = 01 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 01 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 01 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 01 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 01 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 01 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 01 03 27.221 4.90300E+06 4.90300E+06
+rdrlax: pwall.2 ok; expected,input min depth = 1.00 1.00
+rdrlax: pwall.3 NOT ok; expected,input min depth = 2.00 500.00 (bad climatology?)
+rdrlax: continuing because file ./relax.weird exists (ignore the "bad" climatology)
+ relaxation fields for month 1 written into slot 1
+ sigma(k): 27.01 27.01 27.22
+ 0 6 6 istate: temp saln thstar thkns dpth montg
+ mxl 19.2
+ 1 17.18 37.00 27.01 1.0 0.5 0.000
+ 2 17.18 37.00 27.01 499.0 250.5 0.000
+ 3 16.30 37.00 27.22 4500.0 2750.0 -0.106
+ bot 5000.0
+ 0 6 6 istate: temp saln thstar thkns dpth montg
+ mxl 19.2
+ 1 17.18 37.00 27.01 1.0 0.5 0.000
+ 2 17.18 37.00 27.01 499.0 250.5 0.000
+ 3 16.30 37.00 27.22 4500.0 2750.0 -0.106
+ bot 5000.0
+
+model starts at day 0.0, goes to day 11.0 (steps 0 -- 1056)
+
+ tauewd: month,range = 12 -1.00000E-01 1.00000E-01
+ taunwd: month,range = 12 0.00000E+00 0.00000E+00
+ forcing functions for month 12 written into slot 1
+ tauewd: month,range = 01 -1.00000E-01 1.00000E-01
+ taunwd: month,range = 01 0.00000E+00 0.00000E+00
+ forcing functions for month 1 written into slot 2
+ tauewd: month,range = 02 -1.00000E-01 1.00000E-01
+ taunwd: month,range = 02 0.00000E+00 0.00000E+00
+ forcing functions for month 2 written into slot 3
+ tauewd: month,range = 03 -1.00000E-01 1.00000E-01
+ taunwd: month,range = 03 0.00000E+00 0.00000E+00
+ forcing functions for month 3 written into slot 4
+ rdrlax - month = 12 12
+ tem : month,layer,dens,range = 12 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 12 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 12 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 12 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 12 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 12 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 12 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 12 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 12 03 27.221 4.90300E+06 4.90300E+06
+rdrlax: pwall.2 ok; expected,input min depth = 1.00 1.00
+rdrlax: pwall.3 NOT ok; expected,input min depth = 2.00 500.00 (bad climatology?)
+rdrlax: continuing because file ./relax.weird exists (ignore the "bad" climatology)
+ relaxation fields for month 12 written into slot 1
+ rdrlax - month = 1 1
+ tem : month,layer,dens,range = 01 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 01 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 01 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 01 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 01 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 01 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 01 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 01 03 27.221 4.90300E+06 4.90300E+06
+ relaxation fields for month 1 written into slot 2
+ rdrlax - month = 2 2
+ tem : month,layer,dens,range = 02 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 02 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 02 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 02 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 02 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 02 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 02 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 02 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 02 03 27.221 4.90300E+06 4.90300E+06
+ relaxation fields for month 2 written into slot 3
+ rdrlax - month = 3 3
+ tem : month,layer,dens,range = 03 01 27.010 1.71823E+01 1.71823E+01
+ tem : month,layer,dens,range = 03 02 27.010 1.71808E+01 1.71808E+01
+ tem : month,layer,dens,range = 03 03 27.221 1.63001E+01 1.63001E+01
+ sal : month,layer,dens,range = 03 01 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 03 02 27.010 3.70000E+01 3.70000E+01
+ sal : month,layer,dens,range = 03 03 27.221 3.70000E+01 3.70000E+01
+ int : month,layer,dens,range = 03 01 27.010 0.00000E+00 0.00000E+00
+ int : month,layer,dens,range = 03 02 27.010 9.80600E+03 9.80600E+03
+ int : month,layer,dens,range = 03 03 27.221 4.90300E+06 4.90300E+06
+ relaxation fields for month 3 written into slot 4
+
+
+ timer statistics
+ ------------------
+
+ total calls = 1 time = 0.05490 time/call = 0.05490000
+
+
+
+ 1 (0001/016 00) mean SSH (mm): 0.00 (-4.9E-05 to -4.9E-05)
+ 1 (0001/016 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 1 (0001/016 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 1 (0001/016 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 1 (0001/016 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 1 (0001/016 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 1 (0001/016 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 1 (0001/016 00) region-wide mean Kin. Energy: 0.0046712813
+ 1 (0001/016 00) region-wide mean Temperature: 16.3881703000
+ 1 (0001/016 00) region-wide mean Salinity: 37.0000000000
+ 1 (0001/016 00) region-wide mean Density Dev: 0.1898957149
+ 96 1 min/max of s after advection: 37.000 37.000 (range: 1.28E-13)
+ 96 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 96 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 96 (0001/017 00) mean SSH (mm): 0.00 (-5.2E+00 to 4.7E+00)
+ 96 (0001/017 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 96 (0001/017 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 96 (0001/017 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 96 (0001/017 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 96 (0001/017 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 96 (0001/017 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 96 (0001/017 00) region-wide mean Kin. Energy: 4.1432653972
+ 96 (0001/017 00) region-wide mean Temperature: 16.3881703000
+ 96 (0001/017 00) region-wide mean Salinity: 37.0000000000
+ 96 (0001/017 00) region-wide mean Density Dev: 0.1898957164
+ step 96 day 1.00 -- archiving completed --
+ 192 1 min/max of s after advection: 37.000 37.000 (range: 1.63E-13)
+ 192 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 192 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 192 (0001/018 00) mean SSH (mm): 0.00 (-1.0E+01 to 9.3E+00)
+ 192 (0001/018 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 192 (0001/018 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 192 (0001/018 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 192 (0001/018 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 192 (0001/018 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 192 (0001/018 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 192 (0001/018 00) region-wide mean Kin. Energy: 13.4001969478
+ 192 (0001/018 00) region-wide mean Temperature: 16.3881703000
+ 192 (0001/018 00) region-wide mean Salinity: 37.0000000000
+ 192 (0001/018 00) region-wide mean Density Dev: 0.1898957164
+ step 192 day 2.00 -- archiving completed --
+ 288 1 min/max of s after advection: 37.000 37.000 (range: 1.85E-13)
+ 288 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 288 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 288 (0001/019 00) mean SSH (mm): 0.00 (-1.6E+01 to 1.4E+01)
+ 288 (0001/019 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 288 (0001/019 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 288 (0001/019 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 288 (0001/019 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 288 (0001/019 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 288 (0001/019 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 288 (0001/019 00) region-wide mean Kin. Energy: 28.1775391248
+ 288 (0001/019 00) region-wide mean Temperature: 16.3881702999
+ 288 (0001/019 00) region-wide mean Salinity: 37.0000000000
+ 288 (0001/019 00) region-wide mean Density Dev: 0.1898957164
+ step 288 day 3.00 -- archiving completed --
+ 384 1 min/max of s after advection: 37.000 37.000 (range: 1.92E-13)
+ 384 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 384 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 384 (0001/020 00) mean SSH (mm): 0.00 (-2.1E+01 to 1.9E+01)
+ 384 (0001/020 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 384 (0001/020 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 384 (0001/020 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 384 (0001/020 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 384 (0001/020 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 384 (0001/020 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 384 (0001/020 00) region-wide mean Kin. Energy: 48.4792190514
+ 384 (0001/020 00) region-wide mean Temperature: 16.3881702999
+ 384 (0001/020 00) region-wide mean Salinity: 37.0000000000
+ 384 (0001/020 00) region-wide mean Density Dev: 0.1898957164
+ step 384 day 4.00 -- archiving completed --
+ 480 1 min/max of s after advection: 37.000 37.000 (range: 1.99E-13)
+ 480 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 480 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 480 (0001/021 00) mean SSH (mm): 0.00 (-2.6E+01 to 2.3E+01)
+ 480 (0001/021 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 480 (0001/021 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 480 (0001/021 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 480 (0001/021 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 480 (0001/021 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 480 (0001/021 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 480 (0001/021 00) region-wide mean Kin. Energy: 74.1010609419
+ 480 (0001/021 00) region-wide mean Temperature: 16.3881702998
+ 480 (0001/021 00) region-wide mean Salinity: 37.0000000000
+ 480 (0001/021 00) region-wide mean Density Dev: 0.1898957164
+ step 480 day 5.00 -- archiving completed --
+ 576 1 min/max of s after advection: 37.000 37.000 (range: 2.20E-13)
+ 576 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 576 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 576 (0001/022 00) mean SSH (mm): 0.00 (-3.1E+01 to 2.8E+01)
+ 576 (0001/022 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 576 (0001/022 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 576 (0001/022 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 576 (0001/022 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 576 (0001/022 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 576 (0001/022 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 576 (0001/022 00) region-wide mean Kin. Energy: 103.6767617399
+ 576 (0001/022 00) region-wide mean Temperature: 16.3881702998
+ 576 (0001/022 00) region-wide mean Salinity: 37.0000000000
+ 576 (0001/022 00) region-wide mean Density Dev: 0.1898957164
+ step 576 day 6.00 -- archiving completed --
+ 672 1 min/max of s after advection: 37.000 37.000 (range: 2.34E-13)
+ 672 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 672 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 672 (0001/023 00) mean SSH (mm): 0.00 (-3.7E+01 to 3.2E+01)
+ 672 (0001/023 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 672 (0001/023 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 672 (0001/023 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 672 (0001/023 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 672 (0001/023 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 672 (0001/023 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 672 (0001/023 00) region-wide mean Kin. Energy: 137.1932841362
+ 672 (0001/023 00) region-wide mean Temperature: 16.3881702997
+ 672 (0001/023 00) region-wide mean Salinity: 37.0000000000
+ 672 (0001/023 00) region-wide mean Density Dev: 0.1898957164
+ step 672 day 7.00 -- archiving completed --
+ 768 1 min/max of s after advection: 37.000 37.000 (range: 2.42E-13)
+ 768 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 768 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 768 (0001/024 00) mean SSH (mm): 0.00 (-4.2E+01 to 3.7E+01)
+ 768 (0001/024 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 768 (0001/024 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 768 (0001/024 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 768 (0001/024 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 768 (0001/024 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 768 (0001/024 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 768 (0001/024 00) region-wide mean Kin. Energy: 174.0607178422
+ 768 (0001/024 00) region-wide mean Temperature: 16.3881702996
+ 768 (0001/024 00) region-wide mean Salinity: 37.0000000000
+ 768 (0001/024 00) region-wide mean Density Dev: 0.1898957165
+ step 768 day 8.00 -- archiving completed --
+ 864 1 min/max of s after advection: 37.000 37.000 (range: 2.77E-13)
+ 864 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 864 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 864 (0001/025 00) mean SSH (mm): 0.00 (-4.7E+01 to 4.1E+01)
+ 864 (0001/025 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 864 (0001/025 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 864 (0001/025 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 864 (0001/025 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 864 (0001/025 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 864 (0001/025 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 864 (0001/025 00) region-wide mean Kin. Energy: 213.4808880508
+ 864 (0001/025 00) region-wide mean Temperature: 16.3881702995
+ 864 (0001/025 00) region-wide mean Salinity: 37.0000000000
+ 864 (0001/025 00) region-wide mean Density Dev: 0.1898957165
+ step 864 day 9.00 -- archiving completed --
+ 960 1 min/max of s after advection: 37.000 37.000 (range: 2.77E-13)
+ 960 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 960 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 960 (0001/026 00) mean SSH (mm): 0.00 (-5.2E+01 to 4.5E+01)
+ 960 (0001/026 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 960 (0001/026 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 960 (0001/026 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 960 (0001/026 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 960 (0001/026 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 960 (0001/026 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 960 (0001/026 00) region-wide mean Kin. Energy: 255.1227171568
+ 960 (0001/026 00) region-wide mean Temperature: 16.3881702995
+ 960 (0001/026 00) region-wide mean Salinity: 37.0000000000
+ 960 (0001/026 00) region-wide mean Density Dev: 0.1898957165
+ time step 960 y e a r 0001 d a y 026 h o u r 00
+ creating a new backup restart file
+ restart created at model day 10.000
+ step 960 day 10.00 -- archiving completed --
+ 1056 1 min/max of s after advection: 37.000 37.000 (range: 1.49E-13)
+ 1056 2 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 1056 3 min/max of s after advection: 37.000 37.000 (range: 0.00E+00)
+ 1056 (0001/027 00) mean SSH (mm): 0.00 (-5.6E+01 to 4.9E+01)
+ 1056 (0001/027 00) mean mixl thk. (m): 19.20 temp: 17.182 saln: 37.000
+ 1056 (0001/027 00) mean surf thk. (m): 1.00 sst: 17.182 sss: 37.000
+ 1056 (0001/027 00) mean clim thk. (m): 19.20 sst: 17.182 sss: 37.000
+ 1056 (0001/027 00) mean L 1 thk. (m): 1.00 temp: 17.182 saln: 37.000
+ 1056 (0001/027 00) mean L 2 thk. (m): 498.89 temp: 17.181 saln: 37.000
+ 1056 (0001/027 00) mean L 3 thk. (m): 4500.11 temp: 16.300 saln: 37.000
+ 1056 (0001/027 00) region-wide mean Kin. Energy: 298.0234395822
+ 1056 (0001/027 00) region-wide mean Temperature: 16.3881704135
+ 1056 (0001/027 00) region-wide mean Salinity: 37.0000000000
+ 1056 (0001/027 00) region-wide mean Density Dev: 0.1898956897
+ northward heat flux (petawatts):
+ 0.000 0.000 0.006 0.010 0.012 0.012 0.012 0.011 0.009 0.007 0.004
+ 0.002 0.001 0.001 0.000 0.000 0.001 0.001 0.001 0.002 0.002 0.001
+ 0.001 0.000 -0.001 -0.001 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002
+ -0.003 -0.004 -0.005 -0.007 -0.008 -0.009 -0.010 -0.010 -0.009 -0.009 -0.007
+ -0.006 -0.005 -0.004 -0.004 -0.004 -0.004 -0.005 -0.007 -0.008 -0.009 -0.010
+ -0.010 -0.010 -0.010 -0.009 -0.008 -0.006 -0.005 -0.004 -0.003 -0.003 -0.003
+ -0.003 -0.003 -0.004 -0.004 -0.004 -0.004 -0.003 -0.003 -0.002 -0.001 -0.001
+ -0.001 0.000 0.000 0.000 0.000 0.000 0.001 0.001 0.002 0.003 0.004
+ 0.004 0.005 0.005 0.005 0.005 0.004 0.002 0.002 0.001 0.001 0.002
+ 0.001
+ time step 1056 y e a r 0001 d a y 027 h o u r 00
+ creating a new standard restart file
+ restart created & closed at model day 11.000
+ step 1056 day 11.00 -- archiving completed --
+
+
+ timer statistics
+ ------------------
+
+ cnuity calls = 1056 time = 5.52540 time/call = 0.00523239
+ tsadvc calls = 1056 time = 9.11310 time/call = 0.00862983
+ momtum calls = 1056 time = 20.12560 time/call = 0.01905833
+ barotp calls = 1056 time = 13.51720 time/call = 0.01280038
+ thermf calls = 1056 time = 0.10300 time/call = 0.00009754
+ ic**** calls = 1056 time = 0.18430 time/call = 0.00017453
+ mx**** calls = 1056 time = 0.00000 time/call = 0.00000000
+ conv** calls = 1056 time = 4.29240 time/call = 0.00406477
+ diapf* calls = 1056 time = 0.00020 time/call = 0.00000019
+ hybgen calls = 1056 time = 12.58270 time/call = 0.01191544
+ restrt calls = 2 time = 0.01360 time/call = 0.00680000
+ overtn calls = 1 time = 0.00140 time/call = 0.00140000
+ archiv calls = 11 time = 0.04990 time/call = 0.00453636
+ incupd calls = 1056 time = 0.00000 time/call = 0.00000000
+ total calls = 1 time = 65.85210 time/call = 65.85210000
+
+
+
+ **************************************************
+ (normal)
+ **************************************************
+You are Done !
diff --git a/expt_01.0/limits b/expt_01.0/limits
new file mode 100755
index 0000000..2a043ba
--- /dev/null
+++ b/expt_01.0/limits
@@ -0,0 +1 @@
+-111 360
diff --git a/expt_01.0/script_exe.com b/expt_01.0/script_exe.com
new file mode 100755
index 0000000..71b6b68
--- /dev/null
+++ b/expt_01.0/script_exe.com
@@ -0,0 +1,92 @@
+#!/bin/csh
+
+set echo
+## CONFIGURATION BOX 20kmx20km
+setenv R BB86 ## config name
+setenv T 01 ## topography version (see name of your file..)
+setenv E 010 ## experiment number (ex: 010)
+setenv E1 `echo ${E} | awk '{printf("%04.1f", $1*0.1)}'` ## (ex: 01.0)
+
+## time to run
+setenv day1 111
+setenv day2 360
+## restart run?
+setenv restart - ## - means no restart (+ means restart)
+
+## get all the files in the same directory
+# P : path where you are going to launch the run
+# D : path where you are actually running
+setenv P /Net/yucatan/abozec/BB86_PACKAGE/expt_${E1}/
+setenv D ${P}/data
+
+mkdir -p ${D}
+
+## get the grid and depth files
+touch ${D}/regional.grid.[ab] ${D}/regional.depth.[ab]
+/bin/rm ${D}/regional.grid.[ab] ${D}/regional.depth.[ab]
+
+/bin/cp ${P}/../topo/regional.grid.${R}.a ${D}/regional.grid.a
+/bin/cp ${P}/../topo/regional.grid.${R}.b ${D}/regional.grid.b
+/bin/cp ${P}/../topo/depth_${R}_${T}.a ${D}/regional.depth.a
+/bin/cp ${P}/../topo/depth_${R}_${T}.b ${D}/regional.depth.b
+
+## get the initial conditions
+touch ${D}/relax.temp.[ab] ${D}/relax.saln.[ab] ${D}/relax.intf.[ab]
+/bin/rm ${D}/relax.temp.[ab] ${D}/relax.saln.[ab] ${D}/relax.intf.[ab]
+
+#potential temperature
+/bin/cp ${P}/../relax/${E}/relax_tem_${R}.a ${D}/relax.temp.a
+/bin/cp ${P}/../relax/${E}/relax_tem_${R}.b ${D}/relax.temp.b
+
+#salinity
+/bin/cp ${P}/../relax/${E}/relax_sal_${R}.a ${D}/relax.saln.a
+/bin/cp ${P}/../relax/${E}/relax_sal_${R}.b ${D}/relax.saln.b
+
+#interface depth
+/bin/cp ${P}/../relax/${E}/relax_int_${R}.a ${D}/relax.intf.a
+/bin/cp ${P}/../relax/${E}/relax_int_${R}.b ${D}/relax.intf.b
+
+## to not get into trouble with some flags ..
+touch ${D}/relax.weird
+
+## get the forcing
+touch ${D}/forcing.tauewd.[ab] ${D}/forcing.taunwd.[ab]
+/bin/rm ${D}/forcing.tauewd.[ab] ${D}/forcing.taunwd.[ab]
+
+#eastward windstress
+/bin/cp ${P}/../force/forcing.tauewd.${R}.a ${D}/forcing.tauewd.a
+/bin/cp ${P}/../force/forcing.tauewd.${R}.b ${D}/forcing.tauewd.b
+
+#northward windstress
+/bin/cp ${P}/../force/forcing.taunwd.${R}.a ${D}/forcing.taunwd.a
+/bin/cp ${P}/../force/forcing.taunwd.${R}.b ${D}/forcing.taunwd.b
+
+## get the executable
+/bin/cp ${P}/../src_2.2.18_3_one/hycom_gfortran ${D}/hycom
+
+## get rid of the old files
+/bin/rm ${D}/restart_out* ${D}/ovrtn_out
+
+
+## Parameter file
+/bin/cp ${P}/blkdat.input ${D}/blkdat.input
+
+## length of the run
+cat > limits <