Changeset 1295
- Timestamp:
- Jun 13, 2014, 5:28:30 PM (11 years ago)
- Location:
- trunk/LMDZ.GENERIC/libf/phystd
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/comgeomfi_h.F90
r787 r1295 5 5 6 6 REAL,ALLOCATABLE,DIMENSION(:) :: long,lati,area 7 REAL :: totarea 7 REAL :: totarea, totarea_planet 8 8 9 9 end module comgeomfi_h -
trunk/LMDZ.GENERIC/libf/phystd/inifis.F
r1252 r1295 7 7 use datafile_mod, only: datadir 8 8 use comdiurn_h, only: sinlat, coslat, sinlon, coslon 9 use comgeomfi_h, only: long, lati, area, totarea 9 use comgeomfi_h, only: long, lati, area, totarea, totarea_planet 10 10 use comsoil_h, only: ini_comsoil_h 11 11 use control_mod, only: ecritphy 12 use planetwide_mod, only: planetwide_sumval 12 13 13 14 !======================================================================= … … 677 678 CALL SCOPY(ngrid,parea,1,area,1) 678 679 totarea=SSUM(ngrid,area,1) 680 call planetwide_sumval(area,totarea_planet) 679 681 680 682 !! those are defined in comdiurn_h.F90 -
trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
r1283 r1295 19 19 use comsaison_h, only: mu0, fract, dist_star, declin 20 20 use comsoil_h, only: nsoilmx, layer, mlayer, inertiedat 21 USE comgeomfi_h, only: long, lati, area, totarea 21 USE comgeomfi_h, only: long, lati, area, totarea, totarea_planet 22 22 USE tracer_h, only: noms, mmol, radius, rho_q, qext, & 23 23 alpha_lift, alpha_devil, qextrhor, & … … 26 26 use control_mod, only: ecritphy, iphysiq, nday 27 27 use phyredem, only: physdem0, physdem1 28 use planetwide_mod, only: planetwide_minval,planetwide_maxval,planetwide_sumval 29 use mod_phys_lmdz_para, only : is_master 28 30 29 31 implicit none … … 338 340 real madjdE(ngrid), lscaledE(ngrid),madjdEz(ngrid,nlayermx), lscaledEz(ngrid,nlayermx) 339 341 !JL12 conservation test for mean flow kinetic energy has been disabled temporarily 342 real dtmoist_max,dtmoist_min 340 343 341 real dItot, d Vtot344 real dItot, dItot_tmp, dVtot, dVtot_tmp 342 345 343 346 ! included by BC for evaporation … … 352 355 ! included by RW to test water conservation (by routine) 353 356 real h2otot 354 real dWtot, dWtot s357 real dWtot, dWtot_tmp, dWtots, dWtots_tmp 355 358 real h2o_surf_all 356 359 logical watertest … … 914 917 ! test energy conservation 915 918 if(enertest)then 916 dEtotSW = cpp*SUM(massarea(:,:)*zdtsw(:,:))/totarea 917 dEtotLW = cpp*SUM(massarea(:,:)*zdtlw(:,:))/totarea 918 dEtotsSW = SUM(fluxsurf_sw(:)*(1.-albedo(:))*area(:))/totarea!JL13 carefull, albedo can have changed since the last time we called corrk919 dEtotsLW = SUM((fluxsurf_lw(:)*emis(:)-zplanck(:))*area(:))/totarea 919 call planetwide_sumval(cpp*massarea(:,:)*zdtsw(:,:)/totarea_planet,dEtotSW) 920 call planetwide_sumval(cpp*massarea(:,:)*zdtlw(:,:)/totarea_planet,dEtotLW) 921 call planetwide_sumval(fluxsurf_sw(:)*(1.-albedo(:))*area(:)/totarea_planet,dEtotsSW) !JL13 carefull, albedo can have changed since the last time we called corrk 922 call planetwide_sumval((fluxsurf_lw(:)*emis(:)-zplanck(:))*area(:)/totarea_planet,dEtotsLW) 920 923 dEzRadsw(:,:)=cpp*mass(:,:)*zdtsw(:,:) 921 924 dEzRadlw(:,:)=cpp*mass(:,:)*zdtlw(:,:) 922 print*,'---------------------------------------------------------------' 923 print*,'In corrk SW atmospheric heating =',dEtotSW,' W m-2' 924 print*,'In corrk LW atmospheric heating =',dEtotLW,' W m-2' 925 print*,'atmospheric net rad heating (SW+LW) =',dEtotLW+dEtotSW,' W m-2' 926 print*,'In corrk SW surface heating =',dEtotsSW,' W m-2' 927 print*,'In corrk LW surface heating =',dEtotsLW,' W m-2' 928 print*,'surface net rad heating (SW+LW) =',dEtotsLW+dEtotsSW,' W m-2' 925 if (is_master) then 926 print*,'---------------------------------------------------------------' 927 print*,'In corrk SW atmospheric heating =',dEtotSW,' W m-2' 928 print*,'In corrk LW atmospheric heating =',dEtotLW,' W m-2' 929 print*,'atmospheric net rad heating (SW+LW) =',dEtotLW+dEtotSW,' W m-2' 930 print*,'In corrk SW surface heating =',dEtotsSW,' W m-2' 931 print*,'In corrk LW surface heating =',dEtotsLW,' W m-2' 932 print*,'surface net rad heating (SW+LW) =',dEtotsLW+dEtotsSW,' W m-2' 933 endif 929 934 endif 930 935 !------------------------- … … 989 994 dEzdiff(ig,1)= dEzdiff(ig,1)+ sensibFlux(ig)! subtract flux to the ground 990 995 enddo 991 dEtot = SUM(dEdiff(:)*area(:))/totarea996 call planetwide_sumval(dEdiff(:)*area(:)/totarea_planet,dEtot) 992 997 dEdiffs(:)=capcal(:)*zdtsdif(:)-zflubid(:)-sensibFlux(:) 993 dEtots = SUM(dEdiffs(:)*area(:))/totarea 994 AtmToSurf_TurbFlux=SUM(sensibFlux(:)*area(:))/totarea 995 if (UseTurbDiff) then 996 print*,'In TurbDiff sensible flux (atm=>surf) =',AtmToSurf_TurbFlux,' W m-2' 997 print*,'In TurbDiff non-cons atm nrj change =',dEtot,' W m-2' 998 print*,'In TurbDiff (correc rad+latent heat) surf nrj change =',dEtots,' W m-2' 999 else 1000 print*,'In vdifc sensible flux (atm=>surf) =',AtmToSurf_TurbFlux,' W m-2' 1001 print*,'In vdifc non-cons atm nrj change =',dEtot,' W m-2' 1002 print*,'In vdifc (correc rad+latent heat) surf nrj change =',dEtots,' W m-2' 1003 end if 998 call planetwide_sumval(dEdiffs(:)*area(:)/totarea_planet,dEtots) 999 call planetwide_sumval(sensibFlux(:)*area(:)/totarea_planet,AtmToSurf_TurbFlux) 1000 if (is_master) then 1001 if (UseTurbDiff) then 1002 print*,'In TurbDiff sensible flux (atm=>surf) =',AtmToSurf_TurbFlux,' W m-2' 1003 print*,'In TurbDiff non-cons atm nrj change =',dEtot,' W m-2' 1004 print*,'In TurbDiff (correc rad+latent heat) surf nrj change =',dEtots,' W m-2' 1005 else 1006 print*,'In vdifc sensible flux (atm=>surf) =',AtmToSurf_TurbFlux,' W m-2' 1007 print*,'In vdifc non-cons atm nrj change =',dEtot,' W m-2' 1008 print*,'In vdifc (correc rad+latent heat) surf nrj change =',dEtots,' W m-2' 1009 end if 1010 endif ! of if (is_master) 1004 1011 ! JL12 note that the black body radiative flux emitted by the surface has been updated by the implicit scheme 1005 1012 ! but not given back elsewhere … … 1010 1017 ! test water conservation 1011 1018 if(watertest.and.water)then 1012 dWtot = SUM(massarea(:,:)*zdqdif(:,:,igcm_h2o_vap))*ptimestep/totarea 1013 dWtots = SUM(zdqsdif(:,igcm_h2o_vap)*area(:))*ptimestep/totarea 1019 call planetwide_sumval(massarea(:,:)*zdqdif(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dWtot_tmp) 1020 call planetwide_sumval(zdqsdif(:,igcm_h2o_vap)*area(:)*ptimestep/totarea_planet,dWtots_tmp) 1014 1021 do ig = 1, ngrid 1015 1022 vdifcncons(ig)=SUM(mass(ig,:)*zdqdif(ig,:,igcm_h2o_vap)) 1016 1023 Enddo 1017 dWtot = dWtot + SUM(massarea(:,:)*zdqdif(:,:,igcm_h2o_ice))*ptimestep/totarea 1018 dWtots = dWtots + SUM(zdqsdif(:,igcm_h2o_ice)*area(:))*ptimestep/totarea 1024 call planetwide_sumval(massarea(:,:)*zdqdif(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) 1025 call planetwide_sumval(zdqsdif(:,igcm_h2o_ice)*area(:)*ptimestep/totarea_planet,dWtots) 1026 dWtot = dWtot + dWtot_tmp 1027 dWtots = dWtots + dWtots_tmp 1019 1028 do ig = 1, ngrid 1020 1029 vdifcncons(ig)=vdifcncons(ig) + SUM(mass(ig,:)*zdqdif(ig,:,igcm_h2o_ice)) 1021 1030 Enddo 1022 nconsMAX=MAXVAL(vdifcncons(:)) 1023 1024 print*,'---------------------------------------------------------------' 1025 print*,'In difv atmospheric water change =',dWtot,' kg m-2' 1026 print*,'In difv surface water change =',dWtots,' kg m-2' 1027 print*,'In difv non-cons factor =',dWtot+dWtots,' kg m-2' 1028 print*,'In difv MAX non-cons factor =',nconsMAX,' kg m-2 s-1' 1031 call planetwide_maxval(vdifcncons(:),nconsMAX) 1032 1033 if (is_master) then 1034 print*,'---------------------------------------------------------------' 1035 print*,'In difv atmospheric water change =',dWtot,' kg m-2' 1036 print*,'In difv surface water change =',dWtots,' kg m-2' 1037 print*,'In difv non-cons factor =',dWtot+dWtots,' kg m-2' 1038 print*,'In difv MAX non-cons factor =',nconsMAX,' kg m-2 s-1' 1039 endif 1029 1040 1030 1041 endif … … 1073 1084 ! test energy conservation 1074 1085 if(enertest)then 1075 dEtot=cpp*SUM(massarea(:,:)*zdtadj(:,:))/totarea 1076 print*,'In convadj atmospheric energy change =',dEtot,' W m-2'1086 call planetwide_sumval(cpp*massarea(:,:)*zdtadj(:,:)/totarea_planet,dEtot) 1087 if (is_master) print*,'In convadj atmospheric energy change =',dEtot,' W m-2' 1077 1088 endif 1078 1089 !------------------------- … … 1081 1092 ! test water conservation 1082 1093 if(watertest)then 1083 dWtot = SUM(massarea(:,:)*zdqadj(:,:,igcm_h2o_vap))*ptimestep/totarea 1094 call planetwide_sumval(massarea(:,:)*zdqadj(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dWtot_tmp) 1084 1095 do ig = 1, ngrid 1085 1096 cadjncons(ig)=SUM(mass(ig,:)*zdqadj(ig,:,igcm_h2o_vap)) 1086 1097 Enddo 1087 dWtot = dWtot + SUM(massarea(:,:)*zdqadj(:,:,igcm_h2o_ice))*ptimestep/totarea 1098 call planetwide_sumval(massarea(:,:)*zdqadj(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) 1099 dWtot = dWtot + dWtot_tmp 1088 1100 do ig = 1, ngrid 1089 1101 cadjncons(ig)=cadjncons(ig) + SUM(mass(ig,:)*zdqadj(ig,:,igcm_h2o_ice)) 1090 1102 Enddo 1091 nconsMAX=MAXVAL(cadjncons(:)) 1092 1093 print*,'In convadj atmospheric water change =',dWtot,' kg m-2' 1094 print*,'In convadj MAX non-cons factor =',nconsMAX,' kg m-2 s-1' 1103 call planetwide_maxval(cadjncons(:),nconsMAX) 1104 1105 if (is_master) then 1106 print*,'In convadj atmospheric water change =',dWtot,' kg m-2' 1107 print*,'In convadj MAX non-cons factor =',nconsMAX,' kg m-2 s-1' 1108 endif 1095 1109 endif 1096 1110 !------------------------- … … 1126 1140 ! test energy conservation 1127 1141 if(enertest)then 1128 dEtot = cpp*SUM(massarea(:,:)*zdtc(:,:))/totarea 1129 dEtots = SUM(capcal(:)*zdtsurfc(:)*area(:))/totarea 1130 print*,'In co2cloud atmospheric energy change =',dEtot,' W m-2' 1131 print*,'In co2cloud surface energy change =',dEtots,' W m-2' 1142 call planetwide_sumval(cpp*massarea(:,:)*zdtc(:,:)/totarea_planet,dEtot) 1143 call planetwide_sumval(capcal(:)*zdtsurfc(:)*area(:)/totarea_planet,dEtots) 1144 if (is_master) then 1145 print*,'In co2cloud atmospheric energy change =',dEtot,' W m-2' 1146 print*,'In co2cloud surface energy change =',dEtots,' W m-2' 1147 endif 1132 1148 endif 1133 1149 !------------------------- … … 1169 1185 ! test energy conservation 1170 1186 if(enertest)then 1171 dEtot=cpp*SUM(massarea(:,:)*dtmoist(:,:))/totarea 1187 call planetwide_sumval(cpp*massarea(:,:)*dtmoist(:,:)/totarea_planet,dEtot) 1188 call planetwide_maxval(dtmoist(:,:),dtmoist_max) 1189 call planetwide_minval(dtmoist(:,:),dtmoist_min) 1172 1190 madjdEz(:,:)=cpp*mass(:,:)*dtmoist(:,:) 1173 1191 do ig=1,ngrid 1174 1192 madjdE(ig) = cpp*SUM(mass(:,:)*dtmoist(:,:)) 1175 1193 enddo 1176 print*,'In moistadj atmospheric energy change =',dEtot,' W m-2' 1177 print*,'In moistadj MAX atmospheric energy change =',MAXVAL(dtmoist(:,:))*ptimestep,'K/step' 1178 print*,'In moistadj MIN atmospheric energy change =',MINVAL(dtmoist(:,:))*ptimestep,'K/step' 1194 if (is_master) then 1195 print*,'In moistadj atmospheric energy change =',dEtot,' W m-2' 1196 print*,'In moistadj MAX atmospheric energy change =',dtmoist_max*ptimestep,'K/step' 1197 print*,'In moistadj MIN atmospheric energy change =',dtmoist_min*ptimestep,'K/step' 1198 endif 1179 1199 1180 1200 ! test energy conservation 1181 dWtot = SUM(massarea(:,:)*dqmoist(:,:,igcm_h2o_vap))*ptimestep/totarea1182 dWtot = dWtot + SUM(massarea(:,:)*dqmoist(:,:,igcm_h2o_ice))*ptimestep/totarea 1183 1201 call planetwide_sumval(massarea(:,:)*dqmoist(:,:,igcm_h2o_vap)*ptimestep/totarea_planet+ & 1202 massarea(:,:)*dqmoist(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) 1203 if (is_master) print*,'In moistadj atmospheric water change =',dWtot,' kg m-2' 1184 1204 endif 1185 1205 !------------------------- … … 1202 1222 lscaledE(ig) = cpp*SUM(mass(:,:)*dtlscale(:,:)) 1203 1223 enddo 1204 dEtot=cpp*SUM(massarea(:,:)*(dtlscale(:,:)))/totarea 1224 call planetwide_sumval(cpp*massarea(:,:)*dtlscale(:,:)/totarea_planet,dEtot) 1205 1225 ! if(isnan(dEtot)) then ! NB: isnan() is not a standard function... 1206 1226 ! print*,'Nan in largescale, abort' 1207 1227 ! STOP 1208 1228 ! endif 1209 print*,'In largescale atmospheric energy change =',dEtot,' W m-2'1229 if (is_master) print*,'In largescale atmospheric energy change =',dEtot,' W m-2' 1210 1230 1211 1231 ! test water conservation 1212 dWtot = SUM(massarea(:,:)*dqvaplscale(:,:))*ptimestep/totarea1213 dWtot = dWtot + SUM(massarea(:,:)*dqcldlscale(:,:))*ptimestep/totarea 1214 1232 call planetwide_sumval(massarea(:,:)*dqvaplscale(:,:)*ptimestep/totarea_planet+ & 1233 SUM(massarea(:,:)*dqcldlscale(:,:))*ptimestep/totarea_planet,dWtot) 1234 if (is_master) print*,'In largescale atmospheric water change =',dWtot,' kg m-2' 1215 1235 endif 1216 1236 !------------------------- … … 1250 1270 ! test energy conservation 1251 1271 if(enertest)then 1252 dEtot=cpp*SUM(massarea(:,:)*zdtrain(:,:))/totarea 1253 print*,'In rain atmospheric T energy change =',dEtot,' W m-2' 1254 dItot = SUM(massarea(:,:)*zdqrain(:,:,igcm_h2o_ice))/totarea*RLVTT/cpp 1255 dItot = dItot + SUM(area(:)*zdqssnow(:))/totarea*RLVTT/cpp 1256 dVtot = SUM(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap))*ptimestep/totarea 1257 dVtot = dVtot + SUM(area(:)*zdqsrain(:))/totarea*RLVTT/cpp 1272 call planetwide_sumval(cpp*massarea(:,:)*zdtrain(:,:)/totarea_planet,dEtot) 1273 if (is_master) print*,'In rain atmospheric T energy change =',dEtot,' W m-2' 1274 call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_ice)/totarea_planet*RLVTT/cpp,dItot_tmp) 1275 call planetwide_sumval(area(:)*zdqssnow(:)/totarea_planet*RLVTT/cpp,dItot) 1276 dItot = dItot + dItot_tmp 1277 call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dVtot_tmp) 1278 call planetwide_sumval(area(:)*zdqsrain(:)/totarea_planet*RLVTT/cpp,dVtot) 1279 dVtot = dVtot + dVtot_tmp 1258 1280 dEtot = dItot + dVtot 1259 print*,'In rain dItot =',dItot,' W m-2' 1260 print*,'In rain dVtot =',dVtot,' W m-2' 1261 print*,'In rain atmospheric L energy change =',dEtot,' W m-2' 1281 if (is_master) then 1282 print*,'In rain dItot =',dItot,' W m-2' 1283 print*,'In rain dVtot =',dVtot,' W m-2' 1284 print*,'In rain atmospheric L energy change =',dEtot,' W m-2' 1285 endif 1262 1286 1263 1287 ! test water conservation 1264 dWtot = SUM(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap))*ptimestep/totarea 1265 dWtot = dWtot + SUM(massarea(:,:)*zdqrain(:,:,igcm_h2o_ice))*ptimestep/totarea 1266 dWtots = SUM((zdqsrain(:)+zdqssnow(:))*area(:))*ptimestep/totarea 1267 print*,'In rain atmospheric water change =',dWtot,' kg m-2' 1268 print*,'In rain surface water change =',dWtots,' kg m-2' 1269 print*,'In rain non-cons factor =',dWtot+dWtots,' kg m-2' 1288 call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap)*ptimestep/totarea_planet+ & 1289 massarea(:,:)*zdqrain(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) 1290 call planetwide_sumval((zdqsrain(:)+zdqssnow(:))*area(:)*ptimestep/totarea_planet,dWtots) 1291 if (is_master) then 1292 print*,'In rain atmospheric water change =',dWtot,' kg m-2' 1293 print*,'In rain surface water change =',dWtots,' kg m-2' 1294 print*,'In rain non-cons factor =',dWtot+dWtots,' kg m-2' 1295 endif 1270 1296 endif 1271 1297 !------------------------- … … 1289 1315 if(watertest)then 1290 1316 iq=igcm_h2o_ice 1291 dWtot = SUM(massarea(:,:)*pq(:,:,iq))*ptimestep/totarea 1292 dWtots = SUM(massarea(:,:)*pdq(:,:,iq))*ptimestep/totarea 1293 print*,'Before sedim pq =',dWtot,' kg m-2' 1294 print*,'Before sedim pdq =',dWtots,' kg m-2' 1317 call planetwide_sumval(massarea(:,:)*pq(:,:,iq)*ptimestep/totarea_planet,dWtot) 1318 call planetwide_sumval(massarea(:,:)*pdq(:,:,iq)*ptimestep/totarea_planet,dWtots) 1319 if (is_master) then 1320 print*,'Before sedim pq =',dWtot,' kg m-2' 1321 print*,'Before sedim pdq =',dWtots,' kg m-2' 1322 endif 1295 1323 endif 1296 1324 !------------------------- … … 1303 1331 if(watertest)then 1304 1332 iq=igcm_h2o_ice 1305 dWtot = SUM(massarea(:,:)*pq(:,:,iq))*ptimestep/totarea 1306 dWtots = SUM(massarea(:,:)*pdq(:,:,iq))*ptimestep/totarea 1307 print*,'After sedim pq =',dWtot,' kg m-2' 1308 print*,'After sedim pdq =',dWtots,' kg m-2' 1333 call planetwide_sumval(massarea(:,:)*pq(:,:,iq)*ptimestep/totarea_planet,dWtot) 1334 call planetwide_sumval(massarea(:,:)*pdq(:,:,iq)*ptimestep/totarea_planet,dWtots) 1335 if (is_master) then 1336 print*,'After sedim pq =',dWtot,' kg m-2' 1337 print*,'After sedim pdq =',dWtots,' kg m-2' 1338 endif 1309 1339 endif 1310 1340 !------------------------- … … 1319 1349 ! test water conservation 1320 1350 if(watertest)then 1321 dWtot = SUM(massarea(:,:)*(zdqsed(:,:,igcm_h2o_vap)+zdqsed(:,:,igcm_h2o_ice)))*ptimestep/totarea 1322 dWtots = SUM((zdqssed(:,igcm_h2o_vap)+zdqssed(:,igcm_h2o_ice))*area(:))*ptimestep/totarea 1323 print*,'In sedim atmospheric ice change =',dWtot,' kg m-2' 1324 print*,'In sedim surface ice change =',dWtots,' kg m-2' 1325 print*,'In sedim non-cons factor =',dWtot+dWtots,' kg m-2' 1351 call planetwide_sumval(massarea(:,:)*(zdqsed(:,:,igcm_h2o_vap)+zdqsed(:,:,igcm_h2o_ice))*ptimestep/totarea_planet,dWtot) 1352 call planetwide_sumval((zdqssed(:,igcm_h2o_vap)+zdqssed(:,igcm_h2o_ice))*area(:)*ptimestep/totarea_planet,dWtots) 1353 if (is_master) then 1354 print*,'In sedim atmospheric ice change =',dWtot,' kg m-2' 1355 print*,'In sedim surface ice change =',dWtots,' kg m-2' 1356 print*,'In sedim non-cons factor =',dWtot+dWtots,' kg m-2' 1357 endif 1326 1358 endif 1327 1359 !------------------------- … … 1389 1421 ! test energy conservation 1390 1422 if(enertest)then 1391 dEtots = SUM(area(:)*capcal(:)*zdtsurf_hyd(:))/totarea 1392 1423 call planetwide_sumval(area(:)*capcal(:)*zdtsurf_hyd(:)/totarea_planet,dEtots) 1424 if (is_master) print*,'In hydrol surface energy change =',dEtots,' W m-2' 1393 1425 endif 1394 1426 !------------------------- … … 1397 1429 ! test water conservation 1398 1430 if(watertest)then 1399 dWtots = SUM(dqs_hyd(:,igcm_h2o_ice)*area(:))*ptimestep/totarea 1400 print*,'In hydrol surface ice change =',dWtots,' kg m-2' 1401 dWtots = SUM(dqs_hyd(:,igcm_h2o_vap)*area(:))*ptimestep/totarea 1402 print*,'In hydrol surface water change =',dWtots,' kg m-2' 1403 print*,'---------------------------------------------------------------' 1431 call planetwide_sumval(dqs_hyd(:,igcm_h2o_ice)*area(:)*ptimestep/totarea_planet,dWtots) 1432 if (is_master) print*,'In hydrol surface ice change =',dWtots,' kg m-2' 1433 call planetwide_sumval(dqs_hyd(:,igcm_h2o_vap)*area(:)*ptimestep/totarea_planet,dWtots) 1434 if (is_master) then 1435 print*,'In hydrol surface water change =',dWtots,' kg m-2' 1436 print*,'---------------------------------------------------------------' 1437 endif 1404 1438 endif 1405 1439 !------------------------- … … 1439 1473 ! test energy conservation 1440 1474 if(enertest)then 1441 dEtots = SUM(area(:)*capcal(:)*zdtsurf(:))/totarea 1442 1475 call planetwide_sumval(area(:)*capcal(:)*zdtsurf(:)/totarea_planet,dEtots) 1476 if (is_master) print*,'Surface energy change =',dEtots,' W m-2' 1443 1477 endif 1444 1478 !------------------------- … … 1487 1521 ! --------------------------------------------------------- 1488 1522 1489 Ts1 = SUM(area(:)*tsurf(:))/totarea1490 Ts2 = MINVAL(tsurf(:))1491 Ts3 = MAXVAL(tsurf(:))1523 call planetwide_sumval(area(:)*tsurf(:)/totarea_planet,Ts1) 1524 call planetwide_minval(tsurf(:),Ts2) 1525 call planetwide_maxval(tsurf(:),Ts3) 1492 1526 if(callsoil)then 1493 1527 TsS = SUM(area(:)*tsoil(:,nsoilmx))/totarea ! mean temperature at bottom soil layer … … 1495 1529 print*,Ts1,Ts2,Ts3,TsS 1496 1530 else 1531 if (is_master) then 1497 1532 print*,' ave[Tsurf] min[Tsurf] max[Tsurf]' 1498 1533 print*,Ts1,Ts2,Ts3 1534 endif 1499 1535 end if 1500 1536 … … 1505 1541 if(corrk)then 1506 1542 1507 ISR = SUM(area(:)*fluxtop_dn(:))/totarea 1508 ASR = SUM(area(:)*fluxabs_sw(:))/totarea 1509 OLR = SUM(area(:)*fluxtop_lw(:))/totarea 1510 GND = SUM(area(:)*fluxgrd(:))/totarea 1511 DYN = SUM(area(:)*fluxdyn(:))/totarea 1543 call planetwide_sumval(area(:)*fluxtop_dn(:)/totarea_planet,ISR) 1544 call planetwide_sumval(area(:)*fluxabs_sw(:)/totarea_planet,ASR) 1545 call planetwide_sumval(area(:)*fluxtop_lw(:)/totarea_planet,OLR) 1546 call planetwide_sumval(area(:)*fluxgrd(:)/totarea_planet,GND) 1547 call planetwide_sumval(area(:)*fluxdyn(:)/totarea_planet,DYN) 1512 1548 do ig=1,ngrid 1513 1549 if(fluxtop_dn(ig).lt.0.0)then … … 1525 1561 DYN=0.0 1526 1562 endif 1527 1528 print*,' ISR ASR OLR GND DYN [W m^-2]' 1529 print*, ISR,ASR,OLR,GND,DYN 1530 1531 if(enertest)then 1563 1564 if (is_master) then 1565 print*,' ISR ASR OLR GND DYN [W m^-2]' 1566 print*, ISR,ASR,OLR,GND,DYN 1567 endif 1568 1569 if(enertest .and. is_master)then 1532 1570 print*,'SW flux/heating difference SW++ - ASR = ',dEtotSW+dEtotsSW-ASR,' W m-2' 1533 1571 print*,'LW flux/heating difference LW++ - OLR = ',dEtotLW+dEtotsLW+OLR,' W m-2' … … 1535 1573 endif 1536 1574 1537 if(meanOLR )then1575 if(meanOLR .and. is_master)then 1538 1576 if((ngrid.gt.1) .or. (mod(icount-1,ecritphy).eq.0))then 1539 1577 ! to record global radiative balance … … 1542 1580 close(92) 1543 1581 open(93,file="tem_bal.out",form='formatted',position='append') 1544 write(93,*) zday,Ts1,Ts2,Ts3,TsS 1582 if(callsoil)then 1583 write(93,*) zday,Ts1,Ts2,Ts3,TsS 1584 else 1585 write(93,*) zday,Ts1,Ts2,Ts3 1586 endif 1545 1587 close(93) 1546 1588 endif … … 1600 1642 if(water)then 1601 1643 1602 icesrf = SUM(area(:)*qsurf_hist(:,igcm_h2o_ice))/totarea 1603 liqsrf = SUM(area(:)*qsurf_hist(:,igcm_h2o_vap))/totarea 1604 icecol = SUM(area(:)*qcol(:,igcm_h2o_ice))/totarea 1605 vapcol = SUM(area(:)*qcol(:,igcm_h2o_vap))/totarea 1644 call planetwide_sumval(area(:)*qsurf_hist(:,igcm_h2o_ice)/totarea_planet,icesrf) 1645 call planetwide_sumval(area(:)*qsurf_hist(:,igcm_h2o_vap)/totarea_planet,liqsrf) 1646 call planetwide_sumval(area(:)*qcol(:,igcm_h2o_ice)/totarea_planet,icecol) 1647 call planetwide_sumval(area(:)*qcol(:,igcm_h2o_vap)/totarea_planet,vapcol) 1606 1648 1607 1649 h2otot = icesrf + liqsrf + icecol + vapcol 1608 1609 print*,' Total water amount [kg m^-2]: ',h2otot 1610 print*,' Surface ice Surface liq. Atmos. con. Atmos. vap. [kg m^-2] ' 1611 print*, icesrf,liqsrf,icecol,vapcol 1612 1613 if(meanOLR)then 1650 1651 if (is_master) then 1652 print*,' Total water amount [kg m^-2]: ',h2otot 1653 print*,' Surface ice Surface liq. Atmos. con. Atmos. vap. [kg m^-2] ' 1654 print*, icesrf,liqsrf,icecol,vapcol 1655 endif 1656 1657 if(meanOLR .and. is_master)then 1614 1658 if((ngrid.gt.1) .or. (mod(icount-1,ecritphy).eq.0))then 1615 1659 ! to record global water balance -
trunk/LMDZ.GENERIC/libf/phystd/planetwide_mod.F90
r1216 r1295 20 20 end interface 21 21 22 interface planetwide_sumval ! sum() , over the entire planet 23 module procedure planetwide_sumval_i1, planetwide_sumval_i2, & 24 planetwide_sumval_r1, planetwide_sumval_r2 25 end interface 26 22 27 contains 23 28 … … 200 205 end subroutine planetwide_minval_r2 201 206 202 207 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 208 209 subroutine planetwide_sumval_i1(values,values_sum) 210 use dimphy, only: klon 211 use mod_grid_phy_lmdz, only : klon_glo 212 implicit none 213 integer,intent(in) :: values(:) ! local grid (klon) 214 integer,intent(out) :: values_sum 215 #ifdef CPP_PARA 216 integer :: values_glo(klon_glo) ! global grid 217 218 ! gather field on master: 219 call gather(values,values_glo) 220 ! calculate sum value 221 if (is_master) then 222 values_sum=SUM(values_glo(:)) 223 endif 224 ! broadcast information to all cores 225 call bcast(values_sum) 226 #else 227 values_sum=SUM(values(:)) 228 #endif 229 end subroutine planetwide_sumval_i1 230 231 subroutine planetwide_sumval_i2(values,values_sum) 232 use dimphy, only: klon, klev 233 use mod_grid_phy_lmdz, only : klon_glo 234 implicit none 235 integer,intent(in) :: values(:,:) ! local grid (klon,klev) 236 integer,intent(out) :: values_sum 237 #ifdef CPP_PARA 238 integer :: values_glo(klon_glo,klev) ! global grid 239 240 ! gather field on master: 241 call gather(values,values_glo) 242 ! calculate sum value 243 if (is_master) then 244 values_sum=SUM(values_glo) 245 endif 246 ! broadcast information to all cores 247 call bcast(values_sum) 248 #else 249 values_sum=SUM(values) 250 #endif 251 end subroutine planetwide_sumval_i2 252 253 subroutine planetwide_sumval_r1(values,values_sum) 254 use dimphy, only: klon 255 use mod_grid_phy_lmdz, only : klon_glo 256 implicit none 257 real,intent(in) :: values(:) ! local grid (klon) 258 real,intent(out) :: values_sum 259 #ifdef CPP_PARA 260 real :: values_glo(klon_glo) ! global grid 261 262 ! gather field on master: 263 call gather(values,values_glo) 264 ! calculate sum value 265 if (is_master) then 266 values_sum=SUM(values_glo) 267 endif 268 ! broadcast information to all cores 269 call bcast(values_sum) 270 #else 271 values_sum=SUM(values) 272 #endif 273 end subroutine planetwide_sumval_r1 274 275 subroutine planetwide_sumval_r2(values,values_sum) 276 use dimphy, only: klon, klev 277 use mod_grid_phy_lmdz, only : klon_glo 278 implicit none 279 real,intent(in) :: values(:,:) ! local grid (klon,klev) 280 real,intent(out) :: values_sum 281 #ifdef CPP_PARA 282 real :: values_glo(klon_glo,klev) ! global grid 283 284 ! gather field on master: 285 call gather(values,values_glo) 286 ! calculate sum value 287 if (is_master) then 288 values_sum=SUM(values_glo) 289 endif 290 ! broadcast information to all cores 291 call bcast(values_sum) 292 #else 293 values_sum=SUM(values) 294 #endif 295 end subroutine planetwide_sumval_r2 296 297 203 298 end module planetwide_mod
Note: See TracChangeset
for help on using the changeset viewer.