2 SUBROUTINE CPVFULL !SHCN
3 IMPLICIT DOUBLE PRECISION (A-H,O-Z)
4 PARAMETER( IMAX=1,JMAX=1,KMAX=3 )
5 DIMENSION GPV(IMAX,JMAX,KMAX),GPS(IMAX,JMAX),GPS9(IMAX,JMAX),
6 . A(KMAX),B(KMAX),GPS8(IMAX,JMAX),GPS1(IMAX,JMAX),
7 . GPV9(IMAX,JMAX,KMAX),GPV8(IMAX,JMAX,KMAX)
8 DIMENSION GPVC9(IMAX,JMAX,KMAX)
9 C : eta-level coefficients
19 GPS(1,1) = GPS9(1,1)*0.01
20 C : original log P on full model levels
24 I (GPS9,IMAX,JMAX,KMAX,A,B,
27 C WRITE(6,*) ' GPV9=',(DEXP(GPV9(1,1,K)),K=1,KMAX)
29 I (GPS9,IMAX,JMAX,KMAX,A,B,
34 I (GPS,IMAX,JMAX,KMAX,
41 ALFA = 10.D0**(-DFLOAT(N)/2.D0)
42 GPS8(1,1) = GPS9(1,1)+GPS(1,1)*ALFA
45 I (GPS8,IMAX,JMAX,KMAX,A,B,
52 DOT1 = DOT1 + (GPS8(1,1)-GPS9(1,1))**2
53 DOT2 = DOT2 + GPS(1,1)**2
54 DOT = DOT + (GPS8(1,1)-GPS9(1,1))*GPS(1,1)
55 C write(6,*) ' GPS DOT1,DOT2,DOT=',DOT1,DOT2,DOT
57 DOT1V= (GPV8(1,1,K)-GPV9(1,1,K))**2.D0
61 DOTV = (GPV8(1,1,K)-GPV9(1,1,K))*GPV(1,1,K)
66 C write(6,*) ' GPV DOT1,DOT2,DOT=',DOT1V,DOT2V,DOTV
68 WRITE(6,*) ' GSI DEV=',N,DOT/DSQRT(DOT1*DOT2),ALFA*GPS(1,1)
70 C : left-hand side calculation (inner product of tagent code output)
72 RLEFT = RLEFT + GPS(1,1)*GPS(1,1)
74 RLEFT = RLEFT + GPV(1,1,K)*GPV(1,1,K)
76 WRITE(6,*) ' RLEFT=',RLEFT
80 I (GPS1,IMAX,JMAX,KMAX,
86 WRITE(6,*) ' AGPV=',GPV
87 WRITE(6,*) ' GPS9=',GPS9
88 WRITE(6,*) ' AGPS=',GPS1
89 C : right-hand side calculation
91 RIGHT = RIGHT + GPS(1,1)*GPS1(1,1)
92 WRITE(6,*) ' LEFT,RIGHT,DEV=',RLEFT,RIGHT,RLEFT-RIGHT
96 I (GPS,IMAX,JMAX,KMAX,A,B,
99 C**********************************************************************
100 C full-level (L) pressure (PV) (HPA) calcualtion (log P)
101 C 2000.01.19 Y.TAKEUCHI
103 C GPS(IMAX,JMAX): surface pressure (hPa)
105 C GPV(IMAX,JMAX,KMAX): full-level log P (NOUNIT)
106 C**********************************************************************
107 IMPLICIT DOUBLE PRECISION (A-H,O-Z)
108 DIMENSION GPS(IMAX,JMAX),GPV(IMAX,JMAX,KMAX)
110 C******************** PROCEDURE ***************************************
111 C : half-level (L+1/2,L-1/2) pressure (HPA) calculation
112 C : parallelization, modified for vectorization
115 CSHCO*POPTION PARALLEL
116 CSHCO*POPTION TLOCAL(I,J,K,PU,PD)
117 CSHCO*POPTION INDEP(GPV)
119 C DO 160 J1= 1,JMAX/IJFACT
123 C DO 161 I1= 1,IMAX*IJFACT
124 C I = MOD(I1-1,IMAX)+1
125 C J = (J1-1)*IJFACT+(I1-1)/IMAX+1
126 C write(6,*) ' I,J,I1,J1=',I,J,I1,J1
129 C : half-level (L+1/2,L-1/2) pressure (HPA) calculation
130 PU = A(K+1) + B(K+1)*GPS(I,J)
131 PD = A(K ) + B(K )*GPS(I,J)
132 c if (pd.eq.0.0.or.pu.eq.0.0) write(999,*) i,j,pd,pu !SHCN
133 C : full-level (L) pressure (HPA) calculation
134 GPV(I,J,K) = ( PD*DLOG(PD)-PU*DLOG(PU) )/(PD-PU) -1.D0
135 C if(I.EQ.1.AND.J.EQ.1) write(6,*) ' GPV',K,PU,PD,GPV(I,J,K)
136 C GPV(I,J,K) = GPV(I,J,K)*1000.D0
138 GPV(I,J,KMAX) = DLOG((A(KMAX)+B(KMAX)*GPS(I,J))/2.D0)
139 C GPV(I,J,KMAX) = GPV(I,J,KMAX)*1000.D0
140 C if(I.EQ.1.AND.J.EQ.1) write(6,*) ' GPV',KMAX,PU,PD,GPV(I,J,KMAX)
146 I (GPS,IMAX,JMAX,KMAX,
150 C**********************************************************************
151 C : PV: full-level (L) pressure (HPA) calculation GPV DELETE
154 C 2000.01.19 Y.TAKEUCHI
156 C GPS(IMAX,JMAX): surface pressure increment (hPa)
157 C GPVC9(IMAX,JMAX,KMAX): coefficient
159 C GPV(IMAX,JMAX,KMAX): full-level log P increment (NOUNIT)
160 C**********************************************************************
161 IMPLICIT DOUBLE PRECISION (A-H,O-Z)
162 DIMENSION GPS(IMAX,JMAX),GPVC9(IMAX,JMAX,KMAX)
163 DIMENSION GPV(IMAX,JMAX,KMAX)
164 C******************** PROCEDURE ***************************************
165 C : parallelization, modified for vectorization
169 *POPTION TLOCAL(I,J,K)
170 *POPTION INDEP(GPVC9)
172 C DO 960 J1= 1,JMAX/IJFACT
175 C DO 961 I1= 1,IMAX*IJFACT
176 C I = MOD(I1-1,IMAX)+1
177 C J = (J1-1)*IJFACT+(I1-1)/IMAX+1
182 GPV(I,J,KMAX) = GPS(I,J) * GPVC9(I,J,KMAX)
186 GPV(I,J,K) = GPS(I,J)*GPVC9(I,J,K)
193 I (GPS,IMAX,JMAX,KMAX,
197 C**********************************************************************
198 C : PV: full-level (L) pressure (HPA) calculation GPV DELETE
199 C : verification of the adjoint code TDVAR.FORT(PVFULL)
201 C 2000.01.19 Y.TAKEUCHI
202 C**********************************************************************
203 IMPLICIT DOUBLE PRECISION (A-H,O-Z)
204 DIMENSION GPS(IMAX,JMAX),GPV(IMAX,JMAX,KMAX),
205 . GPVC9(IMAX,JMAX,KMAX)
206 C******************** PROCEDURE ***************************************
208 *POPTION PARALLEL,PRIND((J,1))
209 *POPTION TLOCAL(I,J,K)
212 GPS(I,J) = GPS(I,J)+GPV(I,J,KMAX)*GPVC9(I,J,KMAX)
216 GPS(I,J) = GPS(I,J) +GPV(I,J,K)*GPVC9(I,J,K)
223 I (GPS9,IMAX,JMAX,KMAX,A,B,
226 C**********************************************************************
227 C : coefficients for full-level pressure calculation
229 C 2000.01.19 Y.TAKEUCHI
231 C GPS9(IMAX,JMAX): base state of surface pressure (hPa)
233 C GPVC9(IMAX,JMAX,KMAX):
234 C**********************************************************************
235 IMPLICIT DOUBLE PRECISION (A-H,O-Z)
236 DIMENSION GPS9(IMAX,JMAX),GPVC9(IMAX,JMAX,KMAX)
238 C******************** PROCEDURE ***************************************
239 C : half-level (L+1/2,L-1/2) pressure (HPA) calculation
241 C : parallelization, modified for vectorization
245 *POPTION TLOCAL(I,J,K,PU9,PD9)
246 *POPTION INDEP(GPVC9)
248 C DO 960 J1= 1,JMAX/IJFACT
251 C DO 961 I1= 1,IMAX*IJFACT
252 C I = MOD(I1-1,IMAX)+1
253 C J = (J1-1)*IJFACT+(I1-1)/IMAX+1
259 . B(KMAX)/(A(KMAX)+B(KMAX)*GPS9(I,J))
261 PU9 = A(K+1) + B(K+1)*GPS9(I,J)
262 PD9 = A(K ) + B(K )*GPS9(I,J)
264 GPVC9(I,J,K) = B(K )*
265 . 1.D0/(PD9-PU9)**2*(-PU9*(DLOG(PD9)-DLOG(PU9))+PD9-PU9)
267 . 1.D0/(PD9-PU9)**2*(PD9*(DLOG(PD9)-DLOG(PU9))-PD9+PU9)