diff --git a/cime_config/stream_cdeps.py b/cime_config/stream_cdeps.py index 1c05645ea..c989532e0 100644 --- a/cime_config/stream_cdeps.py +++ b/cime_config/stream_cdeps.py @@ -100,7 +100,7 @@ def create_stream_xml(self, stream_names, case, streams_xml_file, data_list_file for line in lines_input_new: # read in a single line in user_nl_xxx_streams and parse it if it is not a comment - stream_mods = [x.strip() for x in line.strip().split(":") if x] + stream_mods = [x.strip() for x in line.strip().split(":",maxsplit=1) if x] expect(len(stream_mods) == 2, "input stream mod can only be of the form streamname:var=value(s)") stream,varmod = stream_mods diff --git a/datm/cime_config/config_component.xml b/datm/cime_config/config_component.xml index 8a5fac7b3..eed8a082d 100644 --- a/datm/cime_config/config_component.xml +++ b/datm/cime_config/config_component.xml @@ -10,7 +10,7 @@ This file may have atm desc entries. --> - Data driven ATM + Data driven ATM QIAN data set QIAN with water isotopes CRUNCEP data set @@ -23,6 +23,9 @@ COREv2 interannual forcing interannual JRA55 forcing interannual JRA55 forcing, v1.4, through 2018 + JRA55 Repeat Year Forcing v1.3 1984-1985 + JRA55 Repeat Year Forcing v1.3 1990-1991 + JRA55 Repeat Year Forcing v1.3 2003-2004 ERA5 interannual forcing diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 53983cf14..3ea0bef64 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -50,7 +50,16 @@ CORE2_IAF.GCGCS.PREC,CORE2_IAF.GISS.LWDN,CORE2_IAF.GISS.SWDN,CORE2_IAF.GISS.SWUP,CORE2_IAF.NCEP.DN10,CORE2_IAF.NCEP.Q_10,CORE2_IAF.NCEP.SLP_,CORE2_IAF.NCEP.T_10,CORE2_IAF.NCEP.U_10,CORE2_IAF.NCEP.V_10,CORE2_IAF.CORE2.ArcFactor - CORE_IAF_JRA_1p4_2018.GCGCS.PREC,CORE_IAF_JRA_1p4_2018.GISS.LWDN,CORE_IAF_JRA_1p4_2018.GISS.SWDN,CORE_IAF_JRA_1p4_2018.NCEP.Q_10,CORE_IAF_JRA_1p4_2018.NCEP.SLP_,CORE_IAF_JRA_1p4_2018.NCEP.T_10,CORE_IAF_JRA_1p4_2018.NCEP.U_10,CORE_IAF_JRA_1p4_2018.NCEP.V_10 + CORE_IAF_JRA_1p4_2018.GCGCS.PREC,CORE_IAF_JRA_1p4_2018.GISS.LWDN,CORE_IAF_JRA_1p4_2018.GISS.SWDN,CORE_IAF_JRA_1p4_2018.NCEP.Q_10,CORE_IAF_JRA_1p4_2018.NCEP.SLP_,CORE_IAF_JRA_1p4_2018.NCEP.T_10,CORE_IAF_JRA_1p4_2018.NCEP.U_10,CORE_IAF_JRA_1p4_2018.NCEP.V_10 + + + CORE_RYF8485_JRA.GISS.LWDN,CORE_RYF8485_JRA.GISS.SWDN,CORE_RYF8485_JRA.GCGCS,CORE_RYF8485_JRA.NCEP + + + CORE_RYF9091_JRA.GISS.LWDN,CORE_RYF9091_JRA.GISS.SWDN,CORE_RYF9091_JRA.GCGCS,CORE_RYF9091_JRA.NCEP + + + CORE_RYF0304_JRA.GISS.LWDN,CORE_RYF0304_JRA.GISS.SWDN,CORE_RYF0304_JRA.GCGCS,CORE_RYF0304_JRA.NCEP CORE_IAF_JRA.PREC,CORE_IAF_JRA.LWDN,CORE_IAF_JRA.SWDN,CORE_IAF_JRA.Q_10,CORE_IAF_JRA.SLP_,CORE_IAF_JRA.T_10,CORE_IAF_JRA.U_10,CORE_IAF_JRA.V_10 diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index ec3004693..590151bf0 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -37,6 +37,9 @@ CORE2_IAF = CORE2 intra-annual year forcing (for forcing POP and CICE) CORE_IAF_JRA = JRA55 intra-annual year forcing (for forcing POP and CICE) CORE_IAF_JRA_1p4_2018 = JRA55 intra-annual year forcing, v1.4, through 2018 (for forcing POP and CICE) + CORE_RYF8485_JRA = JRA55 repeat year forcing, v1.3, 1984-1985 (for forcing POP and CICE) + CORE_RYF9091_JRA = JRA55 repeat year forcing, v1.3, 1990-1991 (for forcing POP and CICE) + CORE_RYF0304_JRA = JRA55 repeat year forcing, v1.3, 2003-2004 (for forcing POP and CICE) ERA5 = ERA5 intra-annual year forcing CPLHIST = Streams for lnd or ocn/ice forcing used for spinup @@ -1307,7 +1310,7 @@ bilinear - u:v + null 1 1 1 @@ -1338,7 +1341,7 @@ bilinear - u:v + null 1 1 1 @@ -1374,7 +1377,7 @@ bilinear - u:v + Sa_u:Sa_v 1 1 1 @@ -1409,7 +1412,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1440,7 +1443,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1471,7 +1474,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1502,7 +1505,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1533,7 +1536,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1564,7 +1567,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1595,7 +1598,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1626,7 +1629,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1657,7 +1660,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1688,7 +1691,7 @@ bilinear - u:v + null 1 2010 2011 @@ -1720,7 +1723,7 @@ bilinear - u:v + null 1 1948 2009 @@ -1752,7 +1755,7 @@ bilinear - u:v + null 1 1948 2009 @@ -1784,7 +1787,7 @@ bilinear - u:v + null 1 1948 2009 @@ -1816,7 +1819,7 @@ bilinear - u:v + null 1 1948 2009 @@ -1850,7 +1853,7 @@ bilinear - u:v + null 1 1948 2009 @@ -1884,7 +1887,7 @@ bilinear - u:v + null 1 1948 2009 @@ -1918,7 +1921,7 @@ bilinear - u:v + null 1 1948 2009 @@ -1952,7 +1955,7 @@ bilinear - u:v + null 1 1948 2009 @@ -1986,7 +1989,7 @@ bilinear - u:v + null 1 1948 2009 @@ -2020,7 +2023,7 @@ bilinear - u:v + null 1 1948 2009 @@ -2051,7 +2054,7 @@ bilinear - u:v + null 1 1948 2009 @@ -2094,7 +2097,7 @@ bilinear - u:v + null 1 1958 2018 @@ -2125,7 +2128,7 @@ bilinear - u:v + null 1 1958 2018 @@ -2156,7 +2159,7 @@ bilinear - u:v + null 1 1958 2018 @@ -2187,7 +2190,7 @@ bilinear - u:v + null 1 1958 2018 @@ -2218,7 +2221,7 @@ bilinear - u:v + null 1 1958 2018 @@ -2249,7 +2252,7 @@ bilinear - u:v + null 1 1958 2018 @@ -2280,7 +2283,7 @@ bilinear - u:v + null 1 1958 2018 @@ -2311,7 +2314,7 @@ bilinear - u:v + null 1 1958 2018 @@ -2328,6 +2331,402 @@ single + + + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.radiation.lwdn.TL319.180404.nc + + + lwdn Faxa_lwdn + + null + + bilinear + + null + 1 + 1984 + 1984 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.radiation.swdn.TL319.180404.nc + + + swdn Faxa_swdn + + null + + bilinear + + null + 1 + 1984 + 1984 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.prec.TL319.180404.nc + + + prec Faxa_prec + + null + + bilinear + + null + 1 + 1984 + 1984 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.states.TL319.180404.nc + + + u_10 Sa_u + v_10 Sa_v + t_10 Sa_tbot + q_10 Sa_shum + slp Sa_pslv + + null + + bilinear + + Sa_u:Sa_v + 1 + 1984 + 1984 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.radiation.lwdn.TL319.180404.nc + + + lwdn Faxa_lwdn + + null + + bilinear + + null + 1 + 1990 + 1990 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.radiation.swdn.TL319.180404.nc + + + swdn Faxa_swdn + + null + + bilinear + + null + 1 + 1990 + 1990 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.prec.TL319.180404.nc + + + prec Faxa_prec + + null + + bilinear + + null + 1 + 1990 + 1990 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.states.TL319.180404.nc + + + u_10 Sa_u + v_10 Sa_v + t_10 Sa_tbot + q_10 Sa_shum + slp Sa_pslv + + null + + bilinear + + Sa_u:Sa_v + 1 + 1990 + 1990 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.radiation.lwdn.TL319.180404.nc + + + lwdn Faxa_lwdn + + null + + bilinear + + null + 1 + 2003 + 2003 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.radiation.swdn.TL319.180404.nc + + + swdn Faxa_swdn + + null + + bilinear + + null + 1 + 2003 + 2003 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.prec.TL319.180404.nc + + + prec Faxa_prec + + null + + bilinear + + null + 1 + 2003 + 2003 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.states.TL319.180404.nc + + + u_10 Sa_u + v_10 Sa_v + t_10 Sa_tbot + q_10 Sa_shum + slp Sa_pslv + + null + + bilinear + + Sa_u:Sa_v + 1 + 2003 + 2003 + 0 + + linear + + + cycle + + + 1.5 + + single + + @@ -2346,7 +2745,7 @@ bilinear - u:v + null 1 1958 2016 @@ -2377,7 +2776,7 @@ bilinear - u:v + null 1 1958 2016 @@ -2408,7 +2807,7 @@ bilinear - u:v + null 1 1958 2016 @@ -2439,7 +2838,7 @@ bilinear - u:v + null 1 1958 2016 @@ -2470,7 +2869,7 @@ bilinear - u:v + null 1 1958 2016 @@ -2501,7 +2900,7 @@ bilinear - u:v + null 1 1958 2016 @@ -2532,7 +2931,7 @@ bilinear - u:v + null 1 1958 2016 @@ -2563,7 +2962,7 @@ bilinear - u:v + null 1 1958 2016 diff --git a/datm/cime_config/user_nl_datm_streams b/datm/cime_config/user_nl_datm_streams index 856ee8944..b01a4fe80 100644 --- a/datm/cime_config/user_nl_datm_streams +++ b/datm/cime_config/user_nl_datm_streams @@ -1,8 +1,8 @@ !------------------------------------------------------------------------ ! This file is used to modify datm.streams.xml generated in $RUNDIR ! Entries should have the form -! :<= new stream_value> -! The following are accepted values for an assume streamname of foo +! := (NO Quotes!!!) +! The following are accepted values for a stream named foo ! foo:meshfile = character string ! foo:datafiles = comma separated string of full pathnames (e.g. file1,file2,file3...) ! foo:datavars = comma separated string of field pairs (e.g. foo foobar,foo2 foobar2...) @@ -14,7 +14,7 @@ ! foo:year_first = integer ! foo:year_last = integer ! foo:year_align = integer -! foo:vectors = one of [none,u:v] +! foo:vectors = null or the names of the vector fields in the model (i.e. Sa_u:Sa_v) ! foo:lev_dimname: = one of [null,name of level dimenion name] ! foo:offset = integer ! As an example: diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index c7faa91ce..9bae5d5c6 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -17,7 +17,7 @@ module dshr_strdata_mod use ESMF , only : ESMF_REGRIDMETHOD_CONSERVE, ESMF_NORMTYPE_FRACAREA, ESMF_NORMTYPE_DSTAREA use ESMF , only : ESMF_ClockGet, operator(-), operator(==), ESMF_CALKIND_NOLEAP use ESMF , only : ESMF_FieldReGridStore, ESMF_FieldRedistStore, ESMF_UNMAPPEDACTION_IGNORE - use ESMF , only : ESMF_TERMORDER_SRCSEQ, ESMF_FieldRegrid, ESMF_FieldFill + use ESMF , only : ESMF_TERMORDER_SRCSEQ, ESMF_FieldRegrid, ESMF_FieldFill, ESMF_FieldIsCreated use ESMF , only : ESMF_REGION_TOTAL, ESMF_FieldGet, ESMF_TraceRegionExit, ESMF_TraceRegionEnter use ESMF , only : ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_RC_ARG_VALUE use shr_kind_mod , only : r8=>shr_kind_r8, r4=>shr_kind_r4, i2=>shr_kind_I2 @@ -97,11 +97,9 @@ module dshr_strdata_mod integer :: stream_lb ! index of the Lowerbound (LB) in fldlist_stream integer :: stream_ub ! index of the Upperbound (UB) in fldlist_stream type(ESMF_Field) :: field_stream ! a field on the stream data domain - type(ESMF_Field) :: stream_vector ! a vector field on the stream data domain + type(ESMF_Field) :: field_stream_vector ! a vector field on the stream data domain type(ESMF_FieldBundle), allocatable :: fldbun_data(:) ! stream field bundle interpolated to model grid spatially type(ESMF_FieldBundle) :: fldbun_model ! stream n field bundle interpolated to model grid and time - integer :: ucomp = -1 ! index of vector u in stream - integer :: vcomp = -1 ! index of vector v in stream integer :: ymdLB = -1 ! stream ymd lower bound integer :: todLB = -1 ! stream tod lower bound integer :: ymdUB = -1 ! stream ymd upper bound @@ -114,7 +112,6 @@ module dshr_strdata_mod type shr_strdata_type type(shr_strdata_perstream), allocatable :: pstrm(:) ! stream info type(shr_stream_streamType), pointer :: stream(:)=> null() ! stream datatype - integer :: nvectors ! number of vectors logical :: mainproc integer :: logunit ! stdout unit integer :: io_type ! pio info @@ -398,7 +395,7 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) integer :: nvars integer :: i, stream_nlev, index integer, allocatable :: mask(:) - character(CL) :: stream_vectors + character(CL) :: stream_vector_names character(len=*), parameter :: subname='(shr_sdat_init)' ! ---------------------------------------------- @@ -450,15 +447,19 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) call shr_stream_getStreamFieldList(sdat%stream(ns), sdat%pstrm(ns)%fldlist_stream) ! Create field bundles on model mesh - if(sdat%stream(ns)%readmode=='single') then + if (sdat%stream(ns)%readmode=='single') then sdat%pstrm(ns)%stream_lb = 1 sdat%pstrm(ns)%stream_ub = 2 allocate(sdat%pstrm(ns)%fldbun_data(2)) + if (mainproc) then + write(sdat%logunit,'(a,i8)') trim(subname)//" Creating field bundle array fldbun_data of size 2 for stream ",& + ns + end if else if(sdat%stream(ns)%readmode=='full_file') then ! TODO: add this in endif - ! create spatially interpolated (but not time interpolated) field bundle - fldbun_data array + ! Create spatially interpolated (but not time interpolated) field bundle - fldbun_data array do i=1,size(sdat%pstrm(ns)%fldbun_data) sdat%pstrm(ns)%fldbun_data(i) = ESMF_FieldBundleCreate(rc=rc) ! stream mesh enddo @@ -476,6 +477,12 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) end if call ESMF_FieldBundleAdd(sdat%pstrm(ns)%fldbun_data(i), (/lfield/), rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + if (mainproc) then + if (i == 1) then + write(sdat%logunit,'(a,i8)') " adding field "//trim(sdat%pstrm(ns)%fldlist_model(nfld))//& + " to fldbun_data for stream ",ns + end if + end if enddo end do @@ -596,30 +603,34 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) do ns = 1,shr_strdata_get_stream_count(sdat) stream_mesh => sdat%pstrm(ns)%stream_mesh stream_nlev = sdat%pstrm(ns)%stream_nlev - stream_vectors = trim(sdat%stream(ns)%stream_vectors) + stream_vector_names = trim(sdat%stream(ns)%stream_vectors) ! check that vector field list is a valid colon delimited string - if (trim(stream_vectors) /= 'null') then - ! check that for now u and v are only for single leve fields + if (trim(stream_vector_names) /= 'null') then + ! check that for now u and v are only for single level fields if (stream_nlev > 1) then ! TODO: add support for u and v for multi level fields call shr_sys_abort(subname//': vector fields are not currently supported for multi-level fields') end if ! check that stream vector names are valid - if (.not. shr_string_listIsValid(stream_vectors)) then - write(sdat%logunit,*) trim(subname),' vec fldlist invalid m=',m,trim(stream_vectors) - call shr_sys_abort(subname//': vec fldlist invalid:'//trim(stream_vectors)) + if (.not. shr_string_listIsValid(stream_vector_names)) then + write(sdat%logunit,*) trim(subname),' vec fldlist invalid m=',m,trim(stream_vector_names) + call shr_sys_abort(subname//': vec fldlist invalid:'//trim(stream_vector_names)) endif ! check that only 2 fields are contained for any vector pairing - if (shr_string_listGetNum(stream_vectors) /= 2) then - write(sdat%logunit,*) trim(subname),' vec fldlist ne 2 m=',m,trim(stream_vectors) - call shr_sys_abort(subname//': vec fldlist ne 2:'//trim(stream_vectors)) + if (shr_string_listGetNum(stream_vector_names) /= 2) then + write(sdat%logunit,*) trim(subname),' vec fldlist ne 2 m=',m,trim(stream_vector_names) + call shr_sys_abort(subname//': vec fldlist ne 2:'//trim(stream_vector_names)) endif ! create stream vector field - sdat%pstrm(ns)%stream_vector = ESMF_FieldCreate(stream_mesh, & + sdat%pstrm(ns)%field_stream_vector = ESMF_FieldCreate(stream_mesh, & ESMF_TYPEKIND_r8, name='stream_vector', meshloc=ESMF_MESHLOC_ELEMENT, & ungriddedLbound=(/1/), ungriddedUbound=(/2/), gridToFieldMap=(/2/), rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + if (mainproc) then + write(sdat%logunit,'(a,i8)') "creating ESMF stream vector field with names" //& + trim(stream_vector_names)//" for stream ",ns + end if end if enddo @@ -1182,6 +1193,7 @@ subroutine shr_strdata_print(sdat, name) character(*),parameter :: F01 = "('(shr_strdata_print) ',a,i6,a)" character(*),parameter :: F02 = "('(shr_strdata_print) ',a,es13.6)" character(*),parameter :: F04 = "('(shr_strdata_print) ',a,i2,a,a)" + character(*),parameter :: F05 = "('(shr_strdata_print) ',a)" character(*),parameter :: F07 = "('(shr_strdata_print) ',a,i2,a,es13.6)" character(*),parameter :: F90 = "('(shr_strdata_print) ',58('-'))" !------------------------------------------------------------------------------- @@ -1195,9 +1207,8 @@ subroutine shr_strdata_print(sdat, name) write(sdat%logunit,F02) "lambm0 = ",sdat%lambm0 write(sdat%logunit,F02) "obliqr = ",sdat%obliqr write(sdat%logunit,F01) "pio_iotype = ",sdat%io_type - write(sdat%logunit,F01) "nstreams = ",shr_strdata_get_stream_count(sdat) - write(sdat%logunit,F01) "nvectors = ",sdat%nvectors + write(sdat%logunit,F05) "Per stream information " do ns = 1, shr_strdata_get_stream_count(sdat) write(sdat%logunit,F04) " taxMode (",ns,") = ",trim(sdat%stream(ns)%taxmode) write(sdat%logunit,F07) " dtlimit (",ns,") = ",sdat%stream(ns)%dtlimit @@ -1363,7 +1374,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & ! local variables integer :: stream_nlev - type(ESMF_Field) :: field_dst, vector_dst + type(ESMF_Field) :: field_dst, field_vector_dst character(CL) :: currfile logical :: fileexists logical :: fileopen @@ -1375,17 +1386,17 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & real(r8) :: fillvalue_r8 logical :: handlefill = .false. integer :: old_error_handle - real(r8), pointer :: dataptr(:) => null() - real(r8), pointer :: dataptr1d(:) => null() ! field bundle data - real(r8), pointer :: dataptr2d(:,:) => null() ! field bundle data - real(r8), pointer :: dataptr2d_src(:,:) => null() ! field bundle data - real(r8), pointer :: dataptr2d_dst(:,:) => null() ! field bundle data - real(r4), allocatable :: data_real1d(:) ! stream input data - real(r4), allocatable :: data_real2d(:,:) ! stream input data - real(r8), allocatable :: data_dbl1d(:) ! stream input data - real(r8), allocatable :: data_dbl2d(:,:) ! stream input data - integer(i2), allocatable :: data_short1d(:) ! stream input data - integer(i2), allocatable :: data_short2d(:,:) ! stream input data + real(r8), pointer :: dataptr(:) + real(r8), pointer :: dataptr1d(:) ! field bundle data + real(r8), pointer :: dataptr2d(:,:) ! field bundle data + real(r8), pointer :: dataptr2d_src(:,:) ! field bundle data + real(r8), pointer :: dataptr2d_dst(:,:) ! field bundle data + real(r4), allocatable :: data_real1d(:) ! stream input data + real(r4), allocatable :: data_real2d(:,:) ! stream input data + real(r8), allocatable :: data_dbl1d(:) ! stream input data + real(r8), allocatable :: data_dbl2d(:,:) ! stream input data + integer(i2), allocatable :: data_short1d(:) ! stream input data + integer(i2), allocatable :: data_short2d(:,:) ! stream input data integer :: lsize, n integer :: spatialDim, numOwnedElements integer :: pio_iovartype @@ -1407,6 +1418,17 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & rc = ESMF_SUCCESS + ! nullify local pointers + nullify(dataptr) + nullify(dataptr1d) + nullify(dataptr2d) + nullify(dataptr2d_src) + nullify(dataptr2d_dst) + nullify(nv_coords) + nullify(nu_coords) + nullify(data_u_dst) + nullify(data_v_dst) + ! Set up file to read from if (sdat%mainproc) then inquire(file=trim(fileName),exist=fileExists) @@ -1473,10 +1495,10 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & write(sdat%logunit,F02) 'reading file ' // trim(boundstr) //': ',trim(filename), nt endif - if(per_stream%ucomp > 0 .and. per_stream%vcomp > 0) then + if (ESMF_FieldIsCreated(per_stream%field_stream_vector)) then call shr_string_listGetName(stream%stream_vectors,1,uname) call shr_string_listGetName(stream%stream_vectors,2,vname) - call dshr_field_getfldptr(per_stream%stream_vector, fldptr2=dataptr2d_src, rc=rc) + call dshr_field_getfldptr(per_stream%field_stream_vector, fldptr2=dataptr2d_src, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return endif @@ -1776,15 +1798,19 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & dataptr2d_src(1,i) = (coslon * dataptr(i) - sinlon * dataptr2d_src(2,i)) dataptr2d_src(2,i) = (sinlon * dataptr(i) + coslon * dataptr2d_src(2,i)) enddo - vector_dst = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, name='vector_dst', & + field_vector_dst = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, name='field_vector_dst', & ungriddedLbound=(/1/), ungriddedUbound=(/2/), gridToFieldMap=(/2/), meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldRegrid(per_stream%stream_vector, vector_dst, per_stream%routehandle, & + if (.not. ESMF_FieldIsCreated(per_stream%field_stream_vector)) then + call shr_sys_abort('ERROR: per_stream%field_stream_vector has not been created') + end if + + call ESMF_FieldRegrid(per_stream%field_stream_vector, field_vector_dst, per_stream%routehandle, & termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(vector_dst, farrayPtr=dataptr2d_dst, rc=rc) + call ESMF_FieldGet(field_vector_dst, farrayPtr=dataptr2d_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_fldbun_getFldPtr(fldbun_data, trim(uname), data_u_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -1832,7 +1858,6 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) integer , intent(out) :: rc ! local variables - integer :: stream_nlev integer :: gsize2d integer :: pio_iovartype @@ -1844,8 +1869,8 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) integer, allocatable :: dimlens(:) type(ESMF_DistGrid) :: distGrid integer :: lsize - integer, pointer :: compdof(:) => null() - integer, pointer :: compdof3d(:) => null() + integer, pointer :: compdof(:) + integer, pointer :: compdof3d(:) integer :: rCode ! pio return code (only used when pio error handling is PIO_BCAST_ERROR) character(*), parameter :: subname = '(shr_strdata_set_stream_iodesc) ' character(*), parameter :: F00 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,a)" @@ -1855,6 +1880,10 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) rc = ESMF_SUCCESS + ! nullify local pointers + nullify(compdof) + nullify(compdof3d) + ! set the number of vertical levels to a local variable stream_nlev = per_stream%stream_nlev