1 | module physiq_mod |
---|
2 | |
---|
3 | implicit none |
---|
4 | |
---|
5 | contains |
---|
6 | |
---|
7 | subroutine physiq(ngrid,nlayer,nq, & |
---|
8 | nametrac, & |
---|
9 | firstcall,lastcall, & |
---|
10 | pday,ptime,ptimestep, & |
---|
11 | pplev,pplay,pphi, & |
---|
12 | pu,pv,pt,pq, & |
---|
13 | flxw, & |
---|
14 | pdu,pdv,pdt,pdq,pdpsrf) |
---|
15 | |
---|
16 | use radinc_h, only : L_NSPECTI,L_NSPECTV,naerkind |
---|
17 | use watercommon_h, only : RLVTT, Psat_water,epsi,su_watercycle, RV, T_h2o_ice_liq |
---|
18 | use thermcell_mod, only: nbsrf, init_thermcell_mod |
---|
19 | use gases_h, only: gnom, gfrac |
---|
20 | use radcommon_h, only: sigma, glat, grav, BWNV |
---|
21 | use radii_mod, only: h2o_reffrad, co2_reffrad |
---|
22 | use aerosol_mod, only: iaero_co2, iaero_h2o |
---|
23 | use surfdat_h, only: phisfi, zmea, zstd, zsig, zgam, zthe, & |
---|
24 | dryness, watercaptag |
---|
25 | use comdiurn_h, only: coslat, sinlat, coslon, sinlon |
---|
26 | use comsaison_h, only: mu0, fract, dist_star, declin, right_ascen |
---|
27 | use comsoil_h, only: nsoilmx, layer, mlayer, inertiedat |
---|
28 | use geometry_mod, only: latitude, longitude, cell_area |
---|
29 | USE comgeomfi_h, only: totarea, totarea_planet |
---|
30 | USE tracer_h, only: noms, mmol, radius, rho_q, qext, & |
---|
31 | alpha_lift, alpha_devil, qextrhor, & |
---|
32 | igcm_h2o_ice, igcm_h2o_vap, igcm_dustbin, & |
---|
33 | igcm_co2_ice |
---|
34 | use time_phylmdz_mod, only: ecritphy, iphysiq, nday |
---|
35 | use phyetat0_mod, only: phyetat0 |
---|
36 | use phyredem, only: physdem0, physdem1 |
---|
37 | use slab_ice_h, only: capcalocean, capcalseaice,capcalsno, & |
---|
38 | noceanmx |
---|
39 | use ocean_slab_mod, only :ocean_slab_init, ocean_slab_ice, & |
---|
40 | ini_surf_heat_transp_mod, & |
---|
41 | ocean_slab_get_vars,ocean_slab_final |
---|
42 | use surf_heat_transp_mod,only :init_masquv |
---|
43 | use planetwide_mod, only: planetwide_minval,planetwide_maxval,planetwide_sumval |
---|
44 | use mod_phys_lmdz_para, only : is_master |
---|
45 | use planete_mod, only: apoastr, periastr, year_day, peri_day, & |
---|
46 | obliquit, nres, z0 |
---|
47 | use comcstfi_mod, only: pi, g, rcp, r, rad, mugaz, cpp |
---|
48 | use time_phylmdz_mod, only: daysec |
---|
49 | use callkeys_mod |
---|
50 | use conc_mod |
---|
51 | use phys_state_var_mod |
---|
52 | use callcorrk_mod, only: callcorrk |
---|
53 | use turb_mod, only : q2,sensibFlux,turb_resolved |
---|
54 | #ifndef MESOSCALE |
---|
55 | use vertical_layers_mod, only: presnivs, pseudoalt |
---|
56 | use mod_phys_lmdz_omp_data, ONLY: is_omp_master |
---|
57 | #else |
---|
58 | use comm_wrf, only : comm_HR_SW, comm_HR_LW, & |
---|
59 | comm_CLOUDFRAC,comm_TOTCLOUDFRAC,& |
---|
60 | comm_SURFRAIN,comm_REEVAP,comm_HR_DYN,& |
---|
61 | comm_RAIN,comm_SNOW,comm_ALBEQ,& |
---|
62 | comm_FLUXTOP_DN,comm_FLUXABS_SW,& |
---|
63 | comm_FLUXTOP_LW,comm_FLUXSURF_SW,& |
---|
64 | comm_FLUXSURF_LW,comm_FLXGRD,& |
---|
65 | comm_LSCEZ,comm_H2OICE_REFF |
---|
66 | #endif |
---|
67 | |
---|
68 | #ifdef CPP_XIOS |
---|
69 | use xios_output_mod, only: initialize_xios_output, & |
---|
70 | update_xios_timestep, & |
---|
71 | send_xios_field |
---|
72 | use wxios, only: wxios_context_init, xios_context_finalize |
---|
73 | #endif |
---|
74 | |
---|
75 | implicit none |
---|
76 | |
---|
77 | |
---|
78 | !================================================================== |
---|
79 | ! |
---|
80 | ! Purpose |
---|
81 | ! ------- |
---|
82 | ! Central subroutine for all the physics parameterisations in the |
---|
83 | ! universal model. Originally adapted from the Mars LMDZ model. |
---|
84 | ! |
---|
85 | ! The model can be run without or with tracer transport |
---|
86 | ! depending on the value of "tracer" in file "callphys.def". |
---|
87 | ! |
---|
88 | ! |
---|
89 | ! It includes: |
---|
90 | ! |
---|
91 | ! I. Initialization : |
---|
92 | ! I.1 Firstcall initializations. |
---|
93 | ! I.2 Initialization for every call to physiq. |
---|
94 | ! |
---|
95 | ! II. Compute radiative transfer tendencies (longwave and shortwave) : |
---|
96 | ! II.a Option 1 : Call correlated-k radiative transfer scheme. |
---|
97 | ! II.b Option 2 : Call Newtonian cooling scheme. |
---|
98 | ! II.c Option 3 : Atmosphere has no radiative effect. |
---|
99 | ! |
---|
100 | ! III. Vertical diffusion (turbulent mixing) : |
---|
101 | ! |
---|
102 | ! IV. Convection : |
---|
103 | ! IV.a Thermal plume model |
---|
104 | ! IV.b Dry convective adjusment |
---|
105 | ! |
---|
106 | ! V. Condensation and sublimation of gases (currently just CO2). |
---|
107 | ! |
---|
108 | ! VI. Tracers |
---|
109 | ! VI.1. Water and water ice. |
---|
110 | ! VI.2 Photochemistry |
---|
111 | ! VI.3. Aerosols and particles. |
---|
112 | ! VI.4. Updates (pressure variations, surface budget). |
---|
113 | ! VI.5. Slab Ocean. |
---|
114 | ! VI.6. Surface Tracer Update. |
---|
115 | ! |
---|
116 | ! VII. Surface and sub-surface soil temperature. |
---|
117 | ! |
---|
118 | ! VIII. Perform diagnostics and write output files. |
---|
119 | ! |
---|
120 | ! |
---|
121 | ! arguments |
---|
122 | ! --------- |
---|
123 | ! |
---|
124 | ! INPUT |
---|
125 | ! ----- |
---|
126 | ! |
---|
127 | ! ngrid Size of the horizontal grid. |
---|
128 | ! nlayer Number of vertical layers. |
---|
129 | ! nq Number of advected fields. |
---|
130 | ! nametrac Name of corresponding advected fields. |
---|
131 | ! |
---|
132 | ! firstcall True at the first call. |
---|
133 | ! lastcall True at the last call. |
---|
134 | ! |
---|
135 | ! pday Number of days counted from the North. Spring equinoxe. |
---|
136 | ! ptime Universal time (0<ptime<1): ptime=0.5 at 12:00 UT. |
---|
137 | ! ptimestep timestep (s). |
---|
138 | ! |
---|
139 | ! pplay(ngrid,nlayer) Pressure at the middle of the layers (Pa). |
---|
140 | ! pplev(ngrid,nlayer+1) Intermediate pressure levels (Pa). |
---|
141 | ! pphi(ngrid,nlayer) Geopotential at the middle of the layers (m2.s-2). |
---|
142 | ! |
---|
143 | ! pu(ngrid,nlayer) u, zonal component of the wind (ms-1). |
---|
144 | ! pv(ngrid,nlayer) v, meridional component of the wind (ms-1). |
---|
145 | ! |
---|
146 | ! pt(ngrid,nlayer) Temperature (K). |
---|
147 | ! |
---|
148 | ! pq(ngrid,nlayer,nq) Advected fields. |
---|
149 | ! |
---|
150 | ! pudyn(ngrid,nlayer) \ |
---|
151 | ! pvdyn(ngrid,nlayer) \ Dynamical temporal derivative for the |
---|
152 | ! ptdyn(ngrid,nlayer) / corresponding variables. |
---|
153 | ! pqdyn(ngrid,nlayer,nq) / |
---|
154 | ! flxw(ngrid,nlayer) vertical mass flux (kg/s) at layer lower boundary |
---|
155 | ! |
---|
156 | ! OUTPUT |
---|
157 | ! ------ |
---|
158 | ! |
---|
159 | ! pdu(ngrid,nlayer) \ |
---|
160 | ! pdv(ngrid,nlayer) \ Temporal derivative of the corresponding |
---|
161 | ! pdt(ngrid,nlayer) / variables due to physical processes. |
---|
162 | ! pdq(ngrid,nlayer) / |
---|
163 | ! pdpsrf(ngrid) / |
---|
164 | ! |
---|
165 | ! |
---|
166 | ! Authors |
---|
167 | ! ------- |
---|
168 | ! Frederic Hourdin 15/10/93 |
---|
169 | ! Francois Forget 1994 |
---|
170 | ! Christophe Hourdin 02/1997 |
---|
171 | ! Subroutine completely rewritten by F. Forget (01/2000) |
---|
172 | ! Water ice clouds: Franck Montmessin (update 06/2003) |
---|
173 | ! Radiatively active tracers: J.-B. Madeleine (10/2008-06/2009) |
---|
174 | ! New correlated-k radiative scheme: R. Wordsworth (2009) |
---|
175 | ! Many specifically Martian subroutines removed: R. Wordsworth (2009) |
---|
176 | ! Improved water cycle: R. Wordsworth / B. Charnay (2010) |
---|
177 | ! To F90: R. Wordsworth (2010) |
---|
178 | ! New turbulent diffusion scheme: J. Leconte (2012) |
---|
179 | ! Loops converted to F90 matrix format: J. Leconte (2012) |
---|
180 | ! No more ngridmx/nqmx, F90 commons and adaptation to parallel: A. Spiga (2012) |
---|
181 | ! Purge of the code : M. Turbet (2015) |
---|
182 | ! Photochemical core developped by F. Lefevre: B. Charnay (2017) |
---|
183 | !================================================================== |
---|
184 | |
---|
185 | |
---|
186 | ! 0. Declarations : |
---|
187 | ! ------------------ |
---|
188 | |
---|
189 | include "netcdf.inc" |
---|
190 | |
---|
191 | ! Arguments : |
---|
192 | ! ----------- |
---|
193 | |
---|
194 | ! INPUTS: |
---|
195 | ! ------- |
---|
196 | |
---|
197 | integer,intent(in) :: ngrid ! Number of atmospheric columns. |
---|
198 | integer,intent(in) :: nlayer ! Number of atmospheric layers. |
---|
199 | integer,intent(in) :: nq ! Number of tracers. |
---|
200 | character*30,intent(in) :: nametrac(nq) ! Names of the tracers taken from dynamics. |
---|
201 | |
---|
202 | logical,intent(in) :: firstcall ! Signals first call to physics. |
---|
203 | logical,intent(in) :: lastcall ! Signals last call to physics. |
---|
204 | |
---|
205 | real,intent(in) :: pday ! Number of elapsed sols since reference Ls=0. |
---|
206 | real,intent(in) :: ptime ! "Universal time", given as fraction of sol (e.g.: 0.5 for noon). |
---|
207 | real,intent(in) :: ptimestep ! Physics timestep (s). |
---|
208 | real,intent(in) :: pplev(ngrid,nlayer+1) ! Inter-layer pressure (Pa). |
---|
209 | real,intent(in) :: pplay(ngrid,nlayer) ! Mid-layer pressure (Pa). |
---|
210 | real,intent(in) :: pphi(ngrid,nlayer) ! Geopotential at mid-layer (m2s-2). |
---|
211 | real,intent(in) :: pu(ngrid,nlayer) ! Zonal wind component (m/s). |
---|
212 | real,intent(in) :: pv(ngrid,nlayer) ! Meridional wind component (m/s). |
---|
213 | real,intent(in) :: pt(ngrid,nlayer) ! Temperature (K). |
---|
214 | real,intent(in) :: pq(ngrid,nlayer,nq) ! Tracers (kg/kg_of_air). |
---|
215 | real,intent(in) :: flxw(ngrid,nlayer) ! Vertical mass flux (ks/s) at lower boundary of layer |
---|
216 | |
---|
217 | ! OUTPUTS: |
---|
218 | ! -------- |
---|
219 | |
---|
220 | ! Physical tendencies : |
---|
221 | |
---|
222 | real,intent(out) :: pdu(ngrid,nlayer) ! Zonal wind tendencies (m/s/s). |
---|
223 | real,intent(out) :: pdv(ngrid,nlayer) ! Meridional wind tendencies (m/s/s). |
---|
224 | real,intent(out) :: pdt(ngrid,nlayer) ! Temperature tendencies (K/s). |
---|
225 | real,intent(out) :: pdq(ngrid,nlayer,nq) ! Tracer tendencies (kg/kg_of_air/s). |
---|
226 | real,intent(out) :: pdpsrf(ngrid) ! Surface pressure tendency (Pa/s). |
---|
227 | |
---|
228 | ! Local saved variables: |
---|
229 | ! ---------------------- |
---|
230 | integer,save :: day_ini ! Initial date of the run (sol since Ls=0). |
---|
231 | integer,save :: icount ! Counter of calls to physiq during the run. |
---|
232 | !$OMP THREADPRIVATE(day_ini,icount) |
---|
233 | |
---|
234 | ! Local variables : |
---|
235 | ! ----------------- |
---|
236 | |
---|
237 | ! Aerosol (dust or ice) extinction optical depth at reference wavelength |
---|
238 | ! for the "naerkind" optically active aerosols: |
---|
239 | |
---|
240 | real aerosol(ngrid,nlayer,naerkind) ! Aerosols. |
---|
241 | real zh(ngrid,nlayer) ! Potential temperature (K). |
---|
242 | real pw(ngrid,nlayer) ! Vertical velocity (m/s). (NOTE : >0 WHEN DOWNWARDS !!) |
---|
243 | real omega(ngrid,nlayer) ! omega velocity (Pa/s, >0 when downward) |
---|
244 | |
---|
245 | integer l,ig,ierr,iq,nw,isoil |
---|
246 | |
---|
247 | real zls ! Solar longitude (radians). |
---|
248 | real zlss ! Sub solar point longitude (radians). |
---|
249 | real zday ! Date (time since Ls=0, calculated in sols). |
---|
250 | real zzlay(ngrid,nlayer) ! Altitude at the middle of the atmospheric layers. |
---|
251 | real zzlev(ngrid,nlayer+1) ! Altitude at the atmospheric layer boundaries. |
---|
252 | |
---|
253 | ! VARIABLES for the thermal plume model |
---|
254 | |
---|
255 | INTEGER lmin(ngrid) ! Plume base level |
---|
256 | INTEGER lmix(ngrid) ! Plume maximal velocity level |
---|
257 | INTEGER lalim(ngrid) ! Plume alimentation top level |
---|
258 | INTEGER lmax(ngrid) ! Maximal level reached by the plume |
---|
259 | |
---|
260 | ! AB : Integers used only in alp for diagnoses |
---|
261 | INTEGER lalim_conv(ngrid) |
---|
262 | INTEGER zlcl(ngrid) |
---|
263 | |
---|
264 | real,allocatable,save :: f0(:) ! Mass flux norm |
---|
265 | real dqevap(ngrid,nlayer,nq) ! water tracer mass mixing ratio variations due to evaporation |
---|
266 | real dtevap(ngrid,nlayer) ! temperature variation due to evaporation |
---|
267 | real zqtherm(ngrid,nlayer,nq) ! vapor mass mixing ratio after evaporation |
---|
268 | real zttherm(ngrid,nlayer) ! temperature after evaporation |
---|
269 | real fm0(ngrid, nlayer+1) ! Mass flux |
---|
270 | real entr0(ngrid, nlayer) ! Entrainment |
---|
271 | real detr0(ngrid, nlayer) ! Detrainment |
---|
272 | real fraca(ngrid, nlayer+1) ! Fraction of the surface that plumes occupies |
---|
273 | real zw2(ngrid, nlayer+1) ! Squared vertical speed or its square root |
---|
274 | real zqsatth(ngrid, nlayer) ! Water vapor mixing ratio at saturation |
---|
275 | real zqta(ngrid, nlayer) ! Total water mass mixing ratio in the plume |
---|
276 | real zqla(ngrid, nlayer) ! Liquid water mass mixing ratio in the plume |
---|
277 | real ztv(ngrid, nlayer) ! Virtual potential temperature in the environment considering large scale condensation |
---|
278 | real ztva(ngrid, nlayer) ! Virtual potential temperature in the plume |
---|
279 | real zthl(ngrid, nlayer) ! Potential temperature in the environment without considering condensation |
---|
280 | real ztla(ngrid, nlayer) ! Potential temperature in the plume |
---|
281 | real ratqscth(ngrid, nlayer) ! |
---|
282 | real ratqsdiff(ngrid, nlayer) ! |
---|
283 | |
---|
284 | ! AB : Reals only used in alp for diagnoses |
---|
285 | real Ale_bl(ngrid), Alp_bl(ngrid) |
---|
286 | real therm_tke_max0(ngrid), env_tke_max0(ngrid) |
---|
287 | real n2(ngrid), s2(ngrid) |
---|
288 | real ale_bl_stat(ngrid) |
---|
289 | real therm_tke_max(ngrid, nlayer), env_tke_max(ngrid, nlayer) |
---|
290 | real alp_bl_det(ngrid), alp_bl_fluct_m(ngrid), alp_bl_fluct_tke(ngrid), alp_bl_conv(ngrid), alp_bl_stat(ngrid) |
---|
291 | real wght_th(ngrid, nlayer) |
---|
292 | real pbl_tke(ngrid,nlayer+1,nbsrf) |
---|
293 | real pctsrf(ngrid, nbsrf) |
---|
294 | ! AB : omega already defined, do we have to fusion them ? |
---|
295 | real omega_therm(ngrid, nlayer) |
---|
296 | real airephy(ngrid) |
---|
297 | real w0(ngrid) |
---|
298 | real w_conv(ngrid) |
---|
299 | real fraca0(ngrid) |
---|
300 | |
---|
301 | ! AB : variables used for outputs |
---|
302 | REAL pmax(ngrid) ! Maximal pressure reached by the plume |
---|
303 | REAL pmin(ngrid) ! Minimal pressure reached by the plume |
---|
304 | |
---|
305 | ! TENDENCIES due to various processes : |
---|
306 | |
---|
307 | ! For Surface Temperature : (K/s) |
---|
308 | real zdtsurf(ngrid) ! Cumulated tendencies. |
---|
309 | real zdtsurfmr(ngrid) ! Mass_redistribution routine. |
---|
310 | real zdtsurfc(ngrid) ! Condense_co2 routine. |
---|
311 | real zdtsdif(ngrid) ! Turbdiff/vdifc routines. |
---|
312 | real zdtsurf_hyd(ngrid) ! Hydrol routine. |
---|
313 | |
---|
314 | ! For Atmospheric Temperatures : (K/s) |
---|
315 | real dtlscale(ngrid,nlayer) ! Largescale routine. |
---|
316 | real zdtc(ngrid,nlayer) ! Condense_co2 routine. |
---|
317 | real zdtdif(ngrid,nlayer) ! Turbdiff/vdifc routines. |
---|
318 | real zdttherm(ngrid,nlayer) ! Calltherm routine. |
---|
319 | real zdtmr(ngrid,nlayer) ! Mass_redistribution routine. |
---|
320 | real zdtrain(ngrid,nlayer) ! Rain routine. |
---|
321 | real dtmoist(ngrid,nlayer) ! Moistadj routine. |
---|
322 | real dt_ekman(ngrid,noceanmx), dt_hdiff(ngrid,noceanmx) ! Slab_ocean routine. |
---|
323 | real zdtsw1(ngrid,nlayer), zdtlw1(ngrid,nlayer) ! Callcorrk routine. |
---|
324 | |
---|
325 | ! For Surface Tracers : (kg/m2/s) |
---|
326 | real dqsurf(ngrid,nq) ! Cumulated tendencies. |
---|
327 | real zdqsurfc(ngrid) ! Condense_co2 routine. |
---|
328 | real zdqsdif(ngrid,nq) ! Turbdiff/vdifc routines. |
---|
329 | real zdqssed(ngrid,nq) ! Callsedim routine. |
---|
330 | real zdqsurfmr(ngrid,nq) ! Mass_redistribution routine. |
---|
331 | real zdqsrain(ngrid), zdqssnow(ngrid) ! Rain routine. |
---|
332 | real dqs_hyd(ngrid,nq) ! Hydrol routine. |
---|
333 | real reevap_precip(ngrid) ! re-evaporation flux of precipitation (integrated over the atmospheric column) |
---|
334 | |
---|
335 | ! For Tracers : (kg/kg_of_air/s) |
---|
336 | real zdqc(ngrid,nlayer,nq) ! Condense_co2 routine. |
---|
337 | real zdqadj(ngrid,nlayer,nq) ! Convadj routine. |
---|
338 | real zdqdif(ngrid,nlayer,nq) ! Turbdiff/vdifc routines. |
---|
339 | real zdqevap(ngrid,nlayer) ! Turbdiff routine. |
---|
340 | real zdotherm(ngrid,nlayer) ! Calltherm routine. |
---|
341 | real zdqsed(ngrid,nlayer,nq) ! Callsedim routine. |
---|
342 | real zdqmr(ngrid,nlayer,nq) ! Mass_redistribution routine. |
---|
343 | real zdqrain(ngrid,nlayer,nq) ! Rain routine. |
---|
344 | real dqmoist(ngrid,nlayer,nq) ! Moistadj routine. |
---|
345 | real dqvaplscale(ngrid,nlayer) ! Largescale routine. |
---|
346 | real dqcldlscale(ngrid,nlayer) ! Largescale routine. |
---|
347 | REAL zdqchim(ngrid,nlayer,nq) ! Calchim_asis routine |
---|
348 | REAL zdqschim(ngrid,nq) ! Calchim_asis routine |
---|
349 | |
---|
350 | REAL array_zero1(ngrid) |
---|
351 | REAL array_zero2(ngrid,nlayer) |
---|
352 | |
---|
353 | ! For Winds : (m/s/s) |
---|
354 | real zdvadj(ngrid,nlayer), zduadj(ngrid,nlayer) ! Convadj routine. |
---|
355 | real zdutherm(ngrid,nlayer), zdvtherm(ngrid,nlayer) ! Calltherm routine. |
---|
356 | real zdumr(ngrid,nlayer), zdvmr(ngrid,nlayer) ! Mass_redistribution routine. |
---|
357 | real zdvdif(ngrid,nlayer), zdudif(ngrid,nlayer) ! Turbdiff/vdifc routines. |
---|
358 | real zdhdif(ngrid,nlayer) ! Turbdiff/vdifc routines. |
---|
359 | real zdhadj(ngrid,nlayer) ! Convadj routine. |
---|
360 | |
---|
361 | ! For Pressure and Mass : |
---|
362 | real zdmassmr(ngrid,nlayer) ! Atmospheric Mass tendency for mass_redistribution (kg_of_air/m2/s). |
---|
363 | real zdmassmr_col(ngrid) ! Atmospheric Column Mass tendency for mass_redistribution (kg_of_air/m2/s). |
---|
364 | real zdpsrfmr(ngrid) ! Pressure tendency for mass_redistribution routine (Pa/s). |
---|
365 | |
---|
366 | |
---|
367 | |
---|
368 | ! Local variables for LOCAL CALCULATIONS: |
---|
369 | ! --------------------------------------- |
---|
370 | real zflubid(ngrid) |
---|
371 | real zplanck(ngrid),zpopsk(ngrid,nlayer) |
---|
372 | real ztim1,ztim2,ztim3, z1,z2 |
---|
373 | real ztime_fin |
---|
374 | real zdh(ngrid,nlayer) |
---|
375 | real gmplanet |
---|
376 | real taux(ngrid),tauy(ngrid) |
---|
377 | |
---|
378 | |
---|
379 | ! local variables for DIAGNOSTICS : (diagfi & stat) |
---|
380 | ! ------------------------------------------------- |
---|
381 | real ps(ngrid) ! Surface Pressure. |
---|
382 | real zt(ngrid,nlayer) ! Atmospheric Temperature. |
---|
383 | real zu(ngrid,nlayer),zv(ngrid,nlayer) ! Zonal and Meridional Winds. |
---|
384 | real zq(ngrid,nlayer,nq) ! Atmospheric Tracers. |
---|
385 | real zdtadj(ngrid,nlayer) ! Convadj Diagnostic. |
---|
386 | real zdtdyn(ngrid,nlayer) ! Dynamical Heating (K/s). |
---|
387 | real zdudyn(ngrid,nlayer) ! Dynamical Zonal Wind tendency (m.s-2). |
---|
388 | |
---|
389 | real reff(ngrid,nlayer) ! Effective dust radius (used if doubleq=T). |
---|
390 | real vmr(ngrid,nlayer) ! volume mixing ratio |
---|
391 | real time_phys |
---|
392 | |
---|
393 | real ISR,ASR,OLR,GND,DYN,GSR,Ts1,Ts2,Ts3,TsS ! for Diagnostic. |
---|
394 | |
---|
395 | real qcol(ngrid,nq) ! Tracer Column Mass (kg/m2). |
---|
396 | |
---|
397 | ! included by RW for H2O Manabe scheme |
---|
398 | real rneb_man(ngrid,nlayer) ! H2O cloud fraction (moistadj). |
---|
399 | real rneb_lsc(ngrid,nlayer) ! H2O cloud fraction (large scale). |
---|
400 | |
---|
401 | |
---|
402 | ! to test energy conservation (RW+JL) |
---|
403 | real mass(ngrid,nlayer),massarea(ngrid,nlayer) |
---|
404 | real dEtot, dEtots, AtmToSurf_TurbFlux |
---|
405 | real,save :: dEtotSW, dEtotsSW, dEtotLW, dEtotsLW |
---|
406 | !$OMP THREADPRIVATE(dEtotSW, dEtotsSW, dEtotLW, dEtotsLW) |
---|
407 | real dEzRadsw(ngrid,nlayer),dEzRadlw(ngrid,nlayer),dEzdiff(ngrid,nlayer) |
---|
408 | real dEdiffs(ngrid),dEdiff(ngrid) |
---|
409 | real madjdE(ngrid), lscaledE(ngrid),madjdEz(ngrid,nlayer), lscaledEz(ngrid,nlayer) |
---|
410 | |
---|
411 | !JL12 conservation test for mean flow kinetic energy has been disabled temporarily |
---|
412 | |
---|
413 | real dtmoist_max,dtmoist_min |
---|
414 | real dItot, dItot_tmp, dVtot, dVtot_tmp |
---|
415 | |
---|
416 | |
---|
417 | real h2otot ! Total Amount of water. For diagnostic. |
---|
418 | real icesrf,liqsrf,icecol,vapcol ! Total Amounts of water (ice,liq,vap). For diagnostic. |
---|
419 | real dWtot, dWtot_tmp, dWtots, dWtots_tmp |
---|
420 | logical,save :: watertest |
---|
421 | !$OMP THREADPRIVATE(watertest) |
---|
422 | |
---|
423 | real qsat(ngrid,nlayer) ! Water Vapor Volume Mixing Ratio at saturation (kg/kg_of_air). |
---|
424 | real RH(ngrid,nlayer) ! Relative humidity. |
---|
425 | real H2Omaxcol(ngrid) ! Maximum possible H2O column amount (at 100% saturation) (kg/m2). |
---|
426 | real psat_tmp |
---|
427 | |
---|
428 | logical clearsky ! For double radiative transfer call. By BC |
---|
429 | |
---|
430 | ! For Clear Sky Case. |
---|
431 | real fluxsurf_lw1(ngrid), fluxsurf_sw1(ngrid), fluxsurfabs_sw1(ngrid) ! For SW/LW flux. |
---|
432 | real fluxtop_lw1(ngrid), fluxabs_sw1(ngrid) ! For SW/LW flux. |
---|
433 | real albedo_equivalent1(ngrid) ! For Equivalent albedo calculation. |
---|
434 | real tau_col1(ngrid) ! For aerosol optical depth diagnostic. |
---|
435 | real OLR_nu1(ngrid,L_NSPECTI), OSR_nu1(ngrid,L_NSPECTV) ! For Outgoing Radiation diagnostics. |
---|
436 | real tf, ntf |
---|
437 | |
---|
438 | real nconsMAX, vdifcncons(ngrid), cadjncons(ngrid) ! Vdfic water conservation test. By RW |
---|
439 | |
---|
440 | real muvar(ngrid,nlayer+1) ! For Runaway Greenhouse 1D study. By RW |
---|
441 | |
---|
442 | real reffcol(ngrid,naerkind) |
---|
443 | |
---|
444 | ! Sourceevol for 'accelerated ice evolution'. By RW |
---|
445 | real delta_ice,ice_tot |
---|
446 | integer num_run |
---|
447 | logical,save :: ice_update |
---|
448 | |
---|
449 | |
---|
450 | real :: tsurf2(ngrid) |
---|
451 | real :: flux_o(ngrid),flux_g(ngrid),fluxgrdocean(ngrid) |
---|
452 | real :: flux_sens_lat(ngrid) |
---|
453 | real :: qsurfint(ngrid,nq) |
---|
454 | #ifdef MESOSCALE |
---|
455 | REAL :: lsf_dt(nlayer) |
---|
456 | REAL :: lsf_dq(nlayer) |
---|
457 | #endif |
---|
458 | |
---|
459 | !================================================================================================== |
---|
460 | |
---|
461 | ! ----------------- |
---|
462 | ! I. INITIALISATION |
---|
463 | ! ----------------- |
---|
464 | |
---|
465 | ! -------------------------------- |
---|
466 | ! I.1 First Call Initialisation. |
---|
467 | ! -------------------------------- |
---|
468 | if (firstcall) then |
---|
469 | ! Allocate saved arrays (except for 1D model, where this has already |
---|
470 | ! been done) |
---|
471 | #ifndef MESOSCALE |
---|
472 | if (ngrid>1) call phys_state_var_init(nq) |
---|
473 | #endif |
---|
474 | |
---|
475 | ! Variables set to 0 |
---|
476 | ! ~~~~~~~~~~~~~~~~~~ |
---|
477 | dtrad(:,:) = 0.0 |
---|
478 | fluxrad(:) = 0.0 |
---|
479 | tau_col(:) = 0.0 |
---|
480 | zdtsw(:,:) = 0.0 |
---|
481 | zdtlw(:,:) = 0.0 |
---|
482 | |
---|
483 | |
---|
484 | ! Initialize aerosol indexes. |
---|
485 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
486 | call iniaerosol() |
---|
487 | |
---|
488 | |
---|
489 | ! Initialize tracer names, indexes and properties. |
---|
490 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
491 | IF (.NOT.ALLOCATED(noms)) ALLOCATE(noms(nq)) ! (because noms is an argument of physdem1 whether or not tracer is on) |
---|
492 | if (tracer) then |
---|
493 | call initracer(ngrid,nq,nametrac) |
---|
494 | if(photochem) then |
---|
495 | call ini_conc_mod(ngrid,nlayer) |
---|
496 | endif |
---|
497 | endif |
---|
498 | |
---|
499 | #ifdef CPP_XIOS |
---|
500 | ! Initialize XIOS context |
---|
501 | write(*,*) "physiq: call wxios_context_init" |
---|
502 | CALL wxios_context_init |
---|
503 | #endif |
---|
504 | |
---|
505 | ! Read 'startfi.nc' file. |
---|
506 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
507 | #ifndef MESOSCALE |
---|
508 | call phyetat0(startphy_file, & |
---|
509 | ngrid,nlayer,"startfi.nc",0,0,nsoilmx,nq, & |
---|
510 | day_ini,time_phys,tsurf,tsoil,emis,q2,qsurf, & |
---|
511 | cloudfrac,totcloudfrac,hice, & |
---|
512 | rnat,pctsrf_sic,tslab, tsea_ice,sea_ice) |
---|
513 | #else |
---|
514 | emis(:)=0.0 |
---|
515 | q2(:,:)=0.0 |
---|
516 | qsurf(:,:)=0.0 |
---|
517 | day_ini = pday |
---|
518 | #endif |
---|
519 | |
---|
520 | #ifndef MESOSCALE |
---|
521 | if (.not.startphy_file) then |
---|
522 | ! additionnal "academic" initialization of physics |
---|
523 | if (is_master) write(*,*) "Physiq: initializing tsurf(:) to pt(:,1) !!" |
---|
524 | tsurf(:)=pt(:,1) |
---|
525 | if (is_master) write(*,*) "Physiq: initializing tsoil(:) to pt(:,1) !!" |
---|
526 | do isoil=1,nsoilmx |
---|
527 | tsoil(1:ngrid,isoil)=tsurf(1:ngrid) |
---|
528 | enddo |
---|
529 | if (is_master) write(*,*) "Physiq: initializing day_ini to pdat !" |
---|
530 | day_ini=pday |
---|
531 | endif |
---|
532 | #endif |
---|
533 | |
---|
534 | if (pday.ne.day_ini) then |
---|
535 | write(*,*) "ERROR in physiq.F90:" |
---|
536 | write(*,*) "bad synchronization between physics and dynamics" |
---|
537 | write(*,*) "dynamics day: ",pday |
---|
538 | write(*,*) "physics day: ",day_ini |
---|
539 | stop |
---|
540 | endif |
---|
541 | |
---|
542 | write (*,*) 'In physiq day_ini =', day_ini |
---|
543 | |
---|
544 | ! Initialize albedo calculation. |
---|
545 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
546 | albedo(:,:)=0.0 |
---|
547 | albedo_bareground(:)=0.0 |
---|
548 | albedo_snow_SPECTV(:)=0.0 |
---|
549 | albedo_co2_ice_SPECTV(:)=0.0 |
---|
550 | call surfini(ngrid,nq,qsurf,albedo,albedo_bareground,albedo_snow_SPECTV,albedo_co2_ice_SPECTV) |
---|
551 | |
---|
552 | ! Initialize orbital calculation. |
---|
553 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
554 | call iniorbit(apoastr,periastr,year_day,peri_day,obliquit) |
---|
555 | |
---|
556 | |
---|
557 | if(tlocked)then |
---|
558 | print*,'Planet is tidally locked at resonance n=',nres |
---|
559 | print*,'Make sure you have the right rotation rate!!!' |
---|
560 | endif |
---|
561 | |
---|
562 | ! Initialize oceanic variables. |
---|
563 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
564 | |
---|
565 | if (ok_slab_ocean)then |
---|
566 | |
---|
567 | call ocean_slab_init(ngrid,ptimestep, tslab, & |
---|
568 | sea_ice, pctsrf_sic) |
---|
569 | |
---|
570 | call ini_surf_heat_transp_mod() |
---|
571 | |
---|
572 | knindex(:) = 0 |
---|
573 | |
---|
574 | do ig=1,ngrid |
---|
575 | zmasq(ig)=1 |
---|
576 | knindex(ig) = ig |
---|
577 | if (nint(rnat(ig)).eq.0) then |
---|
578 | zmasq(ig)=0 |
---|
579 | endif |
---|
580 | enddo |
---|
581 | |
---|
582 | CALL init_masquv(ngrid,zmasq) |
---|
583 | |
---|
584 | endif ! end of 'ok_slab_ocean'. |
---|
585 | |
---|
586 | |
---|
587 | ! Initialize soil. |
---|
588 | ! ~~~~~~~~~~~~~~~~ |
---|
589 | if (callsoil) then |
---|
590 | |
---|
591 | call soil(ngrid,nsoilmx,firstcall,lastcall,inertiedat, & |
---|
592 | ptimestep,tsurf,tsoil,capcal,fluxgrd) |
---|
593 | |
---|
594 | if (ok_slab_ocean) then |
---|
595 | do ig=1,ngrid |
---|
596 | if (nint(rnat(ig)).eq.2) then |
---|
597 | capcal(ig)=capcalocean |
---|
598 | if (pctsrf_sic(ig).gt.0.5) then |
---|
599 | capcal(ig)=capcalseaice |
---|
600 | if (qsurf(ig,igcm_h2o_ice).gt.0.) then |
---|
601 | capcal(ig)=capcalsno |
---|
602 | endif |
---|
603 | endif |
---|
604 | endif |
---|
605 | enddo |
---|
606 | endif ! end of 'ok_slab_ocean'. |
---|
607 | |
---|
608 | else ! else of 'callsoil'. |
---|
609 | |
---|
610 | print*,'WARNING! Thermal conduction in the soil turned off' |
---|
611 | capcal(:)=1.e6 |
---|
612 | fluxgrd(:)=intheat |
---|
613 | print*,'Flux from ground = ',intheat,' W m^-2' |
---|
614 | |
---|
615 | endif ! end of 'callsoil'. |
---|
616 | |
---|
617 | icount=1 |
---|
618 | |
---|
619 | ! Decide whether to update ice at end of run. |
---|
620 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
621 | ice_update=.false. |
---|
622 | if(sourceevol)then |
---|
623 | !$OMP MASTER |
---|
624 | open(128,file='num_run',form='formatted', & |
---|
625 | status="old",iostat=ierr) |
---|
626 | if (ierr.ne.0) then |
---|
627 | write(*,*) "physiq: Error! No num_run file!" |
---|
628 | write(*,*) " (which is needed for sourceevol option)" |
---|
629 | stop |
---|
630 | endif |
---|
631 | read(128,*) num_run |
---|
632 | close(128) |
---|
633 | !$OMP END MASTER |
---|
634 | !$OMP BARRIER |
---|
635 | |
---|
636 | if(num_run.ne.0.and.mod(num_run,2).eq.0)then |
---|
637 | print*,'Updating ice at end of this year!' |
---|
638 | ice_update=.true. |
---|
639 | ice_min(:)=1.e4 |
---|
640 | endif |
---|
641 | |
---|
642 | endif ! end of 'sourceevol'. |
---|
643 | |
---|
644 | |
---|
645 | ! Here is defined the type of the surface : Continent or Ocean. |
---|
646 | ! BC2014 : This is now already done in newstart. |
---|
647 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
648 | if (.not.ok_slab_ocean) then |
---|
649 | |
---|
650 | rnat(:)=1. |
---|
651 | do ig=1,ngrid |
---|
652 | if(inertiedat(ig,1).gt.1.E4)then |
---|
653 | rnat(ig)=0 |
---|
654 | endif |
---|
655 | enddo |
---|
656 | |
---|
657 | print*,'WARNING! Surface type currently decided by surface inertia' |
---|
658 | print*,'This should be improved e.g. in newstart.F' |
---|
659 | |
---|
660 | endif ! end of 'ok_slab_ocean'. |
---|
661 | |
---|
662 | |
---|
663 | ! Initialize surface history variable. |
---|
664 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
665 | qsurf_hist(:,:)=qsurf(:,:) |
---|
666 | |
---|
667 | ! Initialize variable for dynamical heating and zonal wind tendency diagnostic |
---|
668 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
669 | ztprevious(:,:)=pt(:,:) |
---|
670 | zuprevious(:,:)=pu(:,:) |
---|
671 | |
---|
672 | ! Set temperature just above condensation temperature (for Early Mars) |
---|
673 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
674 | if(nearco2cond) then |
---|
675 | write(*,*)' WARNING! Starting at Tcond+1K' |
---|
676 | do l=1, nlayer |
---|
677 | do ig=1,ngrid |
---|
678 | pdt(ig,l)= ((-3167.8)/(log(.01*pplay(ig,l))-23.23)+4 & |
---|
679 | -pt(ig,l)) / ptimestep |
---|
680 | enddo |
---|
681 | enddo |
---|
682 | endif |
---|
683 | |
---|
684 | if(meanOLR)then |
---|
685 | call system('rm -f rad_bal.out') ! to record global radiative balance. |
---|
686 | call system('rm -f tem_bal.out') ! to record global mean/max/min temperatures. |
---|
687 | call system('rm -f h2o_bal.out') ! to record global hydrological balance. |
---|
688 | endif |
---|
689 | |
---|
690 | |
---|
691 | watertest=.false. |
---|
692 | if(water)then ! Initialize variables for water cycle |
---|
693 | |
---|
694 | if(enertest)then |
---|
695 | watertest = .true. |
---|
696 | endif |
---|
697 | |
---|
698 | if(ice_update)then |
---|
699 | ice_initial(:)=qsurf(:,igcm_h2o_ice) |
---|
700 | endif |
---|
701 | |
---|
702 | endif |
---|
703 | |
---|
704 | ! Set some parameters for the thermal plume model |
---|
705 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
706 | if (calltherm) then |
---|
707 | call init_thermcell_mod(g, rcp, r, pi, T_h2o_ice_liq, RV) |
---|
708 | ALLOCATE(f0(ngrid)) |
---|
709 | endif |
---|
710 | |
---|
711 | call su_watercycle ! even if we don't have a water cycle, we might |
---|
712 | ! need epsi for the wvp definitions in callcorrk.F |
---|
713 | ! or RETV, RLvCp for the thermal plume model |
---|
714 | #ifndef MESOSCALE |
---|
715 | if (ngrid.ne.1) then ! Note : no need to create a restart file in 1d. |
---|
716 | call physdem0("restartfi.nc",longitude,latitude,nsoilmx,ngrid,nlayer,nq, & |
---|
717 | ptimestep,pday+nday,time_phys,cell_area, & |
---|
718 | albedo_bareground,inertiedat,zmea,zstd,zsig,zgam,zthe) |
---|
719 | endif |
---|
720 | #endif |
---|
721 | |
---|
722 | ! XIOS outputs |
---|
723 | #ifdef CPP_XIOS |
---|
724 | |
---|
725 | write(*,*) "physiq: call initialize_xios_output" |
---|
726 | call initialize_xios_output(pday,ptime,ptimestep,daysec, & |
---|
727 | presnivs,pseudoalt) |
---|
728 | #endif |
---|
729 | write(*,*) "physiq: end of firstcall" |
---|
730 | endif ! end of 'firstcall' |
---|
731 | |
---|
732 | ! ------------------------------------------------------ |
---|
733 | ! I.2 Initializations done at every physical timestep: |
---|
734 | ! ------------------------------------------------------ |
---|
735 | |
---|
736 | #ifdef CPP_XIOS |
---|
737 | ! update XIOS time/calendar |
---|
738 | call update_xios_timestep |
---|
739 | #endif |
---|
740 | |
---|
741 | ! Initialize various variables |
---|
742 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
743 | |
---|
744 | if ( .not.nearco2cond ) then |
---|
745 | pdt(1:ngrid,1:nlayer) = 0.0 |
---|
746 | endif |
---|
747 | zdtsurf(1:ngrid) = 0.0 |
---|
748 | pdq(1:ngrid,1:nlayer,1:nq) = 0.0 |
---|
749 | dqsurf(1:ngrid,1:nq)= 0.0 |
---|
750 | pdu(1:ngrid,1:nlayer) = 0.0 |
---|
751 | pdv(1:ngrid,1:nlayer) = 0.0 |
---|
752 | pdpsrf(1:ngrid) = 0.0 |
---|
753 | zflubid(1:ngrid) = 0.0 |
---|
754 | flux_sens_lat(1:ngrid) = 0.0 |
---|
755 | taux(1:ngrid) = 0.0 |
---|
756 | tauy(1:ngrid) = 0.0 |
---|
757 | |
---|
758 | zday=pday+ptime ! Compute time, in sols (and fraction thereof). |
---|
759 | |
---|
760 | ! Compute Stellar Longitude (Ls), and orbital parameters. |
---|
761 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
762 | if (season) then |
---|
763 | call stellarlong(zday,zls) |
---|
764 | else |
---|
765 | call stellarlong(float(day_ini),zls) |
---|
766 | end if |
---|
767 | |
---|
768 | call orbite(zls,dist_star,declin,right_ascen) |
---|
769 | |
---|
770 | if (tlocked) then |
---|
771 | zlss=Mod(-(2.*pi*(zday/year_day)*nres - right_ascen),2.*pi) |
---|
772 | elseif (diurnal) then |
---|
773 | zlss=-2.*pi*(zday-.5) |
---|
774 | else if(diurnal .eqv. .false.) then |
---|
775 | zlss=9999. |
---|
776 | endif |
---|
777 | |
---|
778 | |
---|
779 | ! Compute variations of g with latitude (oblate case). |
---|
780 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
781 | if (oblate .eqv. .false.) then |
---|
782 | glat(:) = g |
---|
783 | else if (flatten .eq. 0.0 .or. J2 .eq. 0.0 .or. Rmean .eq. 0.0 .or. MassPlanet .eq. 0.0) then |
---|
784 | print*,'I need values for flatten, J2, Rmean and MassPlanet to compute glat (else set oblate=.false.)' |
---|
785 | call abort |
---|
786 | else |
---|
787 | gmplanet = MassPlanet*grav*1e24 |
---|
788 | do ig=1,ngrid |
---|
789 | glat(ig)= gmplanet/(Rmean**2) * (1.D0 + 0.75 *J2 - 2.0*flatten/3. + (2.*flatten - 15./4.* J2) * cos(2. * (pi/2. - latitude(ig)))) |
---|
790 | end do |
---|
791 | endif |
---|
792 | |
---|
793 | ! Compute geopotential between layers. |
---|
794 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
795 | zzlay(1:ngrid,1:nlayer)=pphi(1:ngrid,1:nlayer) |
---|
796 | do l=1,nlayer |
---|
797 | zzlay(1:ngrid,l)= zzlay(1:ngrid,l)/glat(1:ngrid) |
---|
798 | enddo |
---|
799 | |
---|
800 | zzlev(1:ngrid,1)=0. |
---|
801 | zzlev(1:ngrid,nlayer+1)=1.e7 ! Dummy top of last layer above 10000 km... |
---|
802 | |
---|
803 | do l=2,nlayer |
---|
804 | do ig=1,ngrid |
---|
805 | z1=(pplay(ig,l-1)+pplev(ig,l))/(pplay(ig,l-1)-pplev(ig,l)) |
---|
806 | z2=(pplev(ig,l)+pplay(ig,l))/(pplev(ig,l)-pplay(ig,l)) |
---|
807 | zzlev(ig,l)=(z1*zzlay(ig,l-1)+z2*zzlay(ig,l))/(z1+z2) |
---|
808 | enddo |
---|
809 | enddo |
---|
810 | |
---|
811 | ! Compute potential temperature |
---|
812 | ! Note : Potential temperature calculation may not be the same in physiq and dynamic... |
---|
813 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
814 | do l=1,nlayer |
---|
815 | do ig=1,ngrid |
---|
816 | zpopsk(ig,l)=(pplay(ig,l)/pplev(ig,1))**rcp |
---|
817 | zh(ig,l)=pt(ig,l)/zpopsk(ig,l) |
---|
818 | mass(ig,l) = (pplev(ig,l) - pplev(ig,l+1))/glat(ig) |
---|
819 | massarea(ig,l)=mass(ig,l)*cell_area(ig) |
---|
820 | enddo |
---|
821 | enddo |
---|
822 | |
---|
823 | ! Compute vertical velocity (m/s) from vertical mass flux |
---|
824 | ! w = F / (rho*area) and rho = P/(r*T) |
---|
825 | ! But first linearly interpolate mass flux to mid-layers |
---|
826 | do l=1,nlayer-1 |
---|
827 | pw(1:ngrid,l)=0.5*(flxw(1:ngrid,l)+flxw(1:ngrid,l+1)) |
---|
828 | enddo |
---|
829 | pw(1:ngrid,nlayer)=0.5*flxw(1:ngrid,nlayer) ! since flxw(nlayer+1)=0 |
---|
830 | do l=1,nlayer |
---|
831 | pw(1:ngrid,l)=(pw(1:ngrid,l)*r*pt(1:ngrid,l)) / & |
---|
832 | (pplay(1:ngrid,l)*cell_area(1:ngrid)) |
---|
833 | enddo |
---|
834 | ! omega in Pa/s |
---|
835 | do l=1,nlayer-1 |
---|
836 | omega(1:ngrid,l)=0.5*(flxw(1:ngrid,l)+flxw(1:ngrid,l+1)) |
---|
837 | enddo |
---|
838 | omega(1:ngrid,nlayer)=0.5*flxw(1:ngrid,nlayer) ! since flxw(nlayer+1)=0 |
---|
839 | do l=1,nlayer |
---|
840 | omega(1:ngrid,l)=g*omega(1:ngrid,l)/cell_area(1:ngrid) |
---|
841 | enddo |
---|
842 | |
---|
843 | ! ---------------------------------------------------------------- |
---|
844 | ! Compute mean mass, cp, and R |
---|
845 | ! -------------------------------- |
---|
846 | #ifndef MESOSCALE |
---|
847 | if(photochem) then |
---|
848 | call concentrations(ngrid,nlayer,nq,pplay,pt,pdt,pq,pdq,ptimestep) |
---|
849 | endif |
---|
850 | #endif |
---|
851 | |
---|
852 | !--------------------------------- |
---|
853 | ! II. Compute radiative tendencies |
---|
854 | !--------------------------------- |
---|
855 | |
---|
856 | if (callrad) then |
---|
857 | if( mod(icount-1,iradia).eq.0.or.lastcall) then |
---|
858 | |
---|
859 | ! Compute local stellar zenith angles |
---|
860 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
861 | if (tlocked) then |
---|
862 | ! JL14 corrects tidally resonant (and inclined) cases. nres=omega_rot/omega_orb |
---|
863 | ztim1=SIN(declin) |
---|
864 | ztim2=COS(declin)*COS(zlss) |
---|
865 | ztim3=COS(declin)*SIN(zlss) |
---|
866 | |
---|
867 | call stelang(ngrid,sinlon,coslon,sinlat,coslat, & |
---|
868 | ztim1,ztim2,ztim3,mu0,fract, flatten) |
---|
869 | |
---|
870 | elseif (diurnal) then |
---|
871 | ztim1=SIN(declin) |
---|
872 | ztim2=COS(declin)*COS(2.*pi*(zday-.5)) |
---|
873 | ztim3=-COS(declin)*SIN(2.*pi*(zday-.5)) |
---|
874 | |
---|
875 | call stelang(ngrid,sinlon,coslon,sinlat,coslat, & |
---|
876 | ztim1,ztim2,ztim3,mu0,fract, flatten) |
---|
877 | else if(diurnal .eqv. .false.) then |
---|
878 | |
---|
879 | call mucorr(ngrid,declin,latitude,mu0,fract,10000.,rad,flatten) |
---|
880 | ! WARNING: this function appears not to work in 1D |
---|
881 | |
---|
882 | endif |
---|
883 | |
---|
884 | ! Eclipse incoming sunlight (e.g. Saturn ring shadowing). |
---|
885 | if(rings_shadow) then |
---|
886 | call call_rings(ngrid, ptime, pday, diurnal) |
---|
887 | endif |
---|
888 | |
---|
889 | |
---|
890 | if (corrk) then |
---|
891 | |
---|
892 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
893 | ! II.a Call correlated-k radiative transfer scheme |
---|
894 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
895 | if(kastprof)then |
---|
896 | print*,'kastprof should not = true here' |
---|
897 | call abort |
---|
898 | endif |
---|
899 | if(water) then |
---|
900 | muvar(1:ngrid,1:nlayer)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,1:nlayer,igcm_h2o_vap)) |
---|
901 | muvar(1:ngrid,nlayer+1)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,nlayer,igcm_h2o_vap)) |
---|
902 | ! take into account water effect on mean molecular weight |
---|
903 | else |
---|
904 | muvar(1:ngrid,1:nlayer+1)=mugaz |
---|
905 | endif |
---|
906 | |
---|
907 | |
---|
908 | if(ok_slab_ocean) then |
---|
909 | tsurf2(:)=tsurf(:) |
---|
910 | do ig=1,ngrid |
---|
911 | if (nint(rnat(ig))==0) then |
---|
912 | tsurf(ig)=((1.-pctsrf_sic(ig))*tslab(ig,1)**4+pctsrf_sic(ig)*tsea_ice(ig)**4)**0.25 |
---|
913 | endif |
---|
914 | enddo |
---|
915 | endif !(ok_slab_ocean) |
---|
916 | |
---|
917 | ! standard callcorrk |
---|
918 | clearsky=.false. |
---|
919 | call callcorrk(ngrid,nlayer,pq,nq,qsurf, & |
---|
920 | albedo,albedo_equivalent,emis,mu0,pplev,pplay,pt, & |
---|
921 | tsurf,fract,dist_star,aerosol,muvar, & |
---|
922 | zdtlw,zdtsw,fluxsurf_lw,fluxsurf_sw, & |
---|
923 | fluxsurfabs_sw,fluxtop_lw, & |
---|
924 | fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu, & |
---|
925 | tau_col,cloudfrac,totcloudfrac, & |
---|
926 | clearsky,firstcall,lastcall) |
---|
927 | |
---|
928 | ! Option to call scheme once more for clear regions |
---|
929 | if(CLFvarying)then |
---|
930 | |
---|
931 | ! ---> PROBLEMS WITH ALLOCATED ARRAYS : temporary solution in callcorrk: do not deallocate if CLFvarying ... |
---|
932 | clearsky=.true. |
---|
933 | call callcorrk(ngrid,nlayer,pq,nq,qsurf, & |
---|
934 | albedo,albedo_equivalent1,emis,mu0,pplev,pplay,pt, & |
---|
935 | tsurf,fract,dist_star,aerosol,muvar, & |
---|
936 | zdtlw1,zdtsw1,fluxsurf_lw1,fluxsurf_sw1, & |
---|
937 | fluxsurfabs_sw1,fluxtop_lw1, & |
---|
938 | fluxabs_sw1,fluxtop_dn,OLR_nu1,OSR_nu1, & |
---|
939 | tau_col1,cloudfrac,totcloudfrac, & |
---|
940 | clearsky,firstcall,lastcall) |
---|
941 | clearsky = .false. ! just in case. |
---|
942 | |
---|
943 | ! Sum the fluxes and heating rates from cloudy/clear cases |
---|
944 | do ig=1,ngrid |
---|
945 | tf=totcloudfrac(ig) |
---|
946 | ntf=1.-tf |
---|
947 | fluxsurf_lw(ig) = ntf*fluxsurf_lw1(ig) + tf*fluxsurf_lw(ig) |
---|
948 | fluxsurf_sw(ig) = ntf*fluxsurf_sw1(ig) + tf*fluxsurf_sw(ig) |
---|
949 | albedo_equivalent(ig) = ntf*albedo_equivalent1(ig) + tf*albedo_equivalent(ig) |
---|
950 | fluxsurfabs_sw(ig) = ntf*fluxsurfabs_sw1(ig) + tf*fluxsurfabs_sw(ig) |
---|
951 | fluxtop_lw(ig) = ntf*fluxtop_lw1(ig) + tf*fluxtop_lw(ig) |
---|
952 | fluxabs_sw(ig) = ntf*fluxabs_sw1(ig) + tf*fluxabs_sw(ig) |
---|
953 | tau_col(ig) = ntf*tau_col1(ig) + tf*tau_col(ig) |
---|
954 | |
---|
955 | zdtlw(ig,1:nlayer) = ntf*zdtlw1(ig,1:nlayer) + tf*zdtlw(ig,1:nlayer) |
---|
956 | zdtsw(ig,1:nlayer) = ntf*zdtsw1(ig,1:nlayer) + tf*zdtsw(ig,1:nlayer) |
---|
957 | |
---|
958 | OSR_nu(ig,1:L_NSPECTV) = ntf*OSR_nu1(ig,1:L_NSPECTV) + tf*OSR_nu(ig,1:L_NSPECTV) |
---|
959 | OLR_nu(ig,1:L_NSPECTI) = ntf*OLR_nu1(ig,1:L_NSPECTI) + tf*OLR_nu(ig,1:L_NSPECTI) |
---|
960 | enddo |
---|
961 | |
---|
962 | endif ! end of CLFvarying. |
---|
963 | |
---|
964 | if(ok_slab_ocean) then |
---|
965 | tsurf(:)=tsurf2(:) |
---|
966 | endif |
---|
967 | |
---|
968 | |
---|
969 | ! Radiative flux from the sky absorbed by the surface (W.m-2). |
---|
970 | GSR=0.0 |
---|
971 | fluxrad_sky(1:ngrid)=emis(1:ngrid)*fluxsurf_lw(1:ngrid)+fluxsurfabs_sw(1:ngrid) |
---|
972 | |
---|
973 | !if(noradsurf)then ! no lower surface; SW flux just disappears |
---|
974 | ! GSR = SUM(fluxsurf_sw(1:ngrid)*cell_area(1:ngrid))/totarea |
---|
975 | ! fluxrad_sky(1:ngrid)=emis(1:ngrid)*fluxsurf_lw(1:ngrid) |
---|
976 | ! print*,'SW lost in deep atmosphere = ',GSR,' W m^-2' |
---|
977 | !endif |
---|
978 | |
---|
979 | ! Net atmospheric radiative heating rate (K.s-1) |
---|
980 | dtrad(1:ngrid,1:nlayer)=zdtsw(1:ngrid,1:nlayer)+zdtlw(1:ngrid,1:nlayer) |
---|
981 | |
---|
982 | ! Late initialization of the Ice Spectral Albedo. We needed the visible bands to do that ! |
---|
983 | if (firstcall .and. albedo_spectral_mode) then |
---|
984 | call spectral_albedo_calc(albedo_snow_SPECTV) |
---|
985 | endif |
---|
986 | |
---|
987 | elseif(newtonian)then |
---|
988 | |
---|
989 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
990 | ! II.b Call Newtonian cooling scheme |
---|
991 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
992 | call newtrelax(ngrid,nlayer,mu0,sinlat,zpopsk,pt,pplay,pplev,dtrad,firstcall) |
---|
993 | |
---|
994 | zdtsurf(1:ngrid) = +(pt(1:ngrid,1)-tsurf(1:ngrid))/ptimestep |
---|
995 | ! e.g. surface becomes proxy for 1st atmospheric layer ? |
---|
996 | |
---|
997 | else |
---|
998 | |
---|
999 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1000 | ! II.c Atmosphere has no radiative effect |
---|
1001 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1002 | fluxtop_dn(1:ngrid) = fract(1:ngrid)*mu0(1:ngrid)*Fat1AU/dist_star**2 |
---|
1003 | if(ngrid.eq.1)then ! / by 4 globally in 1D case... |
---|
1004 | fluxtop_dn(1) = fract(1)*Fat1AU/dist_star**2/2.0 |
---|
1005 | endif |
---|
1006 | fluxsurf_sw(1:ngrid) = fluxtop_dn(1:ngrid) |
---|
1007 | print*,'------------WARNING---WARNING------------' ! by MT2015. |
---|
1008 | print*,'You are in corrk=false mode, ' |
---|
1009 | print*,'and the surface albedo is taken equal to the first visible spectral value' |
---|
1010 | |
---|
1011 | fluxsurfabs_sw(1:ngrid) = fluxtop_dn(1:ngrid)*(1.-albedo(1:ngrid,1)) |
---|
1012 | fluxrad_sky(1:ngrid) = fluxsurfabs_sw(1:ngrid) |
---|
1013 | fluxtop_lw(1:ngrid) = emis(1:ngrid)*sigma*tsurf(1:ngrid)**4 |
---|
1014 | |
---|
1015 | dtrad(1:ngrid,1:nlayer)=0.0 ! no atmospheric radiative heating |
---|
1016 | |
---|
1017 | endif ! end of corrk |
---|
1018 | |
---|
1019 | endif ! of if(mod(icount-1,iradia).eq.0) |
---|
1020 | |
---|
1021 | |
---|
1022 | ! Transformation of the radiative tendencies |
---|
1023 | ! ------------------------------------------ |
---|
1024 | zplanck(1:ngrid)=tsurf(1:ngrid)*tsurf(1:ngrid) |
---|
1025 | zplanck(1:ngrid)=emis(1:ngrid)*sigma*zplanck(1:ngrid)*zplanck(1:ngrid) |
---|
1026 | fluxrad(1:ngrid)=fluxrad_sky(1:ngrid)-zplanck(1:ngrid) |
---|
1027 | pdt(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)+dtrad(1:ngrid,1:nlayer) |
---|
1028 | |
---|
1029 | ! Test of energy conservation |
---|
1030 | !---------------------------- |
---|
1031 | if(enertest)then |
---|
1032 | call planetwide_sumval(cpp*massarea(:,:)*zdtsw(:,:)/totarea_planet,dEtotSW) |
---|
1033 | call planetwide_sumval(cpp*massarea(:,:)*zdtlw(:,:)/totarea_planet,dEtotLW) |
---|
1034 | !call planetwide_sumval(fluxsurf_sw(:)*(1.-albedo_equivalent(:))*cell_area(:)/totarea_planet,dEtotsSW) !JL13 carefull, albedo can have changed since the last time we called corrk |
---|
1035 | call planetwide_sumval(fluxsurfabs_sw(:)*cell_area(:)/totarea_planet,dEtotsSW) !JL13 carefull, albedo can have changed since the last time we called corrk |
---|
1036 | call planetwide_sumval((fluxsurf_lw(:)*emis(:)-zplanck(:))*cell_area(:)/totarea_planet,dEtotsLW) |
---|
1037 | dEzRadsw(:,:)=cpp*mass(:,:)*zdtsw(:,:) |
---|
1038 | dEzRadlw(:,:)=cpp*mass(:,:)*zdtlw(:,:) |
---|
1039 | if (is_master) then |
---|
1040 | print*,'---------------------------------------------------------------' |
---|
1041 | print*,'In corrk SW atmospheric heating =',dEtotSW,' W m-2' |
---|
1042 | print*,'In corrk LW atmospheric heating =',dEtotLW,' W m-2' |
---|
1043 | print*,'atmospheric net rad heating (SW+LW) =',dEtotLW+dEtotSW,' W m-2' |
---|
1044 | print*,'In corrk SW surface heating =',dEtotsSW,' W m-2' |
---|
1045 | print*,'In corrk LW surface heating =',dEtotsLW,' W m-2' |
---|
1046 | print*,'surface net rad heating (SW+LW) =',dEtotsLW+dEtotsSW,' W m-2' |
---|
1047 | endif |
---|
1048 | endif ! end of 'enertest' |
---|
1049 | |
---|
1050 | endif ! of if (callrad) |
---|
1051 | |
---|
1052 | |
---|
1053 | |
---|
1054 | ! -------------------------------------------- |
---|
1055 | ! III. Vertical diffusion (turbulent mixing) : |
---|
1056 | ! -------------------------------------------- |
---|
1057 | |
---|
1058 | if (calldifv) then |
---|
1059 | |
---|
1060 | zflubid(1:ngrid)=fluxrad(1:ngrid)+fluxgrd(1:ngrid) |
---|
1061 | |
---|
1062 | ! JL12 the following if test is temporarily there to allow us to compare the old vdifc with turbdiff. |
---|
1063 | if (UseTurbDiff) then |
---|
1064 | |
---|
1065 | call turbdiff(ngrid,nlayer,nq,rnat, & |
---|
1066 | ptimestep,capcal,lwrite, & |
---|
1067 | pplay,pplev,zzlay,zzlev,z0, & |
---|
1068 | pu,pv,pt,zpopsk,pq,tsurf,emis,qsurf, & |
---|
1069 | pdt,pdq,zflubid, & |
---|
1070 | zdudif,zdvdif,zdtdif,zdtsdif, & |
---|
1071 | sensibFlux,q2,zdqdif,zdqevap,zdqsdif, & |
---|
1072 | taux,tauy,lastcall) |
---|
1073 | |
---|
1074 | else |
---|
1075 | |
---|
1076 | zdh(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)/zpopsk(1:ngrid,1:nlayer) |
---|
1077 | |
---|
1078 | call vdifc(ngrid,nlayer,nq,rnat,zpopsk, & |
---|
1079 | ptimestep,capcal,lwrite, & |
---|
1080 | pplay,pplev,zzlay,zzlev,z0, & |
---|
1081 | pu,pv,zh,pq,tsurf,emis,qsurf, & |
---|
1082 | zdh,pdq,zflubid, & |
---|
1083 | zdudif,zdvdif,zdhdif,zdtsdif, & |
---|
1084 | sensibFlux,q2,zdqdif,zdqsdif, & |
---|
1085 | taux,tauy,lastcall) |
---|
1086 | |
---|
1087 | zdtdif(1:ngrid,1:nlayer)=zdhdif(1:ngrid,1:nlayer)*zpopsk(1:ngrid,1:nlayer) ! for diagnostic only |
---|
1088 | zdqevap(1:ngrid,1:nlayer)=0. |
---|
1089 | |
---|
1090 | end if !end of 'UseTurbDiff' |
---|
1091 | |
---|
1092 | !!! this is always done, except for turbulence-resolving simulations |
---|
1093 | if (.not. turb_resolved) then |
---|
1094 | pdv(1:ngrid,1:nlayer)=pdv(1:ngrid,1:nlayer)+zdvdif(1:ngrid,1:nlayer) |
---|
1095 | pdu(1:ngrid,1:nlayer)=pdu(1:ngrid,1:nlayer)+zdudif(1:ngrid,1:nlayer) |
---|
1096 | pdt(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)+zdtdif(1:ngrid,1:nlayer) |
---|
1097 | zdtsurf(1:ngrid)=zdtsurf(1:ngrid)+zdtsdif(1:ngrid) |
---|
1098 | endif |
---|
1099 | |
---|
1100 | if(ok_slab_ocean)then |
---|
1101 | flux_sens_lat(1:ngrid)=(zdtsdif(1:ngrid)*capcal(1:ngrid)-fluxrad(1:ngrid)) |
---|
1102 | endif |
---|
1103 | |
---|
1104 | |
---|
1105 | if (tracer) then |
---|
1106 | pdq(1:ngrid,1:nlayer,1:nq)=pdq(1:ngrid,1:nlayer,1:nq)+ zdqdif(1:ngrid,1:nlayer,1:nq) |
---|
1107 | dqsurf(1:ngrid,1:nq)=dqsurf(1:ngrid,1:nq) + zdqsdif(1:ngrid,1:nq) |
---|
1108 | end if ! of if (tracer) |
---|
1109 | |
---|
1110 | |
---|
1111 | ! test energy conservation |
---|
1112 | !------------------------- |
---|
1113 | if(enertest)then |
---|
1114 | |
---|
1115 | dEzdiff(:,:)=cpp*mass(:,:)*zdtdif(:,:) |
---|
1116 | do ig = 1, ngrid |
---|
1117 | dEdiff(ig)=SUM(dEzdiff (ig,:))+ sensibFlux(ig)! subtract flux to the ground |
---|
1118 | dEzdiff(ig,1)= dEzdiff(ig,1)+ sensibFlux(ig)! subtract flux to the ground |
---|
1119 | enddo |
---|
1120 | |
---|
1121 | call planetwide_sumval(dEdiff(:)*cell_area(:)/totarea_planet,dEtot) |
---|
1122 | dEdiffs(:)=capcal(:)*zdtsdif(:)-zflubid(:)-sensibFlux(:) |
---|
1123 | call planetwide_sumval(dEdiffs(:)*cell_area(:)/totarea_planet,dEtots) |
---|
1124 | call planetwide_sumval(sensibFlux(:)*cell_area(:)/totarea_planet,AtmToSurf_TurbFlux) |
---|
1125 | |
---|
1126 | if (is_master) then |
---|
1127 | |
---|
1128 | if (UseTurbDiff) then |
---|
1129 | print*,'In TurbDiff sensible flux (atm=>surf) =',AtmToSurf_TurbFlux,' W m-2' |
---|
1130 | print*,'In TurbDiff non-cons atm nrj change =',dEtot,' W m-2' |
---|
1131 | print*,'In TurbDiff (correc rad+latent heat) surf nrj change =',dEtots,' W m-2' |
---|
1132 | else |
---|
1133 | print*,'In vdifc sensible flux (atm=>surf) =',AtmToSurf_TurbFlux,' W m-2' |
---|
1134 | print*,'In vdifc non-cons atm nrj change =',dEtot,' W m-2' |
---|
1135 | print*,'In vdifc (correc rad+latent heat) surf nrj change =',dEtots,' W m-2' |
---|
1136 | end if |
---|
1137 | endif ! end of 'is_master' |
---|
1138 | |
---|
1139 | ! JL12 : note that the black body radiative flux emitted by the surface has been updated by the implicit scheme but not given back elsewhere. |
---|
1140 | endif ! end of 'enertest' |
---|
1141 | |
---|
1142 | |
---|
1143 | ! Test water conservation. |
---|
1144 | if(watertest.and.water)then |
---|
1145 | |
---|
1146 | call planetwide_sumval(massarea(:,:)*zdqdif(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dWtot_tmp) |
---|
1147 | call planetwide_sumval(zdqsdif(:,igcm_h2o_vap)*cell_area(:)*ptimestep/totarea_planet,dWtots_tmp) |
---|
1148 | do ig = 1, ngrid |
---|
1149 | vdifcncons(ig)=SUM(mass(ig,:)*zdqdif(ig,:,igcm_h2o_vap)) |
---|
1150 | enddo |
---|
1151 | call planetwide_sumval(massarea(:,:)*zdqdif(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) |
---|
1152 | call planetwide_sumval(zdqsdif(:,igcm_h2o_ice)*cell_area(:)*ptimestep/totarea_planet,dWtots) |
---|
1153 | dWtot = dWtot + dWtot_tmp |
---|
1154 | dWtots = dWtots + dWtots_tmp |
---|
1155 | do ig = 1, ngrid |
---|
1156 | vdifcncons(ig)=vdifcncons(ig) + SUM(mass(ig,:)*zdqdif(ig,:,igcm_h2o_ice)) |
---|
1157 | enddo |
---|
1158 | call planetwide_maxval(vdifcncons(:),nconsMAX) |
---|
1159 | |
---|
1160 | if (is_master) then |
---|
1161 | print*,'---------------------------------------------------------------' |
---|
1162 | print*,'In difv atmospheric water change =',dWtot,' kg m-2' |
---|
1163 | print*,'In difv surface water change =',dWtots,' kg m-2' |
---|
1164 | print*,'In difv non-cons factor =',dWtot+dWtots,' kg m-2' |
---|
1165 | print*,'In difv MAX non-cons factor =',nconsMAX,' kg m-2 s-1' |
---|
1166 | endif |
---|
1167 | |
---|
1168 | endif ! end of 'watertest' |
---|
1169 | !------------------------- |
---|
1170 | |
---|
1171 | else ! calldifv |
---|
1172 | |
---|
1173 | if(.not.newtonian)then |
---|
1174 | |
---|
1175 | zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + (fluxrad(1:ngrid) + fluxgrd(1:ngrid))/capcal(1:ngrid) |
---|
1176 | |
---|
1177 | endif |
---|
1178 | |
---|
1179 | endif ! end of 'calldifv' |
---|
1180 | |
---|
1181 | |
---|
1182 | !------------------- |
---|
1183 | ! IV. Convection : |
---|
1184 | !------------------- |
---|
1185 | |
---|
1186 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1187 | ! IV.a Thermal plume model : |
---|
1188 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1189 | |
---|
1190 | IF (calltherm) THEN |
---|
1191 | ! AB : We need to evaporate ice before calling thermcell_main |
---|
1192 | IF (water) THEN |
---|
1193 | CALL evap(ngrid,nlayer,nq,ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,zqtherm,zttherm) |
---|
1194 | ELSE |
---|
1195 | zttherm(:,:) = pt(:,:) |
---|
1196 | zqtherm(:,:,:) = pq(:,:,:) |
---|
1197 | ENDIF |
---|
1198 | |
---|
1199 | ! AB: If a plume stops, the parametrization never look above if somewhere the atmosphere is still unstable! |
---|
1200 | ! Maybe it's a good idea to call convective adjustment too. |
---|
1201 | CALL thermcell_main(icount, ngrid, nlayer, ptimestep, & |
---|
1202 | pplay, pplev, pphi, firstcall, & |
---|
1203 | pu, pv, zttherm, zqtherm(:,:,igcm_h2o_vap), & |
---|
1204 | zdutherm, zdvtherm, zdttherm, zdotherm, & |
---|
1205 | f0, fm0, entr0, detr0, & |
---|
1206 | zqta, zqla, ztv, ztva, ztla, zthl, zqsatth, & |
---|
1207 | zw2, fraca, & |
---|
1208 | lmin, lmix, lalim, lmax, & |
---|
1209 | zpopsk, ratqscth, ratqsdiff, & |
---|
1210 | ! AB : Next variables are only used for diagnoses |
---|
1211 | Ale_bl,Alp_bl,lalim_conv,wght_th, & |
---|
1212 | pbl_tke,pctsrf,omega_therm,airephy, & |
---|
1213 | zlcl,fraca0,w0,w_conv, & |
---|
1214 | therm_tke_max0,env_tke_max0, & |
---|
1215 | n2,s2,ale_bl_stat, & |
---|
1216 | therm_tke_max,env_tke_max, & |
---|
1217 | alp_bl_det,alp_bl_fluct_m,alp_bl_fluct_tke, & |
---|
1218 | alp_bl_conv,alp_bl_stat) |
---|
1219 | |
---|
1220 | DO ig=1,ngrid |
---|
1221 | pmin(ig) = pplev(ig,lmin(ig)) |
---|
1222 | pmax(ig) = pplev(ig,lmax(ig)) |
---|
1223 | ENDDO |
---|
1224 | |
---|
1225 | pdu(1:ngrid,1:nlayer) = pdu(1:ngrid,1:nlayer) + zdutherm(1:ngrid,1:nlayer) |
---|
1226 | pdv(1:ngrid,1:nlayer) = pdv(1:ngrid,1:nlayer) + zdvtherm(1:ngrid,1:nlayer) |
---|
1227 | pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer) + zdttherm(1:ngrid,1:nlayer) |
---|
1228 | |
---|
1229 | IF(tracer) THEN |
---|
1230 | pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap) + zdotherm(1:ngrid,1:nlayer) |
---|
1231 | ENDIF |
---|
1232 | |
---|
1233 | ELSE |
---|
1234 | |
---|
1235 | lmax(1:ngrid) = 0 |
---|
1236 | |
---|
1237 | ENDIF ! end of 'calltherm' |
---|
1238 | |
---|
1239 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1240 | ! IV.b Dry convective adjustment : |
---|
1241 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1242 | |
---|
1243 | if(calladj) then |
---|
1244 | |
---|
1245 | zdh(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)/zpopsk(1:ngrid,1:nlayer) |
---|
1246 | zduadj(1:ngrid,1:nlayer)=0.0 |
---|
1247 | zdvadj(1:ngrid,1:nlayer)=0.0 |
---|
1248 | zdhadj(1:ngrid,1:nlayer)=0.0 |
---|
1249 | |
---|
1250 | |
---|
1251 | call convadj(ngrid,nlayer,nq,ptimestep, & |
---|
1252 | pplay,pplev,zpopsk, & |
---|
1253 | pu,pv,zh,pq, & |
---|
1254 | pdu,pdv,zdh,pdq, & |
---|
1255 | zduadj,zdvadj,zdhadj, & |
---|
1256 | zdqadj,lmax) |
---|
1257 | |
---|
1258 | pdu(1:ngrid,1:nlayer) = pdu(1:ngrid,1:nlayer) + zduadj(1:ngrid,1:nlayer) |
---|
1259 | pdv(1:ngrid,1:nlayer) = pdv(1:ngrid,1:nlayer) + zdvadj(1:ngrid,1:nlayer) |
---|
1260 | pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer) + zdhadj(1:ngrid,1:nlayer)*zpopsk(1:ngrid,1:nlayer) |
---|
1261 | zdtadj(1:ngrid,1:nlayer) = zdhadj(1:ngrid,1:nlayer)*zpopsk(1:ngrid,1:nlayer) ! for diagnostic only |
---|
1262 | |
---|
1263 | if(tracer) then |
---|
1264 | pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + zdqadj(1:ngrid,1:nlayer,1:nq) |
---|
1265 | end if |
---|
1266 | |
---|
1267 | ! Test energy conservation |
---|
1268 | if(enertest)then |
---|
1269 | call planetwide_sumval(cpp*massarea(:,:)*zdtadj(:,:)/totarea_planet,dEtot) |
---|
1270 | if (is_master) print*,'In convadj atmospheric energy change =',dEtot,' W m-2' |
---|
1271 | endif |
---|
1272 | |
---|
1273 | ! Test water conservation |
---|
1274 | if(watertest)then |
---|
1275 | call planetwide_sumval(massarea(:,:)*zdqadj(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dWtot_tmp) |
---|
1276 | do ig = 1, ngrid |
---|
1277 | cadjncons(ig)=SUM(mass(ig,:)*zdqadj(ig,:,igcm_h2o_vap)) |
---|
1278 | enddo |
---|
1279 | call planetwide_sumval(massarea(:,:)*zdqadj(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) |
---|
1280 | dWtot = dWtot + dWtot_tmp |
---|
1281 | do ig = 1, ngrid |
---|
1282 | cadjncons(ig)=cadjncons(ig) + SUM(mass(ig,:)*zdqadj(ig,:,igcm_h2o_ice)) |
---|
1283 | enddo |
---|
1284 | call planetwide_maxval(cadjncons(:),nconsMAX) |
---|
1285 | |
---|
1286 | if (is_master) then |
---|
1287 | print*,'In convadj atmospheric water change =',dWtot,' kg m-2' |
---|
1288 | print*,'In convadj MAX non-cons factor =',nconsMAX,' kg m-2 s-1' |
---|
1289 | endif |
---|
1290 | |
---|
1291 | endif ! end of 'watertest' |
---|
1292 | |
---|
1293 | endif ! end of 'calladj' |
---|
1294 | |
---|
1295 | !----------------------------------------------- |
---|
1296 | ! V. Carbon dioxide condensation-sublimation : |
---|
1297 | !----------------------------------------------- |
---|
1298 | |
---|
1299 | if (co2cond) then |
---|
1300 | |
---|
1301 | if (.not.tracer) then |
---|
1302 | print*,'We need a CO2 ice tracer to condense CO2' |
---|
1303 | call abort |
---|
1304 | endif |
---|
1305 | call condense_co2(ngrid,nlayer,nq,ptimestep, & |
---|
1306 | capcal,pplay,pplev,tsurf,pt, & |
---|
1307 | pdt,zdtsurf,pq,pdq, & |
---|
1308 | qsurf,zdqsurfc,albedo,emis, & |
---|
1309 | albedo_bareground,albedo_co2_ice_SPECTV, & |
---|
1310 | zdtc,zdtsurfc,pdpsrf,zdqc) |
---|
1311 | |
---|
1312 | pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+zdtc(1:ngrid,1:nlayer) |
---|
1313 | zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurfc(1:ngrid) |
---|
1314 | |
---|
1315 | pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq)+ zdqc(1:ngrid,1:nlayer,1:nq) |
---|
1316 | dqsurf(1:ngrid,igcm_co2_ice) = dqsurf(1:ngrid,igcm_co2_ice) + zdqsurfc(1:ngrid) |
---|
1317 | |
---|
1318 | ! test energy conservation |
---|
1319 | if(enertest)then |
---|
1320 | call planetwide_sumval(cpp*massarea(:,:)*zdtc(:,:)/totarea_planet,dEtot) |
---|
1321 | call planetwide_sumval(capcal(:)*zdtsurfc(:)*cell_area(:)/totarea_planet,dEtots) |
---|
1322 | if (is_master) then |
---|
1323 | print*,'In co2cloud atmospheric energy change =',dEtot,' W m-2' |
---|
1324 | print*,'In co2cloud surface energy change =',dEtots,' W m-2' |
---|
1325 | endif |
---|
1326 | endif |
---|
1327 | |
---|
1328 | endif ! end of 'co2cond' |
---|
1329 | |
---|
1330 | |
---|
1331 | !--------------------------------------------- |
---|
1332 | ! VI. Specific parameterizations for tracers |
---|
1333 | !--------------------------------------------- |
---|
1334 | |
---|
1335 | if (tracer) then |
---|
1336 | |
---|
1337 | ! --------------------- |
---|
1338 | ! VI.1. Water and ice |
---|
1339 | ! --------------------- |
---|
1340 | if (water) then |
---|
1341 | |
---|
1342 | ! Water ice condensation in the atmosphere |
---|
1343 | if(watercond.and.(RLVTT.gt.1.e-8))then |
---|
1344 | |
---|
1345 | if (.not.calltherm) then |
---|
1346 | dqmoist(1:ngrid,1:nlayer,1:nq)=0. |
---|
1347 | dtmoist(1:ngrid,1:nlayer)=0. |
---|
1348 | |
---|
1349 | ! Moist Convective Adjustment. |
---|
1350 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1351 | call moistadj(ngrid,nlayer,nq,pt,pq,pdq,pplev,pplay,dtmoist,dqmoist,ptimestep,rneb_man) |
---|
1352 | |
---|
1353 | pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap) & |
---|
1354 | + dqmoist(1:ngrid,1:nlayer,igcm_h2o_vap) |
---|
1355 | pdq(1:ngrid,1:nlayer,igcm_h2o_ice) = pdq(1:ngrid,1:nlayer,igcm_h2o_ice) & |
---|
1356 | + dqmoist(1:ngrid,1:nlayer,igcm_h2o_ice) |
---|
1357 | pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+dtmoist(1:ngrid,1:nlayer) |
---|
1358 | |
---|
1359 | ! Test energy conservation. |
---|
1360 | if(enertest)then |
---|
1361 | call planetwide_sumval(cpp*massarea(:,:)*dtmoist(:,:)/totarea_planet,dEtot) |
---|
1362 | call planetwide_maxval(dtmoist(:,:),dtmoist_max) |
---|
1363 | call planetwide_minval(dtmoist(:,:),dtmoist_min) |
---|
1364 | madjdEz(:,:)=cpp*mass(:,:)*dtmoist(:,:) |
---|
1365 | |
---|
1366 | do ig=1,ngrid |
---|
1367 | madjdE(ig) = cpp*SUM(mass(:,:)*dtmoist(:,:)) |
---|
1368 | enddo |
---|
1369 | |
---|
1370 | if (is_master) then |
---|
1371 | print*,'In moistadj atmospheric energy change =',dEtot,' W m-2' |
---|
1372 | print*,'In moistadj MAX atmospheric energy change =',dtmoist_max*ptimestep,'K/step' |
---|
1373 | print*,'In moistadj MIN atmospheric energy change =',dtmoist_min*ptimestep,'K/step' |
---|
1374 | endif |
---|
1375 | |
---|
1376 | call planetwide_sumval(massarea(:,:)*dqmoist(:,:,igcm_h2o_vap)*ptimestep/totarea_planet+ & |
---|
1377 | massarea(:,:)*dqmoist(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) |
---|
1378 | if (is_master) print*,'In moistadj atmospheric water change =',dWtot,' kg m-2' |
---|
1379 | |
---|
1380 | endif ! end of 'enertest' |
---|
1381 | endif |
---|
1382 | |
---|
1383 | ! Large scale condensation/evaporation. |
---|
1384 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1385 | call largescale(ngrid,nlayer,nq,ptimestep,pplev,pplay,pt,pq,pdt,pdq,dtlscale,dqvaplscale,dqcldlscale,rneb_lsc) |
---|
1386 | |
---|
1387 | pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+dtlscale(1:ngrid,1:nlayer) |
---|
1388 | pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap)+dqvaplscale(1:ngrid,1:nlayer) |
---|
1389 | pdq(1:ngrid,1:nlayer,igcm_h2o_ice) = pdq(1:ngrid,1:nlayer,igcm_h2o_ice)+dqcldlscale(1:ngrid,1:nlayer) |
---|
1390 | |
---|
1391 | ! Test energy conservation. |
---|
1392 | if(enertest)then |
---|
1393 | lscaledEz(:,:) = cpp*mass(:,:)*dtlscale(:,:) |
---|
1394 | do ig=1,ngrid |
---|
1395 | lscaledE(ig) = cpp*SUM(mass(:,:)*dtlscale(:,:)) |
---|
1396 | enddo |
---|
1397 | call planetwide_sumval(cpp*massarea(:,:)*dtlscale(:,:)/totarea_planet,dEtot) |
---|
1398 | |
---|
1399 | if (is_master) print*,'In largescale atmospheric energy change =',dEtot,' W m-2' |
---|
1400 | |
---|
1401 | ! Test water conservation. |
---|
1402 | call planetwide_sumval(massarea(:,:)*dqvaplscale(:,:)*ptimestep/totarea_planet+ & |
---|
1403 | SUM(massarea(:,:)*dqcldlscale(:,:))*ptimestep/totarea_planet,dWtot) |
---|
1404 | |
---|
1405 | if (is_master) print*,'In largescale atmospheric water change =',dWtot,' kg m-2' |
---|
1406 | endif ! end of 'enertest' |
---|
1407 | |
---|
1408 | ! Compute cloud fraction. |
---|
1409 | do l = 1, nlayer |
---|
1410 | do ig=1,ngrid |
---|
1411 | cloudfrac(ig,l)=MAX(rneb_lsc(ig,l),rneb_man(ig,l)) |
---|
1412 | enddo |
---|
1413 | enddo |
---|
1414 | |
---|
1415 | endif ! end of 'watercond' |
---|
1416 | |
---|
1417 | ! Water ice / liquid precipitation. |
---|
1418 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
1419 | zdqrain(1:ngrid,1:nlayer,1:nq) = 0.0 !JL18 need to do that everytimestep if mass redis is on. |
---|
1420 | |
---|
1421 | if(waterrain)then |
---|
1422 | |
---|
1423 | zdqsrain(1:ngrid) = 0.0 |
---|
1424 | zdqssnow(1:ngrid) = 0.0 |
---|
1425 | |
---|
1426 | call rain(ngrid,nlayer,nq,ptimestep,pplev,pplay,pt,pdt,pq,pdq, & |
---|
1427 | zdtrain,zdqrain,zdqsrain,zdqssnow,reevap_precip,cloudfrac) |
---|
1428 | |
---|
1429 | pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap) & |
---|
1430 | + zdqrain(1:ngrid,1:nlayer,igcm_h2o_vap) |
---|
1431 | pdq(1:ngrid,1:nlayer,igcm_h2o_ice) = pdq(1:ngrid,1:nlayer,igcm_h2o_ice) & |
---|
1432 | + zdqrain(1:ngrid,1:nlayer,igcm_h2o_ice) |
---|
1433 | pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+zdtrain(1:ngrid,1:nlayer) |
---|
1434 | |
---|
1435 | dqsurf(1:ngrid,igcm_h2o_vap) = dqsurf(1:ngrid,igcm_h2o_vap)+zdqsrain(1:ngrid) |
---|
1436 | dqsurf(1:ngrid,igcm_h2o_ice) = dqsurf(1:ngrid,igcm_h2o_ice)+zdqssnow(1:ngrid) |
---|
1437 | |
---|
1438 | ! Test energy conservation. |
---|
1439 | if(enertest)then |
---|
1440 | |
---|
1441 | call planetwide_sumval(cpp*massarea(:,:)*zdtrain(:,:)/totarea_planet,dEtot) |
---|
1442 | if (is_master) print*,'In rain atmospheric T energy change =',dEtot,' W m-2' |
---|
1443 | call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_ice)/totarea_planet*RLVTT/cpp,dItot_tmp) |
---|
1444 | call planetwide_sumval(cell_area(:)*zdqssnow(:)/totarea_planet*RLVTT/cpp,dItot) |
---|
1445 | dItot = dItot + dItot_tmp |
---|
1446 | call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dVtot_tmp) |
---|
1447 | call planetwide_sumval(cell_area(:)*zdqsrain(:)/totarea_planet*RLVTT/cpp,dVtot) |
---|
1448 | dVtot = dVtot + dVtot_tmp |
---|
1449 | dEtot = dItot + dVtot |
---|
1450 | |
---|
1451 | if (is_master) then |
---|
1452 | print*,'In rain dItot =',dItot,' W m-2' |
---|
1453 | print*,'In rain dVtot =',dVtot,' W m-2' |
---|
1454 | print*,'In rain atmospheric L energy change =',dEtot,' W m-2' |
---|
1455 | endif |
---|
1456 | |
---|
1457 | ! Test water conservation |
---|
1458 | call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap)*ptimestep/totarea_planet+ & |
---|
1459 | massarea(:,:)*zdqrain(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) |
---|
1460 | call planetwide_sumval((zdqsrain(:)+zdqssnow(:))*cell_area(:)*ptimestep/totarea_planet,dWtots) |
---|
1461 | |
---|
1462 | if (is_master) then |
---|
1463 | print*,'In rain atmospheric water change =',dWtot,' kg m-2' |
---|
1464 | print*,'In rain surface water change =',dWtots,' kg m-2' |
---|
1465 | print*,'In rain non-cons factor =',dWtot+dWtots,' kg m-2' |
---|
1466 | endif |
---|
1467 | |
---|
1468 | endif ! end of 'enertest' |
---|
1469 | |
---|
1470 | end if ! enf of 'waterrain' |
---|
1471 | |
---|
1472 | end if ! end of 'water' |
---|
1473 | |
---|
1474 | ! ------------------------- |
---|
1475 | ! VI.2. Photochemistry |
---|
1476 | ! ------------------------- |
---|
1477 | |
---|
1478 | #ifndef MESOSCALE |
---|
1479 | IF (photochem) then |
---|
1480 | |
---|
1481 | DO ig=1,ngrid |
---|
1482 | array_zero1(ig)=0.0 |
---|
1483 | DO l=1,nlayer |
---|
1484 | array_zero2(ig,l)=0. |
---|
1485 | ENDDO |
---|
1486 | ENDDO |
---|
1487 | |
---|
1488 | call calchim_asis(ngrid,nlayer,nq, & |
---|
1489 | ptimestep,pplay,pplev,pt,pdt,dist_star,mu0, & |
---|
1490 | fract,zzlev,zzlay,zday,pq,pdq,zdqchim,zdqschim, & |
---|
1491 | array_zero1,array_zero1, & |
---|
1492 | pu,pdu,pv,pdv,array_zero2,array_zero2) |
---|
1493 | |
---|
1494 | ! increment values of tracers: |
---|
1495 | DO iq=1,nq ! loop on all tracers; tendencies for non-chemistry |
---|
1496 | ! tracers is zero anyways |
---|
1497 | DO l=1,nlayer |
---|
1498 | DO ig=1,ngrid |
---|
1499 | pdq(ig,l,iq)=pdq(ig,l,iq)+zdqchim(ig,l,iq) |
---|
1500 | ENDDO |
---|
1501 | ENDDO |
---|
1502 | ENDDO ! of DO iq=1,nq |
---|
1503 | |
---|
1504 | |
---|
1505 | ! increment surface values of tracers: |
---|
1506 | DO iq=1,nq ! loop on all tracers; tendencies for non-chemistry |
---|
1507 | ! tracers is zero anyways |
---|
1508 | DO ig=1,ngrid |
---|
1509 | ! dqsurf(ig,iq)=dqsurf(ig,iq)+zdqschim(ig,iq) |
---|
1510 | ENDDO |
---|
1511 | ENDDO ! of DO iq=1,nq |
---|
1512 | |
---|
1513 | END IF ! of IF (photochem) |
---|
1514 | #endif |
---|
1515 | |
---|
1516 | |
---|
1517 | ! ------------------------- |
---|
1518 | ! VI.3. Aerosol particles |
---|
1519 | ! ------------------------- |
---|
1520 | |
---|
1521 | ! Sedimentation. |
---|
1522 | if (sedimentation) then |
---|
1523 | |
---|
1524 | zdqsed(1:ngrid,1:nlayer,1:nq) = 0.0 |
---|
1525 | zdqssed(1:ngrid,1:nq) = 0.0 |
---|
1526 | |
---|
1527 | if(watertest)then |
---|
1528 | |
---|
1529 | iq=igcm_h2o_ice |
---|
1530 | call planetwide_sumval(massarea(:,:)*pq(:,:,iq)*ptimestep/totarea_planet,dWtot) |
---|
1531 | call planetwide_sumval(massarea(:,:)*pdq(:,:,iq)*ptimestep/totarea_planet,dWtots) |
---|
1532 | if (is_master) then |
---|
1533 | print*,'Before sedim pq =',dWtot,' kg m-2' |
---|
1534 | print*,'Before sedim pdq =',dWtots,' kg m-2' |
---|
1535 | endif |
---|
1536 | endif |
---|
1537 | |
---|
1538 | call callsedim(ngrid,nlayer,ptimestep, & |
---|
1539 | pplev,zzlev,pt,pdt,pq,pdq, & |
---|
1540 | zdqsed,zdqssed,nq) |
---|
1541 | |
---|
1542 | if(watertest)then |
---|
1543 | iq=igcm_h2o_ice |
---|
1544 | call planetwide_sumval(massarea(:,:)*pq(:,:,iq)*ptimestep/totarea_planet,dWtot) |
---|
1545 | call planetwide_sumval(massarea(:,:)*pdq(:,:,iq)*ptimestep/totarea_planet,dWtots) |
---|
1546 | if (is_master) then |
---|
1547 | print*,'After sedim pq =',dWtot,' kg m-2' |
---|
1548 | print*,'After sedim pdq =',dWtots,' kg m-2' |
---|
1549 | endif |
---|
1550 | endif |
---|
1551 | |
---|
1552 | ! Whether it falls as rain or snow depends only on the surface temperature |
---|
1553 | pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + zdqsed(1:ngrid,1:nlayer,1:nq) |
---|
1554 | dqsurf(1:ngrid,1:nq) = dqsurf(1:ngrid,1:nq) + zdqssed(1:ngrid,1:nq) |
---|
1555 | |
---|
1556 | ! Test water conservation |
---|
1557 | if(watertest)then |
---|
1558 | call planetwide_sumval(massarea(:,:)*(zdqsed(:,:,igcm_h2o_vap)+zdqsed(:,:,igcm_h2o_ice))*ptimestep/totarea_planet,dWtot) |
---|
1559 | call planetwide_sumval((zdqssed(:,igcm_h2o_vap)+zdqssed(:,igcm_h2o_ice))*cell_area(:)*ptimestep/totarea_planet,dWtots) |
---|
1560 | if (is_master) then |
---|
1561 | print*,'In sedim atmospheric ice change =',dWtot,' kg m-2' |
---|
1562 | print*,'In sedim surface ice change =',dWtots,' kg m-2' |
---|
1563 | print*,'In sedim non-cons factor =',dWtot+dWtots,' kg m-2' |
---|
1564 | endif |
---|
1565 | endif |
---|
1566 | |
---|
1567 | end if ! end of 'sedimentation' |
---|
1568 | |
---|
1569 | |
---|
1570 | ! --------------- |
---|
1571 | ! VI.4. Updates |
---|
1572 | ! --------------- |
---|
1573 | |
---|
1574 | ! Updating Atmospheric Mass and Tracers budgets. |
---|
1575 | if(mass_redistrib) then |
---|
1576 | |
---|
1577 | zdmassmr(1:ngrid,1:nlayer) = mass(1:ngrid,1:nlayer) * & |
---|
1578 | ( zdqevap(1:ngrid,1:nlayer) & |
---|
1579 | + zdqrain(1:ngrid,1:nlayer,igcm_h2o_vap) & |
---|
1580 | + dqmoist(1:ngrid,1:nlayer,igcm_h2o_vap) & |
---|
1581 | + dqvaplscale(1:ngrid,1:nlayer) ) |
---|
1582 | |
---|
1583 | do ig = 1, ngrid |
---|
1584 | zdmassmr_col(ig)=SUM(zdmassmr(ig,1:nlayer)) |
---|
1585 | enddo |
---|
1586 | |
---|
1587 | call writediagfi(ngrid,"mass_evap","mass gain"," ",3,zdmassmr) |
---|
1588 | call writediagfi(ngrid,"mass_evap_col","mass gain col"," ",2,zdmassmr_col) |
---|
1589 | call writediagfi(ngrid,"mass","mass","kg/m2",3,mass) |
---|
1590 | |
---|
1591 | call mass_redistribution(ngrid,nlayer,nq,ptimestep, & |
---|
1592 | rnat,capcal,pplay,pplev,pt,tsurf,pq,qsurf, & |
---|
1593 | pu,pv,pdt,zdtsurf,pdq,pdu,pdv,zdmassmr, & |
---|
1594 | zdtmr,zdtsurfmr,zdpsrfmr,zdumr,zdvmr,zdqmr,zdqsurfmr) |
---|
1595 | |
---|
1596 | pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + zdqmr(1:ngrid,1:nlayer,1:nq) |
---|
1597 | dqsurf(1:ngrid,1:nq) = dqsurf(1:ngrid,1:nq) + zdqsurfmr(1:ngrid,1:nq) |
---|
1598 | pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer) + zdtmr(1:ngrid,1:nlayer) |
---|
1599 | pdu(1:ngrid,1:nlayer) = pdu(1:ngrid,1:nlayer) + zdumr(1:ngrid,1:nlayer) |
---|
1600 | pdv(1:ngrid,1:nlayer) = pdv(1:ngrid,1:nlayer) + zdvmr(1:ngrid,1:nlayer) |
---|
1601 | pdpsrf(1:ngrid) = pdpsrf(1:ngrid) + zdpsrfmr(1:ngrid) |
---|
1602 | zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurfmr(1:ngrid) |
---|
1603 | |
---|
1604 | endif |
---|
1605 | |
---|
1606 | ! ------------------ |
---|
1607 | ! VI.5. Slab Ocean |
---|
1608 | ! ------------------ |
---|
1609 | |
---|
1610 | if (ok_slab_ocean)then |
---|
1611 | |
---|
1612 | do ig=1,ngrid |
---|
1613 | qsurfint(:,igcm_h2o_ice)=qsurf(:,igcm_h2o_ice) |
---|
1614 | enddo |
---|
1615 | |
---|
1616 | call ocean_slab_ice(ptimestep, & |
---|
1617 | ngrid, knindex, tsea_ice, fluxrad, & |
---|
1618 | zdqssnow, qsurf(:,igcm_h2o_ice), & |
---|
1619 | - zdqsdif(:,igcm_h2o_vap), & |
---|
1620 | flux_sens_lat,tsea_ice, pctsrf_sic, & |
---|
1621 | taux,tauy,icount) |
---|
1622 | |
---|
1623 | |
---|
1624 | call ocean_slab_get_vars(ngrid,tslab, & |
---|
1625 | sea_ice, flux_o, & |
---|
1626 | flux_g, dt_hdiff, & |
---|
1627 | dt_ekman) |
---|
1628 | |
---|
1629 | do ig=1,ngrid |
---|
1630 | if (nint(rnat(ig)).eq.1)then |
---|
1631 | tslab(ig,1) = 0. |
---|
1632 | tslab(ig,2) = 0. |
---|
1633 | tsea_ice(ig) = 0. |
---|
1634 | sea_ice(ig) = 0. |
---|
1635 | pctsrf_sic(ig) = 0. |
---|
1636 | qsurf(ig,igcm_h2o_ice) = qsurfint(ig,igcm_h2o_ice) |
---|
1637 | endif |
---|
1638 | enddo |
---|
1639 | |
---|
1640 | endif ! end of 'ok_slab_ocean' |
---|
1641 | |
---|
1642 | ! ----------------------------- |
---|
1643 | ! VI.6. Surface Tracer Update |
---|
1644 | ! ----------------------------- |
---|
1645 | |
---|
1646 | if(hydrology)then |
---|
1647 | |
---|
1648 | call hydrol(ngrid,nq,ptimestep,rnat,tsurf,qsurf,dqsurf,dqs_hyd, & |
---|
1649 | capcal,albedo,albedo_bareground, & |
---|
1650 | albedo_snow_SPECTV,albedo_co2_ice_SPECTV, & |
---|
1651 | mu0,zdtsurf,zdtsurf_hyd,hice,pctsrf_sic, & |
---|
1652 | sea_ice) |
---|
1653 | |
---|
1654 | zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurf_hyd(1:ngrid) |
---|
1655 | dqsurf(1:ngrid,1:nq) = dqsurf(1:ngrid,1:nq) + dqs_hyd(1:ngrid,1:nq) |
---|
1656 | |
---|
1657 | qsurf(1:ngrid,1:nq) = qsurf(1:ngrid,1:nq) + ptimestep*dqsurf(1:ngrid,1:nq) |
---|
1658 | |
---|
1659 | ! Test energy conservation |
---|
1660 | if(enertest)then |
---|
1661 | call planetwide_sumval(cell_area(:)*capcal(:)*zdtsurf_hyd(:)/totarea_planet,dEtots) |
---|
1662 | if (is_master) print*,'In hydrol surface energy change =',dEtots,' W m-2' |
---|
1663 | endif |
---|
1664 | |
---|
1665 | ! test water conservation |
---|
1666 | if(watertest)then |
---|
1667 | call planetwide_sumval(dqs_hyd(:,igcm_h2o_ice)*cell_area(:)*ptimestep/totarea_planet,dWtots) |
---|
1668 | if (is_master) print*,'In hydrol surface ice change =',dWtots,' kg m-2' |
---|
1669 | call planetwide_sumval(dqs_hyd(:,igcm_h2o_vap)*cell_area(:)*ptimestep/totarea_planet,dWtots) |
---|
1670 | if (is_master) then |
---|
1671 | print*,'In hydrol surface water change =',dWtots,' kg m-2' |
---|
1672 | print*,'---------------------------------------------------------------' |
---|
1673 | endif |
---|
1674 | endif |
---|
1675 | |
---|
1676 | else ! of if (hydrology) |
---|
1677 | |
---|
1678 | qsurf(1:ngrid,1:nq) = qsurf(1:ngrid,1:nq) + ptimestep*dqsurf(1:ngrid,1:nq) |
---|
1679 | |
---|
1680 | end if ! of if (hydrology) |
---|
1681 | |
---|
1682 | ! Add qsurf to qsurf_hist, which is what we save in diagfi.nc. At the same time, we set the water |
---|
1683 | ! content of ocean gridpoints back to zero, in order to avoid rounding errors in vdifc, rain. |
---|
1684 | qsurf_hist(:,:) = qsurf(:,:) |
---|
1685 | |
---|
1686 | if(ice_update)then |
---|
1687 | ice_min(1:ngrid)=min(ice_min(1:ngrid),qsurf(1:ngrid,igcm_h2o_ice)) |
---|
1688 | endif |
---|
1689 | |
---|
1690 | endif! end of if 'tracer' |
---|
1691 | |
---|
1692 | |
---|
1693 | !------------------------------------------------ |
---|
1694 | ! VII. Surface and sub-surface soil temperature |
---|
1695 | !------------------------------------------------ |
---|
1696 | |
---|
1697 | |
---|
1698 | ! Increment surface temperature |
---|
1699 | if(ok_slab_ocean)then |
---|
1700 | do ig=1,ngrid |
---|
1701 | if (nint(rnat(ig)).eq.0)then |
---|
1702 | zdtsurf(ig)= (tslab(ig,1) & |
---|
1703 | + pctsrf_sic(ig)*(tsea_ice(ig)-tslab(ig,1))-tsurf(ig))/ptimestep |
---|
1704 | endif |
---|
1705 | tsurf(ig)=tsurf(ig)+ptimestep*zdtsurf(ig) |
---|
1706 | enddo |
---|
1707 | |
---|
1708 | else |
---|
1709 | tsurf(1:ngrid)=tsurf(1:ngrid)+ptimestep*zdtsurf(1:ngrid) |
---|
1710 | endif ! end of 'ok_slab_ocean' |
---|
1711 | |
---|
1712 | |
---|
1713 | ! Compute soil temperatures and subsurface heat flux. |
---|
1714 | if (callsoil) then |
---|
1715 | call soil(ngrid,nsoilmx,.false.,lastcall,inertiedat, & |
---|
1716 | ptimestep,tsurf,tsoil,capcal,fluxgrd) |
---|
1717 | endif |
---|
1718 | |
---|
1719 | |
---|
1720 | if (ok_slab_ocean) then |
---|
1721 | |
---|
1722 | do ig=1,ngrid |
---|
1723 | |
---|
1724 | fluxgrdocean(ig)=fluxgrd(ig) |
---|
1725 | if (nint(rnat(ig)).eq.0) then |
---|
1726 | capcal(ig)=capcalocean |
---|
1727 | fluxgrd(ig)=0. |
---|
1728 | fluxgrdocean(ig)=pctsrf_sic(ig)*flux_g(ig)+(1-pctsrf_sic(ig))*(dt_hdiff(ig,1)+dt_ekman(ig,1)) |
---|
1729 | do iq=1,nsoilmx |
---|
1730 | tsoil(ig,iq)=tsurf(ig) |
---|
1731 | enddo |
---|
1732 | if (pctsrf_sic(ig).gt.0.5) then |
---|
1733 | capcal(ig)=capcalseaice |
---|
1734 | if (qsurf(ig,igcm_h2o_ice).gt.0.) then |
---|
1735 | capcal(ig)=capcalsno |
---|
1736 | endif |
---|
1737 | endif |
---|
1738 | endif |
---|
1739 | |
---|
1740 | enddo |
---|
1741 | |
---|
1742 | endif !end of 'ok_slab_ocean' |
---|
1743 | |
---|
1744 | |
---|
1745 | ! Test energy conservation |
---|
1746 | if(enertest)then |
---|
1747 | call planetwide_sumval(cell_area(:)*capcal(:)*zdtsurf(:)/totarea_planet,dEtots) |
---|
1748 | if (is_master) print*,'Surface energy change =',dEtots,' W m-2' |
---|
1749 | endif |
---|
1750 | |
---|
1751 | |
---|
1752 | !--------------------------------------------------- |
---|
1753 | ! VIII. Perform diagnostics and write output files |
---|
1754 | !--------------------------------------------------- |
---|
1755 | |
---|
1756 | ! Note : For output only: the actual model integration is performed in the dynamics. |
---|
1757 | |
---|
1758 | |
---|
1759 | |
---|
1760 | ! Temperature, zonal and meridional winds. |
---|
1761 | zt(1:ngrid,1:nlayer) = pt(1:ngrid,1:nlayer) + pdt(1:ngrid,1:nlayer)*ptimestep |
---|
1762 | zu(1:ngrid,1:nlayer) = pu(1:ngrid,1:nlayer) + pdu(1:ngrid,1:nlayer)*ptimestep |
---|
1763 | zv(1:ngrid,1:nlayer) = pv(1:ngrid,1:nlayer) + pdv(1:ngrid,1:nlayer)*ptimestep |
---|
1764 | |
---|
1765 | ! Diagnostic. |
---|
1766 | zdtdyn(1:ngrid,1:nlayer) = (pt(1:ngrid,1:nlayer)-ztprevious(1:ngrid,1:nlayer)) / ptimestep |
---|
1767 | ztprevious(1:ngrid,1:nlayer) = zt(1:ngrid,1:nlayer) |
---|
1768 | |
---|
1769 | zdudyn(1:ngrid,1:nlayer) = (pu(1:ngrid,1:nlayer)-zuprevious(1:ngrid,1:nlayer)) / ptimestep |
---|
1770 | zuprevious(1:ngrid,1:nlayer) = zu(1:ngrid,1:nlayer) |
---|
1771 | |
---|
1772 | if(firstcall)then |
---|
1773 | zdtdyn(1:ngrid,1:nlayer)=0.0 |
---|
1774 | zdudyn(1:ngrid,1:nlayer)=0.0 |
---|
1775 | endif |
---|
1776 | |
---|
1777 | ! Dynamical heating diagnostic. |
---|
1778 | do ig=1,ngrid |
---|
1779 | fluxdyn(ig)= SUM(zdtdyn(ig,:) *mass(ig,:))*cpp |
---|
1780 | enddo |
---|
1781 | |
---|
1782 | ! Tracers. |
---|
1783 | zq(1:ngrid,1:nlayer,1:nq) = pq(1:ngrid,1:nlayer,1:nq) + pdq(1:ngrid,1:nlayer,1:nq)*ptimestep |
---|
1784 | |
---|
1785 | ! Surface pressure. |
---|
1786 | ps(1:ngrid) = pplev(1:ngrid,1) + pdpsrf(1:ngrid)*ptimestep |
---|
1787 | |
---|
1788 | |
---|
1789 | |
---|
1790 | ! Surface and soil temperature information |
---|
1791 | call planetwide_sumval(cell_area(:)*tsurf(:)/totarea_planet,Ts1) |
---|
1792 | call planetwide_minval(tsurf(:),Ts2) |
---|
1793 | call planetwide_maxval(tsurf(:),Ts3) |
---|
1794 | if(callsoil)then |
---|
1795 | TsS = SUM(cell_area(:)*tsoil(:,nsoilmx))/totarea ! mean temperature at bottom soil layer |
---|
1796 | if (is_master) then |
---|
1797 | print*,' ave[Tsurf] min[Tsurf] max[Tsurf] ave[Tdeep]' |
---|
1798 | print*,Ts1,Ts2,Ts3,TsS |
---|
1799 | end if |
---|
1800 | else |
---|
1801 | if (is_master) then |
---|
1802 | print*,' ave[Tsurf] min[Tsurf] max[Tsurf]' |
---|
1803 | print*,Ts1,Ts2,Ts3 |
---|
1804 | endif |
---|
1805 | end if |
---|
1806 | |
---|
1807 | |
---|
1808 | ! Check the energy balance of the simulation during the run |
---|
1809 | if(corrk)then |
---|
1810 | |
---|
1811 | call planetwide_sumval(cell_area(:)*fluxtop_dn(:)/totarea_planet,ISR) |
---|
1812 | call planetwide_sumval(cell_area(:)*fluxabs_sw(:)/totarea_planet,ASR) |
---|
1813 | call planetwide_sumval(cell_area(:)*fluxtop_lw(:)/totarea_planet,OLR) |
---|
1814 | call planetwide_sumval(cell_area(:)*fluxgrd(:)/totarea_planet,GND) |
---|
1815 | call planetwide_sumval(cell_area(:)*fluxdyn(:)/totarea_planet,DYN) |
---|
1816 | do ig=1,ngrid |
---|
1817 | if(fluxtop_dn(ig).lt.0.0)then |
---|
1818 | print*,'fluxtop_dn has gone crazy' |
---|
1819 | print*,'fluxtop_dn=',fluxtop_dn(ig) |
---|
1820 | print*,'tau_col=',tau_col(ig) |
---|
1821 | print*,'aerosol=',aerosol(ig,:,:) |
---|
1822 | print*,'temp= ',pt(ig,:) |
---|
1823 | print*,'pplay= ',pplay(ig,:) |
---|
1824 | call abort |
---|
1825 | endif |
---|
1826 | end do |
---|
1827 | |
---|
1828 | if(ngrid.eq.1)then |
---|
1829 | DYN=0.0 |
---|
1830 | endif |
---|
1831 | |
---|
1832 | if (is_master) then |
---|
1833 | print*,' ISR ASR OLR GND DYN [W m^-2]' |
---|
1834 | print*, ISR,ASR,OLR,GND,DYN |
---|
1835 | endif |
---|
1836 | |
---|
1837 | if(enertest .and. is_master)then |
---|
1838 | print*,'SW flux/heating difference SW++ - ASR = ',dEtotSW+dEtotsSW-ASR,' W m-2' |
---|
1839 | print*,'LW flux/heating difference LW++ - OLR = ',dEtotLW+dEtotsLW+OLR,' W m-2' |
---|
1840 | print*,'LW energy balance LW++ + ASR = ',dEtotLW+dEtotsLW+ASR,' W m-2' |
---|
1841 | endif |
---|
1842 | |
---|
1843 | if(meanOLR .and. is_master)then |
---|
1844 | if((ngrid.gt.1) .or. (mod(icount-1,ecritphy).eq.0))then |
---|
1845 | ! to record global radiative balance |
---|
1846 | open(92,file="rad_bal.out",form='formatted',position='append') |
---|
1847 | write(92,*) zday,ISR,ASR,OLR |
---|
1848 | close(92) |
---|
1849 | open(93,file="tem_bal.out",form='formatted',position='append') |
---|
1850 | if(callsoil)then |
---|
1851 | write(93,*) zday,Ts1,Ts2,Ts3,TsS |
---|
1852 | else |
---|
1853 | write(93,*) zday,Ts1,Ts2,Ts3 |
---|
1854 | endif |
---|
1855 | close(93) |
---|
1856 | endif |
---|
1857 | endif |
---|
1858 | |
---|
1859 | endif ! end of 'corrk' |
---|
1860 | |
---|
1861 | |
---|
1862 | ! Diagnostic to test radiative-convective timescales in code. |
---|
1863 | if(testradtimes)then |
---|
1864 | open(38,file="tau_phys.out",form='formatted',position='append') |
---|
1865 | ig=1 |
---|
1866 | do l=1,nlayer |
---|
1867 | write(38,*) -1./pdt(ig,l),pt(ig,l),pplay(ig,l) |
---|
1868 | enddo |
---|
1869 | close(38) |
---|
1870 | print*,'As testradtimes enabled,' |
---|
1871 | print*,'exiting physics on first call' |
---|
1872 | call abort |
---|
1873 | endif |
---|
1874 | |
---|
1875 | |
---|
1876 | ! Compute column amounts (kg m-2) if tracers are enabled. |
---|
1877 | if(tracer)then |
---|
1878 | qcol(1:ngrid,1:nq)=0.0 |
---|
1879 | do iq=1,nq |
---|
1880 | do ig=1,ngrid |
---|
1881 | qcol(ig,iq) = SUM( zq(ig,1:nlayer,iq) * mass(ig,1:nlayer)) |
---|
1882 | enddo |
---|
1883 | enddo |
---|
1884 | |
---|
1885 | ! Generalised for arbitrary aerosols now. By LK |
---|
1886 | reffcol(1:ngrid,1:naerkind)=0.0 |
---|
1887 | if(co2cond.and.(iaero_co2.ne.0))then |
---|
1888 | call co2_reffrad(ngrid,nlayer,nq,zq,reffrad(1,1,iaero_co2)) |
---|
1889 | do ig=1,ngrid |
---|
1890 | reffcol(ig,iaero_co2) = SUM(zq(ig,1:nlayer,igcm_co2_ice)*reffrad(ig,1:nlayer,iaero_co2)*mass(ig,1:nlayer)) |
---|
1891 | enddo |
---|
1892 | endif |
---|
1893 | if(water.and.(iaero_h2o.ne.0))then |
---|
1894 | call h2o_reffrad(ngrid,nlayer,zq(1,1,igcm_h2o_ice),zt, & |
---|
1895 | reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o)) |
---|
1896 | do ig=1,ngrid |
---|
1897 | reffcol(ig,iaero_h2o) = SUM(zq(ig,1:nlayer,igcm_h2o_ice)*reffrad(ig,1:nlayer,iaero_h2o)*mass(ig,1:nlayer)) |
---|
1898 | enddo |
---|
1899 | endif |
---|
1900 | |
---|
1901 | endif ! end of 'tracer' |
---|
1902 | |
---|
1903 | |
---|
1904 | ! Test for water conservation. |
---|
1905 | if(water)then |
---|
1906 | |
---|
1907 | call planetwide_sumval(cell_area(:)*qsurf_hist(:,igcm_h2o_ice)/totarea_planet,icesrf) |
---|
1908 | call planetwide_sumval(cell_area(:)*qsurf_hist(:,igcm_h2o_vap)/totarea_planet,liqsrf) |
---|
1909 | call planetwide_sumval(cell_area(:)*qcol(:,igcm_h2o_ice)/totarea_planet,icecol) |
---|
1910 | call planetwide_sumval(cell_area(:)*qcol(:,igcm_h2o_vap)/totarea_planet,vapcol) |
---|
1911 | |
---|
1912 | h2otot = icesrf + liqsrf + icecol + vapcol |
---|
1913 | |
---|
1914 | if (is_master) then |
---|
1915 | print*,' Total water amount [kg m^-2]: ',h2otot |
---|
1916 | print*,' Surface ice Surface liq. Atmos. con. Atmos. vap. [kg m^-2] ' |
---|
1917 | print*, icesrf,liqsrf,icecol,vapcol |
---|
1918 | endif |
---|
1919 | |
---|
1920 | if(meanOLR .and. is_master)then |
---|
1921 | if((ngrid.gt.1) .or. (mod(icount-1,ecritphy).eq.0))then |
---|
1922 | ! to record global water balance |
---|
1923 | open(98,file="h2o_bal.out",form='formatted',position='append') |
---|
1924 | write(98,*) zday,icesrf,liqsrf,icecol,vapcol |
---|
1925 | close(98) |
---|
1926 | endif |
---|
1927 | endif |
---|
1928 | |
---|
1929 | endif |
---|
1930 | |
---|
1931 | |
---|
1932 | ! Calculate RH (Relative Humidity) for diagnostic. |
---|
1933 | if(water)then |
---|
1934 | |
---|
1935 | do l = 1, nlayer |
---|
1936 | do ig=1,ngrid |
---|
1937 | call Psat_water(zt(ig,l),pplay(ig,l),psat_tmp,qsat(ig,l)) |
---|
1938 | RH(ig,l) = zq(ig,l,igcm_h2o_vap) / qsat(ig,l) |
---|
1939 | enddo |
---|
1940 | enddo |
---|
1941 | |
---|
1942 | ! Compute maximum possible H2O column amount (100% saturation). |
---|
1943 | do ig=1,ngrid |
---|
1944 | H2Omaxcol(ig) = SUM( qsat(ig,:) * mass(ig,:)) |
---|
1945 | enddo |
---|
1946 | |
---|
1947 | endif ! end of 'water' |
---|
1948 | |
---|
1949 | |
---|
1950 | if (is_master) print*,'--> Ls =',zls*180./pi |
---|
1951 | |
---|
1952 | |
---|
1953 | !---------------------------------------------------------------------- |
---|
1954 | ! Writing NetCDF file "RESTARTFI" at the end of the run |
---|
1955 | !---------------------------------------------------------------------- |
---|
1956 | |
---|
1957 | ! Note: 'restartfi' is stored just before dynamics are stored |
---|
1958 | ! in 'restart'. Between now and the writting of 'restart', |
---|
1959 | ! there will have been the itau=itau+1 instruction and |
---|
1960 | ! a reset of 'time' (lastacll = .true. when itau+1= itaufin) |
---|
1961 | ! thus we store for time=time+dtvr |
---|
1962 | |
---|
1963 | |
---|
1964 | |
---|
1965 | if(lastcall) then |
---|
1966 | ztime_fin = ptime + ptimestep/(float(iphysiq)*daysec) |
---|
1967 | |
---|
1968 | ! Update surface ice distribution to iterate to steady state if requested |
---|
1969 | if(ice_update)then |
---|
1970 | |
---|
1971 | do ig=1,ngrid |
---|
1972 | |
---|
1973 | delta_ice = (qsurf(ig,igcm_h2o_ice)-ice_initial(ig)) |
---|
1974 | |
---|
1975 | ! add multiple years of evolution |
---|
1976 | qsurf_hist(ig,igcm_h2o_ice) = qsurf_hist(ig,igcm_h2o_ice) + delta_ice*icetstep |
---|
1977 | |
---|
1978 | ! if ice has gone -ve, set to zero |
---|
1979 | if(qsurf_hist(ig,igcm_h2o_ice).lt.0.0)then |
---|
1980 | qsurf_hist(ig,igcm_h2o_ice) = 0.0 |
---|
1981 | endif |
---|
1982 | |
---|
1983 | ! if ice is seasonal, set to zero (NEW) |
---|
1984 | if(ice_min(ig).lt.0.01)then |
---|
1985 | qsurf_hist(ig,igcm_h2o_ice) = 0.0 |
---|
1986 | endif |
---|
1987 | |
---|
1988 | enddo |
---|
1989 | |
---|
1990 | ! enforce ice conservation |
---|
1991 | ice_tot= SUM(qsurf_hist(:,igcm_h2o_ice)*cell_area(:) )/SUM(cell_area(:)) |
---|
1992 | qsurf_hist(:,igcm_h2o_ice) = qsurf_hist(:,igcm_h2o_ice)*(icesrf/ice_tot) |
---|
1993 | |
---|
1994 | endif |
---|
1995 | #ifndef MESOSCALE |
---|
1996 | |
---|
1997 | if (ngrid.ne.1) then |
---|
1998 | write(*,*)'PHYSIQ: for physdem ztime_fin =',ztime_fin |
---|
1999 | |
---|
2000 | call physdem1("restartfi.nc",nsoilmx,ngrid,nlayer,nq, & |
---|
2001 | ptimestep,ztime_fin, & |
---|
2002 | tsurf,tsoil,emis,q2,qsurf_hist, & |
---|
2003 | cloudfrac,totcloudfrac,hice, & |
---|
2004 | rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) |
---|
2005 | endif |
---|
2006 | #endif |
---|
2007 | if(ok_slab_ocean) then |
---|
2008 | call ocean_slab_final!(tslab, seaice) |
---|
2009 | end if |
---|
2010 | |
---|
2011 | endif ! end of 'lastcall' |
---|
2012 | |
---|
2013 | |
---|
2014 | !----------------------------------- |
---|
2015 | ! Saving statistics : |
---|
2016 | !----------------------------------- |
---|
2017 | |
---|
2018 | ! Note :("stats" stores and accumulates 8 key variables in file "stats.nc" |
---|
2019 | ! which can later be used to make the statistic files of the run: |
---|
2020 | ! "stats") only possible in 3D runs !!! |
---|
2021 | |
---|
2022 | |
---|
2023 | if (callstats) then |
---|
2024 | |
---|
2025 | call wstats(ngrid,"ps","Surface pressure","Pa",2,ps) |
---|
2026 | call wstats(ngrid,"tsurf","Surface temperature","K",2,tsurf) |
---|
2027 | call wstats(ngrid,"fluxsurf_lw", & |
---|
2028 | "Thermal IR radiative flux to surface","W.m-2",2, & |
---|
2029 | fluxsurf_lw) |
---|
2030 | call wstats(ngrid,"fluxtop_lw", & |
---|
2031 | "Thermal IR radiative flux to space","W.m-2",2, & |
---|
2032 | fluxtop_lw) |
---|
2033 | |
---|
2034 | ! call wstats(ngrid,"fluxsurf_sw", & |
---|
2035 | ! "Solar radiative flux to surface","W.m-2",2, & |
---|
2036 | ! fluxsurf_sw_tot) |
---|
2037 | ! call wstats(ngrid,"fluxtop_sw", & |
---|
2038 | ! "Solar radiative flux to space","W.m-2",2, & |
---|
2039 | ! fluxtop_sw_tot) |
---|
2040 | |
---|
2041 | |
---|
2042 | call wstats(ngrid,"ISR","incoming stellar rad.","W m-2",2,fluxtop_dn) |
---|
2043 | call wstats(ngrid,"ASR","absorbed stellar rad.","W m-2",2,fluxabs_sw) |
---|
2044 | call wstats(ngrid,"OLR","outgoing longwave rad.","W m-2",2,fluxtop_lw) |
---|
2045 | !call wstats(ngrid,"ALB","Surface albedo"," ",2,albedo_equivalent) |
---|
2046 | !call wstats(ngrid,"ALB_1st","First Band Surface albedo"," ",2,albedo(:,1)) |
---|
2047 | call wstats(ngrid,"p","Pressure","Pa",3,pplay) |
---|
2048 | call wstats(ngrid,"temp","Atmospheric temperature","K",3,zt) |
---|
2049 | call wstats(ngrid,"u","Zonal (East-West) wind","m.s-1",3,zu) |
---|
2050 | call wstats(ngrid,"v","Meridional (North-South) wind","m.s-1",3,zv) |
---|
2051 | call wstats(ngrid,"w","Vertical (down-up) wind","m.s-1",3,pw) |
---|
2052 | call wstats(ngrid,"q2","Boundary layer eddy kinetic energy","m2.s-2",3,q2) |
---|
2053 | |
---|
2054 | if (tracer) then |
---|
2055 | do iq=1,nq |
---|
2056 | call wstats(ngrid,noms(iq),noms(iq),'kg/kg',3,zq(1,1,iq)) |
---|
2057 | call wstats(ngrid,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', & |
---|
2058 | 'kg m^-2',2,qsurf(1,iq) ) |
---|
2059 | call wstats(ngrid,trim(noms(iq))//'_col',trim(noms(iq))//'_col', & |
---|
2060 | 'kg m^-2',2,qcol(1,iq) ) |
---|
2061 | |
---|
2062 | ! call wstats(ngrid,trim(noms(iq))//'_reff', & |
---|
2063 | ! trim(noms(iq))//'_reff', & |
---|
2064 | ! 'm',3,reffrad(1,1,iq)) |
---|
2065 | |
---|
2066 | end do |
---|
2067 | |
---|
2068 | if (water) then |
---|
2069 | vmr=zq(1:ngrid,1:nlayer,igcm_h2o_vap)*mugaz/mmol(igcm_h2o_vap) |
---|
2070 | call wstats(ngrid,"vmr_h2ovapor", & |
---|
2071 | "H2O vapour volume mixing ratio","mol/mol", & |
---|
2072 | 3,vmr) |
---|
2073 | endif |
---|
2074 | |
---|
2075 | endif ! end of 'tracer' |
---|
2076 | |
---|
2077 | if(watercond.and.CLFvarying)then |
---|
2078 | call wstats(ngrid,"rneb_man","H2O cloud fraction (conv)"," ",3,rneb_man) |
---|
2079 | call wstats(ngrid,"rneb_lsc","H2O cloud fraction (large scale)"," ",3,rneb_lsc) |
---|
2080 | call wstats(ngrid,"CLF","H2O cloud fraction"," ",3,cloudfrac) |
---|
2081 | call wstats(ngrid,"CLFt","H2O column cloud fraction"," ",2,totcloudfrac) |
---|
2082 | call wstats(ngrid,"RH","relative humidity"," ",3,RH) |
---|
2083 | endif |
---|
2084 | |
---|
2085 | if (ok_slab_ocean) then |
---|
2086 | call wstats(ngrid,"dt_hdiff1","dt_hdiff1","K/s",2,dt_hdiff(:,1)) |
---|
2087 | call wstats(ngrid,"dt_hdiff2","dt_hdiff2","K/s",2,dt_hdiff(:,2)) |
---|
2088 | call wstats(ngrid,"dt_ekman1","dt_ekman1","K/s",2,dt_ekman(:,1)) |
---|
2089 | call wstats(ngrid,"dt_ekman2","dt_ekman2","K/s",2,dt_ekman(:,2)) |
---|
2090 | call wstats(ngrid,"tslab1","tslab1","K",2,tslab(:,1)) |
---|
2091 | call wstats(ngrid,"tslab2","tslab2","K",2,tslab(:,2)) |
---|
2092 | call wstats(ngrid,"pctsrf_sic","pct ice/sea","",2,pctsrf_sic) |
---|
2093 | call wstats(ngrid,"tsea_ice","tsea_ice","K",2,tsea_ice) |
---|
2094 | call wstats(ngrid,"sea_ice","sea ice","kg/m2",2,sea_ice) |
---|
2095 | call wstats(ngrid,"rnat","nature of the surface","",2,rnat) |
---|
2096 | endif |
---|
2097 | |
---|
2098 | if(lastcall) then |
---|
2099 | write (*,*) "Writing stats..." |
---|
2100 | call mkstats(ierr) |
---|
2101 | endif |
---|
2102 | |
---|
2103 | endif ! end of 'callstats' |
---|
2104 | |
---|
2105 | #ifndef MESOSCALE |
---|
2106 | |
---|
2107 | !----------------------------------------------------------------------------------------------------- |
---|
2108 | ! OUTPUT in netcdf file "DIAGFI.NC", containing any variable for diagnostic |
---|
2109 | ! |
---|
2110 | ! Note 1 : output with period "ecritphy", set in "run.def" |
---|
2111 | ! |
---|
2112 | ! Note 2 : writediagfi can also be called from any other subroutine for any variable, |
---|
2113 | ! but its preferable to keep all the calls in one place ... |
---|
2114 | !----------------------------------------------------------------------------------------------------- |
---|
2115 | |
---|
2116 | call writediagfi(ngrid,"Ls","solar longitude","deg",0,zls*180./pi) |
---|
2117 | call writediagfi(ngrid,"Lss","sub solar longitude","deg",0,zlss*180./pi) |
---|
2118 | call writediagfi(ngrid,"RA","right ascension","deg",0,right_ascen*180./pi) |
---|
2119 | call writediagfi(ngrid,"Declin","solar declination","deg",0,declin*180./pi) |
---|
2120 | call writediagfi(ngrid,"tsurf","Surface temperature","K",2,tsurf) |
---|
2121 | call writediagfi(ngrid,"ps","Surface pressure","Pa",2,ps) |
---|
2122 | call writediagfi(ngrid,"temp","temperature","K",3,zt) |
---|
2123 | call writediagfi(ngrid,"teta","potential temperature","K",3,zh) |
---|
2124 | call writediagfi(ngrid,"u","Zonal wind","m.s-1",3,zu) |
---|
2125 | call writediagfi(ngrid,"v","Meridional wind","m.s-1",3,zv) |
---|
2126 | call writediagfi(ngrid,"w","Vertical wind","m.s-1",3,pw) |
---|
2127 | call writediagfi(ngrid,"p","Pressure","Pa",3,pplay) |
---|
2128 | |
---|
2129 | ! Subsurface temperatures |
---|
2130 | ! call writediagsoil(ngrid,"tsurf","Surface temperature","K",2,tsurf) |
---|
2131 | ! call writediagsoil(ngrid,"temp","temperature","K",3,tsoil) |
---|
2132 | |
---|
2133 | ! Oceanic layers |
---|
2134 | if(ok_slab_ocean) then |
---|
2135 | call writediagfi(ngrid,"pctsrf_sic","pct ice/sea","",2,pctsrf_sic) |
---|
2136 | call writediagfi(ngrid,"tsea_ice","tsea_ice","K",2,tsea_ice) |
---|
2137 | call writediagfi(ngrid,"sea_ice","sea ice","kg/m2",2,sea_ice) |
---|
2138 | call writediagfi(ngrid,"tslab1","tslab1","K",2,tslab(:,1)) |
---|
2139 | call writediagfi(ngrid,"tslab2","tslab2","K",2,tslab(:,2)) |
---|
2140 | call writediagfi(ngrid,"dt_hdiff1","dt_hdiff1","K/s",2,dt_hdiff(:,1)) |
---|
2141 | call writediagfi(ngrid,"dt_hdiff2","dt_hdiff2","K/s",2,dt_hdiff(:,2)) |
---|
2142 | call writediagfi(ngrid,"dt_ekman1","dt_ekman1","K/s",2,dt_ekman(:,1)) |
---|
2143 | call writediagfi(ngrid,"dt_ekman2","dt_ekman2","K/s",2,dt_ekman(:,2)) |
---|
2144 | call writediagfi(ngrid,"rnat","nature of the surface","",2,rnat) |
---|
2145 | call writediagfi(ngrid,"sensibFlux","sensible heat flux","w.m^-2",2,sensibFlux) |
---|
2146 | call writediagfi(ngrid,"latentFlux","latent heat flux","w.m^-2",2,zdqsdif(:,igcm_h2o_vap)*RLVTT) |
---|
2147 | endif |
---|
2148 | |
---|
2149 | ! Thermal plume model |
---|
2150 | if (calltherm) then |
---|
2151 | call writediagfi(ngrid,'entr','Entrainment','kg m$^{-2}$ s$^{-1}$', 3, entr0) |
---|
2152 | call writediagfi(ngrid,'detr','Detrainment','kg m$^{-2}$ s$^{-1}$', 3, detr0) |
---|
2153 | call writediagfi(ngrid,'fm','Mass flux','kg m$^{-2}$ s$^{-1}$', 3, fm0) |
---|
2154 | call writediagfi(ngrid,'w_plm','Squared vertical velocity','m s$^{-1}$', 3, zw2) |
---|
2155 | call writediagfi(ngrid,'fraca','Updraft fraction','', 3, fraca) |
---|
2156 | ! call writediagfi(ngrid,'pmin', 'pmin', 'Pa', 2, pmin) |
---|
2157 | ! call writediagfi(ngrid,'pmax', 'pmax', 'Pa', 2, pmax) |
---|
2158 | endif |
---|
2159 | |
---|
2160 | ! Total energy balance diagnostics |
---|
2161 | if(callrad.and.(.not.newtonian))then |
---|
2162 | |
---|
2163 | !call writediagfi(ngrid,"ALB","Surface albedo"," ",2,albedo_equivalent) |
---|
2164 | !call writediagfi(ngrid,"ALB_1st","First Band Surface albedo"," ",2,albedo(:,1)) |
---|
2165 | call writediagfi(ngrid,"ISR","incoming stellar rad.","W m-2",2,fluxtop_dn) |
---|
2166 | call writediagfi(ngrid,"ASR","absorbed stellar rad.","W m-2",2,fluxabs_sw) |
---|
2167 | call writediagfi(ngrid,"OLR","outgoing longwave rad.","W m-2",2,fluxtop_lw) |
---|
2168 | call writediagfi(ngrid,"shad","rings"," ", 2, fract) |
---|
2169 | |
---|
2170 | ! call writediagfi(ngrid,"ASRcs","absorbed stellar rad (cs).","W m-2",2,fluxabs_sw1) |
---|
2171 | ! call writediagfi(ngrid,"OLRcs","outgoing longwave rad (cs).","W m-2",2,fluxtop_lw1) |
---|
2172 | ! call writediagfi(ngrid,"fluxsurfsw","sw surface flux.","W m-2",2,fluxsurf_sw) |
---|
2173 | ! call writediagfi(ngrid,"fluxsurflw","lw back radiation.","W m-2",2,fluxsurf_lw) |
---|
2174 | ! call writediagfi(ngrid,"fluxsurfswcs","sw surface flux (cs).","W m-2",2,fluxsurf_sw1) |
---|
2175 | ! call writediagfi(ngrid,"fluxsurflwcs","lw back radiation (cs).","W m-2",2,fluxsurf_lw1) |
---|
2176 | |
---|
2177 | if(ok_slab_ocean) then |
---|
2178 | call writediagfi(ngrid,"GND","heat flux from ground","W m-2",2,fluxgrdocean) |
---|
2179 | else |
---|
2180 | call writediagfi(ngrid,"GND","heat flux from ground","W m-2",2,fluxgrd) |
---|
2181 | endif |
---|
2182 | |
---|
2183 | call writediagfi(ngrid,"DYN","dynamical heat input","W m-2",2,fluxdyn) |
---|
2184 | |
---|
2185 | endif ! end of 'callrad' |
---|
2186 | |
---|
2187 | if(enertest) then |
---|
2188 | |
---|
2189 | if (calldifv) then |
---|
2190 | |
---|
2191 | call writediagfi(ngrid,"q2","turbulent kinetic energy","J.kg^-1",3,q2) |
---|
2192 | call writediagfi(ngrid,"sensibFlux","sensible heat flux","w.m^-2",2,sensibFlux) |
---|
2193 | |
---|
2194 | ! call writediagfi(ngrid,"dEzdiff","turbulent diffusion heating (-sensible flux)","w.m^-2",3,dEzdiff) |
---|
2195 | ! call writediagfi(ngrid,"dEdiff","integrated turbulent diffusion heating (-sensible flux)","w.m^-2",2,dEdiff) |
---|
2196 | ! call writediagfi(ngrid,"dEdiffs","In TurbDiff (correc rad+latent heat) surf nrj change","w.m^-2",2,dEdiffs) |
---|
2197 | |
---|
2198 | endif |
---|
2199 | |
---|
2200 | if (corrk) then |
---|
2201 | call writediagfi(ngrid,"dEzradsw","radiative heating","w.m^-2",3,dEzradsw) |
---|
2202 | call writediagfi(ngrid,"dEzradlw","radiative heating","w.m^-2",3,dEzradlw) |
---|
2203 | endif |
---|
2204 | |
---|
2205 | if(watercond) then |
---|
2206 | |
---|
2207 | call writediagfi(ngrid,"lscaledE","heat from largescale","W m-2",2,lscaledE) |
---|
2208 | call writediagfi(ngrid,"madjdE","heat from moistadj","W m-2",2,madjdE) |
---|
2209 | call writediagfi(ngrid,"qsatatm","atm qsat"," ",3,qsat) |
---|
2210 | |
---|
2211 | ! call writediagfi(ngrid,"lscaledEz","heat from largescale","W m-2",3,lscaledEz) |
---|
2212 | ! call writediagfi(ngrid,"madjdEz","heat from moistadj","W m-2",3,madjdEz) |
---|
2213 | ! call writediagfi(ngrid,"h2o_max_col","maximum H2O column amount","kg.m^-2",2,H2Omaxcol) |
---|
2214 | |
---|
2215 | endif |
---|
2216 | |
---|
2217 | endif ! end of 'enertest' |
---|
2218 | |
---|
2219 | |
---|
2220 | ! Temporary inclusions for heating diagnostics. |
---|
2221 | !call writediagfi(ngrid,"zdtsw","SW heating","T s-1",3,zdtsw) |
---|
2222 | !call writediagfi(ngrid,"zdtlw","LW heating","T s-1",3,zdtlw) |
---|
2223 | !call writediagfi(ngrid,"dtrad","radiative heating","K s-1",3,dtrad) |
---|
2224 | ! call writediagfi(ngrid,"zdtdyn","Dyn. heating","T s-1",3,zdtdyn) |
---|
2225 | |
---|
2226 | ! For Debugging. |
---|
2227 | !call writediagfi(ngrid,'rnat','Terrain type',' ',2,real(rnat)) |
---|
2228 | !call writediagfi(ngrid,'pphi','Geopotential',' ',3,pphi) |
---|
2229 | |
---|
2230 | |
---|
2231 | ! Output aerosols. |
---|
2232 | if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) & |
---|
2233 | call writediagfi(ngrid,'CO2ice_reff','CO2ice_reff','m',3,reffrad(1,1,iaero_co2)) |
---|
2234 | if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) & |
---|
2235 | call writediagfi(ngrid,'H2Oice_reff','H2Oice_reff','m',3,reffrad(:,:,iaero_h2o)) |
---|
2236 | if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) & |
---|
2237 | call writediagfi(ngrid,'CO2ice_reffcol','CO2ice_reffcol','um kg m^-2',2,reffcol(1,iaero_co2)) |
---|
2238 | if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) & |
---|
2239 | call writediagfi(ngrid,'H2Oice_reffcol','H2Oice_reffcol','um kg m^-2',2,reffcol(1,iaero_h2o)) |
---|
2240 | |
---|
2241 | ! Output tracers. |
---|
2242 | if (tracer) then |
---|
2243 | |
---|
2244 | do iq=1,nq |
---|
2245 | call writediagfi(ngrid,noms(iq),noms(iq),'kg/kg',3,zq(1,1,iq)) |
---|
2246 | call writediagfi(ngrid,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', & |
---|
2247 | 'kg m^-2',2,qsurf_hist(1,iq) ) |
---|
2248 | call writediagfi(ngrid,trim(noms(iq))//'_col',trim(noms(iq))//'_col', & |
---|
2249 | 'kg m^-2',2,qcol(1,iq) ) |
---|
2250 | |
---|
2251 | ! call writediagfi(ngrid,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', & |
---|
2252 | ! 'kg m^-2',2,qsurf(1,iq) ) |
---|
2253 | |
---|
2254 | if(watercond.or.CLFvarying)then |
---|
2255 | call writediagfi(ngrid,"rneb_man","H2O cloud fraction (conv)"," ",3,rneb_man) |
---|
2256 | call writediagfi(ngrid,"rneb_lsc","H2O cloud fraction (large scale)"," ",3,rneb_lsc) |
---|
2257 | call writediagfi(ngrid,"CLF","H2O cloud fraction"," ",3,cloudfrac) |
---|
2258 | call writediagfi(ngrid,"CLFt","H2O column cloud fraction"," ",2,totcloudfrac) |
---|
2259 | call writediagfi(ngrid,"RH","relative humidity"," ",3,RH) |
---|
2260 | endif |
---|
2261 | |
---|
2262 | if(waterrain)then |
---|
2263 | call writediagfi(ngrid,"rain","rainfall","kg m-2 s-1",2,zdqsrain) |
---|
2264 | call writediagfi(ngrid,"snow","snowfall","kg m-2 s-1",2,zdqssnow) |
---|
2265 | call writediagfi(ngrid,"reevap","reevaporation of precipitation","kg m-2 s-1",2,reevap_precip) |
---|
2266 | endif |
---|
2267 | |
---|
2268 | if((hydrology).and.(.not.ok_slab_ocean))then |
---|
2269 | call writediagfi(ngrid,"hice","oceanic ice height","m",2,hice) |
---|
2270 | endif |
---|
2271 | |
---|
2272 | if(ice_update)then |
---|
2273 | call writediagfi(ngrid,"ice_min","min annual ice","m",2,ice_min) |
---|
2274 | call writediagfi(ngrid,"ice_ini","initial annual ice","m",2,ice_initial) |
---|
2275 | endif |
---|
2276 | |
---|
2277 | do ig=1,ngrid |
---|
2278 | if(tau_col(ig).gt.1.e3)then |
---|
2279 | print*,'WARNING: tau_col=',tau_col(ig) |
---|
2280 | print*,'at ig=',ig,'in PHYSIQ' |
---|
2281 | endif |
---|
2282 | end do |
---|
2283 | |
---|
2284 | call writediagfi(ngrid,"tau_col","Total aerosol optical depth","[]",2,tau_col) |
---|
2285 | |
---|
2286 | enddo ! end of 'nq' loop |
---|
2287 | |
---|
2288 | endif ! end of 'tracer' |
---|
2289 | |
---|
2290 | |
---|
2291 | ! Output spectrum. |
---|
2292 | if(specOLR.and.corrk)then |
---|
2293 | call writediagspecIR(ngrid,"OLR3D","OLR(lon,lat,band)","W/m^2/cm^-1",3,OLR_nu) |
---|
2294 | call writediagspecVI(ngrid,"OSR3D","OSR(lon,lat,band)","W/m^2/cm^-1",3,OSR_nu) |
---|
2295 | endif |
---|
2296 | |
---|
2297 | #else |
---|
2298 | comm_HR_SW(1:ngrid,1:nlayer) = zdtsw(1:ngrid,1:nlayer) |
---|
2299 | comm_HR_LW(1:ngrid,1:nlayer) = zdtlw(1:ngrid,1:nlayer) |
---|
2300 | if ((tracer).and.(water)) then |
---|
2301 | comm_CLOUDFRAC(1:ngrid,1:nlayer)=cloudfrac(1:ngrid,1:nlayer) |
---|
2302 | comm_TOTCLOUDFRAC(1:ngrid)=totcloudfrac(1:ngrid) |
---|
2303 | comm_RAIN(1:ngrid,1:nlayer)=zdqrain(1:ngrid,1:nlayer,igcm_h2o_vap) |
---|
2304 | comm_SURFRAIN(1:ngrid)=zdqsrain(1:ngrid) |
---|
2305 | comm_SNOW(1:ngrid,1:nlayer)=zdqrain(1:ngrid,1:nlayer,igcm_h2o_ice) |
---|
2306 | comm_ALBEQ(1:ngrid)=albedo_equivalent(1:ngrid) |
---|
2307 | comm_H2OICE_REFF(1:ngrid,1:nlayer)=reffrad(1:ngrid,1:nlayer,iaero_h2o) |
---|
2308 | comm_REEVAP(1:ngrid)=reevap_precip(1:ngrid) |
---|
2309 | endif |
---|
2310 | comm_FLUXTOP_DN(1:ngrid)=fluxtop_dn(1:ngrid) |
---|
2311 | comm_FLUXABS_SW(1:ngrid)=fluxabs_sw(1:ngrid) |
---|
2312 | comm_FLUXTOP_LW(1:ngrid)=fluxtop_lw(1:ngrid) |
---|
2313 | comm_FLUXSURF_SW(1:ngrid)=fluxsurf_sw(1:ngrid) |
---|
2314 | comm_FLUXSURF_LW(1:ngrid)=fluxsurf_lw(1:ngrid) |
---|
2315 | comm_FLXGRD(1:ngrid)=fluxgrd(1:ngrid) |
---|
2316 | comm_LSCEZ(1:ngrid,1:nlayer)=lscaledEz(1:ngrid,1:nlayer) |
---|
2317 | sensibFlux(1:ngrid) = zflubid(1:ngrid) - capcal(1:ngrid)*zdtsdif(1:ngrid) !!! ???? |
---|
2318 | |
---|
2319 | if (turb_resolved) then |
---|
2320 | open(17,file='lsf.txt',form='formatted',status='old') |
---|
2321 | rewind(17) |
---|
2322 | DO l=1,nlayer |
---|
2323 | read(17,*) lsf_dt(l),lsf_dq(l) |
---|
2324 | ENDDO |
---|
2325 | close(17) |
---|
2326 | do ig=1,ngrid |
---|
2327 | if ((tracer).and.(water)) then |
---|
2328 | pdq(ig,:,igcm_h2o_vap) = pdq(ig,:,igcm_h2o_vap) + lsf_dq(:) |
---|
2329 | endif |
---|
2330 | pdt(ig,:) = pdt(ig,:) + lsf_dt(:) |
---|
2331 | comm_HR_DYN(ig,:) = lsf_dt(:) |
---|
2332 | enddo |
---|
2333 | endif |
---|
2334 | #endif |
---|
2335 | |
---|
2336 | ! XIOS outputs |
---|
2337 | #ifdef CPP_XIOS |
---|
2338 | ! Send fields to XIOS: (NB these fields must also be defined as |
---|
2339 | ! <field id="..." /> in context_lmdz_physics.xml to be correctly used) |
---|
2340 | CALL send_xios_field("ls",zls) |
---|
2341 | |
---|
2342 | CALL send_xios_field("ps",ps) |
---|
2343 | CALL send_xios_field("area",cell_area) |
---|
2344 | |
---|
2345 | CALL send_xios_field("temperature",zt) |
---|
2346 | CALL send_xios_field("u",zu) |
---|
2347 | CALL send_xios_field("v",zv) |
---|
2348 | CALL send_xios_field("omega",omega) |
---|
2349 | |
---|
2350 | CALL send_xios_field("ISR",fluxtop_dn) |
---|
2351 | CALL send_xios_field("OLR",fluxtop_lw) |
---|
2352 | |
---|
2353 | if (lastcall.and.is_omp_master) then |
---|
2354 | write(*,*) "physiq: call xios_context_finalize" |
---|
2355 | call xios_context_finalize |
---|
2356 | endif |
---|
2357 | #endif |
---|
2358 | |
---|
2359 | icount=icount+1 |
---|
2360 | |
---|
2361 | end subroutine physiq |
---|
2362 | |
---|
2363 | end module physiq_mod |
---|