From 182906c2afbb9d7a124684261143702ea4e1b49c Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 12 Sep 2019 09:07:16 -0600 Subject: [PATCH] 'Add capability to read emissions datasets on unstructured grids Imported from https://svn-ccsm-models.cgd.ucar.edu/cam1/trunk@91682 Committed by Francis Vitt at 2019-09-12 09:07:16 -0600 Original svn commit message: Add capability to read emissions datasets on unstructured grids A + components/cam/test/system/nl_files/outfrq3s_unstr_emis M components/cam/test/system/input_tests_master M components/cam/test/system/tests_chem_mpi M components/cam/cime_config/config_pes.xml A + components/cam/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem A + components/cam/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem M components/cam/cime_config/testdefs/testlist_cam.xml M components/cam/doc/ChangeLog M components/cam/src/chemistry/utils/tracer_data.F90 M components/cam/src/chemistry/mozart/mo_srf_emissions.F90 M components/cam/src/chemistry/mozart/mo_extfrc.F90 ' --- cime_config/config_pes.xml | 95 +++++--- cime_config/testdefs/testlist_cam.xml | 21 +- .../outfrq1d_refined_camchem/shell_commands | 2 + .../cam/outfrq1d_refined_camchem/user_nl_cam | 61 +++++ .../cam/outfrq1d_refined_camchem/user_nl_clm | 33 +++ .../outfrq9s_refined_camchem/shell_commands | 2 + .../cam/outfrq9s_refined_camchem/user_nl_cam | 61 +++++ .../cam/outfrq9s_refined_camchem/user_nl_clm | 33 +++ doc/ChangeLog | 78 +++++++ src/chemistry/mozart/mo_extfrc.F90 | 32 ++- src/chemistry/mozart/mo_srf_emissions.F90 | 66 ++++-- src/chemistry/utils/tracer_data.F90 | 217 ++++++++++++------ test/system/input_tests_master | 6 + test/system/nl_files/outfrq3s_unstr_emis | 28 +++ test/system/tests_chem_mpi | 1 + 15 files changed, 602 insertions(+), 134 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/user_nl_clm create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/user_nl_clm create mode 100644 test/system/nl_files/outfrq3s_unstr_emis diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index bde96b4e28..1f4f2d2236 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -325,6 +325,39 @@ 0 + + none + + -50 + -50 + -50 + -50 + -50 + -50 + -50 + -50 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + @@ -439,37 +472,37 @@ - none - - 1200 - 1200 - 1200 - 1200 - 1200 - 1200 - 1200 - 1200 - - - 3 - 3 - 3 - 3 - 3 - 3 - 3 - 3 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - + none + + -50 + -50 + -50 + -50 + -50 + -50 + -50 + -50 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 217d0de9b2..755a42e95f 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -354,7 +354,6 @@ - @@ -403,8 +402,9 @@ - + + @@ -417,6 +417,23 @@ + + + + + + + + + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/shell_commands new file mode 100644 index 0000000000..cb98b78ad5 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/shell_commands @@ -0,0 +1,2 @@ +./xmlchange EPS_AAREA=1.e-4 +./xmlchange RUN_STARTDATE=2013-10-01 diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/user_nl_cam new file mode 100644 index 0000000000..4928799dcb --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/user_nl_cam @@ -0,0 +1,61 @@ + se_phys_dyn_cp = 2 + gw_polar_taper = .true. + + mfilt=1,1,1,1,1,1,1,1,1 + ndens=1,1,1,1,1,1,1,1,1 + nhtfrq=-24,-24,-24,-24,-24,-24,-24,-24,-24 + + inithist='ENDOFRUN' + + ncdata = '$DIN_LOC_ROOT/atm/cam/inic/se/fchist_ne0conus30x8_L32_2012-11-01_c190906.nc' + + fincl2 = 'SFBENZENE','SFBIGALK','SFC2H2','SFCH2O','SFCH3COOH','SFCO','SFNO' + + ext_frc_specifier = + 'bc_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_bc_a4_aircraft_vertical_1750-2015_0.9x1.25_c20170608.nc', + 'NO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-EPA_NO2_vertical_anthro_201306-201310_conus_30x8_c190906.nc', + 'num_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_so4_a1_anthro-ene_vertical_1750-2015_0.9x1.25_c20170616.nc', + 'num_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc', + 'num_a2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc', + 'num_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_bc_a4_aircraft_vertical_1750-2015_0.9x1.25_c20170608.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-EPA_SO2_vertical_anthro_201306-201310_conus_30x8_c190906.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_SO2_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/stratvolc/VolcanEESMv3.11_SO2_850-2016_Mscale_Zreduc_1deg_c180812.nc', + 'so4_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a1_anthro-ene_vertical_1750-2015_0.9x1.25_c20170616.nc', + 'so4_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc', + 'so4_a2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc' + + srf_emis_specifier = + 'BENZENE -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_BENZENE_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'BIGENE -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_BIGENE_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C2H2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C2H2_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C2H4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C2H4_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C2H6 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C2H6_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C3H6 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C3H6_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C3H8 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C3H8_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'CH2O -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CH2O_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'CH3CHO -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CH3CHO_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'CH3CN -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CH3CN_surface_anthro_2012-2014_conus_30x8_c190903.nc', + 'CH3COOH -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CH3COOH_surface_anthro_2012-2014_conus_30x8_c190903.nc', + 'CO -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CO_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'E90 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions_E90global_surface_1750-2100_0.9x1.25_c20170322.nc', + 'HCN -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_HCN_surface_anthro_2012-2014_conus_30x8_c190903.nc', + 'HCOOH -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_HCOOH_surface_anthro_2012-2014_conus_30x8_c190903.nc', + 'IVOC -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_IVOC_anthro_surface_1750-2015_0.9x1.25_c20170608.nc', + 'NH3 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_NH3_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'NO -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_NOx_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'SVOC -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_SVOC_anthro_surface_1750-2015_0.9x1.25_c20170608.nc', + 'TOLUENE -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_TOLUENE_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'DMS -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_DMS_other_surface_1750-2015_0.9x1.25_c20170322.nc', + 'bc_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_BC_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'num_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_so4_a1_bb_surface_1750-2015_0.9x1.25_c20170322.nc', + 'num_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_so4_a1_anthro-ag-ship_surface_1750-2015_0.9x1.25_c20170616.nc', + 'num_a2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_so4_a2_anthro-res_surface_1750-2015_0.9x1.25_c20170616.nc', + 'num_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_num_bc_a4_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'num_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_pom_a4_anthro_surface_1750-2015_0.9x1.25_c20170608.nc', + 'pom_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_pom_a4_anthro_surface_1750-2015_0.9x1.25_c20170608.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_SO2_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_SO2_anthro-ene_surface_1750-2015_0.9x1.25_c20170616.nc', + 'so4_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a1_anthro-ag-ship_surface_1750-2015_0.9x1.25_c20170616.nc', + 'so4_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a1_bb_surface_1750-2015_0.9x1.25_c20170322.nc', + 'so4_a2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a2_anthro-res_surface_1750-2015_0.9x1.25_c20170616.nc' diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/user_nl_clm new file mode 100644 index 0000000000..e45c51587b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem/user_nl_clm @@ -0,0 +1,33 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = -24 +hist_mfilt = 1 +hist_ndens = 1 + +finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata/opt_se_cslam_topo.FCHIST.ne30_ne30_mg17.default_spin_up_TS1.clm2.r.2012-11-01-00000_c190810.nc' +use_init_interp = .true. + +fsurdat = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_ne0CONUSne30x8_hist_16pfts_Irrig_CMIP6_simyr1850_c190814.nc' + +flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/landuse.timeseries_ne0CONUSne30x8_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190815.nc' diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/shell_commands new file mode 100644 index 0000000000..cb98b78ad5 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/shell_commands @@ -0,0 +1,2 @@ +./xmlchange EPS_AAREA=1.e-4 +./xmlchange RUN_STARTDATE=2013-10-01 diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/user_nl_cam new file mode 100644 index 0000000000..5458667218 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/user_nl_cam @@ -0,0 +1,61 @@ + se_phys_dyn_cp = 2 + gw_polar_taper = .true. + + mfilt=1,1,1,1,1,1,1,1,1 + ndens=1,1,1,1,1,1,1,1,1 + nhtfrq=9,9,9,9,9,9,9,9,9 + + inithist='ENDOFRUN' + + ncdata = '$DIN_LOC_ROOT/atm/cam/inic/se/fchist_ne0conus30x8_L32_2012-11-01_c190906.nc' + + fincl2 = 'SFBENZENE','SFBIGALK','SFC2H2','SFCH2O','SFCH3COOH','SFCO','SFNO' + + ext_frc_specifier = + 'bc_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_bc_a4_aircraft_vertical_1750-2015_0.9x1.25_c20170608.nc', + 'NO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-EPA_NO2_vertical_anthro_201306-201310_conus_30x8_c190906.nc', + 'num_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_so4_a1_anthro-ene_vertical_1750-2015_0.9x1.25_c20170616.nc', + 'num_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc', + 'num_a2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc', + 'num_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_bc_a4_aircraft_vertical_1750-2015_0.9x1.25_c20170608.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-EPA_SO2_vertical_anthro_201306-201310_conus_30x8_c190906.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_SO2_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/stratvolc/VolcanEESMv3.11_SO2_850-2016_Mscale_Zreduc_1deg_c180812.nc', + 'so4_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a1_anthro-ene_vertical_1750-2015_0.9x1.25_c20170616.nc', + 'so4_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc', + 'so4_a2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_0.9x1.25_c20170724.nc' + + srf_emis_specifier = + 'BENZENE -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_BENZENE_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'BIGENE -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_BIGENE_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C2H2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C2H2_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C2H4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C2H4_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C2H6 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C2H6_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C3H6 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C3H6_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'C3H8 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_C3H8_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'CH2O -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CH2O_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'CH3CHO -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CH3CHO_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'CH3CN -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CH3CN_surface_anthro_2012-2014_conus_30x8_c190903.nc', + 'CH3COOH -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CH3COOH_surface_anthro_2012-2014_conus_30x8_c190903.nc', + 'CO -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_CO_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'E90 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions_E90global_surface_1750-2100_0.9x1.25_c20170322.nc', + 'HCN -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_HCN_surface_anthro_2012-2014_conus_30x8_c190903.nc', + 'HCOOH -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_HCOOH_surface_anthro_2012-2014_conus_30x8_c190903.nc', + 'IVOC -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_IVOC_anthro_surface_1750-2015_0.9x1.25_c20170608.nc', + 'NH3 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_NH3_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'NO -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_NOx_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'SVOC -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_SVOC_anthro_surface_1750-2015_0.9x1.25_c20170608.nc', + 'TOLUENE -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_TOLUENE_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'DMS -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_DMS_other_surface_1750-2015_0.9x1.25_c20170322.nc', + 'bc_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_BC_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'num_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_so4_a1_bb_surface_1750-2015_0.9x1.25_c20170322.nc', + 'num_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_so4_a1_anthro-ag-ship_surface_1750-2015_0.9x1.25_c20170616.nc', + 'num_a2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_so4_a2_anthro-res_surface_1750-2015_0.9x1.25_c20170616.nc', + 'num_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_num_bc_a4_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'num_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_num_pom_a4_anthro_surface_1750-2015_0.9x1.25_c20170608.nc', + 'pom_a4 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_pom_a4_anthro_surface_1750-2015_0.9x1.25_c20170608.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CAM-SE_ne0conus_30x8/emissions-CMIP6_SO2_surface_anthro_2012-2014_masked_conus_30x8_c190903.nc', + 'SO2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_SO2_anthro-ene_surface_1750-2015_0.9x1.25_c20170616.nc', + 'so4_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a1_anthro-ag-ship_surface_1750-2015_0.9x1.25_c20170616.nc', + 'so4_a1 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a1_bb_surface_1750-2015_0.9x1.25_c20170322.nc', + 'so4_a2 -> $DIN_LOC_ROOT/atm/cam/chem/emis/CMIP6_emissions_1750_2015/emissions-cmip6_so4_a2_anthro-res_surface_1750-2015_0.9x1.25_c20170616.nc' diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/user_nl_clm new file mode 100644 index 0000000000..ad53faaa11 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem/user_nl_clm @@ -0,0 +1,33 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 9 +hist_mfilt = 1 +hist_ndens = 1 + +finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata/opt_se_cslam_topo.FCHIST.ne30_ne30_mg17.default_spin_up_TS1.clm2.r.2012-11-01-00000_c190810.nc' +use_init_interp = .true. + +fsurdat = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_ne0CONUSne30x8_hist_16pfts_Irrig_CMIP6_simyr1850_c190814.nc' + +flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/landuse.timeseries_ne0CONUSne30x8_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190815.nc' diff --git a/doc/ChangeLog b/doc/ChangeLog index 78059b2425..27c6a67d7c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,83 @@ =============================================================== +Tag name: cam6_1_032 +Originator(s): fvitt +Date: 12 Sep 2019 +One-line Summary: Add capability to read emissions datasets on unstructured grids + +Purpose of changes: + +This supports CAM-Chem simulations on regional refined SE grids. For these types +of simulations it is desirable to grid high-resolution emissions to the regional +refined grid offline while conserving mass, and read in the emissions without +2D linear interpolation to the model grid. + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: CAM code review team + +List all files eliminated: + +List all files added and what they do: + +A components/cam/test/system/nl_files/outfrq3s_unstr_emis + - for NAG testing on izumi + +A components/cam/cime_config/testdefs/testmods_dirs/cam/outfrq1d_refined_camchem +A components/cam/cime_config/testdefs/testmods_dirs/cam/outfrq9s_refined_camchem + - for cime tests on cheyenne + +List all existing files that have been modified, and describe the changes: + +M components/cam/src/chemistry/utils/tracer_data.F90 + - add ability to read in data on unstructred grid + +M components/cam/src/chemistry/mozart/mo_srf_emissions.F90 +M components/cam/src/chemistry/mozart/mo_extfrc.F90 + - determine if on (un)structured grid and look for appropriate number of + dimensions in sector fields + +M components/cam/cime_config/config_pes.xml + - give appropriate PE layouts for CAM-Chem on CONUS and ne30 grids + +M components/cam/cime_config/testdefs/testlist_cam.xml + - for cime tests on cheyenne + +M components/cam/test/system/input_tests_master +M components/cam/test/system/tests_chem_mpi + - for NAG testing on izumi + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +cheyenne/intel: All PASS + +cheyenne/intel/aux_cam: + SMS_D_Ln9.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.cheyenne_intel.cam-outfrq9s_refined_camchem (Overall: DIFF) details: + FAIL SMS_D_Ln9.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.cheyenne_intel.cam-outfrq9s_refined_camchem NLCOMP + FAIL SMS_D_Ln9.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.cheyenne_intel.cam-outfrq9s_refined_camchem BASELINE cam6_1_031: ERROR BFAIL baseline directory '/glade/p/cesmdata/cseg/cesm_baselines/cam6_1_031/SMS_D_Ln9.ne0CONUSn + - this is a new aux_cam test + +izumi/nag: All PASS + +izumi/pgi: All PASS + +Summarize any changes to answers: bit-for-bit + + +=============================================================== +=============================================================== + Tag name: cam6_1_031 Originator(s): fischer Date: Thu Aug 29 12:55:00 MDT 2019 diff --git a/src/chemistry/mozart/mo_extfrc.F90 b/src/chemistry/mozart/mo_extfrc.F90 index bb77dc2aa1..6c85e24f12 100644 --- a/src/chemistry/mozart/mo_extfrc.F90 +++ b/src/chemistry/mozart/mo_extfrc.F90 @@ -49,7 +49,7 @@ subroutine extfrc_inti( extfrc_specifier, extfrc_type_in, extfrc_cycle_yr, extfr ! ... initialize the surface forcings !----------------------------------------------------------------------- use cam_pio_utils, only : cam_pio_openfile, cam_pio_closefile - use pio, only : pio_inquire, pio_inq_varndims + use pio, only : pio_inquire, pio_inq_varndims, pio_inq_dimid use pio, only : pio_inq_varname, pio_nowrite, file_desc_t use pio, only : pio_get_att, PIO_NOERR, PIO_GLOBAL use pio, only : pio_seterrorhandling, PIO_BCAST_ERROR,PIO_INTERNAL_ERROR @@ -83,9 +83,11 @@ subroutine extfrc_inti( extfrc_specifier, extfrc_type_in, extfrc_cycle_yr, extfr integer :: frc_indexes(gas_pcnst) integer :: indx(gas_pcnst) - integer :: vid, ndims, nvars, isec, ierr + integer :: vid, ndims, nvars, isec, ierr, num_dims_xfrc, dimid + logical, allocatable :: is_sector(:) type(file_desc_t) :: ncid character(len=32) :: varname + logical :: unstructured character(len=1), parameter :: filelist = '' character(len=1), parameter :: datapath = '' @@ -249,13 +251,26 @@ subroutine extfrc_inti( extfrc_specifier, extfrc_type_in, extfrc_cycle_yr, extfr call cam_pio_openfile ( ncid, trim(forcings(m)%filename), PIO_NOWRITE) ierr = pio_inquire (ncid, nVariables=nvars) + call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) + ierr = pio_inq_dimid( ncid, 'ncol', dimid ) + unstructured = ierr==PIO_NOERR + call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) + + allocate(is_sector(nvars)) + is_sector(:) = .false. + do vid = 1,nvars ierr = pio_inq_varndims (ncid, vid, ndims) + if (unstructured) then + num_dims_xfrc = 3 + else + num_dims_xfrc = 4 + endif - if( ndims < 4 ) then + if( ndims < num_dims_xfrc ) then cycle - elseif( ndims > 4 ) then + elseif( ndims > num_dims_xfrc ) then ierr = pio_inq_varname (ncid, vid, varname) write(iulog,*) 'extfrc_inti: Skipping variable ', trim(varname),', ndims = ',ndims, & ' , species=',trim(forcings(m)%species) @@ -263,7 +278,8 @@ subroutine extfrc_inti( extfrc_specifier, extfrc_type_in, extfrc_cycle_yr, extfr end if forcings(m)%nsectors = forcings(m)%nsectors+1 - + is_sector(vid)=.true. + enddo allocate( forcings(m)%sectors(forcings(m)%nsectors), stat=astat ) @@ -274,14 +290,12 @@ subroutine extfrc_inti( extfrc_specifier, extfrc_type_in, extfrc_cycle_yr, extfr isec = 1 do vid = 1,nvars - - ierr = pio_inq_varndims (ncid, vid, ndims) - if( ndims == 4 ) then + if( is_sector(vid) ) then ierr = pio_inq_varname(ncid, vid, forcings(m)%sectors(isec)) isec = isec+1 endif - enddo + deallocate(is_sector) ! Global attribute 'input_method' overrides the ext_frc_type namelist setting on ! a file-by-file basis. If the ext_frc file does not contain the 'input_method' diff --git a/src/chemistry/mozart/mo_srf_emissions.F90 b/src/chemistry/mozart/mo_srf_emissions.F90 index f1cc056d9c..e0d80ef1b1 100644 --- a/src/chemistry/mozart/mo_srf_emissions.F90 +++ b/src/chemistry/mozart/mo_srf_emissions.F90 @@ -5,11 +5,9 @@ module mo_srf_emissions use shr_kind_mod, only : r8 => shr_kind_r8 use chem_mods, only : gas_pcnst - use spmd_utils, only : masterproc,iam - use mo_tracname, only : solsym + use spmd_utils, only : masterproc use cam_abortutils,only : endrun use ioFileMod, only : getfil - use ppgrid, only : pcols, begchunk, endchunk use cam_logfile, only : iulog use tracer_data, only : trfld,trfile @@ -49,13 +47,12 @@ subroutine srf_emissions_inti( srf_emis_specifier, emis_type_in, emis_cycle_yr, !----------------------------------------------------------------------- use chem_mods, only : adv_mass - use mo_constants, only : d2r, pi, rearth - use string_utils, only : to_upper use mo_chem_utls, only : get_spc_ndx use tracer_data, only : trcdata_init use cam_pio_utils, only : cam_pio_openfile use pio, only : pio_inquire, pio_nowrite, pio_closefile, pio_inq_varndims - use pio, only : pio_inq_varname, file_desc_t, pio_get_att, PIO_NOERR, PIO_GLOBAL + use pio, only : pio_inq_varname, pio_inq_vardimid, pio_inq_dimid + use pio, only : file_desc_t, pio_get_att, PIO_NOERR, PIO_GLOBAL use pio, only : pio_seterrorhandling, PIO_BCAST_ERROR,PIO_INTERNAL_ERROR use chem_surfvals, only : flbc_list use string_utils, only : GLC @@ -86,8 +83,9 @@ subroutine srf_emissions_inti( srf_emis_specifier, emis_type_in, emis_cycle_yr, integer :: indx(gas_pcnst) real(r8) :: emis_scalefactor(gas_pcnst) - integer :: vid, nvars, isec - integer, allocatable :: vndims(:) + integer :: vid, nvars, isec, num_dims_emis + integer :: vndims + logical, allocatable :: is_sector(:) type(file_desc_t) :: ncid character(len=32) :: varname character(len=256) :: locfn @@ -95,13 +93,15 @@ subroutine srf_emissions_inti( srf_emis_specifier, emis_type_in, emis_cycle_yr, character(len=1), parameter :: filelist = '' character(len=1), parameter :: datapath = '' logical , parameter :: rmv_file = .false. - + logical :: unstructured character(len=32) :: emis_type = ' ' character(len=80) :: file_interp_type = ' ' character(len=256) :: tmp_string = ' ' character(len=32) :: xchr = ' ' real(r8) :: xdbl - + integer :: time_dimid, ncol_dimid + integer, allocatable :: dimids(:) + has_emis(:) = .false. nn = 0 indx(:) = 0 @@ -189,24 +189,51 @@ subroutine srf_emissions_inti( srf_emis_specifier, emis_type_in, emis_cycle_yr, call getfil (emissions(m)%filename, locfn, 0) call cam_pio_openfile ( ncid, trim(locfn), PIO_NOWRITE) - ierr = pio_inquire (ncid, nvariables=nvars) + ierr = pio_inquire (ncid, nVariables=nvars) - allocate(vndims(nvars)) + call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) + ierr = pio_inq_dimid( ncid, 'ncol', ncol_dimid ) + unstructured = ierr==PIO_NOERR + call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) + + allocate(is_sector(nvars)) + is_sector(:) = .false. + + if (unstructured) then + ierr = pio_inq_dimid( ncid, 'time', time_dimid ) + end if do vid = 1,nvars - ierr = pio_inq_varndims (ncid, vid, vndims(vid)) + ierr = pio_inq_varndims (ncid, vid, vndims) - if( vndims(vid) < 3 ) then + if (unstructured) then + num_dims_emis = 2 + else + num_dims_emis = 3 + endif + + if( vndims < num_dims_emis ) then cycle - elseif( vndims(vid) > 3 ) then + elseif( vndims > num_dims_emis ) then ierr = pio_inq_varname (ncid, vid, varname) - write(iulog,*) 'srf_emis_inti: Skipping variable ', trim(varname),', ndims = ',vndims(vid), & + write(iulog,*) 'srf_emis_inti: Skipping variable ', trim(varname),', ndims = ',vndims, & ' , species=',trim(emissions(m)%species) cycle end if - emissions(m)%nsectors = emissions(m)%nsectors+1 + if (unstructured) then + allocate( dimids(vndims) ) + ierr = pio_inq_vardimid( ncid, vid, dimids ) + if ( any(dimids(:)==ncol_dimid) .and. any(dimids(:)==time_dimid) ) then + emissions(m)%nsectors = emissions(m)%nsectors+1 + is_sector(vid)=.true. + endif + deallocate(dimids) + else + emissions(m)%nsectors = emissions(m)%nsectors+1 + is_sector(vid)=.true. + end if enddo @@ -219,13 +246,12 @@ subroutine srf_emissions_inti( srf_emis_specifier, emis_type_in, emis_cycle_yr, isec = 1 do vid = 1,nvars - if( vndims(vid) == 3 ) then + if( is_sector(vid) ) then ierr = pio_inq_varname(ncid, vid, emissions(m)%sectors(isec)) isec = isec+1 endif - enddo - deallocate(vndims) + deallocate(is_sector) ! Global attribute 'input_method' overrides the srf_emis_type namelist setting on ! a file-by-file basis. If the emis file does not contain the 'input_method' diff --git a/src/chemistry/utils/tracer_data.F90 b/src/chemistry/utils/tracer_data.F90 index 7d23654f7e..eafd768d01 100644 --- a/src/chemistry/utils/tracer_data.F90 +++ b/src/chemistry/utils/tracer_data.F90 @@ -8,8 +8,8 @@ module tracer_data !----------------------------------------------------------------------- use perf_mod, only : t_startf, t_stopf - use shr_kind_mod, only : r8 => shr_kind_r8,r4 => shr_kind_r4, shr_kind_cl, SHR_KIND_CS - use time_manager, only : get_curr_date, get_step_size, get_curr_calday + use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl + use time_manager, only : get_curr_date, get_step_size use spmd_utils, only : masterproc use ppgrid, only : pcols, pver, pverp, begchunk, endchunk use cam_abortutils, only : endrun @@ -19,7 +19,6 @@ module tracer_data use time_manager, only : set_time_float_from_date, set_date_from_time_float use pio, only : file_desc_t, var_desc_t, & pio_seterrorhandling, pio_internal_error, pio_bcast_error, & - pio_setdebuglevel, & pio_char, pio_noerr, & pio_inq_dimid, pio_inq_varid, & pio_def_dim, pio_def_var, & @@ -116,6 +115,7 @@ module tracer_data logical, allocatable, dimension(:) :: in_pbuf logical :: has_ps = .false. logical :: zonal_ave = .false. + logical :: unstructured = .false. logical :: alt_data = .false. logical :: geop_alt = .false. logical :: cyclical = .false. @@ -156,7 +156,6 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & use mo_constants, only : d2r use dyn_grid, only : get_dyn_grid_parm - use string_utils, only : to_upper use horizontal_interpolate, only : xy_interp_init #if ( defined SPMD ) use mpishorthand, only: mpicom, mpir8, mpiint @@ -208,8 +207,6 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & file%cyclical = .false. file%cyclical_list = .false. -! does not work when compiled with pathf90 -! select case ( to_upper(data_type) ) select case ( data_type ) case( 'FIXED' ) file%fixed = .true. @@ -282,11 +279,14 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & endif call pio_seterrorhandling(File%curr_fileid, PIO_BCAST_ERROR) - ierr = pio_inq_dimid( file%curr_fileid, 'lon', idx ) + ierr = pio_inq_dimid( file%curr_fileid, 'ncol', idx ) + file%unstructured = (ierr==PIO_NOERR) + if (.not.file%unstructured) then + ierr = pio_inq_dimid( file%curr_fileid, 'lon', idx ) + file%zonal_ave = (ierr/=PIO_NOERR) + endif call pio_seterrorhandling(File%curr_fileid, PIO_INTERNAL_ERROR) - file%zonal_ave = (ierr/=PIO_NOERR) - plon = get_dyn_grid_parm('plon') plat = get_dyn_grid_parm('plat') @@ -296,23 +296,26 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & else - call get_dimension( file%curr_fileid, 'lon', file%nlon, dimid=old_dimid, data=file%lons ) - - file%lons = file%lons * d2r - - lon_dimid = old_dimid + if (.not. file%unstructured ) then + call get_dimension( file%curr_fileid, 'lon', file%nlon, dimid=old_dimid, data=file%lons ) + file%lons = file%lons * d2r + + lon_dimid = old_dimid + end if endif ierr = pio_inq_dimid( file%curr_fileid, 'time', old_dimid) - ! Hack to work with weird netCDF and old gcc or NAG bug. - tim_dimid = old_dimid + if (.not. file%unstructured ) then + ! Hack to work with weird netCDF and old gcc or NAG bug. + tim_dimid = old_dimid - call get_dimension( file%curr_fileid, 'lat', file%nlat, dimid=old_dimid, data=file%lats ) - file%lats = file%lats * d2r + call get_dimension( file%curr_fileid, 'lat', file%nlat, dimid=old_dimid, data=file%lats ) + file%lats = file%lats * d2r - lat_dimid = old_dimid + lat_dimid = old_dimid + endif allocate( file%ps(file%nlon,file%nlat), stat=astat ) if( astat /= 0 ) then @@ -328,7 +331,7 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & call pio_seterrorhandling(File%curr_fileid, PIO_INTERNAL_ERROR) - if ( file%has_ps) then + if ( file%has_ps .and. .not.file%unstructured ) then if ( file%zonal_ave ) then ierr = pio_inq_vardimid (file%curr_fileid, file%ps_id, dimids(1:2)) do did = 1,2 @@ -524,7 +527,7 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & flds(f)%order(did) = ZA_TIMDIM endif enddo - else if ( flds(f)%srf_fld ) then + else if ( flds(f)%srf_fld .and. .not.file%unstructured ) then ierr = pio_inq_vardimid (file%curr_fileid, flds(f)%var_id, dimids(1:3)) do did = 1,3 if ( dimids(did) == lon_dimid ) then @@ -538,7 +541,7 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & flds(f)%order(did) = PS_TIMDIM endif enddo - else + else if (.not. file%unstructured ) then ierr = pio_inq_vardimid (file%curr_fileid, flds(f)%var_id, dimids) do did = 1,4 if ( dimids(did) == lon_dimid ) then @@ -624,7 +627,6 @@ end subroutine trcdata_init !----------------------------------------------------------------------- subroutine advance_trcdata( flds, file, state, pbuf2d ) use physics_types,only : physics_state - use physics_buffer, only : physics_buffer_desc implicit none @@ -677,7 +679,6 @@ end subroutine advance_trcdata !------------------------------------------------------------------- subroutine get_fld_data( flds, field_name, data, ncol, lchnk, pbuf ) - use physics_buffer, only : physics_buffer_desc, pbuf_get_field implicit none @@ -848,10 +849,8 @@ function incr_filename( filename, filenames_list, datapath, cyclical_list, list_ !----------------------------------------------------------------------- ! ... local variables !----------------------------------------------------------------------- - integer :: pos, pos1, istat + integer :: pos, istat character(len=shr_kind_cl) :: fn_new, line, filepath - character(len=6) :: seconds - character(len=5) :: num integer :: ios,unitnumber logical :: abort_run @@ -1220,40 +1219,58 @@ subroutine read_next_trcdata( flds, file ) call read_za_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file, & (/ flds(f)%order(ZA_LATDIM),flds(f)%order(ZA_LEVDIM) /) ) else if ( flds(f)%srf_fld ) then - cnt3( flds(f)%coords(LONDIM)) = file%nlon - cnt3( flds(f)%coords(LATDIM)) = file%nlat - cnt3( flds(f)%coords(PS_TIMDIM)) = 1 - strt3(flds(f)%coords(PS_TIMDIM)) = recnos(i) - call read_2d_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data(:,1,:), strt3, cnt3, file, & - (/ flds(f)%order(LONDIM),flds(f)%order(LATDIM) /) ) + if ( file%unstructured ) then + ! read data directly onto the unstructureed phys grid -- assumes input data is on same grid as phys + call read_physgrid_2d( fids(i), flds(f)%fldnam, recnos(i), flds(f)%input(i)%data(:,1,:) ) + else + cnt3( flds(f)%coords(LONDIM)) = file%nlon + cnt3( flds(f)%coords(LATDIM)) = file%nlat + cnt3( flds(f)%coords(PS_TIMDIM)) = 1 + strt3(flds(f)%coords(PS_TIMDIM)) = recnos(i) + call read_2d_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data(:,1,:), strt3, cnt3, file, & + (/ flds(f)%order(LONDIM),flds(f)%order(LATDIM) /) ) + endif else - cnt4(flds(f)%coords(LONDIM)) = file%nlon - cnt4(flds(f)%coords(LATDIM)) = file%nlat - cnt4(flds(f)%coords(LEVDIM)) = file%nlev - cnt4(flds(f)%coords(TIMDIM)) = 1 - strt4(flds(f)%coords(TIMDIM)) = recnos(i) - call read_3d_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt4, cnt4, file, & - (/ flds(f)%order(LONDIM),flds(f)%order(LATDIM),flds(f)%order(LEVDIM) /)) + if ( file%unstructured ) then + ! read data directly onto the unstructureed phys grid -- assumes input data is on same grid as phys + if ( file%alt_data ) then + call read_physgrid_3d( fids(i), flds(f)%fldnam, 'altitude', file%nlev, recnos(i), flds(f)%input(i)%data(:,:,:) ) + else + call read_physgrid_3d( fids(i), flds(f)%fldnam, 'lev', file%nlev, recnos(i), flds(f)%input(i)%data(:,:,:) ) + end if + else + cnt4(flds(f)%coords(LONDIM)) = file%nlon + cnt4(flds(f)%coords(LATDIM)) = file%nlat + cnt4(flds(f)%coords(LEVDIM)) = file%nlev + cnt4(flds(f)%coords(TIMDIM)) = 1 + strt4(flds(f)%coords(TIMDIM)) = recnos(i) + call read_3d_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt4, cnt4, file, & + (/ flds(f)%order(LONDIM),flds(f)%order(LATDIM),flds(f)%order(LEVDIM) /)) + endif endif enddo if ( file%has_ps ) then - cnt3 = 1 - strt3 = 1 - if (.not. file%zonal_ave) then - cnt3(file%ps_coords(LONDIM)) = file%nlon - end if - cnt3(file%ps_coords(LATDIM)) = file%nlat - cnt3(file%ps_coords(PS_TIMDIM)) = 1 - strt3(file%ps_coords(PS_TIMDIM)) = recnos(i) - if (file%zonal_ave) then - call read_2d_trc( fids(i), file%ps_id, file%ps_in(i)%data, strt3(1:2), cnt3(1:2), file, & - (/ 1, 2 /) ) + if ( file%unstructured ) then + call read_physgrid_2d( fids(i), 'PS', recnos(i), file%ps_in(i)%data ) else - call read_2d_trc( fids(i), file%ps_id, file%ps_in(i)%data, strt3, cnt3, file, & - (/ file%ps_order(LONDIM),file%ps_order(LATDIM) /) ) + cnt3 = 1 + strt3 = 1 + if (.not. file%zonal_ave) then + cnt3(file%ps_coords(LONDIM)) = file%nlon + end if + cnt3(file%ps_coords(LATDIM)) = file%nlat + cnt3(file%ps_coords(PS_TIMDIM)) = 1 + strt3(file%ps_coords(PS_TIMDIM)) = recnos(i) + if (file%zonal_ave) then + call read_2d_trc( fids(i), file%ps_id, file%ps_in(i)%data, strt3(1:2), cnt3(1:2), file, & + (/ 1, 2 /) ) + else + call read_2d_trc( fids(i), file%ps_id, file%ps_in(i)%data, strt3, cnt3, file, & + (/ file%ps_order(LONDIM),file%ps_order(LATDIM) /) ) + end if end if endif @@ -1263,7 +1280,6 @@ end subroutine read_next_trcdata !------------------------------------------------------------------------ - subroutine read_2d_trc( fid, vid, loc_arr, strt, cnt, file, order ) use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish @@ -1280,11 +1296,11 @@ subroutine read_2d_trc( fid, vid, loc_arr, strt, cnt, file, order ) real(r8),intent(out) :: loc_arr(:,:) type (trfile), intent(in) :: file - real(r8) :: to_lats(pcols), to_lons(pcols), wrk(pcols) + real(r8) :: to_lats(pcols), to_lons(pcols) real(r8), allocatable, target :: wrk2d(:,:) real(r8), pointer :: wrk2d_in(:,:) - integer :: tsize, c, i, ierr, ncols + integer :: c, ierr, ncols real(r8), parameter :: zero=0_r8, twopi=2_r8*pi type(interp_type) :: lon_wgts, lat_wgts integer :: lons(pcols), lats(pcols) @@ -1380,10 +1396,7 @@ end subroutine read_2d_trc subroutine read_za_trc( fid, vid, loc_arr, strt, cnt, file, order ) use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish - use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p - use mo_constants, only : pi -! use dycore, only : dycore_is - use polar_avg, only : polar_average + use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p implicit none type(file_desc_t), intent(in) :: fid @@ -1394,7 +1407,7 @@ subroutine read_za_trc( fid, vid, loc_arr, strt, cnt, file, order ) type (trfile), intent(in) :: file type(interp_type) :: lat_wgts - real(r8) :: to_lats(pcols), to_lons(pcols), wrk(pcols) + real(r8) :: to_lats(pcols), wrk(pcols) real(r8), allocatable, target :: wrk2d(:,:) real(r8), pointer :: wrk2d_in(:,:) integer :: c, k, ierr, ncols @@ -1440,11 +1453,75 @@ subroutine read_za_trc( fid, vid, loc_arr, strt, cnt, file, order ) else deallocate(wrk2d_in) end if -! if(dycore_is('LR')) call polar_average(loc_arr) end subroutine read_za_trc !------------------------------------------------------------------------ +! this assumes the input data is gridded to match the physics grid + subroutine read_physgrid_2d(ncid, varname, recno, data ) + + use ncdio_atm, only: infld + use cam_grid_support, only: cam_grid_check, cam_grid_id, cam_grid_get_dim_names + + type(file_desc_t) :: ncid + character(len=*), intent(in) :: varname + integer, intent(in) :: recno + real(r8), intent(out) :: data(1:pcols,begchunk:endchunk) + + logical :: found + character(len=8) :: dim1name, dim2name + integer :: grid_id ! grid ID for data mapping + grid_id = cam_grid_id('physgrid') + if (.not. cam_grid_check(grid_id)) then + call endrun('tracer_data::read_physgrid_2d: Internal error, no "physgrid" grid') + end if + call cam_grid_get_dim_names(grid_id, dim1name, dim2name) + + call infld( varname, ncid, dim1name, dim2name, 1, pcols, begchunk, endchunk, & + data, found, gridname='physgrid', timelevel=recno ) + + if(.not. found) then + call endrun('tracer_data::read_physgrid_2d: Could not find '//trim(varname)//' field in met input datafile') + end if + + end subroutine read_physgrid_2d + +!------------------------------------------------------------------------ +!------------------------------------------------------------------------ +! this assumes the input data is gridded to match the physics grid + subroutine read_physgrid_3d(ncid, varname, vrt_coord_name, nlevs, recno, data ) + + use ncdio_atm, only: infld + use cam_grid_support, only: cam_grid_check, cam_grid_id, cam_grid_get_dim_names + + type(file_desc_t) :: ncid + character(len=*), intent(in) :: varname + character(len=*), intent(in) :: vrt_coord_name + integer, intent(in) :: nlevs + integer, intent(in) :: recno + real(r8), intent(out) :: data(1:pcols,1:nlevs,begchunk:endchunk) + + logical :: found + character(len=8) :: dim1name, dim2name + integer :: grid_id ! grid ID for data mapping + + grid_id = cam_grid_id('physgrid') + if (.not. cam_grid_check(grid_id)) then + call endrun('tracer_data::read_physgrid_3d: Internal error, no "physgrid" grid') + end if + call cam_grid_get_dim_names(grid_id, dim1name, dim2name) + + call infld( varname, ncid, dim1name, vrt_coord_name, dim2name, 1, pcols, 1, nlevs, begchunk, endchunk, & + data, found, gridname='physgrid', timelevel=recno ) + + if(.not. found) then + call endrun('tracer_data::read_physgrid_3d: Could not find '//trim(varname)//' field in met input datafile') + end if + + end subroutine read_physgrid_3d + + !------------------------------------------------------------------------ + subroutine read_3d_trc( fid, vid, loc_arr, strt, cnt, file, order) use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p, get_lon_all_p,& @@ -1463,11 +1540,10 @@ subroutine read_3d_trc( fid, vid, loc_arr, strt, cnt, file, order) type (trfile), intent(in) :: file - integer :: i,j,k, astat, c, ncols + integer :: astat, c, ncols integer :: lons(pcols), lats(pcols) - integer :: jlim(2), jl, ju, ierr - integer :: gndx + integer :: ierr real(r8), allocatable, target :: wrk3d(:,:,:) real(r8), pointer :: wrk3d_in(:,:,:) @@ -1498,8 +1574,6 @@ subroutine read_3d_trc( fid, vid, loc_arr, strt, cnt, file, order) wrk3d_in => wrk3d end if - j=1 - ! If weighting by latitude, then perform horizontal interpolation by using weight_x, weight_y if(file%weight_by_lat) then @@ -1553,7 +1627,6 @@ subroutine interpolate_trcdata( state, flds, file, pbuf2d ) use mo_util, only : rebin use physics_types,only : physics_state use physconst, only : cday, rga - use physics_buffer, only : physics_buffer_desc, pbuf_get_field implicit none @@ -1794,7 +1867,7 @@ subroutine set_cycle_indices( fileid, cyc_ndx_beg, cyc_ndx_end, cyc_yr ) integer, intent(out) :: cyc_ndx_end integer, intent(in) :: cyc_yr - integer, allocatable , dimension(:) :: dates, datesecs + integer, allocatable , dimension(:) :: dates integer :: timesize, i, astat, year, ierr type(var_desc_T) :: dateid call get_dimension( fileid, 'time', timesize ) @@ -1849,7 +1922,7 @@ subroutine open_trc_datafile( fname, path, piofile, times, cyc_ndx_beg, cyc_ndx_ integer, optional, intent(in) :: cyc_yr character(len=shr_kind_cl) :: filen, filepath - integer :: year, month, day, dsize, i, timesize + integer :: year, month, day, i, timesize integer :: dateid,secid integer, allocatable , dimension(:) :: dates, datesecs integer :: astat, ierr @@ -2068,7 +2141,7 @@ subroutine write_trc_restart( piofile, tr_file ) type(file_desc_t), intent(inout) :: piofile type(trfile), intent(inout) :: tr_file - integer :: ioerr, slen ! error status + integer :: ioerr ! error status if(associated(tr_file%currfnameid)) then ioerr = pio_put_var(pioFile, tr_file%currfnameid, tr_file%curr_filename) deallocate(tr_file%currfnameid) @@ -2135,7 +2208,7 @@ subroutine interpz_conserve( nsrc, ntrg, src_x, trg_x, src, trg) !--------------------------------------------------------------- ! ... local variables !--------------------------------------------------------------- - integer :: i, j, n + integer :: i, j integer :: sil real(r8) :: tl, y real(r8) :: bot, top diff --git a/test/system/input_tests_master b/test/system/input_tests_master index 59a2e214db..a14d253590 100644 --- a/test/system/input_tests_master +++ b/test/system/input_tests_master @@ -84,6 +84,8 @@ sm472 TSM.sh f4c6aqwmadm outfrq3s 9s sm473 TSM.sh f4c6aqwmtdm outfrq3s_sums 9s sm474 TSM.sh f1.9c6aqwmth outfrq3s_sums 9s +sm501 TSM.sh h5c5aqdm outfrq3s_unstr_emis 9s + sm700 TSM.sh h5adicdm outfrq3s_bwic 9s sm701 TSM.sh h5addm outfrq3s 9s sm702 TSM.sh h5.3adicdm outfrq3s_bwic 9s @@ -190,6 +192,8 @@ er472 TER.sh f4c6aqwmadm outfrq3s 4+5s er473 TER.sh f4c6aqwmtdm outfrq3s_sums 4+5s er474 TER.sh f1.9c6aqwmth outfrq3s_sums 4+5s +er501 TER.sh h5c5aqdm outfrq3s_unstr_emis 4+5s + er700 TER.sh h5adicdm outfrq3s_bwic 4+5s er701 TER.sh h5addm outfrq3s 4+5s er702 TER.sh h5.3adicdm outfrq3s_bwic 4+5s @@ -326,6 +330,8 @@ bl472 TBL.sh f4c6aqwmadm outfrq3s 9s bl473 TBL.sh f4c6aqwmtdm outfrq3s_sums 9s bl474 TBL.sh f1.9c6aqwmth outfrq3s_sums 9s +bl501 TBL.sh h5c5aqdm outfrq3s_unstr_emis 9s + bl700 TBL.sh h5adicdm outfrq3s_bwic 9s bl701 TBL.sh h5addm outfrq3s 9s bl702 TBL.sh h5.3adicdm outfrq3s_bwic 9s diff --git a/test/system/nl_files/outfrq3s_unstr_emis b/test/system/nl_files/outfrq3s_unstr_emis new file mode 100644 index 0000000000..9a2359bb6b --- /dev/null +++ b/test/system/nl_files/outfrq3s_unstr_emis @@ -0,0 +1,28 @@ +&camexp + restart_option='nsteps' + restart_n=3 + mfilt=1,1,1,1,1,1 + ndens=1,1,1,1,1,1 + nhtfrq=3,3,3,3,3,3 + inithist='ENDOFRUN' + ext_frc_specifier = + 'SO2 -> 0.5*$CSMDATA/atm/cam/chem/se_emis/SO2_alt_emis_ne5np4_2000_c180318.nc', + 'SO2 -> 0.5*$CSMDATA/atm/cam/chem/se_emis/SO2_lev_emis_ne5np4_2000_c180318.nc', + 'bc_a1 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_bc_elev_2000_c120315.nc', + 'num_a1 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_num_a1_elev_2000_c120315.nc', + 'num_a2 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_num_a2_elev_2000_c120315.nc', + 'pom_a1 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_pom_elev_2000_c130422.nc', + 'so4_a1 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_so4_a1_elev_2000_c120315.nc', + 'so4_a2 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_so4_a2_elev_2000_c120315.nc' + srf_emis_specifier = + 'DMS -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/aerocom_mam3_dms_surf_2000_c120315.nc', + 'SO2 -> $CSMDATA/atm/cam/chem/se_emis/SO2_srf_emis_ne5np4_2000_c180315.nc', + 'SOAG -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_soag_1.5_surf_2000_c130422.nc', + 'bc_a1 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_bc_surf_2000_c120315.nc', + 'num_a1 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_num_a1_surf_2000_c120315.nc', + 'num_a2 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_num_a2_surf_2000_c120315.nc', + 'pom_a1 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_pom_surf_2000_c130422.nc', + 'so4_a1 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_so4_a1_surf_2000_c120315.nc', + 'so4_a2 -> $CSMDATA/atm/cam/chem/trop_mozart_aero/emis/ar5_mam3_so4_a2_surf_2000_c120315.nc' + fincl2='SFSO2','SO2_XFRC' +/ diff --git a/test/system/tests_chem_mpi b/test/system/tests_chem_mpi index 3aea6ea5f5..3749ec483c 100644 --- a/test/system/tests_chem_mpi +++ b/test/system/tests_chem_mpi @@ -2,3 +2,4 @@ sm375 er375 bl375 sm376 er376 bl376 sm471 br471 bl471 sm469 bl469 +sm501 er501 bl501