CSHCO PROGRAM CPVFULL
SUBROUTINE CPVFULL !SHCN
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
PARAMETER( IMAX=1,JMAX=1,KMAX=3 )
DIMENSION GPV(IMAX,JMAX,KMAX),GPS(IMAX,JMAX),GPS9(IMAX,JMAX),
. A(KMAX),B(KMAX),GPS8(IMAX,JMAX),GPS1(IMAX,JMAX),
. GPV9(IMAX,JMAX,KMAX),GPV8(IMAX,JMAX,KMAX)
DIMENSION GPVC9(IMAX,JMAX,KMAX)
C : eta-level coefficients
A(1) = 0.01
A(2) = 0.021
A(3) = 0.03
B(1) = 1.0
B(2) = 0.95
B(3) = 0.8
C : base state
GPS9(1,1)= 1013.
C : input variable
GPS(1,1) = GPS9(1,1)*0.01
C : original log P on full model levels
JSTA=1
JFIN=1
CALL PVFULL
I (GPS9,IMAX,JMAX,KMAX,A,B,
I JSTA,JFIN,
O GPV9)
C WRITE(6,*) ' GPV9=',(DEXP(GPV9(1,1,K)),K=1,KMAX)
CALL PVFULLC
I (GPS9,IMAX,JMAX,KMAX,A,B,
I JSTA,JFIN,
O GPVC9)
C : tangent code
CALL TPVFULL
I (GPS,IMAX,JMAX,KMAX,
I GPVC9,
I JSTA,JFIN,
O GPV)
C : input variable
C DO 8000 N=1,10
DO 8000 N=-4,8
ALFA = 10.D0**(-DFLOAT(N)/2.D0)
GPS8(1,1) = GPS9(1,1)+GPS(1,1)*ALFA
C : original code
CALL PVFULL
I (GPS8,IMAX,JMAX,KMAX,A,B,
I JSTA,JFIN,
O GPV8)
C : incremental check
DOT1 = 0.D0
DOT2 = 0.D0
DOT = 0.D0
DOT1 = DOT1 + (GPS8(1,1)-GPS9(1,1))**2
DOT2 = DOT2 + GPS(1,1)**2
DOT = DOT + (GPS8(1,1)-GPS9(1,1))*GPS(1,1)
C write(6,*) ' GPS DOT1,DOT2,DOT=',DOT1,DOT2,DOT
DO 8100 K=1,KMAX
DOT1V= (GPV8(1,1,K)-GPV9(1,1,K))**2.D0
. *1.D5**2
DOT2V= GPV(1,1,K)**2
. *1.D5**2
DOTV = (GPV8(1,1,K)-GPV9(1,1,K))*GPV(1,1,K)
. *1.D5**2
DOT1 = DOT1 + DOT1V
DOT2 = DOT2 + DOT2V
DOT = DOT + DOTV
C write(6,*) ' GPV DOT1,DOT2,DOT=',DOT1V,DOT2V,DOTV
8100 CONTINUE
WRITE(6,*) ' GSI DEV=',N,DOT/DSQRT(DOT1*DOT2),ALFA*GPS(1,1)
8000 CONTINUE
C : left-hand side calculation (inner product of tagent code output)
RLEFT = 0.
RLEFT = RLEFT + GPS(1,1)*GPS(1,1)
DO 3100 K=1,KMAX
RLEFT = RLEFT + GPV(1,1,K)*GPV(1,1,K)
3100 CONTINUE
WRITE(6,*) ' RLEFT=',RLEFT
C : adjoint code
GPS1(1,1) = GPS(1,1)
CALL APVFULL
I (GPS1,IMAX,JMAX,KMAX,
I GPVC9,
I JSTA,JFIN,
O GPV)
WRITE(6,*)
WRITE(6,*)
WRITE(6,*) ' AGPV=',GPV
WRITE(6,*) ' GPS9=',GPS9
WRITE(6,*) ' AGPS=',GPS1
C : right-hand side calculation
RIGHT= 0.
RIGHT = RIGHT + GPS(1,1)*GPS1(1,1)
WRITE(6,*) ' LEFT,RIGHT,DEV=',RLEFT,RIGHT,RLEFT-RIGHT
STOP
END
SUBROUTINE PVFULL
I (GPS,IMAX,JMAX,KMAX,A,B,
I JSTA,JFIN,
O GPV)
C**********************************************************************
C full-level (L) pressure (PV) (HPA) calcualtion (log P)
C 2000.01.19 Y.TAKEUCHI
C
C GPS(IMAX,JMAX): surface pressure (hPa)
C