diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 3c6586bd1..72c6b5972 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -122,7 +122,8 @@ module cdeps_datm_comp integer :: iradsw = 0 ! radiation interval (input namelist) character(CL) :: factorFn_mesh = 'null' ! file containing correction factors mesh character(CL) :: factorFn_data = 'null' ! file containing correction factors data - logical :: flds_presaero = .false. ! true => send valid prescribe aero fields to mediator + logical :: flds_presaero = .false. ! true => send valid prescribed aero fields to mediator + logical :: flds_presndep = .false. ! true => send valid prescribed ndep fields to mediator logical :: flds_co2 = .false. ! true => send prescribed co2 to mediator logical :: flds_wiso = .false. ! true => send water isotopes to mediator character(CL) :: bias_correct = nullstr ! send bias correction fields to coupler @@ -229,7 +230,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) model_meshfile, model_maskfile, & nx_global, ny_global, restfilm, iradsw, factorFn_data, factorFn_mesh, & flds_presaero, flds_co2, flds_wiso, bias_correct, anomaly_forcing, & - skip_restart_read + skip_restart_read, flds_presndep rc = ESMF_SUCCESS @@ -268,6 +269,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_mpi_bcast(factorFn_mesh , mpicom, 'factorFn_mesh') call shr_mpi_bcast(restfilm , mpicom, 'restfilm') call shr_mpi_bcast(flds_presaero , mpicom, 'flds_presaero') + call shr_mpi_bcast(flds_presndep , mpicom, 'flds_presndep') call shr_mpi_bcast(flds_co2 , mpicom, 'flds_co2') call shr_mpi_bcast(flds_wiso , mpicom, 'flds_wiso') call shr_mpi_bcast(skip_restart_read , mpicom, 'skip_restart_read') @@ -285,6 +287,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F00)' factorFn_data = ',trim(factorFn_data) write(logunit,F00)' factorFn_mesh = ',trim(factorFn_mesh) write(logunit,F02)' flds_presaero = ',flds_presaero + write(logunit,F02)' flds_presndep = ',flds_presndep write(logunit,F02)' flds_co2 = ',flds_co2 write(logunit,F02)' flds_wiso = ',flds_wiso write(logunit,F02)' skip_restart_read = ',skip_restart_read @@ -308,19 +311,19 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) select case (trim(datamode)) case ('CORE2_NYF', 'CORE2_IAF') call datm_datamode_core2_advertise(exportState, fldsExport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, rc) + flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('CORE_IAF_JRA') call datm_datamode_jra_advertise(exportState, fldsExport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, rc) + flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('CLMNCEP') call datm_datamode_clmncep_advertise(exportState, fldsExport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, rc) + flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('CPLHIST') call datm_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, rc) + flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('ERA5') call datm_datamode_era5_advertise(exportState, fldsExport, flds_scalar_name, rc) @@ -491,7 +494,7 @@ subroutine ModelAdvance(gcomp, rc) restart_write = dshr_check_restart_alarm(clock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - + ! Run datm call ESMF_TraceRegionEnter('datm_run') call datm_comp_run(importstate, exportstate, next_ymd, next_tod, mon, & @@ -705,6 +708,7 @@ subroutine datm_init_dfields(rc) ! local variables integer :: n + character(CS) :: strm_flds2(2) character(CS) :: strm_flds3(3) character(CS) :: strm_flds4(4) integer :: rank @@ -731,6 +735,10 @@ subroutine datm_init_dfields(rc) exportState, logunit, mainproc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else if (rank == 2) then + ! The following maps stream input fields to export fields that have an ungridded dimension + ! TODO: in the future it might be better to change the format of the streams file to have two more entries + ! that could denote how the stream variables are mapped to export fields that have an ungridded dimension + select case (trim(lfieldnames(n))) case('Faxa_bcph') strm_flds3 = (/'Faxa_bcphidry', 'Faxa_bcphodry', 'Faxa_bcphiwet'/) @@ -764,6 +772,11 @@ subroutine datm_init_dfields(rc) strm_flds3 = (/'Faxa_snowl_16O', 'Faxa_snowl_18O', 'Faxa_snowl_HDO'/) call dshr_dfield_add(dfields, sdat, trim(lfieldnames(n)), strm_flds3, exportState, logunit, mainproc, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('Faxa_ndep') + strm_flds2 = (/'Faxa_ndep_nhx', 'Faxa_ndep_noy'/) + call dshr_dfield_add(dfields, sdat, trim(lfieldnames(n)), strm_flds2, exportState, logunit, mainproc, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end select end if end do diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index 122db7cdc..2ff95fdbe 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -104,6 +104,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path datm_mode = case.get_value("DATM_MODE") datm_topo = case.get_value("DATM_TOPO") datm_presaero = case.get_value("DATM_PRESAERO") + datm_presndep = case.get_value("DATM_PRESNDEP") datm_co2_tseries = case.get_value("DATM_CO2_TSERIES") atm_grid = case.get_value("ATM_GRID") model_grid = case.get_value("GRID") @@ -113,6 +114,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path if "CLM" in datm_mode and comp_lnd == "clm": expect(datm_presaero != "none", "A DATM_MODE for CLM is incompatible with DATM_PRESAERO=none.") + expect(datm_presndep != "none", + "A DATM_MODE for CLM is incompatible with DATM_PRESNDEP=none.") expect(datm_topo != "none", "A DATM_MODE for CLM is incompatible with DATM_TOPO=none.") @@ -120,6 +123,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path logger.debug("DATM mode is {}".format(datm_mode)) logger.debug("DATM grid is {}".format(atm_grid)) logger.debug("DATM presaero mode is {}".format(datm_presaero)) + logger.debug("DATM presndep mode is {}".format(datm_presndep)) logger.debug("DATM topo mode is {}".format(datm_topo)) # Initialize namelist defaults @@ -138,6 +142,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['datm_mode'] = datm_mode config['datm_co2_tseries'] = datm_co2_tseries config['datm_presaero'] = datm_presaero + config['datm_presndep'] = datm_presndep if case.get_value('PTS_LON'): scol_lon = float(case.get_value('PTS_LON')) @@ -166,6 +171,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path if datm_presaero != "none": streamlist.append("presaero.{}".format(datm_presaero)) + if datm_presndep != "none": + streamlist.append("presndep.{}".format(datm_presndep)) if datm_topo != "none": streamlist.append("topo.{}".format(datm_topo)) if datm_co2_tseries != "none": diff --git a/datm/cime_config/config_component.xml b/datm/cime_config/config_component.xml index c8ff2f3ec..eed8a082d 100644 --- a/datm/cime_config/config_component.xml +++ b/datm/cime_config/config_component.xml @@ -66,7 +66,7 @@ char - none,clim_1850,clim_2000,clim_2010,trans_1850-2000,SSP1-1.9,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP4-3.4,SSP4-6.0,SSP5-3.4,SSP5-8.5,cplhist + none,clim_1850,clim_2000,clim_2010,hist,SSP1-1.9,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP4-3.4,SSP4-6.0,SSP5-3.4,SSP5-8.5,cplhist clim_2000 clim_1850 @@ -80,8 +80,8 @@ SSP4-6.0 SSP5-3.4 SSP5-8.5 - trans_1850-2000 - trans_1850-2000 + hist + hist cplhist none @@ -90,6 +90,28 @@ DATM prescribed aerosol forcing + + char + none,clim_1850,clim_2000,clim_2010,hist,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP5-3.4,SSP5-8.5 + clim_2000 + + clim_1850 + clim_2000 + clim_2010 + SSP1-2.6 + SSP2-4.5 + SSP3-7.0 + SSP5-8.5 + hist + hist + cplhist + none + + run_component_datm + env_run.xml + DATM prescribed nitrogen deposition forcing + + char none,observed,cplhist @@ -107,7 +129,7 @@ char - none,20tr,20tr.latbnd,omip,SSP1-1.9,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP4-3.4,SSP4-6.0,SSP5-3.4,SSP5-8.5,SSP1-1.9.latbnd,SSP1-2.6.latbnd,SSP2-4.5.latbnd,SSP3-7.0.latbnd,SSP4-3.4.latbnd,SSP4-6.0.latbnd,SSP5-3.4.latbnd,SSP5-8.5.latbnd + none,20tr,20tr.latbnd,omip.iaf,omip.jra,SSP1-1.9,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP4-3.4,SSP4-6.0,SSP5-3.4,SSP5-8.5,SSP1-1.9.latbnd,SSP1-2.6.latbnd,SSP2-4.5.latbnd,SSP3-7.0.latbnd,SSP4-3.4.latbnd,SSP4-6.0.latbnd,SSP5-3.4.latbnd,SSP5-8.5.latbnd none SSP1-1.9 diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 4a137b4f9..3ea0bef64 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -266,6 +266,19 @@ + + logical + datm + datm_nml + + If true, prescribed nitrogen deposition fluxes are sent from datm (must be true for running with CLM). + + + .true. + .false. + + + logical datm diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index 464ce0353..d4228d246 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -23,8 +23,8 @@ any entry that has %y, %ym or %ymd MUST have first_year and last_year syntax ****** - Each mode below, except for presaero, has a set of streams associated with it - The presaero stream, is associated with all modes + Each mode below, except for presaero and presndep, has a set of streams associated with it + The presaero and presndep streams are associated with all modes Currently the following data modes are supported: CLM_QIAN = Run with the CLM Qian dataset valid from 1948 to 2004 (force CLM) @@ -45,6 +45,7 @@ Currently the following optional streams are supported presaero = Prescribed aerosol forcing + presndep = Prescribed nitrogen deposition forcing topo = Surface topography co2tseries = Time series of prescribed CO2 forcing Anomaly.Forcing = Time series of correction terms @@ -135,7 +136,8 @@ ======================== co2tseries.20tr co2tseries.20tr.latbnd - co2tseries.omip + co2tseries.omip.iaf + co2tseries.omip.jra co2tseries.SSP1-1.9 co2tseries.SSP1-2.6 co2tseries.SSP2-4.5 @@ -160,7 +162,7 @@ presaero.clim_1850 presaero.clim_2000 presaero.clim_2010 - presaero.trans_1850-2000 + presaero.hist presaero.SSP1-1.9 presaero.SSP1-2.6 presaero.SSP2-4.5 @@ -171,6 +173,20 @@ presaero.SSP5-8.5 presaero.cplhist + ======================== + optional stream nitrogen deposition + - DATM_NDEP is set by the 4 character time prefix in config_component.xml + ======================== + presndep.clim_1850 + presndep.clim_2000 + presndep.clim_2010 + presndep.hist + presndep.SSP1-2.6 + presndep.SSP2-4.5 + presndep.SSP3-7.0 + presndep.SSP5-8.5 + presndep.cplhist + ======================== optional stream topo (turned on and stream specified by xml variable DATM_TOPO) ======================== @@ -3763,7 +3779,7 @@ single - + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc @@ -3983,28 +3999,244 @@ single - + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP585_b.e21.BSSP585cmip6.f09_g17.CMIP6-SSP5-8.5.001_2014-2101_monthly_0.9x1.25_c190419.nc + $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc - BCDEPWET Faxa_bcphiwet - BCPHODRY Faxa_bcphodry - BCPHIDRY Faxa_bcphidry - OCDEPWET Faxa_ocphiwet - OCPHIDRY Faxa_ocphidry - OCPHODRY Faxa_ocphodry - DSTX01WD Faxa_dstwet1 - DSTX01DD Faxa_dstdry1 - DSTX02WD Faxa_dstwet2 - DSTX02DD Faxa_dstdry2 - DSTX03WD Faxa_dstwet3 - DSTX03DD Faxa_dstdry3 - DSTX04WD Faxa_dstwet4 - DSTX04DD Faxa_dstdry4 + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy + + null + + bilinear + + null + 1 + 1850 + 1850 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc + + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy + + null + + bilinear + + null + 1 + 2000 + 2000 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc + + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy + + null + + bilinear + + null + 1 + 2010 + 2010 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc + + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy + + null + + bilinear + + null + 1849 + 1849 + 2014 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc + + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy + + null + + bilinear + + null + 2015 + 2015 + 2101 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/lnd/clm2/ndepdata/lnd/clm2/fndepdata/fndep_clm_f09_g17.CMIP6-SSP2-4.5-WACCM_1849-2101_monthly_c191007.nc + + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy + + null + + bilinear + + null + 2015 + 2015 + 2101 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.002_1849-2101_monthly_0.9x1.25_c211216.nc + + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy + + null + + bilinear + + null + 2015 + 2015 + 2101 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc + + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy null @@ -4105,6 +4337,37 @@ single + + + $ATM_DOMAIN_MESH + + + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc + + + a2x1d_Faxa_ndep Faxa_ndep + + null + + bilinear + + null + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END + 0 + + nearest + + + cycle + + + 3.0 + + single + + $ATM_DOMAIN_MESH diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 4ae0b205e..0c4619c01 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -46,6 +46,7 @@ module datm_datamode_clmncep_mod real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() real(r8), pointer :: Faxa_swnet(:) => null() + real(r8), pointer :: Faxa_ndep(:,:) => null() ! stream data real(r8), pointer :: strm_z(:) => null() @@ -112,14 +113,15 @@ module datm_datamode_clmncep_mod !=============================================================================== subroutine datm_datamode_clmncep_advertise(exportState, fldsexport, flds_scalar_name, & - flds_co2, flds_wiso, presaero, rc) + flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState type(fldlist_type) , pointer :: fldsexport logical , intent(in) :: flds_co2 logical , intent(in) :: flds_wiso - logical , intent(in) :: presaero + logical , intent(in) :: flds_presaero + logical , intent(in) :: flds_presndep character(len=*) , intent(in) :: flds_scalar_name integer , intent(out) :: rc @@ -155,12 +157,15 @@ subroutine datm_datamode_clmncep_advertise(exportState, fldsexport, flds_scalar_ call dshr_fldList_add(fldsExport, 'Sa_co2prog') call dshr_fldList_add(fldsExport, 'Sa_co2diag') end if - if (presaero) then + if (flds_presaero) then call dshr_fldList_add(fldsExport, 'Faxa_bcph' , ungridded_lbound=1, ungridded_ubound=3) call dshr_fldList_add(fldsExport, 'Faxa_ocph' , ungridded_lbound=1, ungridded_ubound=3) call dshr_fldList_add(fldsExport, 'Faxa_dstwet' , ungridded_lbound=1, ungridded_ubound=4) call dshr_fldList_add(fldsExport, 'Faxa_dstdry' , ungridded_lbound=1, ungridded_ubound=4) end if + if (flds_presndep) then + call dshr_fldList_add(fldsExport, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=2) + end if if (flds_wiso) then call dshr_fldList_add(fldsExport, 'Faxa_rainc_wiso', ungridded_lbound=1, ungridded_ubound=3) call dshr_fldList_add(fldsExport, 'Faxa_rainl_wiso', ungridded_lbound=1, ungridded_ubound=3) @@ -232,6 +237,8 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn_HDO' , strm_precn_HDO, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn_HDO' , strm_precn_HDO, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! initialize pointers for module level stream arrays for bias correction call shr_strdata_get_stream_pointer( sdat, 'Faxa_precsf' , strm_precsf , rc) @@ -295,6 +302,13 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(exportstate, 'Faxa_ndep', itemFlag, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + call dshr_state_getfldptr(exportState, 'Faxa_ndep', fldptr2=Faxa_ndep, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + ! error check if (.not. associated(strm_wind) .or. .not. associated(strm_tbot)) then call shr_sys_abort(trim(subname)//' ERROR: wind and tbot must be in streams for CLMNCEP') @@ -412,12 +426,12 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) e = strm_rh(n) * 0.01_r8 * datm_esat(tbot,tbot) qsat = (0.622_r8 * e)/(pbot - 0.378_r8 * e) Sa_shum(n) = qsat -! if (associated(strm_rh_16O) .and. associated(strm_rh_18O) .and. associated(strm_rh_HDO)) then - ! for isotopic tracer specific humidity, expect a delta, just keep the delta from the input file -! Sa_shum_wiso(1,n) = strm_rh_16O(n) -! Sa_shum_wiso(2,n) = strm_rh_18O(n) -! Sa_shum_wiso(3,n) = strm_rh_HDO(n) -! end if + ! for isotopic tracer specific humidity, expect a delta, just keep the delta from the input file + ! if (associated(strm_rh_16O) .and. associated(strm_rh_18O) .and. associated(strm_rh_HDO)) then + ! Sa_shum_wiso(1,n) = strm_rh_16O(n) + ! Sa_shum_wiso(2,n) = strm_rh_18O(n) + ! Sa_shum_wiso(3,n) = strm_rh_HDO(n) + ! end if else if (associated(strm_tdew)) then if (tdewmax < 50.0_r8) strm_tdew(n) = strm_tdew(n) + tkFrz e = datm_esat(strm_tdew(n),tbot) @@ -547,6 +561,11 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) endif ! bias correction / anomaly forcing ( end block ) + if (associated(Faxa_ndep)) then + ! convert ndep flux to units of kgN/m2/s (input is in gN/m2/s) + Faxa_ndep(:,:) = Faxa_ndep(:,:) / 1000._r8 + end if + end subroutine datm_datamode_clmncep_advance !=============================================================================== diff --git a/datm/datm_datamode_core2_mod.F90 b/datm/datm_datamode_core2_mod.F90 index 4bdfa58fd..552b35dae 100644 --- a/datm/datm_datamode_core2_mod.F90 +++ b/datm/datm_datamode_core2_mod.F90 @@ -1,9 +1,10 @@ module datm_datamode_core2_mod - use ESMF , only : ESMF_State, ESMF_Field, ESMF_FieldBundle + use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_Field, ESMF_FieldBundle use ESMF , only : ESMF_DistGrid, ESMF_RouteHandle, ESMF_MeshCreate use ESMF , only : ESMF_Mesh, ESMF_MeshGet, ESMF_MeshCreate use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_FILEFORMAT_ESMFMESH + use ESMF , only : ESMF_StateItem_Flag, ESMF_STATEITEM_NOTFOUND, operator(/=) use ESMF , only : ESMF_FieldBundleCreate, ESMF_FieldCreate, ESMF_MESHLOC_ELEMENT use ESMF , only : ESMF_FieldBundleAdd, ESMF_LOGMSG_INFO, ESMF_TYPEKIND_R8 use ESMF , only : ESMF_RouteHandleDestroy, ESMF_EXTRAPMETHOD_NEAREST_STOD @@ -55,6 +56,7 @@ module datm_datamode_core2_mod real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() real(r8), pointer :: Faxa_swnet(:) => null() + real(r8), pointer :: Faxa_ndep(:,:) => null() ! stream data real(r8), pointer :: strm_prec(:) => null() @@ -91,7 +93,7 @@ module datm_datamode_core2_mod !=============================================================================== subroutine datm_datamode_core2_advertise(exportState, fldsexport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, rc) + flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState @@ -100,6 +102,7 @@ subroutine datm_datamode_core2_advertise(exportState, fldsexport, flds_scalar_na logical , intent(in) :: flds_co2 logical , intent(in) :: flds_wiso logical , intent(in) :: flds_presaero + logical , intent(in) :: flds_presndep integer , intent(out) :: rc ! local variables @@ -140,6 +143,9 @@ subroutine datm_datamode_core2_advertise(exportState, fldsexport, flds_scalar_na call dshr_fldList_add(fldsExport, 'Faxa_dstwet' , ungridded_lbound=1, ungridded_ubound=4) call dshr_fldList_add(fldsExport, 'Faxa_dstdry' , ungridded_lbound=1, ungridded_ubound=4) end if + if (flds_presndep) then + call dshr_fldList_add(fldsExport, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=2) + end if if (flds_wiso) then call dshr_fldList_add(fldsExport, 'Faxa_rainc_wiso', ungridded_lbound=1, ungridded_ubound=3) call dshr_fldList_add(fldsExport, 'Faxa_rainl_wiso', ungridded_lbound=1, ungridded_ubound=3) @@ -175,6 +181,7 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor integer :: spatialDim ! number of dimension in mesh integer :: numOwnedElements ! size of mesh real(r8), pointer :: ownedElemCoords(:) ! mesh lat and lons + type(ESMF_StateItem_Flag) :: itemFlag character(len=*), parameter :: subname='(datm_init_pointers): ' !------------------------------------------------------------------------------- @@ -243,6 +250,13 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(exportstate, 'Faxa_ndep', itemFlag, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + call dshr_state_getfldptr(exportState, 'Faxa_ndep', fldptr2=Faxa_ndep, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (.not. associated(strm_prec) .or. .not. associated(strm_swdn)) then call shr_sys_abort(trim(subname)//'ERROR: prec and swdn must be in streams for CORE2') endif @@ -376,6 +390,11 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ enddo ! lsize + if (associated(Faxa_ndep)) then + ! convert ndep flux to units of kgN/m2/s (input is in gN/m2/s) + Faxa_ndep(:,:) = Faxa_ndep(:,:) / 1000._r8 + end if + end subroutine datm_datamode_core2_advance !=============================================================================== diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index 1c085375b..7f0850402 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -52,14 +52,15 @@ module datm_datamode_cplhist_mod !=============================================================================== subroutine datm_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_name, & - flds_co2, flds_wiso, presaero, rc) + flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState type(fldlist_type) , pointer :: fldsexport logical , intent(in) :: flds_co2 logical , intent(in) :: flds_wiso - logical , intent(in) :: presaero + logical , intent(in) :: flds_presaero + logical , intent(in) :: flds_presndep character(len=*) , intent(in) :: flds_scalar_name integer , intent(out) :: rc @@ -95,12 +96,15 @@ subroutine datm_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_ call dshr_fldList_add(fldsExport, 'Sa_co2prog') call dshr_fldList_add(fldsExport, 'Sa_co2diag') end if - if (presaero) then + if (flds_presaero) then call dshr_fldList_add(fldsExport, 'Faxa_bcph' , ungridded_lbound=1, ungridded_ubound=3) call dshr_fldList_add(fldsExport, 'Faxa_ocph' , ungridded_lbound=1, ungridded_ubound=3) call dshr_fldList_add(fldsExport, 'Faxa_dstwet' , ungridded_lbound=1, ungridded_ubound=4) call dshr_fldList_add(fldsExport, 'Faxa_dstdry' , ungridded_lbound=1, ungridded_ubound=4) end if + if (flds_presndep) then + call dshr_fldList_add(fldsExport, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=2) + end if if (flds_wiso) then call dshr_fldList_add(fldsExport, 'Faxa_rainc_wiso', ungridded_lbound=1, ungridded_ubound=3) call dshr_fldList_add(fldsExport, 'Faxa_rainl_wiso', ungridded_lbound=1, ungridded_ubound=3) diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index a694f3588..792e5ba05 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -49,6 +49,7 @@ module datm_datamode_era5_mod real(r8), pointer :: Faxa_lat(:) => null() real(r8), pointer :: Faxa_taux(:) => null() real(r8), pointer :: Faxa_tauy(:) => null() + real(r8), pointer :: Faxa_ndep(:,:) => null() ! stream data real(r8), pointer :: strm_tdew(:) => null() diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index b7055e07c..d280bf860 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -1,7 +1,8 @@ module datm_datamode_jra_mod - use ESMF , only : ESMF_State, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO use ESMF , only : ESMF_MeshGet + use ESMF , only : ESMF_StateItem_Flag, ESMF_STATEITEM_NOTFOUND, operator(/=) use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -39,6 +40,7 @@ module datm_datamode_jra_mod real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() real(r8), pointer :: Faxa_swnet(:) => null() + real(r8), pointer :: Faxa_ndep(:,:) => null() ! stream data real(r8), pointer :: strm_prec(:) => null() @@ -64,7 +66,7 @@ module datm_datamode_jra_mod !=============================================================================== subroutine datm_datamode_jra_advertise(exportState, fldsexport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, rc) + flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState @@ -73,6 +75,7 @@ subroutine datm_datamode_jra_advertise(exportState, fldsexport, flds_scalar_name logical , intent(in) :: flds_co2 logical , intent(in) :: flds_wiso logical , intent(in) :: flds_presaero + logical , intent(in) :: flds_presndep integer , intent(out) :: rc ! local variables @@ -113,6 +116,9 @@ subroutine datm_datamode_jra_advertise(exportState, fldsexport, flds_scalar_name call dshr_fldList_add(fldsExport, 'Faxa_dstwet' , ungridded_lbound=1, ungridded_ubound=4) call dshr_fldList_add(fldsExport, 'Faxa_dstdry' , ungridded_lbound=1, ungridded_ubound=4) end if + if (flds_presndep) then + call dshr_fldList_add(fldsExport, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=2) + end if if (flds_wiso) then call dshr_fldList_add(fldsExport, 'Faxa_rainc_wiso', ungridded_lbound=1, ungridded_ubound=3) call dshr_fldList_add(fldsExport, 'Faxa_rainl_wiso', ungridded_lbound=1, ungridded_ubound=3) @@ -145,6 +151,7 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) integer :: spatialDim ! number of dimension in mesh integer :: numOwnedElements ! size of mesh real(r8), pointer :: ownedElemCoords(:) ! mesh lat and lons + type(ESMF_StateItem_Flag) :: itemFlag character(len=*), parameter :: subname='(datm_init_pointers): ' !------------------------------------------------------------------------------- @@ -200,6 +207,14 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(exportState, 'Faxa_ndep', itemFlag, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + call dshr_state_getfldptr(exportState, 'Faxa_ndep', fldptr2=Faxa_ndep, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! erro check if (.not. associated(strm_prec) .or. .not. associated(strm_swdn)) then call shr_sys_abort(trim(subname)//'ERROR: prec and swdn must be in streams for CORE_IAF_JRA') endif @@ -263,6 +278,11 @@ subroutine datm_datamode_jra_advance(exportstate, target_ymd, target_tod, model_ Faxa_swnet(n) = strm_swdn(n)*(1.0_R8 - avg_alb) enddo ! lsize + if (associated(Faxa_ndep)) then + ! convert ndep flux to units of kgN/m2/s (input is in gN/m2/s) + Faxa_ndep(:,:) = Faxa_ndep(:,:) / 1000._r8 + end if + end subroutine datm_datamode_jra_advance !===============================================================================