42 |
|
|
43 |
C LOCAL VARIABLES: |
C LOCAL VARIABLES: |
44 |
INTEGER i,j,jj |
INTEGER i,j,jj |
45 |
INTEGER ib, ibj1, ibj2 |
INTEGER ib, ibj1, ibj2 ! runoff band loop counters |
46 |
INTEGER j_atm, mn |
INTEGER j_atm, mn |
47 |
INTEGER dUnit |
INTEGER dUnit |
48 |
_RL end1, end2 |
_RL end1, end2, enda1, enda2, enda3 !used to compute grid conv areas |
49 |
_RL totrun_b(sNy) |
_RL totrun_b(sNy) ! total file "runoff" in runoff bands |
50 |
_RL a1,a2 |
_RL a1,a2 |
51 |
_RS atm_dyG(jm0) |
_RS atm_dyG(jm0) ! southern point/(boundary) of atmos grid |
52 |
DATA atm_dyG/2.0,44*4.0,2.0/ |
DATA atm_dyG/2.0,44*4.0,2.0/ ! grid spacing for atmosphere |
53 |
|
|
54 |
dtatmo = dtatm * 3600. |
dtatmo = dtatm * 3600. |
55 |
dtocno = dtocn * 3600. |
dtocno = dtocn * 3600. |
80 |
|
|
81 |
atm_oc_ind(1)=2 |
atm_oc_ind(1)=2 |
82 |
atm_oc_wgt(1)=1. _d 0 |
atm_oc_wgt(1)=1. _d 0 |
83 |
|
atm_oc_frac1(1)= (sin(yG(1,2,1,1)*deg2rad) - |
84 |
|
& sin(yG(1,1,1,1)*deg2rad))/ |
85 |
|
& (sin(atm_yG(3)*deg2rad)-sin(atm_yG(1)*deg2rad)) |
86 |
|
atm_oc_frac2(1)= 0. _d 0 ! assumes ocean(1) fits in atm(1) |
87 |
atm_oc_ind(sNy)=jm0-1 |
atm_oc_ind(sNy)=jm0-1 |
88 |
atm_oc_wgt(sNy)=1. _d 0 |
atm_oc_wgt(sNy)=1. _d 0 |
89 |
|
atm_oc_frac1(sNy)= (sin((yG(1,sNy,1,1) + |
90 |
|
& dyG(1,sNy,1,1)/6.37D6/deg2rad)*deg2rad)- |
91 |
|
& sin(yG(1,sNy,1,1)*deg2rad))/ |
92 |
|
& (sin((atm_yG(jm0)+atm_dyG(jm0))*deg2rad)- |
93 |
|
& sin(atm_yG(jm0-1)*deg2rad)) |
94 |
|
atm_oc_frac2(sNy)= 0. _d 0 ! assumes ocean(1) fits in atm(1) |
95 |
|
|
96 |
|
endwgt1 = sin(atm_yG(2)*deg2rad) !hard-coded that the atmos |
97 |
|
endwgt2 = sin(atm_yG(3)*deg2rad) - endwgt1 !grid is same in NH and SH |
98 |
|
endwgt1 = endwgt1 + 1. _d 0 !and goes 90S to 90N |
99 |
|
rsumwgt = 1. _d 0/(endwgt1 + endwgt2) |
100 |
|
|
101 |
|
atm_yG(2)=atm_yG(1) ! grid now combined atm end points |
102 |
|
atm_yG(jm0)=90. _d 0 |
103 |
|
|
104 |
DO j=2, sNy-1 |
DO j=2, sNy-1 |
105 |
|
|
106 |
DO jj=2,jm0-1 |
DO jj=2,jm0-1 |
107 |
IF ((yG(1,j,1,1).ge.atm_yG(jj)).AND. |
IF ((yG(1,j,1,1).GE.atm_yG(jj)).AND. |
108 |
& (yG(1,j,1,1).lt.atm_yG(jj+1))) j_atm=jj |
& (yG(1,j,1,1).LT.atm_yG(jj+1))) j_atm=jj |
109 |
ENDDO |
ENDDO |
110 |
|
|
111 |
atm_oc_ind(j)=j_atm |
atm_oc_ind(j)=j_atm |
112 |
IF ( yG(1,j+1,1,1) .gt. atm_yG(j_atm+1) ) THEN |
end1= sin(yG(1,j,1,1) *deg2rad) |
113 |
end1= sin(yG(1,j,1,1) *deg2rad) |
end2= sin(yG(1,j+1,1,1) *deg2rad) |
114 |
end2= sin(yG(1,j+1,1,1) *deg2rad) |
enda1 = sin(atm_yG(j_atm) *deg2rad) |
115 |
atm_oc_wgt(j)=(sin(atm_yG(j_atm+1) *deg2rad)-end1)/ |
enda2 = sin(atm_yG(j_atm+1) *deg2rad) |
116 |
& (end2-end1) |
IF ( yG(1,j+1,1,1) .GT. atm_yG(j_atm+1) ) THEN |
117 |
|
enda3 = sin(atm_yG(j_atm+2) *deg2rad) |
118 |
|
atm_oc_wgt(j)=(enda2-end1)/ (end2-end1) |
119 |
|
atm_oc_frac1(j)= (enda2-end1) / (enda2 - enda1) |
120 |
|
atm_oc_frac2(j)= (end2 - enda2) / (enda3 - enda2) |
121 |
ELSE |
ELSE |
122 |
atm_oc_wgt(j)=1. _d 0 |
atm_oc_wgt(j)=1. _d 0 |
123 |
|
atm_oc_frac1(j)= (end2-end1)/ (enda2-enda1) |
124 |
|
atm_oc_frac2(j)=0. _d 0 |
125 |
ENDIF |
ENDIF |
126 |
ENDDO |
ENDDO |
|
|
|
127 |
c |
c |
128 |
c find land fraction |
c find land fraction |
129 |
c |
c |
137 |
IF (maskC(i,j,1,1,1).EQ.1.) THEN |
IF (maskC(i,j,1,1,1).EQ.1.) THEN |
138 |
ocnArea(atm_oc_ind(j))=ocnArea(atm_oc_ind(j)) + |
ocnArea(atm_oc_ind(j))=ocnArea(atm_oc_ind(j)) + |
139 |
& rA(i,j,1,1)*atm_oc_wgt(j) |
& rA(i,j,1,1)*atm_oc_wgt(j) |
140 |
IF (atm_oc_wgt(j).lt.1.d0) THEN |
IF (atm_oc_wgt(j).LT.1.d0) THEN |
141 |
ocnArea(atm_oc_ind(j)+1)=ocnArea(atm_oc_ind(j)+1) + |
ocnArea(atm_oc_ind(j)+1)=ocnArea(atm_oc_ind(j)+1) + |
142 |
& rA(i,j,1,1)*(1.d0-atm_oc_wgt(j)) |
& rA(i,j,1,1)*(1.d0-atm_oc_wgt(j)) |
143 |
ENDIF |
ENDIF |
168 |
PRINT *, cflan |
PRINT *, cflan |
169 |
PRINT *,'Lookup grid index, weights:' |
PRINT *,'Lookup grid index, weights:' |
170 |
PRINT *, atm_oc_ind,atm_oc_wgt |
PRINT *, atm_oc_ind,atm_oc_wgt |
171 |
|
C PRINT *,'Lookup fraction 1 of atmos grid:' |
172 |
|
C PRINT *, atm_oc_frac1 |
173 |
|
C PRINT *,'Lookup fraction 2 of atmos grid:' |
174 |
|
C PRINT *, atm_oc_frac2 |
175 |
|
|
176 |
c |
c |
177 |
c read in mean 1D atmos wind files -- store in memory |
c read in mean 1D atmos wind files -- store in memory |