/[MITgcm]/MITgcm_contrib/jscott/pkg_atm2d/calc_1dto2d.F
ViewVC logotype

Annotation of /MITgcm_contrib/jscott/pkg_atm2d/calc_1dto2d.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Fri Aug 11 18:55:49 2006 UTC (19 years, 7 months ago) by jscott
Branch: MAIN
new 2d atm package

1 jscott 1.1 #include "ctrparam.h"
2     #include "ATM2D_OPTIONS.h"
3    
4     C !INTERFACE:
5     SUBROUTINE CALC_1DTO2D( inMonth, myThid )
6     C *==========================================================*
7     C | - Takes 1D atmos data, regrid to 2D ocean grid |
8     c | |
9     C *==========================================================*
10     IMPLICIT NONE
11    
12     #include "ATMSIZE.h"
13     #include "SIZE.h"
14     #include "GRID.h"
15     #include "EEPARAMS.h"
16    
17     C === Global SeaIce Variables ===
18     #include "THSICE_VARS.h"
19    
20     C === Atmos/Ocean/Seaice Interface Variables ===
21     #include "ATM2D_VARS.h"
22    
23     C !INPUT/OUTPUT PARAMETERS:
24     C === Routine arguments ===
25     C inMonth - current month (or forcing period)
26     C myThid - Thread no. that called this routine.
27     INTEGER inMonth
28     INTEGER myThid
29    
30     C LOCAL VARIABLES:
31     INTEGER i,j
32     INTEGER ib,ibj1,ibj2
33     _RL run_b(sNy)
34    
35     CALL INIT_2DFLD(myThid)
36    
37     C Accumulate runoff into bands (runoff bands are on the ocean grid)
38     DO ib=1,numBands
39     ibj1=1
40     IF (ib.GT.1) ibj1= rband(ib-1)+1
41     ibj2=sNy
42     IF (ib.LT.numBands) ibj2= rband(ib)
43     run_b(ib)=0.D0
44     DO j=ibj1,ibj2
45     run_b(ib)=run_b(ib)+atm_runoff(atm_oc_ind(j))*atm_oc_wgt(j) +
46     & atm_runoff(atm_oc_ind(j)+1)*(1.D0-atm_oc_wgt(j))
47     ENDDO
48     ENDDO
49    
50     DO j=1,sNy
51     DO i=1,sNx
52    
53     IF (maskC(i,j,1,1,1).EQ.1.) THEN
54    
55     runoff_2D(i,j) = run_b(runIndex(j)) *
56     & runoffVal(i,j)/rA(i,j,1,1)
57    
58     CALL CALC_WGHT2D(i,j,atm_oc_ind(j),atm_oc_wgt(j))
59    
60     IF (atm_oc_wgt(j).LT.1.D0)
61     & CALL CALC_WGHT2D(i,j,atm_oc_ind(j)+1,1.D0-atm_oc_wgt(j))
62    
63     C Tabulate following diagnostic fluxes from atmos model only
64    
65     qnet_atm(i,j)= qnet_atm(i,j) +
66     & qneti_2D(i,j)*dtatmo*iceMask(i,j,1,1) +
67     & qneto_2D(i,j)*dtatmo*(1.D0-iceMask(i,j,1,1))
68     evap_atm(i,j)= evap_atm(i,j) +
69     & evapi_2D(i,j)*dtatmo*iceMask(i,j,1,1) +
70     & evapo_2D(i,j)*dtatmo*(1.D0-iceMask(i,j,1,1))
71     precip_atm(i,j)= precip_atm(i,j) +
72     & precipi_2D(i,j)*dtatmo*iceMask(i,j,1,1) +
73     & precipo_2D(i,j)*dtatmo*(1.D0-iceMask(i,j,1,1))
74     runoff_atm(i,j)= runoff_atm(i,j) +
75     & runoff_2D(i,j)*dtatmo
76     C time_cum = time_cum + dtatmo
77     ENDIF
78    
79     ENDDO
80     ENDDO
81    
82     PRINT *,'*** bottom calc_1to2d; evapo_2D',evapo_2D(JBUGI,JBUGJ)
83     PRINT *,'*** bottom calc_1to2d; precipo_2D',precipo_2D(JBUGI,JBUGJ)
84     PRINT *,'*** bottom calc_1to2d; runoff_2D',runoff_2D(JBUGI,JBUGJ)
85     PRINT *,'*** bottom calc_1to2d; qneto_2D',qneto_2D(JBUGI,JBUGJ)
86     RETURN
87     END
88    
89    
90     C--------------------------------------------------------------------------
91    
92     #include "ctrparam.h"
93     #include "ATM2D_OPTIONS.h"
94    
95     C !INTERFACE:
96     SUBROUTINE CALC_WGHT2D( i, j, ind, wgt)
97     C *==========================================================*
98     C | Use atmos grid cell 1D value and weight to convert to 2D |
99     C | Variations from zonal mean computed used derivative dF/dT|
100     C | and dL/dT for heat flux and evap terms. |
101     C | |
102     C | Fluxes/values over seaice computed only if seaice present|
103     C *==========================================================*
104     IMPLICIT NONE
105    
106     #include "ATMSIZE.h"
107     #include "SIZE.h"
108     #include "EEPARAMS.h"
109    
110     C === Global SeaIce Variables ===
111     #include "THSICE_VARS.h"
112    
113     C === Atmos/Ocean/Seaice Interface Variables ===
114     #include "ATM2D_VARS.h"
115    
116     C !INPUT/OUTPUT PARAMETERS:
117     C === Routine arguments ===
118     C index - index into the atmos grid array
119     C wght - weight of this atmos cell for total
120     INTEGER i, j
121     INTEGER ind
122     _RL wgt
123    
124     precipo_2D(i,j)= precipo_2D(i,j) + atm_precip(ind)*wgt
125     solarnet_ocn_2D(i,j)=solarnet_ocn_2D(i,j) + atm_solar_ocn(ind)*wgt
126     slp_2D(i,j)= slp_2D(i,j) + atm_slp(ind)*wgt
127     pCO2_2D(i,j)= pCO2_2D(i,j) + atm_pco2(ind)*wgt
128     wspeed_2D(i,j)= wspeed_2D(i,j) + atm_windspeed(ind)*wgt
129     fu_2D(i,j)= fu_2D(i,j) + atm_tauu(ind)*wgt
130     fv_2D(i,j)= fv_2D(i,j) + atm_tauv(ind)*wgt
131    
132     qneto_2D(i,j)= qneto_2D(i,j) + atm_qnet_ocn(ind)*wgt
133     evapo_2D(i,j)= evapo_2D(i,j) + atm_evap_ocn(ind)*wgt
134     IF (evapo_2D(i,j).GT.0.D0) THEN !convert negative evap. to precip
135     precipo_2D(i,j)= precipo_2D(i,j) - evapo_2D(i,j)
136     evapo_2D(i,j)=0.D0
137     ENDIF
138    
139     IF (iceMask(i,j,1,1).GT.0.D0) THEN
140     qneti_2D(i,j)= qneti_2D(i,j) + atm_qnet_ice(ind)*wgt
141     precipi_2D(i,j)= precipi_2D(i,j) + atm_precip(ind)*wgt
142     evapi_2D(i,j)= evapi_2D(i,j) + atm_evap_ice(ind)*wgt
143     IF (evapi_2D(i,j).GT.0.D0) THEN !convert negative evap. to precip
144     precipi_2D(i,j)= precipi_2D(i,j) - evapi_2D(i,j)
145     evapi_2D(i,j)=0.D0
146     ENDIF
147     dFdT_ice_2D(i,j)= dFdT_ice_2D(i,j) + atm_dFdT_ice(ind)*wgt
148     Tair_2D(i,j)= Tair_2D(i,j) + atm_Tair(ind)*wgt
149     solarinc_2D(i,j)= solarinc_2D(i,j) + atm_solarinc(ind)*wgt
150     ENDIF
151    
152     IF (useAltDeriv) THEN
153     qneto_2D(i,j)= qneto_2D(i,j) + atm_dFdt_ocnq(ind)*
154     & (sstFromOcn(i,j)-ctocn(ind)*wgt)
155     evapo_2D(i,j)= evapo_2D(i,j) + atm_dLdt_ocnq(ind)*
156     & (sstFromOcn(i,j)-ctocn(ind)*wgt)
157     IF (iceMask(i,j,1,1).GT.0.D0) THEN
158     qneti_2D(i,j)=qneti_2D(i,j)+atm_dFdt_iceq(ind)*
159     & (Tsrf(i,j,1,1)-ctice(ind)*wgt)
160     evapi_2D(i,j)=evapi_2D(i,j)+atm_dLdt_iceq(ind)*
161     & (Tsrf(i,j,1,1)-ctice(ind)*wgt)
162     ENDIF
163     ELSE
164     qneto_2D(i,j)= qneto_2D(i,j) + atm_dFdt_ocn(ind)*
165     & (sstFromOcn(i,j)-ctocn(ind)*wgt)
166     evapo_2D(i,j)= evapo_2D(i,j) + atm_dLdt_ocn(ind)*
167     & (sstFromOcn(i,j)-ctocn(ind)*wgt)
168     IF (iceMask(i,j,1,1).GT.0.D0) THEN
169     qneti_2D(i,j)= qneti_2D(i,j) + atm_dFdt_ice(ind)*
170     & (Tsrf(i,j,1,1)-ctice(ind)*wgt)
171     evapi_2D(i,j)= evapi_2D(i,j)+atm_dLdt_ice(ind)*
172     & (Tsrf(i,j,1,1)-ctice(ind)*wgt)
173     ENDIF
174     ENDIF
175    
176    
177     RETURN
178     END
179    
180     C--------------------------------------------------------------------------
181    
182     #include "ctrparam.h"
183     #include "ATM2D_OPTIONS.h"
184    
185     C !INTERFACE:
186     SUBROUTINE INIT_2DFLD( myThid)
187     C *==========================================================*
188     C | |
189     c | |
190     C *==========================================================*
191     IMPLICIT NONE
192    
193     #include "ATMSIZE.h"
194     #include "SIZE.h"
195     #include "EEPARAMS.h"
196     #include "ATM2D_VARS.h"
197    
198     C !INPUT/OUTPUT PARAMETERS:
199     C === Routine arguments ===
200     C myThid - Thread no. that called this routine.
201     INTEGER myThid
202    
203     C LOCAL VARIABLES:
204     INTEGER i,j
205    
206     DO i=1,sNx
207     DO j=1,sNy
208    
209     precipo_2D(i,j)= 0.D0
210     precipi_2D(i,j)= 0.D0
211     solarnet_ocn_2D(i,j)= 0.D0
212     slp_2D(i,j)= 0.D0
213     pCO2_2D(i,j)= 0.D0
214     wspeed_2D(i,j)= 0.D0
215     fu_2D(i,j)= 0.D0
216     fv_2D(i,j)= 0.D0
217     qneto_2D(i,j)= 0.D0
218     evapo_2D(i,j)= 0.D0
219     qneti_2D(i,j)= 0.D0
220     evapi_2D(i,j)= 0.D0
221     dFdT_ice_2D(i,j)= 0.D0
222     Tair_2D(i,j)= 0.D0
223     solarinc_2D(i,j)= 0.D0
224     runoff_2D(i,j)= 0.D0
225    
226     ENDDO
227     ENDDO
228    
229     RETURN
230     END

  ViewVC Help
Powered by ViewVC 1.1.22