Changeset 3406 for LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd
- Timestamp:
- Oct 23, 2018, 11:16:41 AM (6 years ago)
- Location:
- LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/coef_diff_turb_mod.F90
r2952 r3406 65 65 66 66 67 ykmm = 0 !ym missing init 68 ykmn = 0 !ym missing init 69 ykmq = 0 !ym missing init 70 71 67 72 !**************************************************************************************** 68 73 ! Calcul de coefficients de diffusion turbulent de l'atmosphere : -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/cv3_routines.F90
r2908 r3406 3747 3747 END DO ! cld 3748 3748 3749 !ym BIG Warning : it seems that the k loop is missing !!! 3750 !ym Strong advice to check this 3751 !ym add a k loop temporary 3752 3749 3753 ! (particular case: no detraining level is found) ! cld 3750 DO il = 1, ncum ! cld 3751 IF (i<=inb(il) .AND. nent(il,i)==0 .AND. iflag(il)<=1) THEN ! cld 3752 qcond(il, i) = qcond(il, i) + (1.-ep(il,i))*clw(il, i) ! cld 3753 qtment(il, i) = qent(il,k,i) + qtment(il,i) ! cld 3754 nqcond(il, i) = nqcond(il, i) + 1. ! cld 3755 END IF ! cld 3756 END DO ! cld 3754 DO k = i + 1, nl 3755 DO il = 1, ncum !ym k loop added ! cld 3756 IF (i<=inb(il) .AND. nent(il,i)==0 .AND. iflag(il)<=1) THEN ! cld 3757 qcond(il, i) = qcond(il, i) + (1.-ep(il,i))*clw(il, i) ! cld 3758 qtment(il, i) = qent(il,k,i) + qtment(il,i) ! cld 3759 nqcond(il, i) = nqcond(il, i) + 1. ! cld 3760 END IF ! cld 3761 END DO 3762 ENDDO ! cld 3757 3763 3758 3764 DO il = 1, ncum ! cld -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/cva_driver.F90
r2902 r3406 613 613 asupmaxmin1(:) = 0. 614 614 615 tvp(:, :) = 0. !ym missing init, need to have a look by developpers 616 tv(:, :) = 0. !ym missing init, need to have a look by developpers 617 615 618 DO il = 1, len 616 619 cin1(il) = -100000. -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/limit_read_mod.F90
r3312 r3406 258 258 ENDIF 259 259 ierr=NF90_INQUIRE_DIMENSION(nid, ndimid, len=nn) 260 WRITE(abort_message,'(a,2(i 3,a))')'limit.nc records number (',nn,') does no'//&260 WRITE(abort_message,'(a,2(i0,a))')'limit.nc records number (',nn,') does no'//& 261 261 't match year length (',year_len,')' 262 262 IF(nn/=year_len) CALL abort_physic(modname,abort_message,1) … … 288 288 289 289 is_modified = .FALSE. 290 IF (MOD(itime-1, lmt_pas) == 0 .OR. jour_lu /= jour ) THEN ! time to read 290 !ym IF (MOD(itime-1, lmt_pas) == 0 .OR. jour_lu /= jour ) THEN ! time to read 291 ! not REALLY PERIODIC 292 IF (MOD(itime-1, lmt_pas) == 0) THEN ! time to read 291 293 jour_lu = jour 292 294 is_modified = .TRUE. … … 334 336 335 337 !$OMP MASTER ! Only master thread 336 IF (is_mpi_root) THEN ! Only master processus 338 IF (is_mpi_root) THEN ! Only master processus! 337 339 338 340 ierr = NF90_OPEN ('limit.nc', NF90_NOWRITE, nid) -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/pbl_surface_mod.F90
r3055 r3406 1895 1895 ywindsp, rmu0, yfder, yts, & 1896 1896 itap, dtime, jour, knon, ni, & 1897 ypplay(:,1), zgeo1 /RG, ycdragh, ycdragm, yrain_f, ysnow_f, yt(:,1), yq(:,1),&1897 ypplay(:,1), zgeo1(1:knon)/RG, ycdragh, ycdragm, yrain_f, ysnow_f, yt(:,1), yq(:,1),& ! ym missing init 1898 1898 AcoefH, AcoefQ, BcoefH, BcoefQ, & 1899 1899 AcoefU, AcoefV, BcoefU, BcoefV, & -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/phys_cal_mod.F90
r2802 r3406 37 37 SUBROUTINE phys_cal_init(annee_ref,day_ref) 38 38 39 USE IOIPSL, ONLY: ymds2ju 39 USE IOIPSL, ONLY: ymds2ju, ioconf_calendar 40 USE mod_phys_lmdz_para, ONLY: is_master,is_omp_master 40 41 USE ioipsl_getin_p_mod, ONLY: getin_p 41 42 … … 47 48 calend = 'earth_360d' ! default 48 49 CALL getin_p("calend",calend) 50 51 IF (is_omp_master) THEN 52 IF (calend == 'earth_360d') THEN 53 CALL ioconf_calendar('360d') 54 ELSE IF (calend == 'earth_365d') THEN 55 CALL ioconf_calendar('noleap') 56 ELSE IF (calend == 'earth_366d') THEN 57 CALL ioconf_calendar('gregorian') 58 ELSE 59 CALL abort_physic('phys_cal_init','Mauvais choix de calendrier',1) 60 ENDIF 61 ENDIF 62 !$OMP BARRIER 49 63 50 64 CALL ymds2ju(annee_ref, 1, day_ref, 0., jD_ref) -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/phys_local_var_mod.F90
r3050 r3406 573 573 ALLOCATE(dv_gwd_rando(klon,klev),dv_gwd_front(klon,klev)) 574 574 ALLOCATE(east_gwstress(klon,klev),west_gwstress(klon,klev)) 575 east_gwstress(:,:)=0 !ym missing init 576 west_gwstress(:,:)=0 !ym missing init 575 577 ALLOCATE(d_t_hin(klon,klev)) 576 578 ALLOCATE(d_q_ch4(klon,klev)) … … 688 690 !>jyg 689 691 ALLOCATE(dtvdf_x(klon,klev), dtvdf_w(klon,klev)) 692 dtvdf_x = 0 ; dtvdf_w=0 ; !ym missing init 690 693 ALLOCATE(dqvdf_x(klon,klev), dqvdf_w(klon,klev)) 694 dqvdf_x = 0 ; dqvdf_w=0 ; !ym missing init 691 695 ALLOCATE(pbl_tke_input(klon,klev+1,nbsrf)) 692 696 ALLOCATE(t_therm(klon,klev), q_therm(klon,klev),u_therm(klon,klev), v_therm(klon,klev)) -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/phys_output_write_mod.F90
r3003 r3406 348 348 ! ug Pour les sorties XIOS 349 349 USE xios 350 USE wxios, ONLY: wxios_closedef, missing_val 350 USE wxios, ONLY: wxios_closedef, missing_val, wxios_set_context 351 351 #endif 352 352 USE phys_cal_mod, ONLY : mth_len … … 417 417 CALL set_itau_iophy(itau_w) 418 418 419 IF (.NOT.vars_defined) THEN 420 iinitend = 2 421 ELSE 419 ! IF (.NOT.vars_defined) THEN 422 420 iinitend = 1 423 ENDIF 421 ! ELSE 422 ! iinitend = 1 423 ! ENDIF 424 425 #ifdef CPP_XIOS 426 CALL wxios_set_context 427 #endif 424 428 425 429 DO ilev=1,klev … … 687 691 CALL histwrite_phy(o_fsnow, zfra_o) 688 692 CALL histwrite_phy(o_evap, evap) 689 CALL histwrite_phy(o_tops, topsw*swradcorr) 690 CALL histwrite_phy(o_tops0, topsw0*swradcorr) 693 694 IF (vars_defined) THEN 695 zx_tmp_fi2d = topsw*swradcorr 696 ENDIF 697 CALL histwrite_phy(o_tops, zx_tmp_fi2d) 698 699 IF (vars_defined) THEN 700 zx_tmp_fi2d = topsw0*swradcorr 701 ENDIF 702 CALL histwrite_phy(o_tops0, zx_tmp_fi2d) 703 691 704 CALL histwrite_phy(o_topl, toplw) 692 705 CALL histwrite_phy(o_topl0, toplw0) … … 716 729 ENDIF 717 730 CALL histwrite_phy(o_nettop, zx_tmp_fi2d) 718 CALL histwrite_phy(o_SWup200, SWup200*swradcorr) 719 CALL histwrite_phy(o_SWup200clr, SWup200clr*swradcorr) 720 CALL histwrite_phy(o_SWdn200, SWdn200*swradcorr) 721 CALL histwrite_phy(o_SWdn200clr, SWdn200clr*swradcorr) 731 732 IF (vars_defined) THEN 733 zx_tmp_fi2d = SWup200*swradcorr 734 ENDIF 735 CALL histwrite_phy(o_SWup200, zx_tmp_fi2d) 736 737 IF (vars_defined) THEN 738 zx_tmp_fi2d = SWup200clr*swradcorr 739 ENDIF 740 CALL histwrite_phy(o_SWup200clr, zx_tmp_fi2d) 741 742 IF (vars_defined) THEN 743 zx_tmp_fi2d = SWdn200*swradcorr 744 ENDIF 745 CALL histwrite_phy(o_SWdn200, zx_tmp_fi2d) 746 747 748 IF (vars_defined) THEN 749 zx_tmp_fi2d = SWdn200clr*swradcorr 750 ENDIF 751 CALL histwrite_phy(o_SWdn200clr, zx_tmp_fi2d) 752 722 753 CALL histwrite_phy(o_LWup200, LWup200) 723 754 CALL histwrite_phy(o_LWup200clr, LWup200clr) 724 755 CALL histwrite_phy(o_LWdn200, LWdn200) 725 756 CALL histwrite_phy(o_LWdn200clr, LWdn200clr) 726 CALL histwrite_phy(o_sols, solsw*swradcorr) 727 CALL histwrite_phy(o_sols0, solsw0*swradcorr) 757 758 IF (vars_defined) THEN 759 zx_tmp_fi2d = solsw*swradcorr 760 ENDIF 761 CALL histwrite_phy(o_sols, zx_tmp_fi2d) 762 763 764 IF (vars_defined) THEN 765 zx_tmp_fi2d = solsw0*swradcorr 766 ENDIF 767 CALL histwrite_phy(o_sols0, zx_tmp_fi2d) 728 768 CALL histwrite_phy(o_soll, sollw) 729 769 CALL histwrite_phy(o_soll0, sollw0) … … 896 936 CALL histwrite_phy(o_cldt, cldt) 897 937 CALL histwrite_phy(o_JrNt, JrNt) 898 CALL histwrite_phy(o_cldljn, cldl*JrNt) 899 CALL histwrite_phy(o_cldmjn, cldm*JrNt) 900 CALL histwrite_phy(o_cldhjn, cldh*JrNt) 901 CALL histwrite_phy(o_cldtjn, cldt*JrNt) 938 939 IF (vars_defined) zx_tmp_fi2d=cldl*JrNt 940 CALL histwrite_phy(o_cldljn, zx_tmp_fi2d) 941 942 IF (vars_defined) zx_tmp_fi2d=cldm*JrNt 943 CALL histwrite_phy(o_cldmjn, zx_tmp_fi2d) 944 945 IF (vars_defined) zx_tmp_fi2d=cldh*JrNt 946 CALL histwrite_phy(o_cldhjn, zx_tmp_fi2d) 947 948 IF (vars_defined) zx_tmp_fi2d=cldt*JrNt 949 CALL histwrite_phy(o_cldtjn, zx_tmp_fi2d) 950 902 951 CALL histwrite_phy(o_cldq, cldq) 903 952 IF (vars_defined) zx_tmp_fi2d(1:klon) = flwp(1:klon) … … 1050 1099 CALL histwrite_phy(o_alp_wk, alp_wake) 1051 1100 IF (iflag_pbl_split>=1) THEN 1101 !ym warning : dtvdf_x, dtvdf_w, dqvdf_x, dqvdf_w are not defined by model 1102 !ym => init to 0 in phys_local_var_mod 1052 1103 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=dtvdf_x(1:klon,1:klev)/pdtphys 1053 1104 CALL histwrite_phy(o_dtvdf_x ,zx_tmp_fi3d) … … 1085 1136 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_wake(1:klon,1:klev)/pdtphys 1086 1137 CALL histwrite_phy(o_dqwak, zx_tmp_fi3d) 1087 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1138 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1088 1139 CALL histwrite_phy(o_dqwak2d, zx_tmp_fi2d) 1089 1140 ENDIF ! iflag_wake>=1 … … 1251 1302 1252 1303 ! ThL -- In the following, we assume read_climoz == 1 1253 zx_tmp_fi2d = 0.0 ! Computation for strato, added ThL 1254 DO k=1, klev 1255 zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + wo(:,k,1) * stratomask(:,k) * 1.e3 1256 END DO 1304 IF (vars_defined) THEN 1305 zx_tmp_fi2d = 0.0 ! Computation for strato, added ThL 1306 DO k=1, klev 1307 zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + wo(:,k,1) * stratomask(:,k) * 1.e3 1308 END DO 1309 ENDIF 1257 1310 CALL histwrite_phy(o_col_O3_strato, zx_tmp_fi2d) ! Added ThL 1258 zx_tmp_fi2d = 0.0 ! Computation for tropo, added ThL 1259 DO k=1, klev 1260 zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + wo(:,k,1) * (1.0-stratomask(:,k)) * 1.e3 1261 END DO 1311 1312 IF (vars_defined) THEN 1313 zx_tmp_fi2d = 0.0 ! Computation for tropo, added ThL 1314 DO k=1, klev 1315 zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + wo(:,k,1) * (1.0-stratomask(:,k)) * 1.e3 1316 END DO 1317 ENDIF 1262 1318 CALL histwrite_phy(o_col_O3_tropo, zx_tmp_fi2d) ! Added ThL 1263 1319 ! end add ThL … … 1296 1352 #endif 1297 1353 IF (ok_ade) THEN 1298 CALL histwrite_phy(o_topswad, topswad_aero*swradcorr) 1299 CALL histwrite_phy(o_topswad0, topswad0_aero*swradcorr) 1300 CALL histwrite_phy(o_solswad, solswad_aero*swradcorr) 1301 CALL histwrite_phy(o_solswad0, solswad0_aero*swradcorr) 1354 IF (vars_defined) zx_tmp_fi2d(:)=topswad_aero*swradcorr 1355 CALL histwrite_phy(o_topswad, zx_tmp_fi2d) 1356 1357 IF (vars_defined) zx_tmp_fi2d(:)=topswad0_aero*swradcorr 1358 CALL histwrite_phy(o_topswad0, zx_tmp_fi2d) 1359 1360 IF (vars_defined) zx_tmp_fi2d(:)=solswad_aero*swradcorr 1361 CALL histwrite_phy(o_solswad, zx_tmp_fi2d) 1362 1363 IF (vars_defined) zx_tmp_fi2d(:)=solswad0_aero*swradcorr 1364 CALL histwrite_phy(o_solswad0, zx_tmp_fi2d) 1365 1302 1366 IF (type_trac .ne. 'inca') THEN 1303 1367 IF (config_inca .ne. 'aeNP') THEN … … 1310 1374 !====MS forcing diagnostics 1311 1375 IF (new_aod) THEN 1312 zx_tmp_fi2d(:)=topsw_aero(:,1)*swradcorr(:) 1376 !ym warning : topsw_aero, solsw_aero, topsw0_aero, solsw0_aero are not defined by model 1377 !ym => init to 0 in radlwsw_m.F90 ztopsw_aero, zsolsw_aero, ztopsw0_aero, zsolsw0_aero 1378 1379 IF (vars_defined) zx_tmp_fi2d(:)=topsw_aero(:,1)*swradcorr(:) 1313 1380 CALL histwrite_phy(o_swtoaas_nat,zx_tmp_fi2d) 1314 zx_tmp_fi2d(:)=solsw_aero(:,1)*swradcorr(:)1381 IF (vars_defined) zx_tmp_fi2d(:)=solsw_aero(:,1)*swradcorr(:) 1315 1382 CALL histwrite_phy(o_swsrfas_nat,zx_tmp_fi2d) 1316 zx_tmp_fi2d(:)=topsw0_aero(:,1)*swradcorr(:)1383 IF (vars_defined) zx_tmp_fi2d(:)=topsw0_aero(:,1)*swradcorr(:) 1317 1384 CALL histwrite_phy(o_swtoacs_nat,zx_tmp_fi2d) 1318 zx_tmp_fi2d(:)=solsw0_aero(:,1)*swradcorr(:)1385 IF (vars_defined) zx_tmp_fi2d(:)=solsw0_aero(:,1)*swradcorr(:) 1319 1386 CALL histwrite_phy(o_swsrfcs_nat,zx_tmp_fi2d) 1320 1387 !ant 1321 zx_tmp_fi2d(:)=topsw_aero(:,2)*swradcorr(:)1388 IF (vars_defined) zx_tmp_fi2d(:)=topsw_aero(:,2)*swradcorr(:) 1322 1389 CALL histwrite_phy(o_swtoaas_ant,zx_tmp_fi2d) 1323 zx_tmp_fi2d(:)=solsw_aero(:,2)*swradcorr(:)1390 IF (vars_defined) zx_tmp_fi2d(:)=solsw_aero(:,2)*swradcorr(:) 1324 1391 CALL histwrite_phy(o_swsrfas_ant,zx_tmp_fi2d) 1325 zx_tmp_fi2d(:)=topsw0_aero(:,2)*swradcorr(:)1392 IF (vars_defined) zx_tmp_fi2d(:)=topsw0_aero(:,2)*swradcorr(:) 1326 1393 CALL histwrite_phy(o_swtoacs_ant,zx_tmp_fi2d) 1327 zx_tmp_fi2d(:)=solsw0_aero(:,2)*swradcorr(:)1394 IF (vars_defined) zx_tmp_fi2d(:)=solsw0_aero(:,2)*swradcorr(:) 1328 1395 CALL histwrite_phy(o_swsrfcs_ant,zx_tmp_fi2d) 1329 1396 !cf 1330 1397 IF (.not. aerosol_couple) THEN 1331 zx_tmp_fi2d(:)=topswcf_aero(:,1)*swradcorr(:)1398 IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,1)*swradcorr(:) 1332 1399 CALL histwrite_phy(o_swtoacf_nat,zx_tmp_fi2d) 1333 zx_tmp_fi2d(:)=solswcf_aero(:,1)*swradcorr(:)1400 IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,1)*swradcorr(:) 1334 1401 CALL histwrite_phy(o_swsrfcf_nat,zx_tmp_fi2d) 1335 zx_tmp_fi2d(:)=topswcf_aero(:,2)*swradcorr(:)1402 IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,2)*swradcorr(:) 1336 1403 CALL histwrite_phy(o_swtoacf_ant,zx_tmp_fi2d) 1337 zx_tmp_fi2d(:)=solswcf_aero(:,2)*swradcorr(:)1404 IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,2)*swradcorr(:) 1338 1405 CALL histwrite_phy(o_swsrfcf_ant,zx_tmp_fi2d) 1339 zx_tmp_fi2d(:)=topswcf_aero(:,3)*swradcorr(:)1406 IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,3)*swradcorr(:) 1340 1407 CALL histwrite_phy(o_swtoacf_zero,zx_tmp_fi2d) 1341 zx_tmp_fi2d(:)=solswcf_aero(:,3)*swradcorr(:)1408 IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,3)*swradcorr(:) 1342 1409 CALL histwrite_phy(o_swsrfcf_zero,zx_tmp_fi2d) 1343 1410 ENDIF … … 1346 1413 ENDIF 1347 1414 IF (ok_aie) THEN 1348 CALL histwrite_phy(o_topswai, topswai_aero*swradcorr) 1349 CALL histwrite_phy(o_toplwai, toplwai_aero*swradcorr) 1350 CALL histwrite_phy(o_solswai, solswai_aero*swradcorr) 1351 CALL histwrite_phy(o_sollwai, sollwai_aero*swradcorr) 1415 IF (vars_defined) zx_tmp_fi2d(:)= topswai_aero*swradcorr 1416 CALL histwrite_phy(o_topswai, zx_tmp_fi2d) 1417 1418 IF (vars_defined) zx_tmp_fi2d(:)=toplwai_aero*swradcorr 1419 CALL histwrite_phy(o_toplwai, zx_tmp_fi2d) 1420 1421 IF (vars_defined) zx_tmp_fi2d(:)=solswai_aero*swradcorr 1422 CALL histwrite_phy(o_solswai, zx_tmp_fi2d) 1423 1424 IF (vars_defined) zx_tmp_fi2d(:)=sollwai_aero*swradcorr 1425 CALL histwrite_phy(o_sollwai, zx_tmp_fi2d) 1352 1426 ENDIF 1353 1427 IF (flag_aerosol.GT.0.AND.ok_cdnc) THEN … … 1374 1448 CALL histwrite_phy(o_ovap, q_seri) 1375 1449 CALL histwrite_phy(o_oliq, ql_seri) 1376 CALL histwrite_phy(o_ocond, ql_seri+qs_seri) 1450 1451 IF (vars_defined) zx_tmp_fi3d = ql_seri+qs_seri 1452 CALL histwrite_phy(o_ocond, zx_tmp_fi3d) 1453 1377 1454 CALL histwrite_phy(o_geop, zphi) 1378 1455 CALL histwrite_phy(o_vitu, u_seri) … … 1381 1458 CALL histwrite_phy(o_pres, pplay) 1382 1459 CALL histwrite_phy(o_paprs, paprs(:,1:klev)) 1383 CALL histwrite_phy(o_zfull,zphi/RG) 1460 1461 IF (vars_defined) zx_tmp_fi3d = zphi/RG 1462 CALL histwrite_phy(o_zfull,zx_tmp_fi3d) 1384 1463 1385 1464 IF (flag_aerosol_strat.EQ.2) THEN … … 1411 1490 CALL histwrite_phy(o_rnebjn, zx_tmp_fi3d) 1412 1491 CALL histwrite_phy(o_rhum, zx_rh) 1413 CALL histwrite_phy(o_ozone, & 1414 wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd) 1492 1493 IF (vars_defined) zx_tmp_fi3d = wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd 1494 CALL histwrite_phy(o_ozone, zx_tmp_fi3d) 1415 1495 1416 1496 IF (read_climoz == 2) THEN 1417 CALL histwrite_phy(o_ozone_light, &1418 wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd)1497 IF (vars_defined) zx_tmp_fi3d = wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd 1498 CALL histwrite_phy(o_ozone_light, zx_tmp_fi3d) 1419 1499 ENDIF 1420 1500 … … 1424 1504 1425 1505 CALL histwrite_phy(o_dqphy, d_qx(:,:,ivap)) 1426 CALL water_int(klon,klev,d_qx(:,:,ivap),zmasse,zx_tmp_fi2d)1506 IF (vars_defined) CALL water_int(klon,klev,d_qx(:,:,ivap),zmasse,zx_tmp_fi2d) 1427 1507 CALL histwrite_phy(o_dqphy2d, zx_tmp_fi2d) 1428 1508 1429 1509 CALL histwrite_phy(o_dqlphy, d_qx(:,:,iliq)) 1430 CALL water_int(klon,klev,d_qx(:,:,iliq),zmasse,zx_tmp_fi2d)1510 IF (vars_defined) CALL water_int(klon,klev,d_qx(:,:,iliq),zmasse,zx_tmp_fi2d) 1431 1511 CALL histwrite_phy(o_dqlphy2d, zx_tmp_fi2d) 1432 1512 1433 1513 IF (nqo.EQ.3) THEN 1434 1514 CALL histwrite_phy(o_dqsphy, d_qx(:,:,isol)) 1435 CALL water_int(klon,klev,d_qx(:,:,isol),zmasse,zx_tmp_fi2d)1515 IF (vars_defined) CALL water_int(klon,klev,d_qx(:,:,isol),zmasse,zx_tmp_fi2d) 1436 1516 CALL histwrite_phy(o_dqsphy2d, zx_tmp_fi2d) 1437 1517 ELSE … … 1518 1598 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys 1519 1599 CALL histwrite_phy(o_dqcon, zx_tmp_fi3d) 1520 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1600 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1521 1601 CALL histwrite_phy(o_dqcon2d, zx_tmp_fi2d) 1522 1602 … … 1540 1620 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys 1541 1621 CALL histwrite_phy(o_dqlsc, zx_tmp_fi3d) 1542 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1622 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1543 1623 CALL histwrite_phy(o_dqlsc2d, zx_tmp_fi2d) 1544 1624 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=beta_prec(1:klon,1:klev) … … 1553 1633 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_lscth(1:klon,1:klev)/pdtphys 1554 1634 CALL histwrite_phy(o_dqlscth, zx_tmp_fi3d) 1555 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1635 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1556 1636 CALL histwrite_phy(o_dqlscth2d, zx_tmp_fi2d) 1557 1637 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_lscst(1:klon,1:klev)/pdtphys 1558 1638 CALL histwrite_phy(o_dqlscst, zx_tmp_fi3d) 1559 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1639 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1560 1640 CALL histwrite_phy(o_dqlscst2d, zx_tmp_fi2d) 1561 1641 CALL histwrite_phy(o_plulth, plul_th) … … 1587 1667 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_vdf(1:klon,1:klev)/pdtphys 1588 1668 CALL histwrite_phy(o_dqvdf, zx_tmp_fi3d) 1589 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1669 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1590 1670 CALL histwrite_phy(o_dqvdf2d, zx_tmp_fi2d) 1591 1671 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_eva(1:klon,1:klev)/pdtphys … … 1593 1673 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_eva(1:klon,1:klev)/pdtphys 1594 1674 CALL histwrite_phy(o_dqeva, zx_tmp_fi3d) 1595 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1675 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1596 1676 CALL histwrite_phy(o_dqeva2d, zx_tmp_fi2d) 1597 1677 zpt_conv = 0. … … 1634 1714 ENDIF 1635 1715 CALL histwrite_phy(o_dqthe, zx_tmp_fi3d) 1636 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1716 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1637 1717 CALL histwrite_phy(o_dqthe2d, zx_tmp_fi2d) 1638 1718 ENDIF !iflag_thermals … … 1641 1721 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_ajsb(1:klon,1:klev)/pdtphys 1642 1722 CALL histwrite_phy(o_dqajs, zx_tmp_fi3d) 1643 CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d)1723 IF (vars_defined) CALL water_int(klon,klev,zx_tmp_fi3d,zmasse,zx_tmp_fi2d) 1644 1724 CALL histwrite_phy(o_dqajs2d, zx_tmp_fi2d) 1645 1725 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_swr(1:klon,1:klev)/pdtphys … … 1677 1757 1678 1758 IF (ok_hines) THEN 1679 CALL histwrite_phy(o_du_gwd_hines, du_gwd_hines/pdtphys) 1680 CALL histwrite_phy(o_dv_gwd_hines, dv_gwd_hines/pdtphys) 1759 IF (vars_defined) zx_tmp_fi3d=du_gwd_hines/pdtphys 1760 CALL histwrite_phy(o_du_gwd_hines, zx_tmp_fi3d) 1761 1762 IF (vars_defined) zx_tmp_fi3d= dv_gwd_hines/pdtphys 1763 CALL histwrite_phy(o_dv_gwd_hines, zx_tmp_fi3d) 1764 1681 1765 IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_hin(1:klon,1:klev)/pdtphys 1682 1766 CALL histwrite_phy(o_dthin, zx_tmp_fi3d) … … 1686 1770 1687 1771 IF (.not. ok_hines .and. ok_gwd_rando) THEN 1688 CALL histwrite_phy(o_du_gwd_front, du_gwd_front / pdtphys) 1689 CALL histwrite_phy(o_dv_gwd_front, dv_gwd_front / pdtphys) 1772 IF (vars_defined) zx_tmp_fi3d=du_gwd_front / pdtphys 1773 CALL histwrite_phy(o_du_gwd_front, zx_tmp_fi3d) 1774 1775 IF (vars_defined) zx_tmp_fi3d=dv_gwd_front / pdtphys 1776 CALL histwrite_phy(o_dv_gwd_front, zx_tmp_fi3d) 1777 1690 1778 CALL histwrite_phy(o_ustr_gwd_front, zustr_gwd_front) 1691 1779 CALL histwrite_phy(o_vstr_gwd_front, zvstr_gwd_front) … … 1693 1781 1694 1782 IF (ok_gwd_rando) THEN 1695 CALL histwrite_phy(o_du_gwd_rando, du_gwd_rando / pdtphys) 1696 CALL histwrite_phy(o_dv_gwd_rando, dv_gwd_rando / pdtphys) 1783 IF (vars_defined) zx_tmp_fi3d=du_gwd_rando / pdtphys 1784 CALL histwrite_phy(o_du_gwd_rando, zx_tmp_fi3d) 1785 1786 IF (vars_defined) zx_tmp_fi3d=dv_gwd_rando / pdtphys 1787 CALL histwrite_phy(o_dv_gwd_rando, zx_tmp_fi3d) 1697 1788 CALL histwrite_phy(o_ustr_gwd_rando, zustr_gwd_rando) 1698 1789 CALL histwrite_phy(o_vstr_gwd_rando, zvstr_gwd_rando) … … 1702 1793 1703 1794 IF (ok_qch4) THEN 1704 CALL histwrite_phy(o_dqch4, d_q_ch4 / pdtphys) 1705 ENDIF 1706 1707 DO k=1, klevp1 1708 zx_tmp_fi3d1(:,k)=swup(:,k)*swradcorr(:) 1709 ENDDO 1795 IF (vars_defined) zx_tmp_fi3d=d_q_ch4 / pdtphys 1796 CALL histwrite_phy(o_dqch4, zx_tmp_fi3d) 1797 ENDIF 1798 1799 IF (vars_defined) THEN 1800 DO k=1, klevp1 1801 zx_tmp_fi3d1(:,k)=swup(:,k)*swradcorr(:) 1802 ENDDO 1803 ENDIF 1804 1710 1805 CALL histwrite_phy(o_rsu, zx_tmp_fi3d1) 1711 DO k=1, klevp1 1712 zx_tmp_fi3d1(:,k)=swdn(:,k)*swradcorr(:) 1713 ENDDO 1806 1807 1808 IF (vars_defined) THEN 1809 DO k=1, klevp1 1810 zx_tmp_fi3d1(:,k)=swdn(:,k)*swradcorr(:) 1811 ENDDO 1812 ENDIF 1813 1714 1814 CALL histwrite_phy(o_rsd, zx_tmp_fi3d1) 1715 DO k=1, klevp1 1716 zx_tmp_fi3d1(:,k)=swup0(:,k)*swradcorr(:) 1717 ENDDO 1815 1816 IF (vars_defined) THEN 1817 DO k=1, klevp1 1818 zx_tmp_fi3d1(:,k)=swup0(:,k)*swradcorr(:) 1819 ENDDO 1820 ENDIF 1821 1718 1822 CALL histwrite_phy(o_rsucs, zx_tmp_fi3d1) 1719 DO k=1, klevp1 1720 zx_tmp_fi3d1(:,k)=swdn0(:,k)*swradcorr(:) 1721 ENDDO 1823 1824 IF (vars_defined) THEN 1825 DO k=1, klevp1 1826 zx_tmp_fi3d1(:,k)=swdn0(:,k)*swradcorr(:) 1827 ENDDO 1828 ENDIF 1722 1829 CALL histwrite_phy(o_rsdcs, zx_tmp_fi3d1) 1723 1830 … … 1773 1880 ELSE IF (iflag_con == 2) THEN 1774 1881 CALL histwrite_phy(o_mcd, pmfd) 1775 CALL histwrite_phy(o_dmc, pmfu + pmfd) 1882 IF (vars_defined) zx_tmp_fi3d = pmfu + pmfd 1883 CALL histwrite_phy(o_dmc, zx_tmp_fi3d) 1776 1884 ENDIF 1777 1885 CALL histwrite_phy(o_ref_liq, ref_liq) … … 1954 2062 IF (type_trac == 'lmdz' .OR. type_trac == 'repr' .OR. type_trac == 'coag') THEN 1955 2063 !--3D fields 1956 CALL histwrite_phy(o_trac(iq-nqo), tr_seri(:,:,iq-nqo))1957 CALL histwrite_phy(o_dtr_vdf(iq-nqo),d_tr_cl(:,:,iq-nqo))1958 CALL histwrite_phy(o_dtr_the(iq-nqo),d_tr_th(:,:,iq-nqo))1959 CALL histwrite_phy(o_dtr_con(iq-nqo),d_tr_cv(:,:,iq-nqo))1960 CALL histwrite_phy(o_dtr_lessi_impa(iq-nqo),d_tr_lessi_impa(:,:,iq-nqo))1961 CALL histwrite_phy(o_dtr_lessi_nucl(iq-nqo),d_tr_lessi_nucl(:,:,iq-nqo))1962 CALL histwrite_phy(o_dtr_insc(iq-nqo),d_tr_insc(:,:,iq-nqo))1963 CALL histwrite_phy(o_dtr_bcscav(iq-nqo),d_tr_bcscav(:,:,iq-nqo))1964 CALL histwrite_phy(o_dtr_evapls(iq-nqo),d_tr_evapls(:,:,iq-nqo))1965 CALL histwrite_phy(o_dtr_ls(iq-nqo),d_tr_ls(:,:,iq-nqo))1966 CALL histwrite_phy(o_dtr_trsp(iq-nqo),d_tr_trsp(:,:,iq-nqo))1967 CALL histwrite_phy(o_dtr_sscav(iq-nqo),d_tr_sscav(:,:,iq-nqo))1968 CALL histwrite_phy(o_dtr_sat(iq-nqo),d_tr_sat(:,:,iq-nqo))1969 CALL histwrite_phy(o_dtr_uscav(iq-nqo),d_tr_uscav(:,:,iq-nqo))2064 ! CALL histwrite_phy(o_trac(iq-nqo), tr_seri(:,:,iq-nqo)) 2065 ! CALL histwrite_phy(o_dtr_vdf(iq-nqo),d_tr_cl(:,:,iq-nqo)) 2066 ! CALL histwrite_phy(o_dtr_the(iq-nqo),d_tr_th(:,:,iq-nqo)) 2067 ! CALL histwrite_phy(o_dtr_con(iq-nqo),d_tr_cv(:,:,iq-nqo)) 2068 ! CALL histwrite_phy(o_dtr_lessi_impa(iq-nqo),d_tr_lessi_impa(:,:,iq-nqo)) 2069 ! CALL histwrite_phy(o_dtr_lessi_nucl(iq-nqo),d_tr_lessi_nucl(:,:,iq-nqo)) 2070 ! CALL histwrite_phy(o_dtr_insc(iq-nqo),d_tr_insc(:,:,iq-nqo)) 2071 ! CALL histwrite_phy(o_dtr_bcscav(iq-nqo),d_tr_bcscav(:,:,iq-nqo)) 2072 ! CALL histwrite_phy(o_dtr_evapls(iq-nqo),d_tr_evapls(:,:,iq-nqo)) 2073 ! CALL histwrite_phy(o_dtr_ls(iq-nqo),d_tr_ls(:,:,iq-nqo)) 2074 ! CALL histwrite_phy(o_dtr_trsp(iq-nqo),d_tr_trsp(:,:,iq-nqo)) 2075 ! CALL histwrite_phy(o_dtr_sscav(iq-nqo),d_tr_sscav(:,:,iq-nqo)) 2076 ! CALL histwrite_phy(o_dtr_sat(iq-nqo),d_tr_sat(:,:,iq-nqo)) 2077 ! CALL histwrite_phy(o_dtr_uscav(iq-nqo),d_tr_uscav(:,:,iq-nqo)) 1970 2078 !--2D fields 1971 CALL histwrite_phy(o_dtr_dry(iq-nqo), flux_tr_dry(:,iq-nqo))2079 ! CALL histwrite_phy(o_dtr_dry(iq-nqo), flux_tr_dry(:,iq-nqo)) 1972 2080 zx_tmp_fi2d=0. 1973 2081 IF (vars_defined) THEN … … 1976 2084 ENDDO 1977 2085 ENDIF 1978 CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d)2086 ! CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d) 1979 2087 ENDIF 1980 2088 ENDDO -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/phys_state_var_mod.F90
r3312 r3406 607 607 du_gwd_rando(:,:)=0. 608 608 ENDIF 609 if (.not. ok_hines .and. ok_gwd_rando) allocate(du_gwd_front(klon, klev)) 610 609 IF (.not. ok_hines .and. ok_gwd_rando) THEN 610 ALLOCATE(du_gwd_front(klon, klev)) 611 du_gwd_front(:,:) = 0 !ym missing init 612 ENDIF 611 613 END SUBROUTINE phys_state_var_init 612 614 -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/physiq_mod.F90
r3322 r3406 25 25 USE dimphy 26 26 USE infotrac_phy, ONLY: nqtot, nbtr, nqo, type_trac 27 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev, klon_glo 27 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev, klon_glo, grid1dTo2d_glo, grid_type, unstructured 28 28 USE mod_phys_lmdz_para 29 29 USE iophy … … 252 252 use ACAMA_GWD_rando_m, only: ACAMA_GWD_rando 253 253 USE VERTICAL_LAYERS_MOD, ONLY: aps,bps 254 USE etat0_limit_unstruct_mod 255 #ifdef CPP_XIOS 256 USE xios, ONLY: xios_update_calendar, xios_context_finalize 257 #endif 258 USE climoz_mod 259 USE limit_read_mod, ONLY : init_limit_read 260 USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz 254 261 255 262 … … 1129 1136 CALL update_time(pdtphys) 1130 1137 phys_tstep=NINT(pdtphys) 1138 #ifdef CPP_XIOS 1139 IF (.NOT. debut .AND. is_omp_master) CALL xios_update_calendar(itap+1) 1140 #endif 1131 1141 1132 1142 !====================================================================== … … 1161 1171 1162 1172 IF (first) THEN 1173 CALL init_etat0_limit_unstruct 1174 IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed) 1163 1175 !CR:nvelles variables convection/poches froides 1164 1176 … … 1184 1196 CALL phys_state_var_init(read_climoz) 1185 1197 CALL phys_output_var_init 1198 IF(read_climoz>=1 .AND. create_etat0_limit) CALL regr_horiz_time_climoz(read_climoz,ok_daily_climoz) 1199 1186 1200 print*, '=================================================' 1187 1201 ! … … 1394 1408 CALL init_iophy_new(latitude_deg,longitude_deg) 1395 1409 1396 1410 !=================================================================== 1411 !IM stations CFMIP 1412 nCFMIP=npCFMIP 1413 OPEN(98,file='npCFMIP_param.data',status='old', & 1414 form='formatted',iostat=iostat) 1415 IF (iostat == 0) THEN 1416 READ(98,*,end=998) nCFMIP 1417 998 CONTINUE 1418 CLOSE(98) 1419 CONTINUE 1420 IF(nCFMIP.GT.npCFMIP) THEN 1421 print*,'nCFMIP > npCFMIP : augmenter npCFMIP et recompiler' 1422 CALL abort_physic("physiq", "", 1) 1423 ELSE 1424 print*,'physiq npCFMIP=',npCFMIP,'nCFMIP=',nCFMIP 1425 ENDIF 1426 1427 ! 1428 ALLOCATE(tabCFMIP(nCFMIP)) 1429 ALLOCATE(lonCFMIP(nCFMIP), latCFMIP(nCFMIP)) 1430 ALLOCATE(tabijGCM(nCFMIP)) 1431 ALLOCATE(lonGCM(nCFMIP), latGCM(nCFMIP)) 1432 ALLOCATE(iGCM(nCFMIP), jGCM(nCFMIP)) 1433 ! 1434 ! lecture des nCFMIP stations CFMIP, de leur numero 1435 ! et des coordonnees geographiques lonCFMIP, latCFMIP 1436 ! 1437 CALL read_CFMIP_point_locations(nCFMIP, tabCFMIP, & 1438 lonCFMIP, latCFMIP) 1439 ! 1440 ! identification des 1441 ! 1) coordonnees lonGCM, latGCM des points CFMIP dans la 1442 ! grille de LMDZ 1443 ! 2) indices points tabijGCM de la grille physique 1d sur 1444 ! klon points 1445 ! 3) indices iGCM, jGCM de la grille physique 2d 1446 ! 1447 CALL LMDZ_CFMIP_point_locations(nCFMIP, lonCFMIP, latCFMIP, & 1448 tabijGCM, lonGCM, latGCM, iGCM, jGCM) 1449 ! 1450 ELSE 1451 ALLOCATE(tabijGCM(0)) 1452 ALLOCATE(lonGCM(0), latGCM(0)) 1453 ALLOCATE(iGCM(0), jGCM(0)) 1454 ENDIF 1455 1456 #ifdef CPP_IOIPSL 1457 1458 !$OMP MASTER 1459 ! FH : if ok_sync=.true. , the time axis is written at each time step 1460 ! in the output files. Only at the end in the opposite case 1461 ok_sync_omp=.false. 1462 CALL getin('ok_sync',ok_sync_omp) 1463 CALL phys_output_open(longitude_deg,latitude_deg,nCFMIP,tabijGCM, & 1464 iGCM,jGCM,lonGCM,latGCM, & 1465 jjmp1,nlevSTD,clevSTD,rlevSTD, phys_tstep,ok_veget, & 1466 type_ocean,iflag_pbl,iflag_pbl_split,ok_mensuel,ok_journe, & 1467 ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, & 1468 read_climoz, phys_out_filestations, & 1469 new_aod, aerosol_couple, & 1470 flag_aerosol_strat, pdtphys, paprs, pphis, & 1471 pplay, lmax_th, ptconv, ptconvth, ivap, & 1472 d_u, d_t, qx, d_qx, zmasse, ok_sync_omp) 1473 !$OMP END MASTER 1474 !$OMP BARRIER 1475 ok_sync=ok_sync_omp 1476 1477 freq_outNMC(1) = ecrit_files(7) 1478 freq_outNMC(2) = ecrit_files(8) 1479 freq_outNMC(3) = ecrit_files(9) 1480 WRITE(lunout,*)'OK freq_outNMC(1)=',freq_outNMC(1) 1481 WRITE(lunout,*)'OK freq_outNMC(2)=',freq_outNMC(2) 1482 WRITE(lunout,*)'OK freq_outNMC(3)=',freq_outNMC(3) 1483 1484 #ifndef CPP_XIOS 1485 CALL ini_paramLMDZ_phy(phys_tstep,nid_ctesGCM) 1486 #endif 1487 1488 #endif 1489 ecrit_reg = ecrit_reg * un_jour 1490 ecrit_tra = ecrit_tra * un_jour 1491 1492 !XXXPB Positionner date0 pour initialisation de ORCHIDEE 1493 date0 = jD_ref 1494 WRITE(*,*) 'physiq date0 : ',date0 1495 ! 1496 1497 ! CALL create_climoz(read_climoz) 1498 1499 CALL phys_output_write(itap, pdtphys, paprs, pphis, & 1500 pplay, lmax_th, aerosol_couple, & 1501 ok_ade, ok_aie, ivap, iliq, isol, new_aod, ok_sync,& 1502 ptconv, read_climoz, clevSTD, & 1503 ptconvth, d_u, d_t, qx, d_qx, zmasse, & 1504 flag_aerosol, flag_aerosol_strat, ok_cdnc) 1505 1506 #ifdef CPP_XIOS 1507 IF (is_omp_master) CALL xios_update_calendar(1) 1508 #endif 1509 IF(read_climoz>=1 .AND. create_etat0_limit) CALL regr_horiz_time_climoz(read_climoz,ok_daily_climoz) 1510 CALL create_etat0_limit_unstruct 1397 1511 CALL phyetat0 ("startphy.nc",clesphy0,tabcntr0) 1512 1398 1513 !jyg< 1399 1514 IF (klon_glo==1) THEN … … 1405 1520 ENDDO 1406 1521 ENDDO 1522 ELSE 1523 pbl_tke(:,:,is_ave) = 0. !ym missing init : maybe must be initialized in the same way that for klon_glo==1 ?? 1407 1524 !>jyg 1408 1525 ENDIF … … 1421 1538 ENDIF 1422 1539 1423 CALL printflag( tabcntr0,radpas,ok_journe, &1424 ok_instan, ok_region )1425 !1426 1540 ! IF (ABS(phys_tstep-pdtphys).GT.0.001) THEN 1427 1541 ! WRITE(lunout,*) 'Pas physique n est pas correct',phys_tstep, & … … 1506 1620 ! enddo 1507 1621 1508 !=================================================================== 1509 !IM stations CFMIP 1510 nCFMIP=npCFMIP 1511 OPEN(98,file='npCFMIP_param.data',status='old', & 1512 form='formatted',iostat=iostat) 1513 IF (iostat == 0) THEN 1514 READ(98,*,end=998) nCFMIP 1515 998 CONTINUE 1516 CLOSE(98) 1517 CONTINUE 1518 IF(nCFMIP.GT.npCFMIP) THEN 1519 print*,'nCFMIP > npCFMIP : augmenter npCFMIP et recompiler' 1520 CALL abort_physic("physiq", "", 1) 1521 ELSE 1522 print*,'physiq npCFMIP=',npCFMIP,'nCFMIP=',nCFMIP 1523 ENDIF 1524 1525 ! 1526 ALLOCATE(tabCFMIP(nCFMIP)) 1527 ALLOCATE(lonCFMIP(nCFMIP), latCFMIP(nCFMIP)) 1528 ALLOCATE(tabijGCM(nCFMIP)) 1529 ALLOCATE(lonGCM(nCFMIP), latGCM(nCFMIP)) 1530 ALLOCATE(iGCM(nCFMIP), jGCM(nCFMIP)) 1531 ! 1532 ! lecture des nCFMIP stations CFMIP, de leur numero 1533 ! et des coordonnees geographiques lonCFMIP, latCFMIP 1534 ! 1535 CALL read_CFMIP_point_locations(nCFMIP, tabCFMIP, & 1536 lonCFMIP, latCFMIP) 1537 ! 1538 ! identification des 1539 ! 1) coordonnees lonGCM, latGCM des points CFMIP dans la 1540 ! grille de LMDZ 1541 ! 2) indices points tabijGCM de la grille physique 1d sur 1542 ! klon points 1543 ! 3) indices iGCM, jGCM de la grille physique 2d 1544 ! 1545 CALL LMDZ_CFMIP_point_locations(nCFMIP, lonCFMIP, latCFMIP, & 1546 tabijGCM, lonGCM, latGCM, iGCM, jGCM) 1547 ! 1548 ELSE 1549 ALLOCATE(tabijGCM(0)) 1550 ALLOCATE(lonGCM(0), latGCM(0)) 1551 ALLOCATE(iGCM(0), jGCM(0)) 1552 ENDIF 1553 ELSE 1554 ALLOCATE(tabijGCM(0)) 1555 ALLOCATE(lonGCM(0), latGCM(0)) 1556 ALLOCATE(iGCM(0), jGCM(0)) 1622 !ELSE 1623 ! ALLOCATE(tabijGCM(0)) 1624 ! ALLOCATE(lonGCM(0), latGCM(0)) 1625 ! ALLOCATE(iGCM(0), jGCM(0)) 1557 1626 ENDIF 1558 1627 … … 1642 1711 #endif 1643 1712 1644 #ifdef CPP_IOIPSL 1645 1646 !$OMP MASTER 1647 ! FH : if ok_sync=.true. , the time axis is written at each time step 1648 ! in the output files. Only at the end in the opposite case 1649 ok_sync_omp=.false. 1650 CALL getin('ok_sync',ok_sync_omp) 1651 CALL phys_output_open(longitude_deg,latitude_deg,nCFMIP,tabijGCM, & 1652 iGCM,jGCM,lonGCM,latGCM, & 1653 jjmp1,nlevSTD,clevSTD,rlevSTD, phys_tstep,ok_veget, & 1654 type_ocean,iflag_pbl,iflag_pbl_split,ok_mensuel,ok_journe, & 1655 ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, & 1656 read_climoz, phys_out_filestations, & 1657 new_aod, aerosol_couple, & 1658 flag_aerosol_strat, pdtphys, paprs, pphis, & 1659 pplay, lmax_th, ptconv, ptconvth, ivap, & 1660 d_u, d_t, qx, d_qx, zmasse, ok_sync_omp) 1661 !$OMP END MASTER 1662 !$OMP BARRIER 1663 ok_sync=ok_sync_omp 1664 1665 freq_outNMC(1) = ecrit_files(7) 1666 freq_outNMC(2) = ecrit_files(8) 1667 freq_outNMC(3) = ecrit_files(9) 1668 WRITE(lunout,*)'OK freq_outNMC(1)=',freq_outNMC(1) 1669 WRITE(lunout,*)'OK freq_outNMC(2)=',freq_outNMC(2) 1670 WRITE(lunout,*)'OK freq_outNMC(3)=',freq_outNMC(3) 1671 1672 #ifndef CPP_XIOS 1673 CALL ini_paramLMDZ_phy(phys_tstep,nid_ctesGCM) 1674 #endif 1675 1676 #endif 1677 ecrit_reg = ecrit_reg * un_jour 1678 ecrit_tra = ecrit_tra * un_jour 1679 1680 !XXXPB Positionner date0 pour initialisation de ORCHIDEE 1681 date0 = jD_ref 1682 WRITE(*,*) 'physiq date0 : ',date0 1713 1714 CALL printflag( tabcntr0,radpas,ok_journe, & 1715 ok_instan, ok_region ) 1683 1716 ! 1684 1717 ! … … 2207 2240 ! 2208 2241 !-------gustiness calculation-------! 2242 !ym : Warning gustiness non inialized for iflag_gusts=2 & iflag_gusts=3 2243 gustiness=0 !ym missing init 2244 2209 2245 IF (iflag_gusts==0) THEN 2210 2246 gustiness(1:klon)=0 … … 4034 4070 4035 4071 IF (.not. ok_hines .and. ok_gwd_rando) then 4072 ! ym missing init for east_gwstress & west_gwstress -> added in phys_local_var_mod 4036 4073 CALL acama_GWD_rando(PHYS_TSTEP, pplay, latitude_deg, t_seri, u_seri, & 4037 4074 v_seri, rot, zustr_gwd_front, zvstr_gwd_front, du_gwd_front, & … … 4696 4733 ! write(97) u_seri,v_seri,t_seri,q_seri 4697 4734 ! close(97) 4698 !$OMP MASTER4735 ! !$OMP MASTER 4699 4736 IF (read_climoz >= 1) THEN 4700 4737 IF (is_mpi_root) THEN … … 4704 4741 DEALLOCATE(press_cen_climoz) ! pointer 4705 4742 ENDIF 4706 !$OMP END MASTER 4743 ! !$OMP END MASTER 4744 #ifdef CPP_XIOS 4745 IF (is_omp_master) CALL xios_context_finalize 4746 #endif 4707 4747 ENDIF 4708 4748 -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/radlwsw_m.F90
r2611 r3406 384 384 cgaero(:,:,:,:)=0. 385 385 lldebug=.FALSE. 386 387 ztopsw_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4 388 ztopsw0_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4 389 zsolsw_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4 390 zsolsw0_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4 386 391 387 392 ! -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/regr_horiz_time_climoz_m.F90
r2963 r3406 2 2 3 3 USE interpolation, ONLY: locate 4 USE mod_grid_phy_lmdz, ONLY: n lon_ou => nbp_lon, nlat_ou => nbp_lat4 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, grid_type, unstructured 5 5 USE nrtype, ONLY: pi 6 6 USE netcdf, ONLY: NF90_CLOBBER, NF90_FLOAT, NF90_GET_VAR, NF90_OPEN, & … … 11 11 NF95_CLOSE, NF95_ENDDEF, NF95_PUT_ATT, NF95_PUT_VAR, NF95_COPY_ATT 12 12 USE print_control_mod, ONLY: lunout 13 USE dimphy 13 14 IMPLICIT NONE 14 15 PRIVATE … … 16 17 REAL, PARAMETER :: deg2rad=pi/180. 17 18 CHARACTER(LEN=13), PARAMETER :: vars_in(2)=['tro3 ','tro3_daylight'] 19 20 INTEGER :: nlat_ou, nlon_ou 18 21 19 22 CONTAINS … … 52 55 USE assert_m, ONLY: assert 53 56 USE cal_tools_m, ONLY: year_len, mid_month 54 USE control_mod, ONLY: anneeref 57 !! USE control_mod, ONLY: anneeref 58 USE time_phylmdz_mod, ONLY: annee_ref 55 59 USE ioipsl, ONLY: ioget_year_len, ioget_calendar 56 60 USE regr_conserv_m, ONLY: regr_conserv … … 58 62 USE regular_lonlat_mod, ONLY: boundslon_reg, boundslat_reg, south, west, east 59 63 USE slopes_m, ONLY: slopes 64 USE xios 65 USE mod_phys_lmdz_mpi_data, only: is_mpi_root 66 USE mod_phys_lmdz_para, ONLY: gather, bcast 60 67 !------------------------------------------------------------------------------- 61 68 ! Arguments: … … 83 90 CHARACTER(LEN=20) :: cal_in ! Calendar 84 91 REAL, ALLOCATABLE :: o3_in3(:,:,:,:,:) ! Ozone climatologies 92 REAL, ALLOCATABLE :: o3_in3bis(:,:,:,:,:) ! Ozone climatologies 85 93 REAL, ALLOCATABLE :: o3_in2 (:,:,:,:) ! Ozone climatologies 94 REAL, ALLOCATABLE :: o3_in2bis(:,:,:,:,:) ! Ozone climatologies 86 95 ! last index: 1 for the day-night average, 2 for the daylight field. 87 96 REAL :: NaN … … 91 100 REAL, ALLOCATABLE :: o3_regr_lonlat(:,:,:,:,:) ! (nlon_ou,nlat_ou,:,0:13 ,:) 92 101 REAL, ALLOCATABLE :: o3_out3 (:,:,:,:,:) ! (nlon_ou,nlat_ou,:,ntim_ou,:) 102 REAL, ALLOCATABLE :: o3_out3_glo (:,:,:,:) ! (nbp_lat,:,ntim_ou,:) 93 103 REAL, ALLOCATABLE :: o3_regr_lat (:,:,:,:) ! (nlat_in,:,0:13 ,:) 94 104 REAL, ALLOCATABLE :: o3_out2 (:,:,:,:) ! (nlat_ou,:,ntim_ou,:) 105 REAL, ALLOCATABLE :: o3_out2_glo (:,:,:,:) ! (nbp_lat,:,ntim_ou,:) 95 106 ! Dimension number | Interval | Contains | For variables: 96 107 ! 1 (longitude) | [rlonu(i-1), rlonu(i)] | rlonv(i) | all … … 116 127 INTEGER, ALLOCATABLE :: sta(:), cnt(:) 117 128 CHARACTER(LEN=80) :: sub, dim_nam, msg 118 !------------------------------------------------------------------------------- 119 sub="regr_horiz_time_climoz" 120 WRITE(lunout,*)"Call sequence information: "//TRIM(sub) 121 CALL assert(read_climoz == 1 .OR. read_climoz == 2, "regr_lat_time_climoz") 122 123 CALL NF95_OPEN("climoz.nc" , NF90_NOWRITE, fID_in) 124 lprev=NF90_OPEN("climoz_m.nc", NF90_NOWRITE, fID_in_m)==NF90_NOERR 125 lnext=NF90_OPEN("climoz_p.nc", NF90_NOWRITE, fID_in_p)==NF90_NOERR 126 127 !--- Get coordinates from the input file. Converts lon/lat in radians. 128 ! Few inversions because "regr_conserv" and gcm need ascending vectors. 129 CALL NF95_INQ_VARID(fID_in, vars_in(1), varid) 130 CALL NF95_INQUIRE_VARIABLE(fID_in, varid, dimids=dIDs, ndims=ndims) 131 l3D=ndims==4; l2D=ndims==3 132 IF(l3D) WRITE(lunout,*)"Input files contain full 3D ozone fields." 133 IF(l2D) WRITE(lunout,*)"Input files contain zonal 2D ozone fields." 134 DO i=1,ndims 135 CALL NF95_INQUIRE_DIMENSION(fID_in, dIDs(i), name=dim_nam, nclen=dln) 136 CALL NF95_INQ_VARID(fID_in, dim_nam, varid) 137 ii=i; IF(l2D) ii=i+1 !--- ndims==3:NO LONGITUDE 138 SELECT CASE(ii) 139 CASE(1) !--- LONGITUDE 140 CALL NF95_GW_VAR(fID_in, varid, lon_in) 141 ldec_lon=lon_in(1)>lon_in(dln); IF(ldec_lon) lon_in=lon_in(dln:1:-1) 142 nlon_in=dln; lon_in=lon_in*deg2rad 143 CASE(2) !--- LATITUDE 144 CALL NF95_GW_VAR(fID_in, varid, lat_in) 145 ldec_lat=lat_in(1)>lat_in(dln); IF(ldec_lat) lat_in=lat_in(dln:1:-1) 146 nlat_in=dln; lat_in=lat_in*deg2rad 147 CASE(3) !--- PRESSURE LEVELS 148 CALL NF95_GW_VAR(fID_in, varid, lev_in) 149 ldec_lev=lev_in(1)>lev_in(dln); IF(ldec_lev) lev_in=lev_in(dln:1:-1) 150 nlev_in=dln 151 CALL NF95_GET_ATT(fID_in, varid, "units", press_unit) 152 k=LEN_TRIM(press_unit) 153 DO WHILE(ICHAR(press_unit(k:k))==0) 154 press_unit(k:k)=' '; k=LEN_TRIM(press_unit) !--- REMOVE NULL END CHAR 155 END DO 156 IF(press_unit == "Pa") THEN 157 lev_in = lev_in/100. !--- CONVERT TO hPa 158 ELSE IF(press_unit /= "hPa") THEN 159 CALL abort_physic(sub, "the only recognized units are Pa and hPa.",1) 160 END IF 161 CASE(4) !--- TIME 162 CALL NF95_INQUIRE_DIMENSION(fID_in, dIDs(i), nclen=nmth_in) 163 cal_in='gregorian' 164 IF(NF90_GET_ATT(fID_in, varid, 'calendar', cal_in)/=NF90_NOERR) & 129 REAL :: null_array(0) 130 LOGICAL,SAVE :: first=.TRUE. 131 !$OMP THREADPRIVATE(first) 132 REAL, ALLOCATABLE :: test_o3_in(:,:) 133 REAL, ALLOCATABLE :: test_o3_out(:) 134 135 nlat_ou=nbp_lat 136 nlon_ou=nbp_lon 137 138 !------------------------------------------------------------------------------- 139 IF (is_mpi_root) THEN 140 sub="regr_horiz_time_climoz" 141 WRITE(lunout,*)"Call sequence information: "//TRIM(sub) 142 CALL assert(read_climoz == 1 .OR. read_climoz == 2, "regr_lat_time_climoz") 143 144 CALL NF95_OPEN("climoz.nc" , NF90_NOWRITE, fID_in) 145 lprev=NF90_OPEN("climoz_m.nc", NF90_NOWRITE, fID_in_m)==NF90_NOERR 146 lnext=NF90_OPEN("climoz_p.nc", NF90_NOWRITE, fID_in_p)==NF90_NOERR 147 148 !--- Get coordinates from the input file. Converts lon/lat in radians. 149 ! Few inversions because "regr_conserv" and gcm need ascending vectors. 150 CALL NF95_INQ_VARID(fID_in, vars_in(1), varid) 151 CALL NF95_INQUIRE_VARIABLE(fID_in, varid, dimids=dIDs, ndims=ndims) 152 l3D=ndims==4; l2D=ndims==3 153 IF(l3D) WRITE(lunout,*)"Input files contain full 3D ozone fields." 154 IF(l2D) WRITE(lunout,*)"Input files contain zonal 2D ozone fields." 155 DO i=1,ndims 156 CALL NF95_INQUIRE_DIMENSION(fID_in, dIDs(i), name=dim_nam, nclen=dln) 157 CALL NF95_INQ_VARID(fID_in, dim_nam, varid) 158 ii=i; IF(l2D) ii=i+1 !--- ndims==3:NO LONGITUDE 159 SELECT CASE(ii) 160 CASE(1) !--- LONGITUDE 161 CALL NF95_GW_VAR(fID_in, varid, lon_in) 162 ldec_lon=lon_in(1)>lon_in(dln); IF(ldec_lon) lon_in=lon_in(dln:1:-1) 163 nlon_in=dln; lon_in=lon_in*deg2rad 164 CASE(2) !--- LATITUDE 165 CALL NF95_GW_VAR(fID_in, varid, lat_in) 166 ldec_lat=lat_in(1)>lat_in(dln); IF(ldec_lat) lat_in=lat_in(dln:1:-1) 167 nlat_in=dln; lat_in=lat_in*deg2rad 168 CASE(3) !--- PRESSURE LEVELS 169 CALL NF95_GW_VAR(fID_in, varid, lev_in) 170 ldec_lev=lev_in(1)>lev_in(dln); IF(ldec_lev) lev_in=lev_in(dln:1:-1) 171 nlev_in=dln 172 CALL NF95_GET_ATT(fID_in, varid, "units", press_unit) 173 k=LEN_TRIM(press_unit) 174 DO WHILE(ICHAR(press_unit(k:k))==0) 175 press_unit(k:k)=' '; k=LEN_TRIM(press_unit) !--- REMOVE NULL END CHAR 176 END DO 177 IF(press_unit == "Pa") THEN 178 lev_in = lev_in/100. !--- CONVERT TO hPa 179 ELSE IF(press_unit /= "hPa") THEN 180 CALL abort_physic(sub, "the only recognized units are Pa and hPa.",1) 181 END IF 182 CASE(4) !--- TIME 183 CALL NF95_INQUIRE_DIMENSION(fID_in, dIDs(i), nclen=nmth_in) 184 cal_in='gregorian' 185 IF(NF90_GET_ATT(fID_in, varid, 'calendar', cal_in)/=NF90_NOERR) & 165 186 WRITE(lunout,*)'WARNING: missing "calendar" attribute for "'// & 166 187 TRIM(dim_nam)//'" in "climoz.nc". Choosing default: "gregorian".' 167 k=LEN_TRIM(cal_in) 168 DO WHILE(ICHAR(cal_in(k:k))==0) 169 cal_in(k:k)=' '; k=LEN_TRIM(cal_in) !--- REMOVE NULL END CHAR 188 k=LEN_TRIM(cal_in) 189 DO WHILE(ICHAR(cal_in(k:k))==0) 190 cal_in(k:k)=' '; k=LEN_TRIM(cal_in) !--- REMOVE NULL END CHAR 191 END DO 192 END SELECT 193 END DO 194 195 !--- Prepare quantities for time interpolation 196 tmidmonth=mid_month(annee_ref, cal_in) 197 IF(interpt) THEN 198 ntim_ou=ioget_year_len(annee_ref) 199 ALLOCATE(tmidday(ntim_ou)) 200 tmidday=[(REAL(k)-0.5,k=1,ntim_ou)] 201 CALL ioget_calendar(cal_ou) 202 ELSE 203 ntim_ou=14 204 cal_ou=cal_in 205 END IF 206 ENDIF 207 208 IF (grid_type==unstructured) THEN 209 CALL bcast(nlon_in) 210 CALL bcast(nlat_in) 211 CALL bcast(nlev_in) 212 CALL bcast(l3d) 213 CALL bcast(tmidmonth) 214 CALL bcast(tmidday) 215 CALL bcast(ntim_ou) 216 ENDIF 217 218 IF (is_mpi_root) THEN 219 CALL xios_set_domain_attr("domain_climoz",nj_glo=nlat_in, nj=nlat_in, jbegin=0, latvalue_1d=lat_in/deg2rad) 220 IF (l3D) THEN 221 CALL xios_set_domain_attr("domain_climoz",ni_glo=nlon_in, ni=nlon_in, ibegin=0, lonvalue_1d=lon_in/deg2rad) 222 ELSE 223 CALL xios_set_domain_attr("domain_climoz",ni_glo=8, ni=8, ibegin=0, lonvalue_1d = (/ 0.,45.,90.,135.,180.,225.,270., 315. /)) 224 ENDIF 225 ELSE 226 CALL xios_set_domain_attr("domain_climoz",nj_glo=nlat_in, nj=0, jbegin=0, latvalue_1d=null_array ) 227 IF (l3D) THEN 228 CALL xios_set_domain_attr("domain_climoz",ni_glo=nlon_in, ni=0, ibegin=0, lonvalue_1d=null_array) 229 ELSE 230 CALL xios_set_domain_attr("domain_climoz",ni_glo=8, ni=0, ibegin=0, lonvalue_1d=null_array) 231 ENDIF 232 ENDIF 233 CALL xios_set_axis_attr("axis_climoz", n_glo=nlev_in) 234 CALL xios_set_axis_attr("time_axis_climoz", n_glo=ntim_ou) 235 CALL xios_set_axis_attr("time_axis_climoz", n_glo=ntim_ou) 236 CALL xios_set_axis_attr("tr_climoz", n_glo=read_climoz) 237 CALL xios_set_field_attr("tro3_out", enabled=.TRUE.) 238 CALL xios_set_field_attr("tro3_out", enabled=.TRUE.) 239 240 IF (first .AND. grid_type==unstructured) THEN 241 first=.FALSE. 242 RETURN 243 ENDIF 244 245 246 IF (is_mpi_root) THEN 247 !--- Longitudes management: 248 ! * Need to shift data if the origin of input file longitudes /= -pi 249 ! * Need to add some margin in longitude to ensure input interval contains 250 ! all the output intervals => at least one longitudes slice has to be 251 ! duplicated, possibly more for undersampling. 252 IF(l3D) THEN 253 IF (grid_type==unstructured) THEN 254 dx2=0 255 ELSE 256 !--- Compute input edges longitudes vector (no end point yet) 257 ALLOCATE(v1(nlon_in+1)) 258 v1(1)=(lon_in(nlon_in)+lon_in(1))/2.-pi 259 FORALL(i=2:nlon_in) v1(i)=(lon_in(i-1)+lon_in(i))/2. 260 v1(nlon_in+1)=v1(1)+2.*pi 261 DEALLOCATE(lon_in) 262 263 !--- Shift input longitudes vector until it contains first output point boundslon_reg(1,west) 264 v1=v1+2*pi*REAL(FLOOR((boundslon_reg(1,west)-v1(1))/(2.*pi))) 265 266 !--- Ensure first input longitudes interval contains first output point boundslon_reg(1,west) 267 dx1=locate(v1,boundslon_reg(1,west))-1 268 v1=CSHIFT(v1,SHIFT=dx1,DIM=1); v1(nlon_in-dx1+1:)=v1(nlon_in-dx1+1:)+2.*pi 269 270 !--- Extend input longitudes vector until last interval contains boundslon_reg(nlat_ou,east) 271 dx2=0; DO WHILE(v1(1+dx2)+2.*pi<boundslon_reg(nlon_ou,east)); dx2=dx2+1; END DO 272 273 !--- Final edges longitudes vector (with margin and end point) 274 ALLOCATE(lon_in_edge(nlon_in+dx2+1)); lon_in_edge=[v1,v1(2:1+dx2)+2.*pi] 275 DEALLOCATE(v1) 276 ENDIF 277 END IF 278 279 !--- Compute sinus of intervals edges latitudes: 280 ALLOCATE(sinlat_in_edge(nlat_in+1)) 281 sinlat_in_edge(1) = -1. ; sinlat_in_edge(nlat_in+1) = 1. 282 FORALL(j=2:nlat_in) sinlat_in_edge(j)=SIN((lat_in(j-1)+lat_in(j))/2.) 283 DEALLOCATE(lat_in) 284 285 286 287 !--- Check for contiguous years: 288 ib=0; ie=13 289 IF(nmth_in == 14) THEN; lprev=.FALSE.; lnext=.FALSE. 290 WRITE(lunout,*)'Using 14 months ozone climatology "climoz.nc"...' 291 ELSE 292 IF( lprev) WRITE(lunout,*)'Using "climoz_m.nc" last record (previous year).' 293 IF(.NOT.lprev) WRITE(lunout,*)"No previous year file ; assuming periodicity." 294 IF( lnext) WRITE(lunout,*)'Using "climoz_p.nc" first record (next year).' 295 IF(.NOT.lnext) WRITE(lunout,*)"No next year file ; assuming periodicity." 296 IF(.NOT.lprev) ib=1 297 IF(.NOT.lnext) ie=12 298 END IF 299 ALLOCATE(sta(ndims),cnt(ndims)); sta(:)=1 300 IF(l3D) cnt=[nlon_in,nlat_in,nlev_in,1] 301 IF(l2D) cnt=[ nlat_in,nlev_in,1] 302 IF(l3D) ALLOCATE(o3_in3(nlon_in+dx2,nlat_in,nlev_in,ib:ie,read_climoz)) 303 IF(l2D) ALLOCATE(o3_in2( nlat_in,nlev_in,ib:ie,read_climoz)) 304 305 !--- Read full current file and one record each available contiguous file 306 DO iv=1,read_climoz 307 msg=TRIM(sub)//" NF90_GET_VAR "//TRIM(vars_in(iv)) 308 CALL NF95_INQ_VARID(fID_in, vars_in(1), vID_in(iv)) 309 IF(l3D) ncerr=NF90_GET_VAR(fID_in, vID_in(iv), o3_in3(1:nlon_in,:,:,1:12,iv)) 310 IF(l2D) ncerr=NF90_GET_VAR(fID_in, vID_in(iv), o3_in2( :,:,1:12,iv)) 311 CALL handle_err(TRIM(msg), ncerr, fID_in) 312 IF(lprev) THEN; sta(ndims)=12 313 CALL NF95_INQ_VARID(fID_in_m, vars_in(1), vID_in(iv)) 314 IF(l3D) ncerr=NF90_GET_VAR(fID_in_m,vID_in(iv),o3_in3(1:nlon_in,:,:, 0,iv),sta,cnt) 315 IF(l2d) ncerr=NF90_GET_VAR(fID_in_m,vID_in(iv),o3_in2( :,:, 0,iv),sta,cnt) 316 CALL handle_err(TRIM(msg)//" previous", ncerr, fID_in_m) 317 END IF 318 IF(lnext) THEN; sta(ndims)=1 319 CALL NF95_INQ_VARID(fID_in_p, vars_in(1), vID_in(iv)) 320 IF(l3D) ncerr=NF90_GET_VAR(fID_in_p,vID_in(iv),o3_in3(1:nlon_in,:,:,13,iv),sta,cnt) 321 IF(l2D) ncerr=NF90_GET_VAR(fID_in_p,vID_in(iv),o3_in2( :,:,13,iv),sta,cnt) 322 CALL handle_err(TRIM(msg)//" next", ncerr, fID_in_p) 323 END IF 324 END DO 325 IF(lprev.OR.lnext) DEALLOCATE(sta,cnt) 326 IF(lprev) CALL NF95_CLOSE(fID_in_m) 327 IF(lnext) CALL NF95_CLOSE(fID_in_p) 328 329 !--- Revert decreasing coordinates vector 330 IF(l3D) THEN 331 IF(ldec_lon) o3_in3(1:nlon_in,:,:,:,:) = o3_in3(nlon_in:1:-1,:,:,:,:) 332 IF(ldec_lat) o3_in3 = o3_in3(:,nlat_in:1:-1,:,:,:) 333 IF(ldec_lev) o3_in3 = o3_in3(:,:,nlev_in:1:-1,:,:) 334 335 IF (grid_type /= unstructured) THEN 336 !--- Shift values for longitude and duplicate some longitudes slices 337 o3_in3(1:nlon_in,:,:,:,:)=CSHIFT(o3_in3(1:nlon_in,:,:,:,:),SHIFT=dx1,DIM=1) 338 o3_in3(nlon_in+1:nlon_in+dx2,:,:,:,:)=o3_in3(1:dx2,:,:,:,:) 339 ENDIF 340 ELSE 341 IF(ldec_lat) o3_in2 = o3_in2( nlat_in:1:-1,:,:,:) 342 IF(ldec_lev) o3_in2 = o3_in2( :,nlev_in:1:-1,:,:) 343 END IF 344 345 !--- Deal with missing values 346 DO m=1, read_climoz 347 WRITE(msg,'(a,i0)')"regr_lat_time_climoz: field Nr.",m 348 IF(NF90_GET_ATT(fID_in,vID_in(m),"missing_value",NaN)/= NF90_NOERR) THEN 349 IF(NF90_GET_ATT(fID_in, vID_in(m),"_FillValue",NaN)/= NF90_NOERR) THEN 350 WRITE(lunout,*)TRIM(msg)//": no missing value attribute found."; CYCLE 351 END IF 352 END IF 353 WRITE(lunout,*)TRIM(msg)//": missing value attribute found." 354 WRITE(lunout,*)"Trying to fill in NaNs ; a full field would be better." 355 356 !--- Check top layer contains no NaNs & search NaNs from top to ground 357 msg=TRIM(sub)//": NaNs in top layer !" 358 IF(l3D) THEN 359 IF(ANY(o3_in3(:,:,1,:,m)==NaN)) CALL abort_physic(sub,msg,1) 360 DO k = 2,nlev_in 361 WHERE(o3_in3(:,:,k,:,m)==NaN) o3_in3(:,:,k,:,m)=o3_in3(:,:,k-1,:,m) 170 362 END DO 171 END SELECT 172 END DO 173 174 !--- Longitudes management: 175 ! * Need to shift data if the origin of input file longitudes /= -pi 176 ! * Need to add some margin in longitude to ensure input interval contains 177 ! all the output intervals => at least one longitudes slice has to be 178 ! duplicated, possibly more for undersampling. 179 IF(l3D) THEN 180 !--- Compute input edges longitudes vector (no end point yet) 181 ALLOCATE(v1(nlon_in+1)) 182 v1(1)=(lon_in(nlon_in)+lon_in(1))/2.-pi 183 FORALL(i=2:nlon_in) v1(i)=(lon_in(i-1)+lon_in(i))/2. 184 v1(nlon_in+1)=v1(1)+2.*pi 185 DEALLOCATE(lon_in) 186 187 !--- Shift input longitudes vector until it contains first output point boundslon_reg(1,west) 188 v1=v1+2*pi*REAL(FLOOR((boundslon_reg(1,west)-v1(1))/(2.*pi))) 189 190 !--- Ensure first input longitudes interval contains first output point boundslon_reg(1,west) 191 dx1=locate(v1,boundslon_reg(1,west))-1 192 v1=CSHIFT(v1,SHIFT=dx1,DIM=1); v1(nlon_in-dx1+1:)=v1(nlon_in-dx1+1:)+2.*pi 193 194 !--- Extend input longitudes vector until last interval contains boundslon_reg(nlat_ou,east) 195 dx2=0; DO WHILE(v1(1+dx2)+2.*pi<boundslon_reg(nlon_ou,east)); dx2=dx2+1; END DO 196 197 !--- Final edges longitudes vector (with margin and end point) 198 ALLOCATE(lon_in_edge(nlon_in+dx2+1)); lon_in_edge=[v1,v1(2:1+dx2)+2.*pi] 199 DEALLOCATE(v1) 200 END IF 201 202 !--- Compute sinus of intervals edges latitudes: 203 ALLOCATE(sinlat_in_edge(nlat_in+1)) 204 sinlat_in_edge(1) = -1. ; sinlat_in_edge(nlat_in+1) = 1. 205 FORALL(j=2:nlat_in) sinlat_in_edge(j)=SIN((lat_in(j-1)+lat_in(j))/2.) 206 DEALLOCATE(lat_in) 207 208 !--- Prepare quantities for time interpolation 209 tmidmonth=mid_month(anneeref, cal_in) 210 IF(interpt) THEN 211 ntim_ou=ioget_year_len(anneeref) 212 ALLOCATE(tmidday(ntim_ou)) 213 tmidday=[(REAL(k)-0.5,k=1,ntim_ou)] 214 CALL ioget_calendar(cal_ou) 215 ELSE 216 ntim_ou=14 217 cal_ou=cal_in 218 END IF 363 ELSE 364 IF(ANY(o3_in2( :,1,:,m)==NaN)) THEN 365 WRITE(lunout,*)msg 366 !--- Fill in latitudes where all values are missing 367 DO l=1,nmth_in 368 !--- Next to south pole 369 j=1; DO WHILE(o3_in2(j,1,l,m)==NaN); j=j+1; END DO 370 IF(j>1) & 371 o3_in2(:j-1,:,l,m)=SPREAD(o3_in2(j,:,l,m),DIM=1,ncopies=j-1) 372 !--- Next to north pole 373 j=nlat_in; DO WHILE(o3_in2(j,1,l,m)==NaN); j=j+1; END DO 374 IF(j<nlat_in) & 375 o3_in2(j+1:,:,l,m)=SPREAD(o3_in2(j,:,l,m),DIM=1,ncopies=nlat_in-j) 376 END DO 377 END IF 378 379 !--- Fill in high latitudes missing values 380 !--- Highest level been filled-in, so has always valid values. 381 DO k = 2,nlev_in 382 WHERE(o3_in2(:,k,:,m)==NaN) o3_in2(:,k,:,m)=o3_in2(:,k-1,:,m) 383 END DO 384 END IF 385 END DO 386 387 ENDIF 388 389 !============================================================================= 390 IF(l3D) THEN !=== 3D FIELDS 391 !============================================================================= 392 IF (grid_type==unstructured) THEN 393 nlat_ou=klon 394 395 IF (is_mpi_root) THEN 396 ALLOCATE(o3_in3bis(nlon_in,nlat_in,nlev_in,0:13,read_climoz)) 397 o3_in3bis(:,:,:,ib:ie,:)=o3_in3(1:nlon_in,:,:,ib:ie,:) 398 ELSE 399 ALLOCATE(o3_in3bis(0,0,0,0,read_climoz)) 400 ENDIF 401 ALLOCATE(o3_regr_lonlat(1, nlat_ou, nlev_in, 0:13, read_climoz)) 402 403 CALL xios_send_field("tro3_in",o3_in3bis(:,:,:,:,:)) 404 CALL xios_recv_field("tro3_out",o3_regr_lonlat(1,:,:,:,:)) 405 406 ELSE 407 408 !--- Regrid in longitude 409 ALLOCATE(o3_regr_lon(nlon_ou, nlat_in, nlev_in, ie-ib+1, read_climoz)) 410 CALL regr_conserv(1, o3_in3, xs = lon_in_edge, & 411 xt = [boundslon_reg(1,west),boundslon_reg(:,east)], & 412 vt = o3_regr_lon, slope = slopes(1,o3_in3, lon_in_edge)) 413 DEALLOCATE(o3_in3) 414 415 !--- Regrid in latitude: averaging with respect to SIN(lat) is 416 ! equivalent to weighting by COS(lat) 417 !--- (inverted indices in "o3_regr_lonlat" because "rlatu" is decreasing) 418 ALLOCATE(o3_regr_lonlat(nlon_ou, nlat_ou, nlev_in, 0:13, read_climoz)) 419 CALL regr_conserv(2, o3_regr_lon, xs = sinlat_in_edge, & 420 xt = [- 1., SIN(boundslat_reg(nlat_ou-1:1:-1,south)), 1.], & 421 vt = o3_regr_lonlat(:,nlat_ou:1:- 1,:,ib:ie,:), & 422 slope = slopes(2,o3_regr_lon, sinlat_in_edge)) 423 DEALLOCATE(o3_regr_lon) 424 425 ENDIF 426 427 !--- Duplicate previous/next record(s) if they are not available 428 IF(.NOT.lprev) o3_regr_lonlat(:,:,:, 0,:) = o3_regr_lonlat(:,:,:,12,:) 429 IF(.NOT.lnext) o3_regr_lonlat(:,:,:,13,:) = o3_regr_lonlat(:,:,:, 1,:) 430 431 !--- Regrid in time by linear interpolation: 432 ALLOCATE(o3_out3(nlon_ou, nlat_ou, nlev_in, ntim_ou, read_climoz)) 433 IF( interpt) CALL regr_lint(4,o3_regr_lonlat,tmidmonth,tmidday,o3_out3) 434 IF(.NOT.interpt) o3_out3=o3_regr_lonlat 435 DEALLOCATE(o3_regr_lonlat) 436 437 nlat_ou=nbp_lat 438 IF (grid_type==unstructured) THEN 439 CALL xios_send_field('o3_out',o3_out3) 440 ndims=3 441 ALLOCATE(o3_out3_glo(nlat_ou, nlev_in, ntim_ou, read_climoz)) 442 CALL gather(o3_out3(1,:,:,:,:), o3_out3_glo) 443 ENDIF 219 444 220 445 !--- Create the output file and get the variable IDs: … … 222 447 ndims, cal_ou) 223 448 224 !--- Write remaining coordinate variables: 225 CALL NF95_PUT_VAR(fID_ou, levID_ou, lev_in); DEALLOCATE(lev_in) 226 IF( interpt) CALL NF95_PUT_VAR(fID_ou, timID_ou, tmidday) 227 IF(.NOT.interpt) CALL NF95_PUT_VAR(fID_ou, timID_ou, tmidmonth) 228 229 !--- Check for contiguous years: 230 ib=0; ie=13 231 IF(nmth_in == 14) THEN; lprev=.FALSE.; lnext=.FALSE. 232 WRITE(lunout,*)'Using 14 months ozone climatology "climoz.nc"...' 233 ELSE 234 IF( lprev) WRITE(lunout,*)'Using "climoz_m.nc" last record (previous year).' 235 IF(.NOT.lprev) WRITE(lunout,*)"No previous year file ; assuming periodicity." 236 IF( lnext) WRITE(lunout,*)'Using "climoz_p.nc" first record (next year).' 237 IF(.NOT.lnext) WRITE(lunout,*)"No next year file ; assuming periodicity." 238 IF(.NOT.lprev) ib=1 239 IF(.NOT.lnext) ie=12 240 END IF 241 ALLOCATE(sta(ndims),cnt(ndims)); sta(:)=1 242 IF(l3D) cnt=[nlon_in,nlat_in,nlev_in,1] 243 IF(l2D) cnt=[ nlat_in,nlev_in,1] 244 IF(l3D) ALLOCATE(o3_in3(nlon_in+dx2,nlat_in,nlev_in,ib:ie,read_climoz)) 245 IF(l2D) ALLOCATE(o3_in2( nlat_in,nlev_in,ib:ie,read_climoz)) 246 247 !--- Read full current file and one record each available contiguous file 248 DO iv=1,read_climoz 249 msg=TRIM(sub)//" NF90_GET_VAR "//TRIM(vars_in(iv)) 250 CALL NF95_INQ_VARID(fID_in, vars_in(1), vID_in(iv)) 251 IF(l3D) ncerr=NF90_GET_VAR(fID_in, vID_in(iv), o3_in3(1:nlon_in,:,:,1:12,iv)) 252 IF(l2D) ncerr=NF90_GET_VAR(fID_in, vID_in(iv), o3_in2( :,:,1:12,iv)) 253 CALL handle_err(TRIM(msg), ncerr, fID_in) 254 IF(lprev) THEN; sta(ndims)=12 255 CALL NF95_INQ_VARID(fID_in_m, vars_in(1), vID_in(iv)) 256 IF(l3D) ncerr=NF90_GET_VAR(fID_in_m,vID_in(iv),o3_in3(1:nlon_in,:,:, 0,iv),sta,cnt) 257 IF(l2d) ncerr=NF90_GET_VAR(fID_in_m,vID_in(iv),o3_in2( :,:, 0,iv),sta,cnt) 258 CALL handle_err(TRIM(msg)//" previous", ncerr, fID_in_m) 259 END IF 260 IF(lnext) THEN; sta(ndims)=1 261 CALL NF95_INQ_VARID(fID_in_p, vars_in(1), vID_in(iv)) 262 IF(l3D) ncerr=NF90_GET_VAR(fID_in_p,vID_in(iv),o3_in3(1:nlon_in,:,:,13,iv),sta,cnt) 263 IF(l2D) ncerr=NF90_GET_VAR(fID_in_p,vID_in(iv),o3_in2( :,:,13,iv),sta,cnt) 264 CALL handle_err(TRIM(msg)//" next", ncerr, fID_in_p) 265 END IF 266 END DO 267 IF(lprev.OR.lnext) DEALLOCATE(sta,cnt) 268 IF(lprev) CALL NF95_CLOSE(fID_in_m) 269 IF(lnext) CALL NF95_CLOSE(fID_in_p) 270 271 !--- Revert decreasing coordinates vector 272 IF(l3D) THEN 273 IF(ldec_lon) o3_in3(1:nlon_in,:,:,:,:) = o3_in3(nlon_in:1:-1,:,:,:,:) 274 IF(ldec_lat) o3_in3 = o3_in3(:,nlat_in:1:-1,:,:,:) 275 IF(ldec_lev) o3_in3 = o3_in3(:,:,nlev_in:1:-1,:,:) 276 !--- Shift values for longitude and duplicate some longitudes slices 277 o3_in3(1:nlon_in,:,:,:,:)=CSHIFT(o3_in3(1:nlon_in,:,:,:,:),SHIFT=dx1,DIM=1) 278 o3_in3(nlon_in+1:nlon_in+dx2,:,:,:,:)=o3_in3(1:dx2,:,:,:,:) 279 ELSE 280 IF(ldec_lat) o3_in2 = o3_in2( nlat_in:1:-1,:,:,:) 281 IF(ldec_lev) o3_in2 = o3_in2( :,nlev_in:1:-1,:,:) 282 END IF 283 284 !--- Deal with missing values 285 DO m=1, read_climoz 286 WRITE(msg,'(a,i0)')"regr_lat_time_climoz: field Nr.",m 287 IF(NF90_GET_ATT(fID_in,vID_in(m),"missing_value",NaN)/= NF90_NOERR) THEN 288 IF(NF90_GET_ATT(fID_in, vID_in(m),"_FillValue",NaN)/= NF90_NOERR) THEN 289 WRITE(lunout,*)TRIM(msg)//": no missing value attribute found."; CYCLE 290 END IF 291 END IF 292 WRITE(lunout,*)TRIM(msg)//": missing value attribute found." 293 WRITE(lunout,*)"Trying to fill in NaNs ; a full field would be better." 294 295 !--- Check top layer contains no NaNs & search NaNs from top to ground 296 msg=TRIM(sub)//": NaNs in top layer !" 297 IF(l3D) THEN 298 IF(ANY(o3_in3(:,:,1,:,m)==NaN)) CALL abort_physic(sub,msg,1) 299 DO k = 2,nlev_in 300 WHERE(o3_in3(:,:,k,:,m)==NaN) o3_in3(:,:,k,:,m)=o3_in3(:,:,k-1,:,m) 301 END DO 302 ELSE 303 IF(ANY(o3_in2( :,1,:,m)==NaN)) THEN 304 WRITE(lunout,*)msg 305 !--- Fill in latitudes where all values are missing 306 DO l=1,nmth_in 307 !--- Next to south pole 308 j=1; DO WHILE(o3_in2(j,1,l,m)==NaN); j=j+1; END DO 309 IF(j>1) & 310 o3_in2(:j-1,:,l,m)=SPREAD(o3_in2(j,:,l,m),DIM=1,ncopies=j-1) 311 !--- Next to north pole 312 j=nlat_in; DO WHILE(o3_in2(j,1,l,m)==NaN); j=j+1; END DO 313 IF(j<nlat_in) & 314 o3_in2(j+1:,:,l,m)=SPREAD(o3_in2(j,:,l,m),DIM=1,ncopies=nlat_in-j) 449 IF (is_mpi_root) THEN 450 !--- Write remaining coordinate variables: 451 CALL NF95_PUT_VAR(fID_ou, levID_ou, lev_in); DEALLOCATE(lev_in) 452 IF( interpt) CALL NF95_PUT_VAR(fID_ou, timID_ou, tmidday) 453 IF(.NOT.interpt) CALL NF95_PUT_VAR(fID_ou, timID_ou, tmidmonth) 454 455 !--- Write to file (the order of "rlatu" is inverted in the output file): 456 IF (grid_type==unstructured) THEN 457 DO m = 1, read_climoz 458 CALL NF95_PUT_VAR(fID_ou, vID_ou(m), o3_out3_glo(nlat_ou:1:-1,:,:,m)) 315 459 END DO 316 END IF 317 318 !--- Fill in high latitudes missing values 319 !--- Highest level been filled-in, so has always valid values. 320 DO k = 2,nlev_in 321 WHERE(o3_in2(:,k,:,m)==NaN) o3_in2(:,k,:,m)=o3_in2(:,k-1,:,m) 322 END DO 323 END IF 324 END DO 325 CALL NF95_CLOSE(fID_in) 326 327 !============================================================================= 328 IF(l3D) THEN !=== 3D FIELDS 329 !============================================================================= 330 !--- Regrid in longitude 331 ALLOCATE(o3_regr_lon(nlon_ou, nlat_in, nlev_in, ie-ib+1, read_climoz)) 332 CALL regr_conserv(1, o3_in3, xs = lon_in_edge, & 333 xt = [boundslon_reg(1,west),boundslon_reg(:,east)], & 334 vt = o3_regr_lon, slope = slopes(1,o3_in3, lon_in_edge)) 335 DEALLOCATE(o3_in3) 336 337 !--- Regrid in latitude: averaging with respect to SIN(lat) is 338 ! equivalent to weighting by COS(lat) 339 !--- (inverted indices in "o3_regr_lonlat" because "rlatu" is decreasing) 340 ALLOCATE(o3_regr_lonlat(nlon_ou, nlat_ou, nlev_in, 0:13, read_climoz)) 341 CALL regr_conserv(2, o3_regr_lon, xs = sinlat_in_edge, & 342 xt = [- 1., SIN(boundslat_reg(nlat_ou-1:1:-1,south)), 1.], & 343 vt = o3_regr_lonlat(:,nlat_ou:1:- 1,:,ib:ie,:), & 344 slope = slopes(2,o3_regr_lon, sinlat_in_edge)) 345 DEALLOCATE(o3_regr_lon) 346 347 !--- Duplicate previous/next record(s) if they are not available 348 IF(.NOT.lprev) o3_regr_lonlat(:,:,:, 0,:) = o3_regr_lonlat(:,:,:,12,:) 349 IF(.NOT.lnext) o3_regr_lonlat(:,:,:,13,:) = o3_regr_lonlat(:,:,:, 1,:) 350 351 !--- Regrid in time by linear interpolation: 352 ALLOCATE(o3_out3(nlon_ou, nlat_ou, nlev_in, ntim_ou, read_climoz)) 353 IF( interpt) CALL regr_lint(4,o3_regr_lonlat,tmidmonth,tmidday,o3_out3) 354 IF(.NOT.interpt) o3_out3=o3_regr_lonlat 355 DEALLOCATE(o3_regr_lonlat) 356 357 !--- Write to file (the order of "rlatu" is inverted in the output file): 358 DO m = 1, read_climoz 359 CALL NF95_PUT_VAR(fID_ou, vID_ou(m), o3_out3(:,nlat_ou:1:-1,:,:,m)) 360 END DO 460 ELSE 461 DO m = 1, read_climoz 462 CALL NF95_PUT_VAR(fID_ou, vID_ou(m), o3_out3(:,nlat_ou:1:-1,:,:,m)) 463 END DO 464 ENDIF 465 CALL NF95_CLOSE(fID_ou) 466 467 468 ENDIF 469 470 471 472 473 474 475 476 361 477 362 478 !============================================================================= 363 479 ELSE !=== ZONAL FIELDS 364 480 !============================================================================= 365 !--- Regrid in latitude: averaging with respect to SIN(lat) is 366 ! equivalent to weighting by COS(lat) 367 !--- (inverted indices in "o3_regr_lat" because "rlatu" is decreasing) 368 ALLOCATE(o3_regr_lat(nlat_ou, nlev_in, 0:13, read_climoz)) 369 CALL regr_conserv(1, o3_in2, xs = sinlat_in_edge, & 370 xt = [- 1., SIN(boundslat_reg(nlat_ou-1:1:-1,south)), 1.], & 371 vt = o3_regr_lat(nlat_ou:1:- 1,:,ib:ie,:), & 372 slope = slopes(1,o3_in2, sinlat_in_edge)) 373 DEALLOCATE(o3_in2) 374 375 !--- Duplicate previous/next record(s) if they are not available 376 IF(.NOT.lprev) o3_regr_lat(:,:, 0,:) = o3_regr_lat(:,:,12,:) 377 IF(.NOT.lnext) o3_regr_lat(:,:,13,:) = o3_regr_lat(:,:, 1,:) 378 481 482 IF (grid_type==unstructured) THEN 483 nlat_ou=klon 484 485 IF (is_mpi_root) THEN 486 ALLOCATE(o3_in2bis(8,nlat_in,nlev_in,0:13,read_climoz)) 487 o3_in2bis(:,:,:,ib:ie,:)=SPREAD(o3_in2,1,8) 488 ELSE 489 ALLOCATE(o3_in2bis(0,0,0,0,read_climoz)) 490 ENDIF 491 ALLOCATE(o3_regr_lat(nlat_ou, nlev_in, 0:13, read_climoz)) 492 CALL xios_send_field("tro3_in",o3_in2bis(:,:,:,:,:)) 493 CALL xios_recv_field("tro3_out",o3_regr_lat(:,:,:,:)) 494 IF(.NOT.lprev) o3_regr_lat(:,:, 0, :) = o3_regr_lat(:,:,12,:) 495 IF(.NOT.lnext) o3_regr_lat(:,:,13, :) = o3_regr_lat(:,:, 1,:) 496 497 498 ELSE 499 !--- Regrid in latitude: averaging with respect to SIN(lat) is 500 ! equivalent to weighting by COS(lat) 501 !--- (inverted indices in "o3_regr_lat" because "rlatu" is decreasing) 502 ALLOCATE(o3_regr_lat(nlat_ou, nlev_in, 0:13, read_climoz)) 503 CALL regr_conserv(1, o3_in2, xs = sinlat_in_edge, & 504 xt = [- 1., SIN(boundslat_reg(nlat_ou-1:1:-1,south)), 1.], & 505 vt = o3_regr_lat(nlat_ou:1:- 1,:,ib:ie,:), & 506 slope = slopes(1,o3_in2, sinlat_in_edge)) 507 DEALLOCATE(o3_in2) 508 509 !--- Duplicate previous/next record(s) if they are not available 510 IF(.NOT.lprev) o3_regr_lat(:,:, 0,:) = o3_regr_lat(:,:,12,:) 511 IF(.NOT.lnext) o3_regr_lat(:,:,13,:) = o3_regr_lat(:,:, 1,:) 512 513 ENDIF 514 379 515 !--- Regrid in time by linear interpolation: 380 516 ALLOCATE(o3_out2(nlat_ou, nlev_in, ntim_ou, read_climoz)) … … 383 519 DEALLOCATE(o3_regr_lat) 384 520 385 !--- Write to file (the order of "rlatu" is inverted in the output file): 386 DO m = 1, read_climoz 387 CALL NF95_PUT_VAR(fID_ou, vID_ou(m), o3_out2(nlat_ou:1:-1,:,:,m)) 388 END DO 521 nlat_ou=nbp_lat 522 ! ALLOCATE(o3_out2_glo(nlat_ou, nlev_in, ntim_ou, read_climoz)) 523 ! CALL gather(o3_out2, o3_out2_glo) 524 ! CALL xios_send_field('o3_out',o3_out2) 525 526 IF (grid_type==unstructured) THEN 527 ndims=3 528 ALLOCATE(o3_out2_glo(nlat_ou, nlev_in, ntim_ou, read_climoz)) 529 CALL gather(o3_out2, o3_out2_glo) 530 ENDIF 531 532 !--- Create the output file and get the variable IDs: 533 CALL prepare_out(fID_in,nlev_in,ntim_ou, fID_ou,levID_ou,timID_ou,vID_ou, & 534 ndims, cal_ou) 535 536 IF (is_mpi_root) THEN 537 538 !--- Write remaining coordinate variables: 539 CALL NF95_PUT_VAR(fID_ou, levID_ou, lev_in); DEALLOCATE(lev_in) 540 IF( interpt) CALL NF95_PUT_VAR(fID_ou, timID_ou, tmidday) 541 IF(.NOT.interpt) CALL NF95_PUT_VAR(fID_ou, timID_ou, tmidmonth) 542 543 IF (grid_type==unstructured) THEN 544 DO m = 1, read_climoz 545 CALL NF95_PUT_VAR(fID_ou, vID_ou(m), o3_out2_glo(nlat_ou:1:-1,:,:,m)) 546 END DO 547 ELSE 548 !--- Write to file (the order of "rlatu" is inverted in the output file): 549 DO m = 1, read_climoz 550 CALL NF95_PUT_VAR(fID_ou, vID_ou(m), o3_out2(nlat_ou:1:-1,:,:,m)) 551 END DO 552 ENDIF 553 554 CALL NF95_CLOSE(fID_ou) 555 556 ENDIF 389 557 390 558 !============================================================================= … … 392 560 !============================================================================= 393 561 394 CALL NF95_CLOSE(fID_ou)562 IF (is_mpi_root) CALL NF95_CLOSE(fID_in) 395 563 396 564 END SUBROUTINE regr_horiz_time_climoz … … 408 576 !------------------------------------------------------------------------------- 409 577 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 578 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 579 USE geometry_mod, ONLY : latitude_deg 580 USE mod_grid_phy_lmdz, ONLY: klon_glo 581 USE mod_phys_lmdz_mpi_data, only: is_mpi_root 582 USE mod_phys_lmdz_para, ONLY: gather 583 ! 410 584 !------------------------------------------------------------------------------- 411 585 ! Arguments: … … 420 594 INTEGER :: vlonID, vlatID, ncerr, is 421 595 CHARACTER(LEN=80) :: sub 422 !------------------------------------------------------------------------------- 423 sub="prepare_out" 424 WRITE(lunout,*)"CALL sequence information: "//TRIM(sub) 425 CALL NF95_CREATE("climoz_LMDZ.nc", NF90_clobber, fID_ou) 596 REAL :: latitude_glo(klon_glo) 597 598 !------------------------------------------------------------------------------- 599 600 IF (grid_type==unstructured) CALL gather(latitude_deg, latitude_glo) 601 602 IF (is_mpi_root) THEN 603 sub="prepare_out" 604 WRITE(lunout,*)"CALL sequence information: "//TRIM(sub) 605 CALL NF95_CREATE("climoz_LMDZ.nc", NF90_clobber, fID_ou) 426 606 427 607 !--- Dimensions: 428 IF(ndims==4) &429 CALL NF95_DEF_DIM(fID_ou, "rlonv", nlon_ou, dlonID)430 CALL NF95_DEF_DIM(fID_ou, "rlatu", nlat_ou, dlatID)431 CALL NF95_DEF_DIM(fID_ou, "plev", nlev_in, dlevID)432 CALL NF95_DEF_DIM(fID_ou, "time", ntim_ou, dtimID)433 434 !--- Define coordinate variables:435 IF(ndims==4) &436 CALL NF95_DEF_VAR(fID_ou, "rlonv", NF90_FLOAT, dlonID, vlonID)437 CALL NF95_DEF_VAR(fID_ou, "rlatu", NF90_FLOAT, dlatID, vlatID)438 CALL NF95_DEF_VAR(fID_ou, "plev", NF90_FLOAT, dlevID, vlevID)439 CALL NF95_DEF_VAR(fID_ou, "time", NF90_FLOAT, dtimID, vtimID)440 IF(ndims==4) &441 CALL NF95_PUT_ATT(fID_ou, vlonID, "units", "degrees_east")442 CALL NF95_PUT_ATT(fID_ou, vlatID, "units", "degrees_north")443 CALL NF95_PUT_ATT(fID_ou, vlevID, "units", "millibar")444 CALL NF95_PUT_ATT(fID_ou, vtimID, "units", "days since 2000-1-1")445 IF(ndims==4) &446 CALL NF95_PUT_ATT(fID_ou, vlonID, "standard_name", "longitude")447 CALL NF95_PUT_ATT(fID_ou, vlatID, "standard_name", "latitude")448 CALL NF95_PUT_ATT(fID_ou, vlevID, "standard_name", "air_pressure")449 CALL NF95_PUT_ATT(fID_ou, vtimID, "standard_name", "time")450 CALL NF95_PUT_ATT(fID_ou, vlevID, "long_name", "air pressure")451 CALL NF95_PUT_ATT(fID_ou, vtimID, "calendar", cal_ou)608 IF(ndims==4) & 609 CALL NF95_DEF_DIM(fID_ou, "rlonv", nlon_ou, dlonID) 610 CALL NF95_DEF_DIM(fID_ou, "rlatu", nlat_ou, dlatID) 611 CALL NF95_DEF_DIM(fID_ou, "plev", nlev_in, dlevID) 612 CALL NF95_DEF_DIM(fID_ou, "time", ntim_ou, dtimID) 613 614 !--- Define coordinate variables: 615 IF(ndims==4) & 616 CALL NF95_DEF_VAR(fID_ou, "rlonv", NF90_FLOAT, dlonID, vlonID) 617 CALL NF95_DEF_VAR(fID_ou, "rlatu", NF90_FLOAT, dlatID, vlatID) 618 CALL NF95_DEF_VAR(fID_ou, "plev", NF90_FLOAT, dlevID, vlevID) 619 CALL NF95_DEF_VAR(fID_ou, "time", NF90_FLOAT, dtimID, vtimID) 620 IF(ndims==4) & 621 CALL NF95_PUT_ATT(fID_ou, vlonID, "units", "degrees_east") 622 CALL NF95_PUT_ATT(fID_ou, vlatID, "units", "degrees_north") 623 CALL NF95_PUT_ATT(fID_ou, vlevID, "units", "millibar") 624 CALL NF95_PUT_ATT(fID_ou, vtimID, "units", "days since 2000-1-1") 625 IF(ndims==4) & 626 CALL NF95_PUT_ATT(fID_ou, vlonID, "standard_name", "longitude") 627 CALL NF95_PUT_ATT(fID_ou, vlatID, "standard_name", "latitude") 628 CALL NF95_PUT_ATT(fID_ou, vlevID, "standard_name", "air_pressure") 629 CALL NF95_PUT_ATT(fID_ou, vtimID, "standard_name", "time") 630 CALL NF95_PUT_ATT(fID_ou, vlevID, "long_name", "air pressure") 631 CALL NF95_PUT_ATT(fID_ou, vtimID, "calendar", cal_ou) 452 632 453 633 !--- Define the main variables: 454 IF(ndims==3) dIDs(1:3) = [ dlatID, dlevID, dtimID]455 IF(ndims==4) dIDs=[dlonID, dlatID, dlevID, dtimID]456 CALL NF95_DEF_VAR(fID_ou, vars_in(1), NF90_FLOAT, dIDs(1:ndims), vID_ou(1))457 CALL NF95_PUT_ATT(fID_ou, vID_ou(1), "long_name", "ozone mole fraction")458 CALL NF95_PUT_ATT(fID_ou, vID_ou(1), "standard_name", "mole_fraction_of_ozone&634 IF(ndims==3) dIDs(1:3) = [ dlatID, dlevID, dtimID] 635 IF(ndims==4) dIDs=[dlonID, dlatID, dlevID, dtimID] 636 CALL NF95_DEF_VAR(fID_ou, vars_in(1), NF90_FLOAT, dIDs(1:ndims), vID_ou(1)) 637 CALL NF95_PUT_ATT(fID_ou, vID_ou(1), "long_name", "ozone mole fraction") 638 CALL NF95_PUT_ATT(fID_ou, vID_ou(1), "standard_name", "mole_fraction_of_ozone& 459 639 &_in_air") 460 IF(SIZE(vID_ou) == 2) THEN461 CALL NF95_DEF_VAR(fID_ou, vars_in(2), NF90_FLOAT, dIDs(1:ndims), vID_ou(2))462 CALL NF95_PUT_ATT(fID_ou, vID_ou(2), "long_name","ozone mole fraction in da&463 &ylight")464 END IF640 IF(SIZE(vID_ou) == 2) THEN 641 CALL NF95_DEF_VAR(fID_ou, vars_in(2), NF90_FLOAT, dIDs(1:ndims), vID_ou(2)) 642 CALL NF95_PUT_ATT(fID_ou, vID_ou(2), "long_name","ozone mole fraction in da& 643 &ylight") 644 END IF 465 645 466 646 !--- Global attributes: 467 647 ! The following commands, copying attributes, may fail. That is OK. 468 648 ! It should just mean that the attribute is not defined in the input file. 469 CALL NF95_COPY_ATT(fID_in,NF90_GLOBAL,"Conventions",fID_ou,NF90_GLOBAL, ncerr) 470 CALL handle_err_copy_att("Conventions") 471 CALL NF95_COPY_ATT(fID_in,NF90_GLOBAL,"title", fID_ou,NF90_GLOBAL, ncerr) 472 CALL handle_err_copy_att("title") 473 CALL NF95_COPY_ATT(fID_in,NF90_GLOBAL,"institution",fID_ou,NF90_GLOBAL, ncerr) 474 CALL handle_err_copy_att("institution") 475 CALL NF95_COPY_ATT(fID_in,NF90_GLOBAL,"source", fID_ou,NF90_GLOBAL, ncerr) 476 CALL handle_err_copy_att("source") 477 CALL NF95_PUT_ATT (fID_ou,NF90_GLOBAL,"comment", "Regridded for LMDZ") 478 CALL NF95_ENDDEF(fID_ou) 479 480 !--- Write one of the coordinate variables: 481 IF(ndims==4) CALL NF95_PUT_VAR(fID_ou, vlonID, lon_reg/deg2rad) 482 CALL NF95_PUT_VAR(fID_ou, vlatID, lat_reg(nlat_ou:1:-1)/deg2rad) 483 ! (convert from rad to degrees and sort in ascending order) 484 649 CALL NF95_COPY_ATT(fID_in,NF90_GLOBAL,"Conventions",fID_ou,NF90_GLOBAL, ncerr) 650 CALL handle_err_copy_att("Conventions") 651 CALL NF95_COPY_ATT(fID_in,NF90_GLOBAL,"title", fID_ou,NF90_GLOBAL, ncerr) 652 CALL handle_err_copy_att("title") 653 CALL NF95_COPY_ATT(fID_in,NF90_GLOBAL,"institution",fID_ou,NF90_GLOBAL, ncerr) 654 CALL handle_err_copy_att("institution") 655 CALL NF95_COPY_ATT(fID_in,NF90_GLOBAL,"source", fID_ou,NF90_GLOBAL, ncerr) 656 CALL handle_err_copy_att("source") 657 CALL NF95_PUT_ATT (fID_ou,NF90_GLOBAL,"comment", "Regridded for LMDZ") 658 CALL NF95_ENDDEF(fID_ou) 659 660 IF (grid_type==unstructured) THEN 661 CALL NF95_PUT_VAR(fID_ou, vlatID, latitude_glo) 662 ELSE 663 !--- Write one of the coordinate variables: 664 IF(ndims==4) CALL NF95_PUT_VAR(fID_ou, vlonID, lon_reg/deg2rad) 665 CALL NF95_PUT_VAR(fID_ou, vlatID, lat_reg(nlat_ou:1:-1)/deg2rad) 666 ! (convert from rad to degrees and sort in ascending order) 667 ENDIF 668 ENDIF 669 485 670 CONTAINS 486 671 -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/regr_pr_time_av_m.F90
r2981 r3406 106 106 USE assert_m, ONLY: assert 107 107 USE assert_eq_m, ONLY: assert_eq 108 USE comvert_mod, ONLY: scaleheight108 !! USE comvert_mod, ONLY: scaleheight 109 109 USE interpolation, ONLY: locate 110 110 USE regr_conserv_m, ONLY: regr_conserv -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/rrtm/suinit.F90
r1990 r3406 126 126 ALLOCATE(VDELA (MAX(JPMXLE,NFLEVG))) 127 127 ALLOCATE(VDELB (MAX(JPMXLE,NFLEVG))) 128 VDELB = 0 !ym missing init 128 129 ALLOCATE( VC (NFLEVG) ) 130 VC = 0 !ym missing init 129 131 ALLOCATE( NLOEN (NPROMA) ) 130 132 ALLOCATE( NLOENG (NPROMA) ) -
LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/slab_heat_transp_mod.F90
r3002 r3406 84 84 aire_,apoln_,apols_, & 85 85 aireu_,airev_,rlatv) 86 USE comconst_mod, ONLY: omeg, rad86 !!USE comconst_mod, ONLY: omeg, rad 87 87 ! number of points in lon, lat 88 88 IMPLICIT NONE … … 104 104 REAL,INTENT(IN) :: airev_(ip1jm) 105 105 REAL,INTENT(IN) :: rlatv(nbp_lat-1) 106 REAL :: omeg = 7.272205e-05 107 REAL :: rad = 6371229. 106 108 107 109 ! Sanity check on dimensions
Note: See TracChangeset
for help on using the changeset viewer.