From c3a437a4c6939a37a3d70aee5ce7e67f384580d4 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 12 May 2025 10:26:00 +0200 Subject: [PATCH 01/61] changed cplhist and multilev_cplhist taxmode from extend to cycle --- docn/cime_config/stream_definition_docn.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docn/cime_config/stream_definition_docn.xml b/docn/cime_config/stream_definition_docn.xml index a7081c27c..87b1235f7 100644 --- a/docn/cime_config/stream_definition_docn.xml +++ b/docn/cime_config/stream_definition_docn.xml @@ -257,7 +257,7 @@ nearest - extend + cycle 1.e30 @@ -291,7 +291,7 @@ nearest - extend + cycle 1.e30 From b487eb5df32db085958eed7914239608177182bc Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 12 Nov 2025 22:40:36 +0100 Subject: [PATCH 02/61] add stream mapping from a mapping file --- cime_config/stream_cdeps.py | 3 ++- streams/dshr_strdata_mod.F90 | 11 ++++++++++- streams/dshr_stream_mod.F90 | 9 ++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cime_config/stream_cdeps.py b/cime_config/stream_cdeps.py index f80586e80..0763589a7 100644 --- a/cime_config/stream_cdeps.py +++ b/cime_config/stream_cdeps.py @@ -344,7 +344,8 @@ def create_stream_xml( # Check that key is valid expect( - mod_dict[var_key] in valid_values[var_key], + (mod_dict[var_key] in valid_values[var_key]) or + (var_key == 'mapalgo' and 'mapfile:' in mod_dict[var_key]), "{} can only have values of {} for stream {} in file {}".format( var_key, valid_values[var_key], diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 5c1ba395c..7ea17d25d 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -13,7 +13,7 @@ module dshr_strdata_mod use ESMF , only : ESMF_FILEFORMAT_ESMFMESH, ESMF_FieldCreate use ESMF , only : ESMF_FieldBundleCreate, ESMF_MESHLOC_ELEMENT, ESMF_FieldBundleAdd use ESMF , only : ESMF_POLEMETHOD_ALLAVG, ESMF_EXTRAPMETHOD_NEAREST_STOD - use ESMF , only : ESMF_REGRIDMETHOD_BILINEAR, ESMF_REGRIDMETHOD_NEAREST_STOD + use ESMF , only : ESMF_REGRIDMETHOD_BILINEAR, ESMF_REGRIDMETHOD_NEAREST_STOD, ESMF_FieldSMMStore 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 @@ -404,6 +404,7 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) integer :: nvars integer :: i, stream_nlev, index character(CL) :: stream_vector_names + character(CL) :: mapfile character(len=*), parameter :: subname='(shr_sdat_init)' ! ---------------------------------------------- @@ -598,6 +599,14 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) srcMaskValues=(/sdat%stream(ns)%src_mask_val/), & srcTermProcessing=srcTermProcessing_Value, ignoreDegenerate=.true., & unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) + else if (trim(sdat%stream(ns)%mapalgo(1:8)) == 'mapfile:') then + mapfile = trim(sdat%stream(ns)%mapalgo(9:len_trim(sdat%stream(ns)%mapalgo))) + write(6,'(a)')'DEBUG: mapfile = '//trim(mapfile) + call ESMF_FieldSMMStore(sdat%pstrm(ns)%field_stream, lfield_dst, mapfile, & + routehandle=sdat%pstrm(ns)%routehandle, & + ignoreUnmatchedIndices=.true., & + srcTermProcessing=srcTermProcessing_Value, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return else if (trim(sdat%stream(ns)%mapalgo) == 'none') then ! single point stream data, no action required. else diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index 0b5026169..b965c6d06 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -81,6 +81,7 @@ module dshr_stream_mod character(CS),parameter,public :: shr_stream_mapalgo_nn = 'nn' character(CS),parameter,public :: shr_stream_mapalgo_consf = 'consf' character(CS),parameter,public :: shr_stream_mapalgo_consd = 'consd' + character(CL),parameter,public :: shr_stream_mapalgo_mapfile = 'mapfile:' character(CS),parameter,public :: shr_stream_mapalgo_none = 'none' ! a useful derived type to use inside shr_streamType --- @@ -112,7 +113,7 @@ module dshr_stream_mod character(CS) :: lev_dimname = 'null' ! name of vertical dimension if any character(CS) :: taxMode = shr_stream_taxis_cycle ! cycling option for time axis character(CS) :: tInterpAlgo = 'linear' ! algorithm to use for time interpolation - character(CS) :: mapalgo = 'bilinear' ! type of mapping - default is 'bilinear' + character(CL) :: mapalgo = 'bilinear' ! type of mapping - default is 'bilinear' character(CS) :: readMode = 'single' ! stream read model - 'single' or 'full_file' real(r8) :: dtlimit = 1.5_r8 ! delta time ratio limits for time interpolation integer :: offset = 0 ! offset in seconds of stream data @@ -237,11 +238,13 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu p => item(getElementsByTagname(streamnode, "mapalgo"), 0) if (associated(p)) then call extractDataContent(p, streamdat(i)%mapalgo) + write(6,*)'DEBUG: shr_stream_mapalgo = '//trim(streamdat(i)%mapalgo) if (streamdat(i)%mapalgo /= shr_stream_mapalgo_bilinear .and. & streamdat(i)%mapalgo /= shr_stream_mapalgo_redist .and. & streamdat(i)%mapalgo /= shr_stream_mapalgo_nn .and. & streamdat(i)%mapalgo /= shr_stream_mapalgo_consf .and. & streamdat(i)%mapalgo /= shr_stream_mapalgo_consd .and. & + streamdat(i)%mapalgo(1:8) /= shr_stream_mapalgo_mapfile .and. & streamdat(i)%mapalgo /= shr_stream_mapalgo_none) then call shr_log_error("mapaglo must have a value of either bilinear, redist, nn, consf or consd", rc=rc) return @@ -412,7 +415,7 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu call ESMF_VMBroadCast(vm, streamdat(i)%stream_vectors, CL, 0, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMBroadCast(vm, streamdat(i)%mapalgo, CS, 0, rc=rc) + call ESMF_VMBroadCast(vm, streamdat(i)%mapalgo, CL, 0, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return rtmp(1) = streamdat(i)%dtlimit call ESMF_VMBroadCast(vm, rtmp, 1, 0, rc=rc) @@ -1969,7 +1972,7 @@ subroutine shr_stream_restIO(pioid, streams, mode) ! read in filename rcode = pio_get_var(pioid, varid, (/1,n,k/), fname) - + if(trim(fname) /= trim(streams(k)%file(n)%name)) then write(logunit,*) 'Filename does not match restart record, checking realpath' call shr_file_get_real_path(fname, rfname) From ebdfb4fd38d005ab6235d48164d74d2d39212fc1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 25 Nov 2025 20:19:52 +0100 Subject: [PATCH 03/61] new mapping capability from a map file --- streams/dshr_strdata_mod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 7ea17d25d..799ee8a77 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -601,7 +601,6 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) else if (trim(sdat%stream(ns)%mapalgo(1:8)) == 'mapfile:') then mapfile = trim(sdat%stream(ns)%mapalgo(9:len_trim(sdat%stream(ns)%mapalgo))) - write(6,'(a)')'DEBUG: mapfile = '//trim(mapfile) call ESMF_FieldSMMStore(sdat%pstrm(ns)%field_stream, lfield_dst, mapfile, & routehandle=sdat%pstrm(ns)%routehandle, & ignoreUnmatchedIndices=.true., & From bda0ad2ff3977f8443a5c4a0fb1d9fd163cecda2 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 15 Dec 2025 19:40:28 +0100 Subject: [PATCH 04/61] make stream to export state copies explicit and separate out non datamode specific streams --- datm/CMakeLists.txt | 7 +- datm/atm_comp_nuopc.F90 | 194 ++-- datm/cime_config/stream_definition_datm.xml | 1101 ++++++++----------- datm/datm_datamode_clmncep_mod.F90 | 383 +++---- datm/datm_datamode_core2_mod.F90 | 148 +-- datm/datm_datamode_cplhist_mod.F90 | 205 ++-- datm/datm_datamode_gefs_mod.F90 | 3 +- datm/datm_datamode_jra_mod.F90 | 130 ++- datm/datm_datamode_simple_mod.F90 | 18 +- 9 files changed, 1056 insertions(+), 1133 deletions(-) diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index 892bed23d..7757d42f0 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -6,8 +6,11 @@ set(SRCFILES atm_comp_nuopc.F90 datm_datamode_jra_mod.F90 datm_datamode_gefs_mod.F90 datm_datamode_era5_mod.F90 - datm_datamode_simple_mod.F90) - + datm_datamode_simple_mod.F90 + datm_presaero_mod.F90 + datm_ndep_mod.F90 + datm_co2_mod.F90 + datm_o3_mod.F90) foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.datm/${FILE}") diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index ff96448fb..0e48aab91 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -68,6 +68,22 @@ module cdeps_datm_comp use datm_datamode_simple_mod , only : datm_datamode_simple_init_pointers use datm_datamode_simple_mod , only : datm_datamode_simple_advance + use datm_ndep_mod , only : datm_ndep_advertise + use datm_ndep_mod , only : datm_ndep_init_pointers + use datm_ndep_mod , only : datm_ndep_advance + + use datm_presaero_mod , only : datm_presaero_advertise + use datm_presaero_mod , only : datm_presaero_init_pointers + use datm_presaero_mod , only : datm_presaero_advance + + use datm_o3_mod , only : datm_o3_advertise + use datm_o3_mod , only : datm_o3_init_pointers + use datm_o3_mod , only : datm_o3_advance + + use datm_co2_mod , only : datm_co2_advertise + use datm_co2_mod , only : datm_co2_init_pointers + use datm_co2_mod , only : datm_co2_advance + implicit none private ! except @@ -92,7 +108,7 @@ module cdeps_datm_comp integer :: flds_scalar_index_nextsw_cday = 0 integer :: mpicom ! mpi communicator integer :: my_task ! my task in mpi communicator mpicom - logical :: mainproc ! true of my_task == main_task + logical :: mainproc ! true of my_task == main_task integer :: inst_index ! number of current instance (ie. 1) character(len=16) :: inst_suffix = "" ! char string associated with instance (ie. "_0001" or "") integer :: logunit ! logging unit number @@ -110,11 +126,11 @@ module cdeps_datm_comp logical :: nextsw_cday_calc_cam7 ! true => use logic appropriate to cam7 (and later) for calculating nextsw_cday 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 prescribed aero fields to mediator logical :: flds_presndep = .false. ! true => send valid prescribed ndep fields to mediator logical :: flds_preso3 = .false. ! true => send valid prescribed ozone 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 character(CL) :: anomaly_forcing(8) = nullstr ! send anomaly forcing fields to coupler @@ -231,7 +247,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) factorFn_mesh, & flds_presaero, & flds_co2, & - flds_wiso, & bias_correct, & anomaly_forcing, & skip_restart_read, & @@ -282,9 +297,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if(flds_presndep) bcasttmp(5) = 1 if(flds_preso3) bcasttmp(6) = 1 if(flds_co2) bcasttmp(7) = 1 - if(flds_wiso) bcasttmp(8) = 1 - if(skip_restart_read) bcasttmp(9) = 1 - if(export_all) bcasttmp(10) = 1 + if(skip_restart_read) bcasttmp(8) = 1 + if(export_all) bcasttmp(9) = 1 end if call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -316,9 +330,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) flds_presndep = (bcasttmp(5) == 1) flds_preso3 = (bcasttmp(6) == 1) flds_co2 = (bcasttmp(7) == 1) - flds_wiso = (bcasttmp(8) == 1) - skip_restart_read = (bcasttmp(9) == 1) - export_all = (bcasttmp(10) == 1) + skip_restart_read = (bcasttmp(8) == 1) + export_all = (bcasttmp(9) == 1) if (nextsw_cday_calc == 'cam7') then nextsw_cday_calc_cam7 = .true. @@ -346,7 +359,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F02)' flds_presndep = ',flds_presndep write(logunit,F02)' flds_preso3 = ',flds_preso3 write(logunit,F02)' flds_co2 = ',flds_co2 - write(logunit,F02)' flds_wiso = ',flds_wiso write(logunit,F02)' skip_restart_read = ',skip_restart_read write(logunit,F02)' export_all = ',export_all end if @@ -370,23 +382,33 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) return endif - ! Advertise datm fields + ! Advertise fields that are not datamode specific + if (flds_co2) then + call datm_co2_advertise(fldsExport, datamode) + end if + if (flds_preso3) then + call datm_o3_advertise(fldsExport) + end if + if (flds_presndep) then + call datm_ndep_advertise(fldsExport) + end if + if (flds_presaero) then + call datm_presaero_advertise(fldsExport) + end if + + ! Advertise fields that are datamode specific 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, flds_presndep, rc) + call datm_datamode_core2_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('CORE_IAF_JRA', 'CORE_RYF6162_JRA', 'CORE_RYF8485_JRA', 'CORE_RYF9091_JRA', 'CORE_RYF0304_JRA') - call datm_datamode_jra_advertise(exportState, fldsExport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) + call datm_datamode_jra_advertise(exportState, fldsExport, flds_scalar_name, 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, flds_presndep, flds_preso3, rc) + call datm_datamode_clmncep_advertise(exportState, fldsExport, flds_scalar_name, 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, flds_presndep, rc) + call datm_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('ERA5') call datm_datamode_era5_advertise(exportState, fldsExport, flds_scalar_name, rc) @@ -588,7 +610,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod ! ---------------------------------- ! input/output variables - type(ESMF_GridComp) , intent(inout) :: gcomp + type(ESMF_GridComp) , intent(inout) :: gcomp type(ESMF_State) , intent(inout) :: importState type(ESMF_State) , intent(inout) :: exportState integer , intent(in) :: target_ymd ! model date @@ -603,7 +625,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod ! local variables logical :: first_time = .true. - character(len=CL) :: rpfile + character(len=CL) :: rpfile character(*), parameter :: subName = '(datm_comp_run) ' !------------------------------------------------------------------------------- @@ -616,11 +638,36 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod !-------------------- if (first_time) then - ! Initialize dfields + ! Initialize dfields arrays for export fields with no ungridded dimension + ! and that have a corresponding stream field call datm_init_dfields(rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Initialize datamode module ponters + ! Initialize data pointers for co2 (non datamode specific) + if (flds_co2) then + call datm_co2_init_pointers(exportState, sdat, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! Initialize data pointers for o3 (non datamode specific) + if (flds_preso3) then + call datm_o3_init_pointers(exportState, sdat, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! Initialize data pointers for nitrogen deposition (non datamode specific and use of ungridded dimensions) + if (flds_presndep) then + call datm_ndep_init_pointers(exportState, sdat, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! Initialize data pointers for prescribed aerosols (non datamode specific and use of ungridded dimensions) + if (flds_presaero) then + call datm_presaero_init_pointers(exportState, sdat, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! Initialize datamode module pointers select case (trim(datamode)) case('CORE2_NYF','CORE2_IAF') call datm_datamode_core2_init_pointers(exportState, sdat, datamode, factorfn_mesh, factorfn_data, rc) @@ -650,7 +697,10 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod call shr_get_rpointer_name(gcomp, 'atm', target_ymd, target_tod, rpfile, 'read', rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return select case (trim(datamode)) - case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','CORE_RYF6162_JRA','CORE_RYF8485_JRA','CORE_RYF9091_JRA','CORE_RYF0304_JRA','CLMNCEP','CPLHIST','ERA5','GEFS','SIMPLE') + case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA',& + 'CORE_RYF6162_JRA','CORE_RYF8485_JRA' ,& + 'CORE_RYF9091_JRA','CORE_RYF0304_JRA' ,& + 'CLMNCEP','CPLHIST','ERA5','GEFS','SIMPLE') call dshr_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case default @@ -683,6 +733,30 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('datm_dfield_copy') + ! update export state co2 if appropriate + if (flds_co2) then + call datm_co2_advance() + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! update export state o3 if appropriate + if (flds_preso3) then + call datm_o3_advance() + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! ungridded dimension output - update export state nitrogen deposition if appropriate + if (flds_presndep) then + call datm_ndep_advance() + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! ungridded dimension output - upate prescribed aerosol if appropriate + if (flds_presaero) then + call datm_presaero_advance() + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + ! Determine data model behavior based on the mode call ESMF_TraceRegionEnter('datm_datamode') select case (trim(datamode)) @@ -694,18 +768,18 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod call datm_datamode_jra_advance(exportstate, target_ymd, target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CLMNCEP') - call datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) + call datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CPLHIST') - call datm_datamode_cplhist_advance(mainproc, logunit, mpicom, rc) + call datm_datamode_cplhist_advance(mainproc, logunit, mpicom, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') - call datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, target_ymd, & - target_tod, sdat%model_calendar, rc) + call datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, & + target_ymd, target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('GEFS') - call datm_datamode_gefs_advance(exportstate, mainproc, logunit, mpicom, target_ymd, & - target_tod, sdat%model_calendar, rc) + call datm_datamode_gefs_advance(exportstate, mainproc, logunit, mpicom, & + target_ymd, target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('SIMPLE') call datm_datamode_simple_advance(target_ymd, target_tod, target_mon, & @@ -718,7 +792,10 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod call shr_get_rpointer_name(gcomp, 'atm', target_ymd, target_tod, rpfile, 'write', rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return select case (trim(datamode)) - case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','CORE_RYF6162_JRA','CORE_RYF8485_JRA','CORE_RYF9091_JRA','CORE_RYF0304_JRA','CLMNCEP','CPLHIST','ERA5','GEFS','SIMPLE') + case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA', & + 'CORE_RYF6162_JRA','CORE_RYF8485_JRA' , & + 'CORE_RYF9091_JRA','CORE_RYF0304_JRA' , & + 'CLMNCEP','CPLHIST','ERA5','GEFS','SIMPLE') call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, target_ymd, target_tod, logunit, & my_task, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -746,8 +823,8 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod subroutine datm_init_dfields(rc) ! ----------------------------- - ! Initialize dfields arrays - ! (for export fields that have a corresponding stream field) + ! Initialize dfields arrays for export fields with no ungridded dimension + ! and that have a corresponding stream field ! ----------------------------- ! input/output parameters @@ -755,9 +832,6 @@ 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 integer :: fieldcount type(ESMF_Field) :: lfield @@ -782,54 +856,6 @@ subroutine datm_init_dfields(rc) call dshr_dfield_add( dfields, sdat, trim(lfieldnames(n)), trim(lfieldnames(n)), & 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'/) - 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_ocph') - strm_flds3 = (/'Faxa_ocphidry', 'Faxa_ocphodry', 'Faxa_ocphiwet'/) - 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_dstwet') - strm_flds4 = (/'Faxa_dstwet1', 'Faxa_dstwet2', 'Faxa_dstwet3', 'Faxa_dstwet4'/) - call dshr_dfield_add(dfields, sdat, trim(lfieldnames(n)), strm_flds4, exportState, logunit, mainproc, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('Faxa_dstdry') - strm_flds4 = (/'Faxa_dstdry1', 'Faxa_dstdry2', 'Faxa_dstdry3', 'Faxa_dstdry4'/) - call dshr_dfield_add(dfields, sdat, trim(lfieldnames(n)), strm_flds4, exportState, logunit, mainproc, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('Faxa_rainc_wiso') - strm_flds3 = (/'Faxa_rainc_16O', 'Faxa_rainc_18O', 'Faxa_rainc_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_rainl_wiso') - strm_flds3 = (/'Faxa_rainl_16O', 'Faxa_rainl_18O', 'Faxa_rainl_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_snowc_wiso') - strm_flds3 = (/'Faxa_snowc_16O', 'Faxa_snowc_18O', 'Faxa_snowc_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_snowl_wiso') - 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 - case('cpl_scalars') - continue - case default - call shr_log_error(subName//'field '//trim(lfieldnames(n))//' not recognized', rc=rc) - return - end select end if end do end subroutine datm_init_dfields diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index 8f838aa20..c860b2313 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -28,7 +28,6 @@ Currently the following data modes are supported: CLM_QIAN = Run with the CLM Qian dataset valid from 1948 to 2004 (force CLM) - CLM_QIAN_WISO = Run with the CLM Qian dataset with isotopes valid from 2000 to 2004 (force CLM) CLMCRUJRA2024 = Run with the CLM CRUJRA 2024 forcing valid from 1901 to 2023 (force CLM) CLMCRUNCEPv7 = Run with the CLM CRU NCEP V7 forcing valid from 1900 to 2010 (force CLM) CLMGSWP3v1 = Run with the CLM GSWP3 V1 forcing (force CLM) @@ -190,9 +189,11 @@ optional stream nitrogen deposition - DATM_NDEP is set by the 4 character time prefix in config_component.xml ======================== + presndep.clim_1850_cmip7 presndep.clim_1850 presndep.clim_2000 presndep.clim_2010 + presndep.hist_cmip7 presndep.hist presndep.SSP1-2.6 presndep.SSP2-4.5 @@ -247,13 +248,13 @@ $DIN_LOC_ROOT/atm/cdeps/v1/$NEONSITE/%ym.nc - FSDS Faxa_swdn - ZBOT Sa_z - TBOT Sa_tbot - WIND Sa_wind - RH Sa_rh - PSRF Sa_pbot - FLDS Faxa_lwdn + FSDS strm_Faxa_swdn + ZBOT strm_Sa_z + TBOT strm_Sa_tbot + WIND strm_Sa_wind + RH strm_Sa_rh + PSRF strm_Sa_pbot + FLDS strm_Faxa_lwdn null @@ -289,7 +290,7 @@ $DIN_LOC_ROOT/atm/cdeps/PRISM/${NEONSITE}_%y.nc - PRECIP Faxa_precn + PRECIP strm_Faxa_precn null @@ -326,7 +327,7 @@ $DIN_LOC_ROOT/atm/cdeps/v1/$NEONSITE/%ym.nc - PRECTmms Faxa_precn + PRECTmms strm_Faxa_precn null @@ -363,14 +364,14 @@ $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/PLUMBER2/${PLUMBER2SITE}/CLM1PT_data/CTSM_DATM_${PLUMBER2SITE}_${DATM_YR_START_FILENAME}-${DATM_YR_END}.nc - ZBOT Sa_z - TBOT Sa_tbot - QBOT Sa_shum - WIND Sa_wind - PRECTmms Faxa_precn - FSDS Faxa_swdn - PSRF Sa_pbot - FLDS Faxa_lwdn + ZBOT strm_Sa_z + TBOT strm_Sa_tbot + QBOT strm_Sa_shum + WIND strm_Sa_wind + PRECTmms strm_Faxa_precn + FSDS strm_Faxa_swdn + PSRF strm_Sa_pbot + FLDS strm_Faxa_lwdn null @@ -406,7 +407,7 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/Solar/clmforc.GSWP3.c2011.0.5x0.5.Solr.%ym.nc - FSDS Faxa_swdn + FSDS strm_Faxa_swdn null @@ -437,7 +438,7 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/Precip/clmforc.GSWP3.c2011.0.5x0.5.Prec.%ym.nc - PRECTmms Faxa_precn + PRECTmms strm_Faxa_precn null @@ -468,11 +469,11 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/TPHWL/clmforc.GSWP3.c2011.0.5x0.5.TPQWL.%ym.nc - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - FLDS Faxa_lwdn + TBOT strm_Sa_tbot + WIND strm_Sa_wind + QBOT strm_Sa_shum + PSRF strm_Sa_pbot + FLDS strm_Faxa_lwdn null @@ -507,7 +508,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.CRUJRA.0.5d.c20241231/three_stream/clmforc.CRUJRAv2.5_0.5x0.5.Solr.%y.nc - FSDS Faxa_swdn + FSDS strm_Faxa_swdn null @@ -538,7 +539,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.CRUJRA.0.5d.c20241231/three_stream/clmforc.CRUJRAv2.5_0.5x0.5.Prec.%y.nc - PRECTmms Faxa_precn + PRECTmms strm_Faxa_precn null @@ -569,11 +570,11 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.CRUJRA.0.5d.c20241231/three_stream/clmforc.CRUJRAv2.5_0.5x0.5.TPQWL.%y.nc - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - FLDS Faxa_lwdn + TBOT strm_Sa_tbot + WIND strm_Sa_wind + QBOT strm_Sa_shum + PSRF strm_Sa_pbot + FLDS strm_Faxa_lwdn null @@ -608,7 +609,7 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Solar6Hrly/clmforc.cruncep.V7.c2016.0.5d.Solr.%ym.nc - FSDS Faxa_swdn + FSDS strm_Faxa_swdn null @@ -639,7 +640,7 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Precip6Hrly/clmforc.cruncep.V7.c2016.0.5d.Prec.%ym.nc - PRECTmms Faxa_precn + PRECTmms strm_Faxa_precn null @@ -670,10 +671,10 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/TPHWL6Hrly/clmforc.cruncep.V7.c2016.0.5d.TPQWL.%ym.nc - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot + TBOT strm_Sa_tbot + WIND strm_Sa_wind + QBOT strm_Sa_shum + PSRF strm_Sa_pbot null @@ -708,7 +709,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/Solar6Hrly/clmforc.Qian.c2006.T62.Solr.%ym.nc - FSDS Faxa_swdn + FSDS strm_Faxa_swdn null @@ -739,7 +740,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc - PRECTmms Faxa_precn + PRECTmms strm_Faxa_precn null @@ -770,10 +771,10 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/TmpPrsHumWnd3Hrly/clmforc.Qian.c2006.T62.TPQW.%ym.nc - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot + TBOT strm_Sa_tbot + WIND strm_Sa_wind + QBOT strm_Sa_shum + PSRF strm_Sa_pbot null @@ -796,106 +797,6 @@ single - - - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Solar6Hrly/clmforc.Qian.c2006.T62.Solr.%ym.nc - - - FSDS Faxaswdn - - null - - bilinear - - null - 2000 - 2000 - 2004 - 0 - - coszen - - - cycle - - - 1.5 - - single - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc - - - PRECTmms Faxa_precn - - null - - bilinear - - null - 2000 - 2000 - 2004 - 0 - - nearest - - - cycle - - - 1.5 - - single - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/TmpPrsHumWnd3Hrly/clmforc.Qian.c2006.T62.TPQW.%ym.nc - - - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - - null - - bilinear - - null - 2000 - 2000 - 2004 - 0 - - linear - - - cycle - - - 1.5 - - single - - @@ -908,7 +809,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Solar/ctsmforc.NLDAS2.0.125d.v1.Solr.%ym.nc - FSDS Faxa_swdn + FSDS strm_Faxa_swdn null @@ -940,7 +841,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Precip/ctsmforc.NLDAS2.0.125d.v1.Prec.%ym.nc - PRECTmms Faxa_precn + PRECTmms strm_Faxa_precn null @@ -972,11 +873,11 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/TPQWL/ctsmforc.NLDAS2.0.125d.v1.TPQWL.%ym.nc - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - FLDS Faxa_lwdn + TBOT strm_Sa_tbot + WIND strm_Sa_wind + QBOT strm_Sa_shum + PSRF strm_Sa_pbot + FLDS strm_Faxa_lwdn null @@ -1014,14 +915,14 @@ $DIN_LOC_ROOT_CLMFORC/$CLM_USRDAT_NAME/CLM1PT_data/%ym.nc - PRECTmms Faxa_precn - FSDS Faxa_swdn - ZBOT Sa_z - TBOT Sa_tbot - WIND Sa_wind - RH Sa_rh - PSRF Sa_pbot - FLDS Faxa_lwdn + PRECTmms strm_Faxa_precn + FSDS strm_Faxa_swdn + ZBOT strm_Sa_z + TBOT strm_Sa_tbot + WIND strm_Sa_wind + RH strm_Sa_rh + PSRF strm_Sa_pbot + FLDS strm_Faxa_lwdn null @@ -1053,16 +954,16 @@ $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/mexicocityMEX.c080124/clm1pt-1993-12.nc - ZBOT Sa_z - TBOT Sa_tbot - RH Sa_rh - WIND Sa_wind - PSRF Sa_pbot - PRECTmms Faxa_precn - FSDS Faxa_swdn - FSDSdir Faxa_swdndr - FSDSdif Faxa_swdndf - FLDS Faxa_lwdn + ZBOT strm_Sa_z + TBOT strm_Sa_tbot + RH strm_Sa_rh + WIND strm_Sa_wind + PSRF strm_Sa_pbot + PRECTmms strm_Faxa_precn + FSDS strm_Faxa_swdn + FSDSdir strm_Faxa_swdndr + FSDSdif strm_Faxa_swdndf + FLDS strm_Faxa_lwdn null @@ -1093,16 +994,16 @@ $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/vancouverCAN.c080124/clm1pt-1992-08.nc - ZBOT Sa_z - TBOT Sa_tbot - RH Sa_rh - WIND Sa_wind - PSRF Sa_pbot - PRECTmms Faxa_precn - FSDS Faxa_swdn - FSDSdir Faxa_swdndr - FSDSdif Faxa_swdndf - FLDS Faxa_lwdn + ZBOT strm_Sa_z + TBOT strm_Sa_tbot + RH strm_Sa_rh + WIND strm_Sa_wind + PSRF strm_Sa_pbot + PRECTmms strm_Faxa_precn + FSDS strm_Faxa_swdn + FSDSdir strm_Faxa_swdndr + FSDSdif strm_Faxa_swdndf + FLDS strm_Faxa_lwdn null @@ -1148,16 +1049,16 @@ $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-11.nc - ZBOT Sa_z - TBOT Sa_tbot - RH Sa_rh - WIND Sa_wind - PSRF Sa_pbot - PRECTmms Faxa_precn - FSDS Faxa_swdn - FSDSdir Faxa_swdndr - FSDSdif Faxa_swdndf - FLDS Faxa_lwdn + ZBOT strm_Sa_z + TBOT strm_Sa_tbot + RH strm_Sa_rh + WIND strm_Sa_wind + PSRF strm_Sa_pbot + PRECTmms strm_Faxa_precn + FSDS strm_Faxa_swdn + FSDSdir strm_Faxa_swdndr + FSDSdif strm_Faxa_swdndf + FLDS strm_Faxa_lwdn null @@ -1192,7 +1093,7 @@ $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/gpcp/qian/bias_correction.Prec.%y.nc - BC_PREC Faxa_precsf + BC_PREC strm_Faxa_precsf null @@ -1223,7 +1124,7 @@ $DIN_LOC_ROOT/atm/datm7/clm_output/cruncep_precip_1deg/gpcp_1deg_bias_correction/bias_correction.Prec.%y.nc - BC_PREC Faxa_precsf + BC_PREC strm_Faxa_precsf null @@ -1254,7 +1155,7 @@ $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/cmap/cruncep/bias_correction.Prec.%y.nc - BC_PREC Faxa_precsf + BC_PREC strm_Faxa_precsf null @@ -1289,14 +1190,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.allvars.ccsm4.rcp45.2006-2300.nc - huss Sa_shum_af - pr Faxa_prec_af - ps Sa_pbot_af - rlds Faxa_lwdn_af - rsds Faxa_swdn_af - tas Sa_tbot_af - uas Sa_u_af - vas Sa_v_af + huss strm_Sa_shum_af + pr strm_Faxa_prec_af + ps strm_Sa_pbot_af + rlds strm_Faxa_lwdn_af + rsds strm_Faxa_swdn_af + tas strm_Sa_tbot_af + uas strm_Sa_u_af + vas strm_Sa_v_af null @@ -1327,14 +1228,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP1-2.6/af.allvars.CESM.SSP1-2.6.2015-2100_c20220628.nc - huss Sa_shum_af - pr Faxa_prec_af - ps Sa_pbot_af - rlds Faxa_lwdn_af - rsds Faxa_swdn_af - tas Sa_tbot_af - uas Sa_u_af - vas Sa_v_af + pr strm_Faxa_prec_af + rlds strm_Faxa_lwdn_af + rsds strm_Faxa_swdn_af + huss strm_Sa_shum_af + ps strm_Sa_pbot_af + tas strm_Sa_tbot_af + uas strm_Sa_u_af + vas strm_Sa_v_af null @@ -1365,14 +1266,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP2-4.5/af.allvars.CESM.SSP2-4.5.2015-2100_c20220628.nc - huss Sa_shum_af - pr Faxa_prec_af - ps Sa_pbot_af - rlds Faxa_lwdn_af - rsds Faxa_swdn_af - tas Sa_tbot_af - uas Sa_u_af - vas Sa_v_af + pr strm_Faxa_prec_af + rlds strm_Faxa_lwdn_af + rsds strm_Faxa_swdn_af + huss strm_Sa_shum_af + ps strm_Sa_pbot_af + tas strm_Sa_tbot_af + uas strm_Sa_u_af + vas strm_Sa_v_af null @@ -1395,7 +1296,7 @@ single - + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc @@ -1403,14 +1304,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP3-7.0/af.allvars.CESM.SSP3-7.0.2015-2100_c20220628.nc - huss Sa_shum_af - pr Faxa_prec_af - ps Sa_pbot_af - rlds Faxa_lwdn_af - rsds Faxa_swdn_af - tas Sa_tbot_af - uas Sa_u_af - vas Sa_v_af + pr strm_Faxa_prec_af + rlds strm_Faxa_lwdn_af + rsds strm_Faxa_swdn_af + huss strm_Sa_shum_af + ps strm_Sa_pbot_af + tas strm_Sa_tbot_af + uas strm_Sa_u_af + vas strm_Sa_v_af null @@ -1441,14 +1342,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP5-8.5/af.allvars.CESM.SSP5-8.5.2015-2100_c20220628.nc - huss Sa_shum_af - pr Faxa_prec_af - ps Sa_pbot_af - rlds Faxa_lwdn_af - rsds Faxa_swdn_af - tas Sa_tbot_af - uas Sa_u_af - vas Sa_v_af + huss strm_Sa_shum_af + pr strm_Faxa_prec_af + ps strm_Sa_pbot_af + rlds strm_Faxa_lwdn_af + rsds strm_Faxa_swdn_af + tas strm_Sa_tbot_af + uas strm_Sa_u_af + vas strm_Sa_v_af null @@ -1484,9 +1385,8 @@ $DIN_LOC_ROOT/atm/datm7/NYF/nyf.giss.T62.051007.nc - lwdn Faxa_lwdn - swdn Faxa_swdn - swup Faxa_swup + lwdn strm_Faxa_lwdn + swdn strm_Faxa_swdn null @@ -1517,7 +1417,7 @@ $DIN_LOC_ROOT/atm/datm7/NYF/nyf.gxgxs.T62.051007.nc - prc Faxa_prec + prc strm_Faxa_prec null @@ -1548,12 +1448,12 @@ $DIN_LOC_ROOT/atm/datm7/NYF/nyf.ncep.T62.050923.nc - dn10 Sa_dens - slp_ Sa_pslv - q_10 Sa_shum - t_10 Sa_tbot - u_10 Sa_u - v_10 Sa_v + dn10 strm_Sa_dens + slp_ strm_Sa_pslv + q_10 strm_Sa_shum + t_10 strm_Sa_tbot + u_10 strm_Sa_u + v_10 strm_Sa_v null @@ -1588,7 +1488,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.SOFS.2010.nc - dn10 Sa_dens + dn10 strm_Sa_dens null @@ -1619,7 +1519,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.SOFS.2010.nc - slp_ Sa_pslv + slp_ strm_Sa_pslv null @@ -1650,7 +1550,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - prec Faxa_prec + prec strm_Faxa_prec null @@ -1681,7 +1581,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -1712,38 +1612,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - swdn Faxa_swdn - - null - - bilinear - - null - 1 - 2010 - 2011 - 0 - - linear - - - cycle - - - 1.5 - - single - - - - - $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - - - swup Faxa_swup + swdn strm_Faxa_swdn null @@ -1774,7 +1643,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - q3_5 Faxa_shum + q3_5 strm_Faxa_shum null @@ -1805,7 +1674,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - t3_5 Sa_tbot + t3_5 strm_Sa_tbot null @@ -1836,7 +1705,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - u3_5 Sa_u + u3_5 strm_Sa_u null @@ -1867,7 +1736,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - v3_5 Sa_v + v3_5 strm_Sa_v null @@ -1899,7 +1768,7 @@ $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.%y.20120412.nc - prc Faxa_prec + prc strm_Faxa_prec null @@ -1931,7 +1800,7 @@ $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.%y.20120412.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -1963,7 +1832,7 @@ $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.%y.20120412.nc - swdn Faxa_swdn + swdn strm_Faxa_swdn null @@ -1986,38 +1855,6 @@ single - - - $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc - - - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.%y.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.%y.20120412.nc - - - swup Faxa_swup - - null - - bilinear - - null - 1 - 1948 - 2009 - 0 - - linear - - - cycle - - - 1.5 - - single - - $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc @@ -2029,7 +1866,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.%y.20120412.nc - dn10 Sa_dens + dn10 strm_Sa_dens null @@ -2063,7 +1900,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.%y.20120412.nc - q_10 Sa_shum + q_10 strm_Sa_shum null @@ -2097,7 +1934,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.%y.20120412.nc - slp_ Sa_pslv + slp_ strm_Sa_pslv null @@ -2131,7 +1968,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.%y.20120412.nc - t_10 Sa_tbot + t_10 strm_Sa_tbot null @@ -2165,7 +2002,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.%y.20120412.nc - u_10 Sa_u + u_10 strm_Sa_u null @@ -2199,7 +2036,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.%y.20120412.nc - v_10 Sa_v + v_10 strm_Sa_v null @@ -2230,7 +2067,7 @@ $DIN_LOC_ROOT/atm/datm7/CORE2/CORE2.t_10.ArcFactor.T62.1997-2004.nc - TarcFactor tarcf + TarcFactor strm_tarcf null @@ -2273,7 +2110,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.190528.nc - prec Faxa_prec + prec strm_Faxa_prec null @@ -2304,7 +2141,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.190528.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -2335,7 +2172,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.190528.nc - swdn Faxa_swdn + swdn strm_Faxa_swdn null @@ -2366,7 +2203,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.190528.nc - q_10 Sa_shum + q_10 strm_Sa_shum null @@ -2397,7 +2234,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.190528.nc - slp Sa_pslv + slp strm_Sa_pslv null @@ -2428,7 +2265,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.190528.nc - t_10 Sa_tbot + t_10 strm_Sa_tbot null @@ -2459,7 +2296,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.190528.nc - u_10 Sa_u + u_10 strm_Sa_u null @@ -2490,7 +2327,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.190528.nc - v_10 Sa_v + v_10 strm_Sa_v null @@ -2528,7 +2365,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.prec.TL319.%y.240531.nc - prec Faxa_prec + prec strm_Faxa_prec null @@ -2562,7 +2399,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.lwdn.TL319.%y.240531.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -2596,7 +2433,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.swdn.TL319.%y.240531.nc - swdn Faxa_swdn + swdn strm_Faxa_swdn null @@ -2630,7 +2467,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.q_10.TL319.%y.240531.nc - q_10 Sa_shum + q_10 strm_Sa_shum null @@ -2664,7 +2501,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.slp.TL319.%y.240531.nc - slp Sa_pslv + slp strm_Sa_pslv null @@ -2698,7 +2535,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.t_10.TL319.%y.240531.nc - t_10 Sa_tbot + t_10 strm_Sa_tbot null @@ -2732,7 +2569,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.u_10.TL319.%y.240531.nc - u_10 Sa_u + u_10 strm_Sa_u null @@ -2766,7 +2603,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.v_10.TL319.%y.240531.nc - v_10 Sa_v + v_10 strm_Sa_v null @@ -2801,7 +2638,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_6162.JRA.v1.3.radiation.lwdn.TL319.250427.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -2832,7 +2669,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_6162.JRA.v1.3.radiation.swdn.TL319.250427.nc - swdn Faxa_swdn + swdn strm_Faxa_swdn null @@ -2863,7 +2700,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_6162.JRA.v1.3.prec.TL319.250427.nc - prec Faxa_prec + prec strm_Faxa_prec null @@ -2894,11 +2731,11 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_6162.JRA.v1.3.states.TL319.250427.nc - u_10 Sa_u - v_10 Sa_v - t_10 Sa_tbot - q_10 Sa_shum - slp Sa_pslv + u_10 strm_Sa_u + v_10 strm_Sa_v + t_10 strm_Sa_tbot + q_10 strm_Sa_shum + slp strm_Sa_pslv null @@ -2933,7 +2770,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.radiation.lwdn.TL319.180404.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -2964,7 +2801,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.radiation.swdn.TL319.180404.nc - swdn Faxa_swdn + swdn strm_Faxa_swdn null @@ -2995,7 +2832,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.prec.TL319.180404.nc - prec Faxa_prec + prec strm_Faxa_prec null @@ -3026,11 +2863,11 @@ $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 + u_10 strm_Sa_u + v_10 strm_Sa_v + t_10 strm_Sa_tbot + q_10 strm_Sa_shum + slp strm_Sa_pslv null @@ -3065,7 +2902,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.radiation.lwdn.TL319.180404.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -3096,7 +2933,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.radiation.swdn.TL319.180404.nc - swdn Faxa_swdn + swdn strm_Faxa_swdn null @@ -3127,7 +2964,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.prec.TL319.180404.nc - prec Faxa_prec + prec strm_Faxa_prec null @@ -3158,11 +2995,11 @@ $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 + u_10 strm_Sa_u + v_10 strm_Sa_v + t_10 strm_Sa_tbot + q_10 strm_Sa_shum + slp strm_Sa_pslv null @@ -3197,7 +3034,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.radiation.lwdn.TL319.180404.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -3228,7 +3065,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.radiation.swdn.TL319.180404.nc - swdn Faxa_swdn + swdn strm_Faxa_swdn null @@ -3259,7 +3096,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.prec.TL319.180404.nc - prec Faxa_prec + prec strm_Faxa_prec null @@ -3290,11 +3127,11 @@ $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 + u_10 strm_Sa_u + v_10 strm_Sa_v + t_10 strm_Sa_tbot + q_10 strm_Sa_shum + slp strm_Sa_pslv null @@ -3329,7 +3166,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.171019.nc - prec Faxa_prec + prec strm_Faxa_prec null @@ -3360,7 +3197,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.171019.nc - lwdn Faxa_lwdn + lwdn strm_Faxa_lwdn null @@ -3391,7 +3228,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.171019.nc - swdn Faxa_swdn + swdn strm_Faxa_swdn null @@ -3422,7 +3259,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.171019.nc - q_10 Sa_shum + q_10 strm_Sa_shum null @@ -3453,7 +3290,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.171019.nc - slp Sa_pslv + slp strm_Sa_pslv null @@ -3484,7 +3321,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.171019.nc - t_10 Sa_tbot + t_10 strm_Sa_tbot null @@ -3515,7 +3352,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.171019.nc - u_10 Sa_u + u_10 strm_Sa_u null @@ -3546,7 +3383,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.171019.nc - v_10 Sa_v + v_10 strm_Sa_v null @@ -3592,29 +3429,29 @@ $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.12.200618.nc - u10 Sa_u10m - v10 Sa_v10m - t2m Sa_t2m - skt Sa_tskn - d2m Sa_tdew - msl Sa_pslv - tp Faxa_rain - cp Faxa_rainc - lsp Faxa_rainl - csf Faxa_snowc - lsf Faxa_snowl - ssrd Faxa_swdn - ssr Faxa_swnet - strd Faxa_lwdn - str Faxa_lwnet - aluvp Faxa_swvdr - aluvd Faxa_swvdf - alnip Faxa_swndr - alnid Faxa_swndf - sshf Faxa_sen - slhf Faxa_lat - ewss Faxa_taux - nsss Faxa_tauy + u10 strm_Sa_u10m + v10 strm_Sa_v10m + t2m strm_Sa_t2m + skt strm_Sa_tskn + d2m strm_Sa_tdew + msl strm_Sa_pslv + tp strm_Faxa_rain + cp strm_Faxa_rainc + lsp strm_Faxa_rainl + csf strm_Faxa_snowc + lsf strm_Faxa_snowl + ssrd strm_Faxa_swdn + ssr strm_Faxa_swnet + strd strm_Faxa_lwdn + str strm_Faxa_lwnet + aluvp strm_Faxa_swvdr + aluvd strm_Faxa_swvdf + alnip strm_Faxa_swndr + alnid strm_Faxa_swndf + sshf strm_Faxa_sen + slhf strm_Faxa_lat + ewss strm_Faxa_taux + nsss strm_Faxa_tauy null @@ -3652,7 +3489,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_simyr_1750-2014_CMIP6_c180929.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3683,7 +3520,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_ssp585_simyr_1750-2020_CMIP6_c200324.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3714,7 +3551,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_ssp585_simyr_1750-2020_CMIP6_c200324.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3745,7 +3582,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP1-1.9_simyr_2014-2500_CMIP6_c190514.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3776,7 +3613,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP1-2.6__simyr_2014-2500_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3807,7 +3644,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP2-4.5__simyr_2014-2500_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3838,7 +3675,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/co2_datm_lat-bandsSSP3-7.0__simyr_2014-2500_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3869,7 +3706,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP4-3.4_simyr_2014-2500_CMIP6_c190514.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3900,7 +3737,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP4-6.0__simyr_2014-2500_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3931,7 +3768,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP5-3.4__simyr_2014-2500_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3962,7 +3799,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP5-8.5__simyr_2014-2500_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -3993,7 +3830,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP1-1.9_simyr_2014-2501_CMIP6_c190514.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -4024,7 +3861,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP1-2.6__simyr_2014-2501_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -4055,7 +3892,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP2-4.5__simyr_2014-2501_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -4086,7 +3923,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP3-7.0_simyr_1750-2501_CMIP6_c201101.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -4117,7 +3954,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP4-3.4_simyr_2014-2501_CMIP6_c190514.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -4148,7 +3985,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP4-6.0__simyr_2014-2501_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -4179,7 +4016,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP5-3.4__simyr_2014-2501_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -4210,7 +4047,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP5-8.5__simyr_2014-2501_CMIP6_c190506.nc - CO2 Sa_co2diag + CO2 strm_co2diag null @@ -4245,20 +4082,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4289,20 +4126,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4333,20 +4170,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4377,20 +4214,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4421,20 +4258,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP126_b.e21.BSSP126cmip6.f09_g17.CMIP6-SSP1-2.6.001_2014-2101_monthly_0.9x1.25_c190523.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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4465,20 +4302,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP245_b.e21.BWSSP245cmip6.f09_g17.CMIP6-SSP2-4.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4509,20 +4346,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_1849-2101_monthly_0.9x1.25_c201103.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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4554,20 +4391,20 @@ null - 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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4598,20 +4435,20 @@ $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 - 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 + BCDEPWET strm_Faxabcphiwet + BCPHODRY strm_Faxabcphodry + BCPHIDRY strm_Faxabcphidry + OCDEPWET strm_Faxaocphiwet + OCPHIDRY strm_Faxaocphidry + OCPHODRY strm_Faxaocphodry + DSTX01WD strm_Faxadstwet1 + DSTX01DD strm_Faxadstdry1 + DSTX02WD strm_Faxadstwet2 + DSTX02DD strm_Faxadstdry2 + DSTX03WD strm_Faxadstwet3 + DSTX03DD strm_Faxadstdry3 + DSTX04WD strm_Faxadstwet4 + DSTX04DD strm_Faxadstdry4 null @@ -4646,7 +4483,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-historical-WACCM.001.monthly.185001-201412.nc - O3 Sa_o3 + O3 strm_o3 null @@ -4677,7 +4514,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-historical-WACCM.001.monthly.185001-201412.nc - O3 Sa_o3 + O3 strm_o3 null @@ -4708,7 +4545,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-historical-WACCM.001.monthly.185001-201412.nc - O3 Sa_o3 + O3 strm_o3 null @@ -4739,7 +4576,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-historical-WACCM.001.monthly.185001-201412.nc - O3 Sa_o3 + O3 strm_o3 null @@ -4770,7 +4607,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-SSP2-4.5-WACCM.001.monthly.201501-210012.nc - O3 Sa_o3 + O3 strm_o3 null @@ -4801,7 +4638,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-SSP3-7.0-WACCM.001.monthly.201501-210012.nc - O3 Sa_o3 + O3 strm_o3 null @@ -4832,7 +4669,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-SSP5-8.5-WACCM.001.monthly.201501-210012.nc - O3 Sa_o3 + O3 strm_o3 null @@ -4861,16 +4698,18 @@ - + - $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_ESMFmesh_cdf5_c20251211.nc - $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc + $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_CMIP_FZJ-CMIP-nitrogen-1-2_gn_185001-202212.nc - NDEP_NHx_month Faxa_ndep_nhx - NDEP_NOy_month Faxa_ndep_noy + drynhx strm_Faxandep_nhx_dry + wetnhx strm_Faxa_ndep_nhx_wet + drynoy strm_Faxa_ndep_noy_dry + wetnoy strm_Faxa_ndep_noy_wet null @@ -4893,6 +4732,40 @@ single + + + $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_ESMFmesh_cdf5_c20251211.nc + + + $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_CMIP_FZJ-CMIP-nitrogen-1-2_gn_185001-202212.nc + + + drynhx strm_Faxa_ndep_nhx_dry + wetnhx strm_Faxa_ndep_nhx_wet + drynoy strm_Faxa_ndep_noy_dry + wetnoy strm_Faxa_ndep_noy_wet + + null + + bilinear + + null + 1 + 1850 + 2022 + 0 + + linear + + + cycle + + + 1.5 + + single + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc @@ -4901,8 +4774,8 @@ $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 + NDEP_NHx_month strm_Faxa_ndep_nhx + NDEP_NOy_month strm_Faxa_ndep_noy null @@ -4933,8 +4806,8 @@ $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 + NDEP_NHx_month strm_Faxa_ndep_nhx + NDEP_NOy_month strm_Faxa_ndep_noy null @@ -4965,8 +4838,8 @@ $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 + NDEP_NHx_month strm_Faxa_ndep_nhx + NDEP_NOy_month strm_Faxa_ndep_noy null @@ -4997,8 +4870,8 @@ $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 + NDEP_NHx_month strm_Faxa_ndep_nhx + NDEP_NOy_month strm_Faxa_ndep_noy null @@ -5029,8 +4902,8 @@ $DIN_LOC_ROOT/lnd/clm2/ndepdata/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 + NDEP_NHx_month strm_Faxa_ndep_nhx + NDEP_NOy_month strm_Faxa_ndep_noy null @@ -5061,8 +4934,8 @@ $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 + NDEP_NHx_month strm_Faxa_ndep_nhx + NDEP_NOy_month strm_Faxa_ndep_noy null @@ -5094,8 +4967,8 @@ $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 + NDEP_NHx_month strm_Faxa_ndep_nhx + NDEP_NOy_month strm_Faxa_ndep_noy null @@ -5130,7 +5003,7 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.3h.avrg.%ymd-10800.nc - atmImp_Sa_topo Sa_topo + atmImp_Sa_topo strm_Sa_topo null @@ -5150,7 +5023,8 @@ 3.0 - single + single + @@ -5160,20 +5034,20 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.24h.avrg.%ymd-00000.nc - atmImp_Faxa_bcph1 Faxa_bcphidry - atmImp_Faxa_bcph2 Faxa_bcphodry - atmImp_Faxa_bcph3 Faxa_bcphiwet - atmImp_Faxa_ocph1 Faxa_ocphidry - atmImp_Faxa_ocph2 Faxa_ocphodry - atmImp_Faxa_ocph3 Faxa_ocphiwet - atmImp_Faxa_dstwet1 Faxa_dstwet1 - atmImp_Faxa_dstdry1 Faxa_dstdry1 - atmImp_Faxa_dstwet2 Faxa_dstwet2 - atmImp_Faxa_dstdry2 Faxa_dstdry2 - atmImp_Faxa_dstwet3 Faxa_dstwet3 - atmImp_Faxa_dstdry3 Faxa_dstdry3 - atmImp_Faxa_dstwet4 Faxa_dstwet4 - atmImp_Faxa_dstdry4 Faxa_dstdry4 + atmImp_Faxa_bcph1 strm_Faxa_bcphidry + atmImp_Faxa_bcph2 strm_Faxa_bcphodry + atmImp_Faxa_bcph3 strm_Faxa_bcphiwet + atmImp_Faxa_ocph1 strm_Faxa_ocphidry + atmImp_Faxa_ocph2 strm_Faxa_ocphodry + atmImp_Faxa_ocph3 strm_Faxa_ocphiwet + atmImp_Faxa_dstwet1 strm_Faxa_dstwet1 + atmImp_Faxa_dstdry1 strm_Faxa_dstdry1 + atmImp_Faxa_dstwet2 strm_Faxa_dstwet2 + atmImp_Faxa_dstdry2 strm_Faxa_dstdry2 + atmImp_Faxa_dstwet3 strm_Faxa_dstwet3 + atmImp_Faxa_dstdry3 strm_Faxa_dstdry3 + atmImp_Faxa_dstwet4 strm_Faxa_dstwet4 + atmImp_Faxa_dstdry4 strm_Faxa_dstdry4 null @@ -5201,10 +5075,11 @@ $ATM_DOMAIN_MESH + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc - a2x1d_Faxa_ndep Faxa_ndep + a2x1d_Faxa_ndep strm_Faxa_ndep null @@ -5235,10 +5110,10 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.1h.inst.%ymd-03600.nc - atmImp_Faxa_swndr Faxa_swndr - atmImp_Faxa_swvdr Faxa_swvdr - atmImp_Faxa_swndf Faxa_swndf - atmImp_Faxa_swvdf Faxa_swvdf + atmImp_Faxa_swndr strm_Faxa_swndr + atmImp_Faxa_swvdr strm_Faxa_swvdr + atmImp_Faxa_swndf strm_Faxa_swndf + atmImp_Faxa_swvdf strm_Faxa_swvdf null @@ -5269,11 +5144,11 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.3h.avrg.%ymd-10800.nc - atmImp_Faxa_rainc Faxa_rainc - atmImp_Faxa_rainl Faxa_rainl - atmImp_Faxa_snowc Faxa_snowc - atmImp_Faxa_snowl Faxa_snowl - atmImp_Faxa_lwdn Faxa_lwdn + atmImp_Faxa_rainc strm_Faxa_rainc + atmImp_Faxa_rainl strm_Faxa_rainl + atmImp_Faxa_snowc strm_Faxa_snowc + atmImp_Faxa_snowl strm_Faxa_snowl + atmImp_Faxa_lwdn strm_Faxa_lwdn null @@ -5304,15 +5179,15 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.3h.avrg.%ymd-10800.nc - atmImp_Sa_z Sa_z - atmImp_Sa_tbot Sa_tbot - atmImp_Sa_ptem Sa_ptem - atmImp_Sa_shum Sa_shum - atmImp_Sa_pbot Sa_pbot - atmImp_Sa_dens Sa_dens - atmImp_Sa_pslv Sa_pslv - atmImp_Sa_co2diag Sa_co2diag - atmImp_Sa_co2prog Sa_co2prog + atmImp_Sa_z strm_Sa_z + atmImp_Sa_tbot strm_Sa_tbot + atmImp_Sa_ptem strm_Sa_ptem + atmImp_Sa_shum strm_Sa_shum + atmImp_Sa_pbot strm_Sa_pbot + atmImp_Sa_dens strm_Sa_dens + atmImp_Sa_pslv strm_Sa_pslv + atmImp_Sa_co2diag strm_co2diag + atmImp_Sa_co2prog strm_co2prog null @@ -5343,8 +5218,8 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.1h.avrg.%ymd-03600.nc - atmImp_Sa_u Sa_u - atmImp_Sa_v Sa_v + atmImp_Sa_u strm_Sa_u + atmImp_Sa_v strm_Sa_v null @@ -5379,7 +5254,7 @@ $DIN_LOC_ROOT/atm/datm7/topo_forcing/topodata_0.9x1.25_USGS_070110_stream_c151201.nc - TOPO Sa_topo + TOPO strm_Sa_topo null diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index e0da79283..9ead6ff57 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -22,72 +22,58 @@ module datm_datamode_clmncep_mod private :: datm_esat ! determine saturation vapor pressure ! export state data - real(r8), pointer :: Sa_z(:) => null() - real(r8), pointer :: Sa_u(:) => null() - real(r8), pointer :: Sa_v(:) => null() - real(r8), pointer :: Sa_tbot(:) => null() - real(r8), pointer :: Sa_ptem(:) => null() - real(r8), pointer :: Sa_shum(:) => null() -! TODO: water isotope support -! real(r8), pointer :: Sa_shum_wiso(:,:) => null() ! water isotopes - real(r8), pointer :: Sa_dens(:) => null() - real(r8), pointer :: Sa_pbot(:) => null() - real(r8), pointer :: Sa_pslv(:) => null() - real(r8), pointer :: Sa_o3(:) => null() - real(r8), pointer :: Faxa_lwdn(:) => null() - real(r8), pointer :: Faxa_rainc(:) => null() - real(r8), pointer :: Faxa_rainl(:) => null() - real(r8), pointer :: Faxa_snowc(:) => null() - real(r8), pointer :: Faxa_snowl(:) => null() - real(r8), pointer :: Faxa_swndr(:) => null() - real(r8), pointer :: Faxa_swndf(:) => null() - 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() - real(r8), pointer :: strm_wind(:) => null() - real(r8), pointer :: strm_tdew(:) => null() - real(r8), pointer :: strm_tbot(:) => null() - real(r8), pointer :: strm_pbot(:) => null() - real(r8), pointer :: strm_shum(:) => null() - real(r8), pointer :: strm_lwdn(:) => null() - real(r8), pointer :: strm_rh(:) => null() - real(r8), pointer :: strm_swdn(:) => null() - real(r8), pointer :: strm_swdndf(:) => null() - real(r8), pointer :: strm_swdndr(:) => null() - real(r8), pointer :: strm_precc(:) => null() - real(r8), pointer :: strm_precl(:) => null() - real(r8), pointer :: strm_precn(:) => null() - - ! stream data - water isotopes - real(r8), pointer :: strm_rh_16O(:) => null() ! water isoptopes - real(r8), pointer :: strm_rh_18O(:) => null() ! water isoptopes - real(r8), pointer :: strm_rh_HDO(:) => null() ! water isoptopes - real(r8), pointer :: strm_precn_16O(:) => null() ! water isoptopes - real(r8), pointer :: strm_precn_18O(:) => null() ! water isoptopes - real(r8), pointer :: strm_precn_HDO(:) => null() ! water isoptopes - - ! stream data bias correction - real(r8), pointer :: strm_precsf(:) => null() - - ! stream data anomaly forcing - real(r8), pointer :: strm_u_af(:) => null() ! anomaly forcing - real(r8), pointer :: strm_v_af(:) => null() ! anomaly forcing - real(r8), pointer :: strm_prec_af(:) => null() ! anomaly forcing - real(r8), pointer :: strm_tbot_af(:) => null() ! anomaly forcing - real(r8), pointer :: strm_pbot_af(:) => null() ! anomaly forcing - real(r8), pointer :: strm_shum_af(:) => null() ! anomaly forcing - real(r8), pointer :: strm_swdn_af(:) => null() ! anomaly forcing - real(r8), pointer :: strm_lwdn_af(:) => null() ! anomaly forcing + real(r8), pointer :: Sa_topo(:) => null() + real(r8), pointer :: Sa_z(:) => null() + real(r8), pointer :: Sa_u(:) => null() + real(r8), pointer :: Sa_v(:) => null() + real(r8), pointer :: Sa_tbot(:) => null() + real(r8), pointer :: Sa_ptem(:) => null() + real(r8), pointer :: Sa_shum(:) => null() + real(r8), pointer :: Sa_dens(:) => null() + real(r8), pointer :: Sa_pbot(:) => null() + real(r8), pointer :: Sa_pslv(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() + real(r8), pointer :: Faxa_rainc(:) => null() + real(r8), pointer :: Faxa_rainl(:) => null() + real(r8), pointer :: Faxa_snowc(:) => null() + real(r8), pointer :: Faxa_snowl(:) => null() + real(r8), pointer :: Faxa_swndr(:) => null() + real(r8), pointer :: Faxa_swndf(:) => null() + real(r8), pointer :: Faxa_swvdr(:) => null() + real(r8), pointer :: Faxa_swvdf(:) => null() + real(r8), pointer :: Faxa_swnet(:) => null() ! import state data - real(r8), pointer :: Sx_avsdr(:) => null() - real(r8), pointer :: Sx_anidr(:) => null() - real(r8), pointer :: Sx_avsdf(:) => null() - real(r8), pointer :: Sx_anidf(:) => null() + real(r8), pointer :: Sx_avsdr(:) => null() + real(r8), pointer :: Sx_anidr(:) => null() + real(r8), pointer :: Sx_avsdf(:) => null() + real(r8), pointer :: Sx_anidf(:) => null() + + ! stream data + real(r8), pointer :: strm_Sa_topo(:) => null() + real(r8), pointer :: strm_Sa_z(:) => null() + real(r8), pointer :: strm_Sa_tbot(:) => null() + real(r8), pointer :: strm_Sa_pbot(:) => null() + real(r8), pointer :: strm_Sa_wind(:) => null() + real(r8), pointer :: strm_Sa_tdew(:) => null() + real(r8), pointer :: strm_Sa_shum(:) => null() + real(r8), pointer :: strm_Sa_rh(:) => null() + real(r8), pointer :: strm_Faxa_lwdn(:) => null() + real(r8), pointer :: strm_Faxa_swdn(:) => null() + real(r8), pointer :: strm_Faxa_swdndf(:) => null() + real(r8), pointer :: strm_Faxa_swdndr(:) => null() + real(r8), pointer :: strm_Faxa_precn(:) => null() + real(r8), pointer :: strm_Faxa_precsf(:) => null() ! bias correction + real(r8), pointer :: strm_Sa_u_af(:) => null() ! anomaly forcing + real(r8), pointer :: strm_Sa_v_af(:) => null() ! anomaly forcing + real(r8), pointer :: strm_Sa_tbot_af(:) => null() ! anomaly forcing + real(r8), pointer :: strm_Sa_pbot_af(:) => null() ! anomaly forcing + real(r8), pointer :: strm_Sa_shum_af(:) => null() ! anomaly forcing + real(r8), pointer :: strm_Faxa_prec_af(:) => null() ! anomaly forcing + real(r8), pointer :: strm_Faxa_swdn_af(:) => null() ! anomaly forcing + real(r8), pointer :: strm_Faxa_lwdn_af(:) => null() ! anomaly forcing + + ! Other module variables logical :: atm_prognostic = .false. real(r8) :: tbotmax ! units detector @@ -100,7 +86,6 @@ module datm_datamode_clmncep_mod real(r8) , parameter :: stebol = SHR_CONST_STEBOL ! Stefan-Boltzmann constant ~ W/m^2/K^4 real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg - character(*), parameter :: nullstr = 'null' character(*), parameter :: u_FILE_u = & __FILE__ @@ -109,17 +94,11 @@ module datm_datamode_clmncep_mod contains !=============================================================================== - subroutine datm_datamode_clmncep_advertise(exportState, fldsexport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, flds_presndep, flds_preso3, rc) + subroutine datm_datamode_clmncep_advertise(exportState, fldsexport, flds_scalar_name, 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) :: flds_presaero - logical , intent(in) :: flds_presndep - logical , intent(in) :: flds_preso3 character(len=*) , intent(in) :: flds_scalar_name integer , intent(out) :: rc @@ -151,29 +130,6 @@ subroutine datm_datamode_clmncep_advertise(exportState, fldsexport, flds_scalar_ call dshr_fldList_add(fldsExport, 'Faxa_swnet' ) call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) - if (flds_co2) then - call dshr_fldList_add(fldsExport, 'Sa_co2prog') - call dshr_fldList_add(fldsExport, 'Sa_co2diag') - end if - if (flds_preso3) then - call dshr_fldList_add(fldsExport, 'Sa_o3') - end if - 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) - call dshr_fldList_add(fldsExport, 'Faxa_snowc_wiso', ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsExport, 'Faxa_snowl_wiso', ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsExport, 'Faxa_shum_wiso' , ungridded_lbound=1, ungridded_ubound=3) - end if fldlist => fldsExport ! the head of the linked list do while (associated(fldlist)) @@ -201,69 +157,57 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r rc = ESMF_SUCCESS - ! initialize pointers for module level stream arrays - call shr_strdata_get_stream_pointer( sdat, 'Sa_pbot' , strm_pbot , rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_tbot , rc) + ! initialize stream pointers for module level export states + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_wind' , strm_Sa_wind , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_shum , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_topo' , strm_Sa_topo, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_wind' , strm_wind , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_z' , strm_Sa_z , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_tdew' , strm_tdew , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_pbot' , strm_Sa_pbot , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_rh' , strm_rh , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tbot' , strm_Sa_tbot , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_z' , strm_z , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_shum' , strm_Sa_shum , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdndf' , strm_swdndf, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tdew' , strm_Sa_tdew , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdndr' , strm_swdndr, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_rh' , strm_Sa_rh , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_lwdn , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdndf' , strm_Faxa_swdndf , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_swdn , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdndr' , strm_Faxa_swdndr , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn' , strm_precn , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_lwdn' , strm_Faxa_lwdn , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_rh_16O' , strm_rh_16O, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdn' , strm_Faxa_swdn , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_rh_18O' , strm_rh_18O , rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_rh_HDO' , strm_rh_HDO , rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn_16O' , strm_precn_16O, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn_18O' , strm_precn_18O, 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 - call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn_HDO' , strm_precn_HDO, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_precn' , strm_Faxa_precn , 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) + ! initialize stream pointers for module for bias correction + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_precsf' , strm_Faxa_precsf , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! initialize pointers for module level stream arrays for anomaly forcing - call shr_strdata_get_stream_pointer( sdat, 'Sa_u_af' , strm_u_af , rc) + ! initialize stream pointers anomaly forcing + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_u_af' , strm_Sa_u_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_v_af' , strm_v_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_v_af' , strm_Sa_v_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_shum_af' , strm_shum_af, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_shum_af' , strm_Sa_shum_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot_af' , strm_tbot_af, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tbot_af' , strm_Sa_tbot_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_pbot_af' , strm_pbot_af, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_pbot_af' , strm_Sa_pbot_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec_af' , strm_prec_af, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_prec_af' , strm_Faxa_prec_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn_af' , strm_swdn_af, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdn_af' , strm_Faxa_swdn_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn_af' , strm_lwdn_af, rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_lwdn_af' , strm_Faxa_lwdn_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! get export state pointers + ! initialize export state pointers call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) @@ -303,25 +247,19 @@ 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 + ! Required stream pointers + if (.not. associated(strm_Sa_wind)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_wind must be associated for clmncep datamode') end if - - call ESMF_StateGet(exportstate, 'Sa_o3', itemFlag, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (itemflag /= ESMF_STATEITEM_NOTFOUND) then - call dshr_state_getfldptr(exportState, 'Sa_o3', fldptr1=Sa_o3, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. associated(strm_Sa_tbot)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for clmncep datamode') + end if + if (.not. associated(strm_Sa_topo)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_topo must be associated for clmncep datamode') + end if + if (.not. associated(strm_Faxa_precn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_precn must be associated for clmncep datamode') end if - - ! error check - if (.not. associated(strm_wind) .or. .not. associated(strm_tbot)) then - call shr_log_error(trim(subname)//' ERROR: wind and tbot must be in streams for CLMNCEP', rc=rc) - return - endif ! determine anidrmax (see below for use) call ESMF_StateGet(importstate, 'Sx_anidr', itemFlag, rc=rc) @@ -397,8 +335,8 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) if (mainproc) write(logunit,*) trim(subname),' anidrmax = ',anidrmax ! determine tdewmax (see below for use) - if (associated(strm_tdew)) then - rtmp(1) = maxval(strm_tdew(:)) + if (associated(strm_Sa_tdew)) then + rtmp(1) = maxval(strm_Sa_tdew(:)) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return tdewmax = rtmp(2) @@ -409,91 +347,101 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) first_time = .false. end if + do n = 1,lsize + !--- topography --- + Sa_topo(n) = strm_Sa_topo(n) + !--- bottom layer height --- - if (.not. associated(strm_z)) Sa_z(n) = 30.0_r8 + if (.not. associated(strm_Sa_z)) then + Sa_z(n) = 30.0_r8 + else + Sa_z(n) = strm_Sa_z(n) + end if !--- temperature --- + Sa_tbot(n) = strm_Sa_tbot(n) if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz ! Limit very cold forcing to 180K Sa_tbot(n) = max(180._r8, Sa_tbot(n)) Sa_ptem(n) = Sa_tbot(n) !--- pressure --- - if (.not. associated(strm_pbot)) then - Sa_pbot(n) = pstd - else if (Sa_pbot(n) == 0._r8) then - ! This happens if you are using points over ocean where the mask is 0 + if (.not. associated(strm_Sa_pbot)) then Sa_pbot(n) = pstd + else + Sa_pbot(n) = strm_Sa_pbot(n) + if (Sa_pbot(n) == 0._r8) then + ! This happens if you are using points over ocean where the mask is 0 + Sa_pbot(n) = pstd + end if end if - Sa_pslv(n) = Sa_pbot(n) !--- u, v wind velocity --- - Sa_u(n) = strm_wind(n)/sqrt(2.0_r8) + Sa_u(n) = strm_Sa_wind(n)/sqrt(2.0_r8) Sa_v(n) = Sa_u(n) !--- specific humidity --- tbot = Sa_tbot(n) pbot = Sa_pbot(n) - if (associated(strm_shum)) then + if (associated(strm_Sa_shum)) then e = datm_esat(tbot,tbot) qsat = (0.622_r8 * e)/(pbot - 0.378_r8 * e) - if (qsat < Sa_shum(n)) then + if (qsat < strm_Sa_shum(n)) then Sa_shum(n) = qsat + else + Sa_shum(n) = strm_Sa_shum(n) endif - else if (associated(strm_rh)) then - e = strm_rh(n) * 0.01_r8 * datm_esat(tbot,tbot) + else if (associated(strm_Sa_rh)) then + e = strm_Sa_rh(n) * 0.01_r8 * datm_esat(tbot,tbot) qsat = (0.622_r8 * e)/(pbot - 0.378_r8 * e) Sa_shum(n) = qsat - ! 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) + else if (associated(strm_Sa_tdew)) then + if (tdewmax < 50.0_r8) strm_Sa_tdew(n) = strm_Sa_tdew(n) + tkFrz + e = datm_esat(strm_Sa_tdew(n),tbot) qsat = (0.622_r8 * e)/(pbot - 0.378_r8 * e) Sa_shum(n) = qsat else call shr_log_error(subname//'ERROR: cannot compute shum', rc=rc) return endif + !--- density --- vp = (Sa_shum(n)*pbot) / (0.622_r8 + 0.378_r8 * Sa_shum(n)) Sa_dens(n) = (pbot - 0.378_r8 * vp) / (tbot*rdair) !--- downward longwave --- - if (.not. associated(strm_lwdn)) then + if (.not. associated(strm_Faxa_lwdn)) then e = Sa_pslv(n) * Sa_shum(n) / (0.622_r8 + 0.378_r8 * Sa_shum(n)) ea = 0.70_r8 + 5.95e-05_r8 * 0.01_r8 * e * exp(1500.0_r8/tbot) Faxa_lwdn(n) = ea * stebol * tbot**4 + else + Faxa_lwdn(n) = strm_Faxa_lwdn(n) endif !--- shortwave radiation --- - if (associated(strm_swdndf) .and. associated(strm_swdndr)) then - Faxa_swndr(n) = strm_swdndr(n) * 0.50_r8 - Faxa_swvdr(n) = strm_swdndr(n) * 0.50_r8 - Faxa_swndf(n) = strm_swdndf(n) * 0.50_r8 - Faxa_swvdf(n) = strm_swdndf(n) * 0.50_r8 - elseif (associated(strm_swdn)) then + if (associated(strm_Faxa_swdndf) .and. associated(strm_Faxa_swdndr)) then + Faxa_swndr(n) = strm_Faxa_swdndr(n) * 0.50_r8 + Faxa_swvdr(n) = strm_Faxa_swdndr(n) * 0.50_r8 + Faxa_swndf(n) = strm_Faxa_swdndf(n) * 0.50_r8 + Faxa_swvdf(n) = strm_Faxa_swdndf(n) * 0.50_r8 + elseif (associated(strm_Faxa_swdn)) then ! relationship between incoming NIR or VIS radiation and ratio of ! direct to diffuse radiation calculated based on one year's worth of ! hourly CAM output from CAM version cam3_5_55 - swndr = strm_swdn(n) * 0.50_r8 + swndr = strm_Faxa_swdn(n) * 0.50_r8 ratio_rvrf = min(0.99_r8,max(0.29548_r8 + 0.00504_r8*swndr & -1.4957e-05_r8*swndr**2 + 1.4881e-08_r8*swndr**3,0.01_r8)) Faxa_swndr(n) = ratio_rvrf*swndr - swndf = strm_swdn(n) * 0.50_r8 + swndf = strm_Faxa_swdn(n) * 0.50_r8 Faxa_swndf(n) = (1._r8 - ratio_rvrf)*swndf - swvdr = strm_swdn(n) * 0.50_r8 + swvdr = strm_Faxa_swdn(n) * 0.50_r8 ratio_rvrf = min(0.99_r8,max(0.17639_r8 + 0.00380_r8*swvdr & -9.0039e-06_r8*swvdr**2 + 8.1351e-09_r8*swvdr**3,0.01_r8)) Faxa_swvdr(n) = ratio_rvrf*swvdr - swvdf = strm_swdn(n) * 0.50_r8 + swvdf = strm_Faxa_swdn(n) * 0.50_r8 Faxa_swvdf(n) = (1._r8 - ratio_rvrf)*swvdf else call shr_log_error(subName//'ERROR: cannot compute short-wave down', rc=rc) @@ -514,16 +462,8 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) endif !--- rain and snow --- - if (associated(strm_precc) .and. associated(strm_precl)) then - Faxa_rainc(n) = strm_precc(n) - Faxa_rainl(n) = strm_precl(n) - else if (associated(strm_precn)) then - Faxa_rainc(n) = strm_precn(n)*0.1_r8 - Faxa_rainl(n) = strm_precn(n)*0.9_r8 - else - call shr_log_error(subName//'ERROR: cannot compute rain and snow', rc=rc) - return - endif + Faxa_rainc(n) = strm_Faxa_precn(n)*0.1_r8 + Faxa_rainl(n) = strm_Faxa_precn(n)*0.9_r8 !--- split precip between rain & snow --- call shr_precip_partition_rain_snow_ramp(tbot, frac) @@ -541,54 +481,49 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) ! bias correct precipitation relative to observed ! (via bias_correct nameslist option) - if (associated(strm_precsf)) then - Faxa_snowc(:) = Faxa_snowc(:) * min(1.e2_r8,strm_precsf(:)) - Faxa_snowl(:) = Faxa_snowl(:) * min(1.e2_r8,strm_precsf(:)) - Faxa_rainc(:) = Faxa_rainc(:) * min(1.e2_r8,strm_precsf(:)) - Faxa_rainl(:) = Faxa_rainl(:) * min(1.e2_r8,strm_precsf(:)) + if (associated(strm_Faxa_precsf)) then + Faxa_snowc(:) = Faxa_snowc(:) * min(1.e2_r8,strm_Faxa_precsf(:)) + Faxa_snowl(:) = Faxa_snowl(:) * min(1.e2_r8,strm_Faxa_precsf(:)) + Faxa_rainc(:) = Faxa_rainc(:) * min(1.e2_r8,strm_Faxa_precsf(:)) + Faxa_rainl(:) = Faxa_rainl(:) * min(1.e2_r8,strm_Faxa_precsf(:)) endif ! adjust atmospheric input fields if anomaly forcing streams exist ! (via anomaly_forcing namelist option) - if (associated(strm_u_af) .and. associated(strm_v_af)) then ! wind - Sa_u(:) = Sa_u(:) + strm_u_af(:) - Sa_v(:) = Sa_v(:) + strm_v_af(:) + if (associated(strm_Sa_u_af) .and. associated(strm_Sa_v_af)) then ! wind + Sa_u(:) = Sa_u(:) + strm_Sa_u_af(:) + Sa_v(:) = Sa_v(:) + strm_Sa_v_af(:) endif - if (associated(strm_shum_af)) then ! specific humidity - Sa_shum(:) = Sa_shum(:) + strm_shum_af(:) + if (associated(strm_Sa_shum_af)) then ! specific humidity + Sa_shum(:) = Sa_shum(:) + strm_Sa_shum_af(:) ! avoid possible negative q values where (Sa_shum < 0._r8) Sa_shum = 1.e-6_r8 end where endif - if (associated(strm_pbot_af)) then ! pressure - Sa_pbot(:) = Sa_pbot(:) + strm_pbot_af(:) + if (associated(strm_Sa_pbot_af)) then ! pressure + Sa_pbot(:) = Sa_pbot(:) + strm_Sa_pbot_af(:) endif - if (associated(strm_tbot_af)) then ! temperature - Sa_tbot(:) = Sa_tbot(:) + strm_tbot_af(:) + if (associated(strm_Sa_tbot_af)) then ! temperature + Sa_tbot(:) = Sa_tbot(:) + strm_Sa_tbot_af(:) endif - if (associated(strm_lwdn_af)) then ! longwave - Faxa_lwdn(:) = Faxa_lwdn(:) * strm_lwdn_af(:) + if (associated(strm_Faxa_lwdn_af)) then ! longwave + Faxa_lwdn(:) = Faxa_lwdn(:) * strm_Faxa_lwdn_af(:) endif - if (associated(strm_prec_af)) then ! precipitation - Faxa_snowc(:) = Faxa_snowc(:) * strm_prec_af(:) - Faxa_snowl(:) = Faxa_snowl(:) * strm_prec_af(:) - Faxa_rainc(:) = Faxa_rainc(:) * strm_prec_af(:) - Faxa_rainl(:) = Faxa_rainl(:) * strm_prec_af(:) + if (associated(strm_Faxa_prec_af)) then ! precipitation + Faxa_snowc(:) = Faxa_snowc(:) * strm_Faxa_prec_af(:) + Faxa_snowl(:) = Faxa_snowl(:) * strm_Faxa_prec_af(:) + Faxa_rainc(:) = Faxa_rainc(:) * strm_Faxa_prec_af(:) + Faxa_rainl(:) = Faxa_rainl(:) * strm_Faxa_prec_af(:) end if - if (associated(strm_swdn_af)) then ! shortwave - Faxa_swndr(:) = Faxa_swndr(:) * strm_swdn_af(:) - Faxa_swvdr(:) = Faxa_swvdr(:) * strm_swdn_af(:) - Faxa_swndf(:) = Faxa_swndf(:) * strm_swdn_af(:) - Faxa_swvdf(:) = Faxa_swvdf(:) * strm_swdn_af(:) + if (associated(strm_Faxa_swdn_af)) then ! shortwave + Faxa_swndr(:) = Faxa_swndr(:) * strm_Faxa_swdn_af(:) + Faxa_swvdr(:) = Faxa_swvdr(:) * strm_Faxa_swdn_af(:) + Faxa_swndf(:) = Faxa_swndf(:) * strm_Faxa_swdn_af(:) + Faxa_swvdf(:) = Faxa_swvdf(:) * strm_Faxa_swdn_af(:) 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 b874dcf98..91019248a 100644 --- a/datm/datm_datamode_core2_mod.F90 +++ b/datm/datm_datamode_core2_mod.F90 @@ -55,12 +55,18 @@ 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() - real(r8), pointer :: strm_swdn(:) => null() - real(r8), pointer :: strm_tarcf(:) => null() + ! stream data points + real(r8), pointer :: strm_Faxa_prec(:) => null() + real(r8), pointer :: strm_Faxa_swdn(:) => null() + real(r8), pointer :: strm_Faxa_swnet(:) => null() + real(r8), pointer :: strm_Faxa_lwdn(:) => null() + real(r8), pointer :: strm_Sa_pslv(:) => null() + real(r8), pointer :: strm_Sa_tbot(:) => null() + real(r8), pointer :: strm_Sa_shum(:) => null() + real(r8), pointer :: strm_Sa_u(:) => null() + real(r8), pointer :: strm_Sa_v(:) => null() + real(r8), pointer :: strm_tarcf(:) => null() ! othe module arrays real(R8), pointer :: windFactor(:) @@ -90,17 +96,12 @@ module datm_datamode_core2_mod contains !=============================================================================== - subroutine datm_datamode_core2_advertise(exportState, fldsexport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) + subroutine datm_datamode_core2_advertise(exportState, fldsexport, flds_scalar_name, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState type(fldlist_type) , pointer :: fldsexport character(len=*) , intent(in) :: 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 @@ -133,27 +134,6 @@ subroutine datm_datamode_core2_advertise(exportState, fldsexport, flds_scalar_na call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) - if (flds_co2) then - call dshr_fldList_add(fldsExport, 'Sa_co2prog') - call dshr_fldList_add(fldsExport, 'Sa_co2diag') - end if - 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) - call dshr_fldList_add(fldsExport, 'Faxa_snowc_wiso', ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsExport, 'Faxa_snowl_wiso', ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsExport, 'Faxa_shum_wiso' , ungridded_lbound=1, ungridded_ubound=3) - end if - fldlist => fldsExport ! the head of the linked list do while (associated(fldlist)) call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) @@ -205,11 +185,25 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor end do ! get stream pointers - call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_prec , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_prec' , strm_Faxa_prec , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdn' , strm_Faxa_swdn , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swnet' , strm_Faxa_swnet , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_lwdn' , strm_Faxa_lwdn , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_pslv' , strm_Sa_pslv , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tbot' , strm_Sa_tbot , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_swdn , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_u' , strm_Sa_u , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'tarcf' , strm_tarcf , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_v' , strm_Sa_v , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_shum' , strm_Sa_shum , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_tarcf' , strm_tarcf , rc) ! required for CORE2_IAF if (ChkErr(rc,__LINE__,u_FILE_u)) return ! get export state pointers @@ -254,21 +248,41 @@ 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_log_error(trim(subname)//'ERROR: prec and swdn must be in streams for CORE2', rc=rc) + if (.not. associated(strm_Faxa_prec)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_prec must be associated for CORE2', rc=rc) return endif - - if (trim(datamode) == 'CORE2_IAF' ) then - if (.not. associated(strm_tarcf)) then - call shr_log_error(trim(subname)//'tarcf must be in an input stream for CORE2_IAF', rc=rc) + if (.not. associated(strm_Faxa_swdn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for CORE2', rc=rc) + return + endif + if (.not. associated(strm_Faxa_swnet)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swnet must be associated for CORE2', rc=rc) + return + endif + if (.not. associated(strm_Faxa_lwdn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for CORE2', rc=rc) + return + endif + if (.not. associated(strm_Sa_pslv)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for CORE2', rc=rc) + return + endif + if (.not. associated(strm_Sa_tbot)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for CORE2', rc=rc) + return + endif + if (.not. associated(strm_Sa_u)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_u must be associated for CORE2', rc=rc) + return + endif + if (.not. associated(strm_Sa_v)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_v must be associated for CORE2', rc=rc) + return + endif + if (.not. associated(strm_tarcf)) then + if (trim(datamode) == 'CORE2_IAF' ) then + call shr_log_error(trim(subname)//'strm_tarcf must be associated for CORE2_IAF', rc=rc) return endif endif @@ -316,8 +330,8 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ Sa_z(n) = 10.0_R8 !--- correction to NCEP winds based on QSCAT --- - uprime = Sa_u(n)*windFactor(n) - vprime = Sa_v(n)*windFactor(n) + uprime = strm_Sa_u(n)*windFactor(n) + vprime = strm_Sa_v(n)*windFactor(n) Sa_u(n) = uprime*cos(winddFactor(n)*degtorad) - vprime*sin(winddFactor(n)*degtorad) Sa_v(n) = uprime*sin(winddFactor(n)*degtorad) + vprime*cos(winddFactor(n)*degtorad) @@ -326,9 +340,11 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ Sa_v10m(n) = Sa_v(n) !--- density and pslv taken directly from input stream, set pbot --- + Sa_pslv(n) = strm_Sa_pslv(n) Sa_pbot(n) = Sa_pslv(n) !--- correction to NCEP Arctic & Antarctic air T & potential T --- + Sa_tbot(n) = strm_Sa_tbot(n) if ( yc(n) < -60.0_R8 ) then tMin = (avg_c0 + avg_c1*yc(n)) + (amp_c0 + amp_c1*yc(n))*cosFactor + tKFrz Sa_tbot(n) = max(Sa_tbot(n), tMin) @@ -339,7 +355,7 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ Sa_ptem(n) = Sa_tbot(n) !--- correction to NCEP relative humidity for heat budget balance --- - Sa_shum(n) = Sa_shum(n) + qsatFactor(n) + Sa_shum(n) = strm_Sa_shum(n) + qsatFactor(n) !--- Dupont correction to NCEP Arctic air T --- !--- don't correct during summer months (July-September) @@ -350,34 +366,36 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ end if ! PRECIPITATION DATA - strm_prec(n) = strm_prec(n)/86400.0_R8 ! convert mm/day to kg/m^2/s + strm_Faxa_prec(n) = strm_Faxa_prec(n)/86400.0_R8 ! convert mm/day to kg/m^2/s ! only correct satellite products, do not correct Serreze Arctic data if ( yc(n) < 58. ) then - strm_prec(n) = strm_prec(n)*1.14168_R8 + strm_Faxa_prec(n) = strm_Faxa_prec(n)*1.14168_R8 endif if ( yc(n) >= 58. .and. yc(n) < 68. ) then factor = MAX(0.0_R8, 1.0_R8 - 0.1_R8*(yc(n)-58.0_R8) ) - strm_prec(n) = strm_prec(n)*(factor*(1.14168_R8 - 1.0_R8) + 1.0_R8) + strm_Faxa_prec(n) = strm_Faxa_prec(n)*(factor*(1.14168_R8 - 1.0_R8) + 1.0_R8) endif Faxa_rainc(n) = 0.0_R8 ! default zero Faxa_snowc(n) = 0.0_R8 if (Sa_tbot(n) < tKFrz ) then ! assign precip to rain/snow components Faxa_rainl(n) = 0.0_R8 - Faxa_snowl(n) = strm_prec(n) + Faxa_snowl(n) = strm_Faxa_prec(n) else - Faxa_rainl(n) = strm_prec(n) + Faxa_rainl(n) = strm_Faxa_prec(n) Faxa_snowl(n) = 0.0_R8 endif ! RADIATION DATA !--- fabricate required swdn components from net swdn --- - Faxa_swvdr(n) = strm_swdn(n)*(0.28_R8) - Faxa_swndr(n) = strm_swdn(n)*(0.31_R8) - Faxa_swvdf(n) = strm_swdn(n)*(0.24_R8) - Faxa_swndf(n) = strm_swdn(n)*(0.17_R8) + Faxa_swvdr(n) = strm_Faxa_swdn(n)*(0.28_R8) + Faxa_swndr(n) = strm_Faxa_swdn(n)*(0.31_R8) + Faxa_swvdf(n) = strm_Faxa_swdn(n)*(0.24_R8) + Faxa_swndf(n) = strm_Faxa_swdn(n)*(0.17_R8) + !--- compute net short-wave based on LY08 latitudinally-varying albedo --- avg_alb = ( 0.069 - 0.011*cos(2.0_R8*yc(n)*degtorad ) ) - Faxa_swnet(n) = strm_swdn(n)*(1.0_R8 - avg_alb) + Faxa_swnet(n) = strm_Faxa_swdn(n)*(1.0_R8 - avg_alb) + !--- corrections to GISS sswdn for heat budget balancing --- factor = 1.0_R8 if ( -60.0_R8 < yc(n) .and. yc(n) < -50.0_R8 ) then @@ -392,19 +410,15 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ Faxa_swndr(n) = Faxa_swndr(n)*factor Faxa_swvdf(n) = Faxa_swvdf(n)*factor Faxa_swndf(n) = Faxa_swndf(n)*factor + !--- correction to GISS lwdn in Arctic --- if ( yc(n) > 60._R8 ) then factor = MIN(1.0_R8, 0.1_R8*(yc(n)-60.0_R8) ) - Faxa_lwdn(n) = Faxa_lwdn(n) + factor * dLWarc + Faxa_lwdn(n) = strm_Faxa_lwdn(n) + factor * dLWarc endif 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 a260182e9..20ea3b7d7 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -18,28 +18,52 @@ module datm_datamode_cplhist_mod public :: datm_datamode_cplhist_advance ! export state data - real(r8), pointer :: Sa_z(:) => null() - real(r8), pointer :: Sa_u(:) => null() - real(r8), pointer :: Sa_v(:) => null() - real(r8), pointer :: Sa_tbot(:) => null() - real(r8), pointer :: Sa_ptem(:) => null() - real(r8), pointer :: Sa_shum(:) => null() - ! TODO: water isotope support - ! real(r8), pointer :: Sa_shum_wiso(:,:) => null() ! water isotopes - real(r8), pointer :: Sa_dens(:) => null() - real(r8), pointer :: Sa_pbot(:) => null() - real(r8), pointer :: Sa_pslv(:) => null() - real(r8), pointer :: Faxa_lwdn(:) => null() - real(r8), pointer :: Faxa_rainc(:) => null() - real(r8), pointer :: Faxa_rainl(:) => null() - real(r8), pointer :: Faxa_snowc(:) => null() - real(r8), pointer :: Faxa_snowl(:) => null() - real(r8), pointer :: Faxa_swndr(:) => null() - real(r8), pointer :: Faxa_swndf(:) => null() - real(r8), pointer :: Faxa_swvdr(:) => null() - real(r8), pointer :: Faxa_swvdf(:) => null() - real(r8), pointer :: Faxa_swnet(:) => null() - real(r8), pointer :: Faxa_ndep(:,:) => null() + + real(r8), pointer :: Sa_z(:) => null() + real(r8), pointer :: Sa_tbot(:) => null() + real(r8), pointer :: Sa_ptem(:) => null() + real(r8), pointer :: Sa_shum(:) => null() + real(r8), pointer :: Sa_dens(:) => null() + real(r8), pointer :: Sa_pbot(:) => null() + real(r8), pointer :: Sa_pslv(:) => null() + + real(r8), pointer :: Sa_u(:) => null() + real(r8), pointer :: Sa_v(:) => null() + + real(r8), pointer :: Faxa_rainc(:) => null() + real(r8), pointer :: Faxa_rainl(:) => null() + real(r8), pointer :: Faxa_snowc(:) => null() + real(r8), pointer :: Faxa_snowl(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() + + real(r8), pointer :: Faxa_swndr(:) => null() + real(r8), pointer :: Faxa_swndf(:) => null() + real(r8), pointer :: Faxa_swvdr(:) => null() + real(r8), pointer :: Faxa_swvdf(:) => null() + + ! stream data + + real(r8), pointer :: strm_Sa_z (:) => null() + real(r8), pointer :: strm_Sa_tbot(:) => null() + real(r8), pointer :: strm_Sa_ptem(:) => null() + real(r8), pointer :: strm_Sa_shum(:) => null() + real(r8), pointer :: strm_Sa_pbot(:) => null() + real(r8), pointer :: strm_Sa_dens(:) => null() + real(r8), pointer :: strm_Sa_pslv(:) => null() + + real(r8), pointer :: strm_Sa_u(:) => null() + real(r8), pointer :: strm_Sa_v(:) => null() + + real(r8), pointer :: strm_Faxa_swndr(:) => null() + real(r8), pointer :: strm_Faxa_swvdr(:) => null() + real(r8), pointer :: strm_Faxa_swndf(:) => null() + real(r8), pointer :: strm_Faxa_swvdf(:) => null() + + real(r8), pointer :: strm_Faxa_rainc(:) => null() + real(r8), pointer :: strm_Faxa_rainl(:) => null() + real(r8), pointer :: strm_Faxa_snowc(:) => null() + real(r8), pointer :: strm_Faxa_snowl(:) => null() + real(r8), pointer :: strm_Faxa_lwdn (:) => null() character(*), parameter :: nullstr = 'null' character(*), parameter :: u_FILE_u = & @@ -49,16 +73,11 @@ module datm_datamode_cplhist_mod contains !=============================================================================== - subroutine datm_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) + subroutine datm_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_name, 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) :: flds_presaero - logical , intent(in) :: flds_presndep character(len=*) , intent(in) :: flds_scalar_name integer , intent(out) :: rc @@ -71,45 +90,29 @@ subroutine datm_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_ call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) call dshr_fldList_add(fldsExport, 'Sa_topo' ) call dshr_fldList_add(fldsExport, 'Sa_z' ) - call dshr_fldList_add(fldsExport, 'Sa_u' ) - call dshr_fldList_add(fldsExport, 'Sa_v' ) call dshr_fldList_add(fldsExport, 'Sa_ptem' ) call dshr_fldList_add(fldsExport, 'Sa_dens' ) call dshr_fldList_add(fldsExport, 'Sa_pslv' ) call dshr_fldList_add(fldsExport, 'Sa_tbot' ) call dshr_fldList_add(fldsExport, 'Sa_pbot' ) call dshr_fldList_add(fldsExport, 'Sa_shum' ) - call dshr_fldList_add(fldsExport, 'Faxa_rainc' ) - call dshr_fldList_add(fldsExport, 'Faxa_rainl' ) - call dshr_fldList_add(fldsExport, 'Faxa_snowc' ) - call dshr_fldList_add(fldsExport, 'Faxa_snowl' ) + + call dshr_fldList_add(fldsExport, 'Sa_u' ) + call dshr_fldList_add(fldsExport, 'Sa_v' ) + call dshr_fldList_add(fldsExport, 'Faxa_swndr' ) call dshr_fldList_add(fldsExport, 'Faxa_swvdr' ) call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) call dshr_fldList_add(fldsExport, 'Faxa_swvdf' ) - call dshr_fldList_add(fldsExport, 'Faxa_swnet' ) + + call dshr_fldList_add(fldsExport, 'Faxa_rainc' ) + call dshr_fldList_add(fldsExport, 'Faxa_rainl' ) + call dshr_fldList_add(fldsExport, 'Faxa_snowc' ) + call dshr_fldList_add(fldsExport, 'Faxa_snowl' ) call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) - call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) - if (flds_co2) then - call dshr_fldList_add(fldsExport, 'Sa_co2prog') - call dshr_fldList_add(fldsExport, 'Sa_co2diag') - end if - 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) - call dshr_fldList_add(fldsExport, 'Faxa_snowc_wiso', ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsExport, 'Faxa_snowl_wiso', ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsExport, 'Faxa_shum_wiso' , ungridded_lbound=1, ungridded_ubound=3) - end if + + !call dshr_fldList_add(fldsExport, 'Faxa_swnet' ) !??? + !call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) !??? fldlist => fldsExport ! the head of the linked list do while (associated(fldlist)) @@ -140,10 +143,6 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r ! get export state pointers call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , rc=rc) @@ -156,6 +155,12 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_dens' , fldptr1=Sa_dens , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_rainc' , fldptr1=Faxa_rainc , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rainl' , fldptr1=Faxa_rainl , rc=rc) @@ -164,6 +169,9 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_snowl' , fldptr1=Faxa_snowl , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swvdr' , fldptr1=Faxa_swvdr , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swvdf' , fldptr1=Faxa_swvdf , rc=rc) @@ -172,17 +180,55 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swndf' , fldptr1=Faxa_swndf , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) + + ! call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) !??? + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Set pointers into stream data + + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_z' , strm_Sa_z , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_tbog', strm_Sa_tbot, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_ptem', strm_Sa_ptem, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_shum', strm_Sa_shum, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_pbot', strm_Sa_pbot, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_dens', strm_Sa_dens, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_pslv', strm_Sa_pslv, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_dens', strm_Sa_dens, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateGet(exportState, 'Faxa_ndep', itemFlag, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_u', strm_Sa_u, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_v', strm_Sa_v, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_rainc', strm_Faxa_rainc, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_rainl', strm_Faxa_rainl, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_snowc', strm_Faxa_snowc, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_snowl', strm_Faxa_snowl, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_lwdn', strm_Faxa_lwdn, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_swndr', strm_Faxa_swndr, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_swvdr', strm_Faxa_swvdr, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_swndf', strm_Faxa_swndf, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_swvdf', strm_Faxa_swvdf, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_lwdn', strm_Faxa_lwdn , 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 end subroutine datm_datamode_cplhist_init_pointers @@ -201,11 +247,28 @@ subroutine datm_datamode_cplhist_advance(mainproc, logunit, mpicom, rc) rc = ESMF_SUCCESS - if (associated(Faxa_ndep)) then - ! convert ndep flux to units of kgN/m2/s (assumes that input is in gN/m2/s) - Faxa_ndep(:,:) = Faxa_ndep(:,:) / 1000._r8 - end if + Sa_z(:) = strm_Sa_z(:) + Sa_tbot(:) = strm_Sa_tbot(:) + Sa_ptem(:) = strm_Sa_ptem(:) + Sa_shum(:) = strm_Sa_shum(:) + Sa_dens(:) = strm_Sa_dens(:) + Sa_pbot(:) = strm_Sa_pbot(:) + Sa_pslv(:) = strm_Sa_pslv(:) + + Sa_u(:) = strm_Sa_u(:) + Sa_v(:) = strm_Sa_v(:) + + Faxa_rainc(:) = strm_Faxa_rainc(:) + Faxa_rainl(:) = strm_Faxa_rainl(:) + Faxa_snowc(:) = strm_Faxa_snowc(:) + Faxa_snowl(:) = strm_Faxa_snowl(:) + Faxa_lwdn(:) = strm_Faxa_lwdn (:) + Faxa_swndr(:) = strm_Faxa_swndr(:) + Faxa_swndf(:) = strm_Faxa_swvdr(:) + Faxa_swvdr(:) = strm_Faxa_swndf(:) + Faxa_swvdf(:) = strm_Faxa_swvdf(:) + end subroutine datm_datamode_cplhist_advance end module datm_datamode_cplhist_mod diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index 80d5716d8..8406831f4 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -55,8 +55,7 @@ module datm_datamode_gefs_mod contains !=============================================================================== - subroutine datm_datamode_gefs_advertise(exportState, fldsexport, & - flds_scalar_name, rc) + subroutine datm_datamode_gefs_advertise(exportState, fldsexport, flds_scalar_name, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 13ef64ebf..6f482b81d 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -41,14 +41,19 @@ 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() - real(r8), pointer :: strm_swdn(:) => null() + real(r8), pointer :: strm_Sa_tbot(:) => null() + real(r8), pointer :: strm_Sa_pslv(:) => null() + real(r8), pointer :: strm_Sa_u(:) => null() + real(r8), pointer :: strm_Sa_v(:) => null() + real(r8), pointer :: strm_Sa_shum(:) => null() + real(r8), pointer :: strm_Faxa_prec(:) => null() + real(r8), pointer :: strm_Faxa_lwdn(:) => null() + real(r8), pointer :: strm_Faxa_swdn(:) => null() ! othe module arrays - real(R8), pointer :: yc(:) ! array of model latitudes + real(R8), pointer :: yc(:) ! array of model latitudes ! constants real(R8) , parameter :: tKFrz = SHR_CONST_TKFRZ @@ -65,17 +70,12 @@ module datm_datamode_jra_mod contains !=============================================================================== - subroutine datm_datamode_jra_advertise(exportState, fldsexport, flds_scalar_name, & - flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) + subroutine datm_datamode_jra_advertise(exportState, fldsexport, flds_scalar_name, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState type(fldlist_type) , pointer :: fldsexport character(len=*) , intent(in) :: 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 @@ -108,27 +108,6 @@ subroutine datm_datamode_jra_advertise(exportState, fldsexport, flds_scalar_name call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) - if (flds_co2) then - call dshr_fldList_add(fldsExport, 'Sa_co2prog') - call dshr_fldList_add(fldsExport, 'Sa_co2diag') - end if - 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) - call dshr_fldList_add(fldsExport, 'Faxa_snowc_wiso', ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsExport, 'Faxa_snowl_wiso', ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsExport, 'Faxa_shum_wiso' , ungridded_lbound=1, ungridded_ubound=3) - end if - fldlist => fldsExport ! the head of the linked list do while (associated(fldlist)) call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) @@ -171,11 +150,25 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) yc(n) = ownedElemCoords(2*n) end do - call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_prec , rc) + ! Stream pointers + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tbot' , strm_Sa_tbot , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_pslv' , strm_Sa_pslv , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_u' , strm_Sa_u , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_v' , strm_Sa_v , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_shum' , strm_Sa_shum , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_prec' , strm_Faxa_prec , rc) ! required + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_lwdn' , strm_Faxa_lwdn , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_swdn , rc) + call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdn' , strm_Faxa_swdn , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Export state pointers call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) @@ -217,16 +210,37 @@ 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_log_error(trim(subname)//'ERROR: prec and swdn must be in streams for CORE_IAF_JRA', rc=rc) + ! error check + if (.not. associated(strm_Sa_tbot)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot required for CORE_IAF_JRA', rc=rc) + return + endif + if (.not. associated(strm_Sa_pslv)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv required for CORE_IAF_JRA', rc=rc) + return + endif + if (.not. associated(strm_Sa_u)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_u required for CORE_IAF_JRA', rc=rc) + return + endif + if (.not. associated(strm_Sa_v)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_v required for CORE_IAF_JRA', rc=rc) + return + endif + if (.not. associated(strm_Sa_shum)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_shum required for CORE_IAF_JRA', rc=rc) + return + endif + if (.not. associated(strm_Faxa_prec)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_prec required for CORE_IAF_JRA', rc=rc) + return + endif + if (.not. associated(strm_Faxa_lwdn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn required for CORE_IAF_JRA', rc=rc) + return + endif + if (.not. associated(strm_Faxa_swdn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn required for CORE_IAF_JRA', rc=rc) return endif @@ -261,7 +275,18 @@ subroutine datm_datamode_jra_advance(exportstate, target_ymd, target_tod, model_ do n = 1,lsize Sa_z(n) = 10.0_R8 + + ! Set export fields as copies directly from streams + Sa_pslv(n) = strm_Sa_pslv(n) + Sa_tbot(n) = strm_Sa_tbot(n) + Sa_u(n) = strm_Sa_u(n) + Sa_v(n) = strm_Sa_v(n) + Sa_shum(n) = strm_Sa_shum(n) + + ! Set Sa_pbot from Sa_pslv Sa_pbot(n) = Sa_pslv(n) + + ! Set Sa_ptem from Sa_tbot Sa_ptem(n) = Sa_tbot(n) ! Set Sa_u10m and Sa_v10m to Sa_u and Sa_v @@ -276,28 +301,23 @@ subroutine datm_datamode_jra_advance(exportstate, target_ymd, target_tod, model_ Faxa_snowc(n) = 0.0_R8 if (Sa_tbot(n) < tKFrz ) then ! assign precip to rain/snow components Faxa_rainl(n) = 0.0_R8 - Faxa_snowl(n) = strm_prec(n) + Faxa_snowl(n) = strm_Faxa_prec(n) else - Faxa_rainl(n) = strm_prec(n) + Faxa_rainl(n) = strm_Faxa_prec(n) Faxa_snowl(n) = 0.0_R8 endif ! radiation data - fabricate required swdn components from net swdn - Faxa_swvdr(n) = strm_swdn(n)*(0.28_R8) - Faxa_swndr(n) = strm_swdn(n)*(0.31_R8) - Faxa_swvdf(n) = strm_swdn(n)*(0.24_R8) - Faxa_swndf(n) = strm_swdn(n)*(0.17_R8) + Faxa_swvdr(n) = strm_Faxa_swdn(n)*(0.28_R8) + Faxa_swndr(n) = strm_Faxa_swdn(n)*(0.31_R8) + Faxa_swvdf(n) = strm_Faxa_swdn(n)*(0.24_R8) + Faxa_swndf(n) = strm_Faxa_swdn(n)*(0.17_R8) ! radiation data - compute net short-wave based on LY08 latitudinally-varying albedo avg_alb = ( 0.069 - 0.011*cos(2.0_R8*yc(n)*degtorad ) ) - Faxa_swnet(n) = strm_swdn(n)*(1.0_R8 - avg_alb) + Faxa_swnet(n) = strm_Faxa_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 end module datm_datamode_jra_mod diff --git a/datm/datm_datamode_simple_mod.F90 b/datm/datm_datamode_simple_mod.F90 index e9db91118..dfe2d609c 100644 --- a/datm/datm_datamode_simple_mod.F90 +++ b/datm/datm_datamode_simple_mod.F90 @@ -25,7 +25,7 @@ module datm_datamode_simple_mod use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add use shr_log_mod , only : shr_log_error - + implicit none private ! except @@ -53,7 +53,6 @@ module datm_datamode_simple_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() ! othe module arrays real(R8), pointer :: yc(:) ! array of model latitudes @@ -85,6 +84,7 @@ module datm_datamode_simple_mod subroutine datm_datamode_simple_advertise(exportState, fldsexport, flds_scalar_name, & nlfilename, my_task, vm, rc) + use shr_nl_mod, only: shr_nl_find_group_name ! input/output variables @@ -251,13 +251,6 @@ subroutine datm_datamode_simple_init_pointers(exportState, sdat, rc) 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 - end subroutine datm_datamode_simple_init_pointers !=============================================================================== @@ -319,7 +312,7 @@ subroutine datm_datamode_simple_advance(target_ymd, target_tod, target_mon, & ! long wave solar_decl = (epsilon_deg * degtorad) * sin( 2.0_R8 * shr_const_pi * (int(rday) + 284.0_R8) / 365.0_R8) zenith_angle = acos(sin(yc(n) * degtorad ) * sin(solar_decl) + cos(yc(n) * degtorad) * cos(solar_decl) ) - Faxa_lwdn(n) = max(0.0_R8, peak_lwdn * cos(zenith_angle)) + Faxa_lwdn(n) = max(0.0_R8, peak_lwdn * cos(zenith_angle)) ! short wave hour_angle = (15.0_R8 * (target_tod/3600.0_R8 - 12.0_R8) + xc(n) ) * degtorad @@ -332,11 +325,6 @@ subroutine datm_datamode_simple_advance(target_ymd, target_tod, target_mon, & 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_simple_advance end module datm_datamode_simple_mod From 24b8fa797f0080aabb5c59773ea38fdbcba03f17 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 16 Dec 2025 13:55:36 +0100 Subject: [PATCH 05/61] refactored datm and dice to explicitly use stream data pointers --- datm/CMakeLists.txt | 8 +- datm/atm_comp_nuopc.F90 | 109 +- datm/cime_config/stream_definition_datm.xml | 1110 +++++++++++-------- datm/datm_datamode_clmncep_mod.F90 | 44 +- datm/datm_datamode_core2_mod.F90 | 22 +- datm/datm_datamode_cplhist_mod.F90 | 151 ++- datm/datm_datamode_era5_mod.F90 | 122 +- datm/datm_datamode_gefs_mod.F90 | 36 +- datm/datm_datamode_jra_mod.F90 | 16 +- datm/datm_pres_aero_mod.F90 | 190 ++++ datm/datm_pres_co2_mod.F90 | 110 ++ datm/datm_pres_ndep_mod.F90 | 110 ++ datm/datm_pres_o3_mod.F90 | 81 ++ dice/dice_datamode_cplhist_mod.F90 | 83 +- dice/dice_datamode_ssmi_mod.F90 | 16 +- dice/ice_comp_nuopc.F90 | 66 +- 16 files changed, 1508 insertions(+), 766 deletions(-) create mode 100644 datm/datm_pres_aero_mod.F90 create mode 100644 datm/datm_pres_co2_mod.F90 create mode 100644 datm/datm_pres_ndep_mod.F90 create mode 100644 datm/datm_pres_o3_mod.F90 diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index 7757d42f0..75c31772a 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -7,10 +7,10 @@ set(SRCFILES atm_comp_nuopc.F90 datm_datamode_gefs_mod.F90 datm_datamode_era5_mod.F90 datm_datamode_simple_mod.F90 - datm_presaero_mod.F90 - datm_ndep_mod.F90 - datm_co2_mod.F90 - datm_o3_mod.F90) + datm_pres_aero_mod.F90 + datm_pres_ndep_mod.F90 + datm_pres_co2_mod.F90 + datm_pres_o3_mod.F90) foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.datm/${FILE}") diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 0e48aab91..7191a5343 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -37,7 +37,6 @@ module cdeps_datm_comp use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance use dshr_mod , only : dshr_mesh_init, dshr_check_restart_alarm, dshr_restart_read use dshr_mod , only : dshr_orbital_init, dshr_orbital_update - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize use datm_datamode_core2_mod , only : datm_datamode_core2_advertise @@ -68,21 +67,21 @@ module cdeps_datm_comp use datm_datamode_simple_mod , only : datm_datamode_simple_init_pointers use datm_datamode_simple_mod , only : datm_datamode_simple_advance - use datm_ndep_mod , only : datm_ndep_advertise - use datm_ndep_mod , only : datm_ndep_init_pointers - use datm_ndep_mod , only : datm_ndep_advance + use datm_pres_ndep_mod , only : datm_pres_ndep_advertise + use datm_pres_ndep_mod , only : datm_pres_ndep_init_pointers + use datm_pres_ndep_mod , only : datm_pres_ndep_advance - use datm_presaero_mod , only : datm_presaero_advertise - use datm_presaero_mod , only : datm_presaero_init_pointers - use datm_presaero_mod , only : datm_presaero_advance + use datm_pres_presaero_mod , only : datm_pres_presaero_advertise + use datm_pres_presaero_mod , only : datm_pres_presaero_init_pointers + use datm_pres_presaero_mod , only : datm_pres_presaero_advance - use datm_o3_mod , only : datm_o3_advertise - use datm_o3_mod , only : datm_o3_init_pointers - use datm_o3_mod , only : datm_o3_advance + use datm_pres_o3_mod , only : datm_pres_o3_advertise + use datm_pres_o3_mod , only : datm_pres_o3_init_pointers + use datm_pres_o3_mod , only : datm_pres_o3_advance - use datm_co2_mod , only : datm_co2_advertise - use datm_co2_mod , only : datm_co2_init_pointers - use datm_co2_mod , only : datm_co2_advance + use datm_pres_co2_mod , only : datm_pres_co2_advertise + use datm_pres_co2_mod , only : datm_pres_co2_init_pointers + use datm_pres_co2_mod , only : datm_pres_co2_advance implicit none private ! except @@ -144,14 +143,13 @@ module cdeps_datm_comp ! linked lists type(fldList_type) , pointer :: fldsImport => null() type(fldList_type) , pointer :: fldsExport => null() - type(dfield_type) , pointer :: dfields => null() ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() integer , pointer :: model_mask(:) => null() ! constants - integer :: idt ! integer model timestep + integer :: idt ! integer model timestep logical :: diagnose_data = .true. integer , parameter :: main_task = 0 ! task number of main task #ifdef CESMCOUPLED @@ -384,16 +382,16 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Advertise fields that are not datamode specific if (flds_co2) then - call datm_co2_advertise(fldsExport, datamode) + call datm_pres_co2_advertise(fldsExport, datamode) end if if (flds_preso3) then - call datm_o3_advertise(fldsExport) + call datm_pres_o3_advertise(fldsExport) end if if (flds_presndep) then - call datm_ndep_advertise(fldsExport) + call datm_pres_ndep_advertise(fldsExport) end if if (flds_presaero) then - call datm_presaero_advertise(fldsExport) + call datm_pres_aero_advertise(fldsExport) end if ! Advertise fields that are datamode specific @@ -638,32 +636,27 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod !-------------------- if (first_time) then - ! Initialize dfields arrays for export fields with no ungridded dimension - ! and that have a corresponding stream field - call datm_init_dfields(rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Initialize data pointers for co2 (non datamode specific) if (flds_co2) then - call datm_co2_init_pointers(exportState, sdat, rc=rc) + call datm_pres_co2_init_pointers(exportState, sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! Initialize data pointers for o3 (non datamode specific) if (flds_preso3) then - call datm_o3_init_pointers(exportState, sdat, rc=rc) + call datm_pres_o3_init_pointers(exportState, sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! Initialize data pointers for nitrogen deposition (non datamode specific and use of ungridded dimensions) if (flds_presndep) then - call datm_ndep_init_pointers(exportState, sdat, rc=rc) + call datm_pres_ndep_init_pointers(exportState, sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! Initialize data pointers for prescribed aerosols (non datamode specific and use of ungridded dimensions) if (flds_presaero) then - call datm_presaero_init_pointers(exportState, sdat, rc=rc) + call datm_pres_aero_init_pointers(exportState, sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if @@ -685,7 +678,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod call datm_datamode_era5_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('GEFS') - call datm_datamode_gefs_init_pointers(exportState, sdat, rc) + call datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('SIMPLE') call datm_datamode_simple_init_pointers(exportState, sdat, rc) @@ -726,34 +719,27 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('datm_strdata_advance') - ! copy all fields from streams to export state as default - ! This automatically will update the fields in the export state - call ESMF_TraceRegionEnter('datm_dfield_copy') - call dshr_dfield_copy(dfields, sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('datm_dfield_copy') - ! update export state co2 if appropriate if (flds_co2) then - call datm_co2_advance() + call datm_pres_co2_advance() if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! update export state o3 if appropriate if (flds_preso3) then - call datm_o3_advance() + call datm_pres_o3_advance() if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! ungridded dimension output - update export state nitrogen deposition if appropriate if (flds_presndep) then - call datm_ndep_advance() + call datm_pres_ndep_advance() if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! ungridded dimension output - upate prescribed aerosol if appropriate if (flds_presaero) then - call datm_presaero_advance() + call datm_pres_aero_advance() if (ChkErr(rc,__LINE__,u_FILE_u)) return end if @@ -817,49 +803,6 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod call ESMF_TraceRegionExit('datm_datamode') call ESMF_TraceRegionExit('DATM_RUN') - !-------- - contains - !-------- - - subroutine datm_init_dfields(rc) - ! ----------------------------- - ! Initialize dfields arrays for export fields with no ungridded dimension - ! and that have a corresponding stream field - ! ----------------------------- - - ! input/output parameters - integer, intent(out) :: rc - - ! local variables - integer :: n - integer :: rank - integer :: fieldcount - type(ESMF_Field) :: lfield - character(ESMF_MAXSTR) ,pointer :: lfieldnames(:) - character(*), parameter :: subName = "(datm_init_dfields) " - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lfieldnames(fieldCount)) - call ESMF_StateGet(exportState, itemNameList=lfieldnames, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1, fieldCount - call ESMF_LogWrite(trim(subname)//': field name = '//trim(lfieldnames(n)), ESMF_LOGMSG_INFO) - call ESMF_StateGet(exportState, itemName=trim(lfieldnames(n)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(lfield, rank=rank, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (rank == 1) then - call dshr_dfield_add( dfields, sdat, trim(lfieldnames(n)), trim(lfieldnames(n)), & - exportState, logunit, mainproc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - end do - end subroutine datm_init_dfields - end subroutine datm_comp_run !=============================================================================== diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index c860b2313..6ddd48343 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -28,6 +28,7 @@ Currently the following data modes are supported: CLM_QIAN = Run with the CLM Qian dataset valid from 1948 to 2004 (force CLM) + CLM_QIAN_WISO = Run with the CLM Qian dataset with isotopes valid from 2000 to 2004 (force CLM) CLMCRUJRA2024 = Run with the CLM CRUJRA 2024 forcing valid from 1901 to 2023 (force CLM) CLMCRUNCEPv7 = Run with the CLM CRU NCEP V7 forcing valid from 1900 to 2010 (force CLM) CLMGSWP3v1 = Run with the CLM GSWP3 V1 forcing (force CLM) @@ -248,13 +249,13 @@ $DIN_LOC_ROOT/atm/cdeps/v1/$NEONSITE/%ym.nc - FSDS strm_Faxa_swdn - ZBOT strm_Sa_z - TBOT strm_Sa_tbot - WIND strm_Sa_wind - RH strm_Sa_rh - PSRF strm_Sa_pbot - FLDS strm_Faxa_lwdn + FSDS Faxa_swdn + ZBOT Sa_z + TBOT Sa_tbot + WIND Sa_wind + RH Sa_rh + PSRF Sa_pbot + FLDS Faxa_lwdn null @@ -290,7 +291,7 @@ $DIN_LOC_ROOT/atm/cdeps/PRISM/${NEONSITE}_%y.nc - PRECIP strm_Faxa_precn + PRECIP Faxa_precn null @@ -327,7 +328,7 @@ $DIN_LOC_ROOT/atm/cdeps/v1/$NEONSITE/%ym.nc - PRECTmms strm_Faxa_precn + PRECTmms Faxa_precn null @@ -364,14 +365,14 @@ $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/PLUMBER2/${PLUMBER2SITE}/CLM1PT_data/CTSM_DATM_${PLUMBER2SITE}_${DATM_YR_START_FILENAME}-${DATM_YR_END}.nc - ZBOT strm_Sa_z - TBOT strm_Sa_tbot - QBOT strm_Sa_shum - WIND strm_Sa_wind - PRECTmms strm_Faxa_precn - FSDS strm_Faxa_swdn - PSRF strm_Sa_pbot - FLDS strm_Faxa_lwdn + ZBOT Sa_z + TBOT Sa_tbot + QBOT Sa_shum + WIND Sa_wind + PRECTmms Faxa_precn + FSDS Faxa_swdn + PSRF Sa_pbot + FLDS Faxa_lwdn null @@ -407,7 +408,7 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/Solar/clmforc.GSWP3.c2011.0.5x0.5.Solr.%ym.nc - FSDS strm_Faxa_swdn + FSDS Faxa_swdn null @@ -438,7 +439,7 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/Precip/clmforc.GSWP3.c2011.0.5x0.5.Prec.%ym.nc - PRECTmms strm_Faxa_precn + PRECTmms Faxa_precn null @@ -469,11 +470,11 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/TPHWL/clmforc.GSWP3.c2011.0.5x0.5.TPQWL.%ym.nc - TBOT strm_Sa_tbot - WIND strm_Sa_wind - QBOT strm_Sa_shum - PSRF strm_Sa_pbot - FLDS strm_Faxa_lwdn + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + FLDS Faxa_lwdn null @@ -508,7 +509,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.CRUJRA.0.5d.c20241231/three_stream/clmforc.CRUJRAv2.5_0.5x0.5.Solr.%y.nc - FSDS strm_Faxa_swdn + FSDS Faxa_swdn null @@ -539,7 +540,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.CRUJRA.0.5d.c20241231/three_stream/clmforc.CRUJRAv2.5_0.5x0.5.Prec.%y.nc - PRECTmms strm_Faxa_precn + PRECTmms Faxa_precn null @@ -570,11 +571,11 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.CRUJRA.0.5d.c20241231/three_stream/clmforc.CRUJRAv2.5_0.5x0.5.TPQWL.%y.nc - TBOT strm_Sa_tbot - WIND strm_Sa_wind - QBOT strm_Sa_shum - PSRF strm_Sa_pbot - FLDS strm_Faxa_lwdn + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + FLDS Faxa_lwdn null @@ -609,7 +610,7 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Solar6Hrly/clmforc.cruncep.V7.c2016.0.5d.Solr.%ym.nc - FSDS strm_Faxa_swdn + FSDS Faxa_swdn null @@ -640,7 +641,7 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Precip6Hrly/clmforc.cruncep.V7.c2016.0.5d.Prec.%ym.nc - PRECTmms strm_Faxa_precn + PRECTmms Faxa_precn null @@ -671,10 +672,10 @@ $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/TPHWL6Hrly/clmforc.cruncep.V7.c2016.0.5d.TPQWL.%ym.nc - TBOT strm_Sa_tbot - WIND strm_Sa_wind - QBOT strm_Sa_shum - PSRF strm_Sa_pbot + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot null @@ -709,7 +710,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/Solar6Hrly/clmforc.Qian.c2006.T62.Solr.%ym.nc - FSDS strm_Faxa_swdn + FSDS Faxa_swdn null @@ -740,7 +741,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc - PRECTmms strm_Faxa_precn + PRECTmms Faxa_precn null @@ -771,10 +772,10 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/TmpPrsHumWnd3Hrly/clmforc.Qian.c2006.T62.TPQW.%ym.nc - TBOT strm_Sa_tbot - WIND strm_Sa_wind - QBOT strm_Sa_shum - PSRF strm_Sa_pbot + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot null @@ -797,6 +798,106 @@ single + + + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Solar6Hrly/clmforc.Qian.c2006.T62.Solr.%ym.nc + + + FSDS Faxaswdn + + null + + bilinear + + null + 2000 + 2000 + 2004 + 0 + + coszen + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc + + + PRECTmms Faxa_precn + + null + + bilinear + + null + 2000 + 2000 + 2004 + 0 + + nearest + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/TmpPrsHumWnd3Hrly/clmforc.Qian.c2006.T62.TPQW.%ym.nc + + + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + + null + + bilinear + + null + 2000 + 2000 + 2004 + 0 + + linear + + + cycle + + + 1.5 + + single + + @@ -809,7 +910,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Solar/ctsmforc.NLDAS2.0.125d.v1.Solr.%ym.nc - FSDS strm_Faxa_swdn + FSDS Faxa_swdn null @@ -841,7 +942,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Precip/ctsmforc.NLDAS2.0.125d.v1.Prec.%ym.nc - PRECTmms strm_Faxa_precn + PRECTmms Faxa_precn null @@ -873,11 +974,11 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/TPQWL/ctsmforc.NLDAS2.0.125d.v1.TPQWL.%ym.nc - TBOT strm_Sa_tbot - WIND strm_Sa_wind - QBOT strm_Sa_shum - PSRF strm_Sa_pbot - FLDS strm_Faxa_lwdn + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + FLDS Faxa_lwdn null @@ -915,14 +1016,14 @@ $DIN_LOC_ROOT_CLMFORC/$CLM_USRDAT_NAME/CLM1PT_data/%ym.nc - PRECTmms strm_Faxa_precn - FSDS strm_Faxa_swdn - ZBOT strm_Sa_z - TBOT strm_Sa_tbot - WIND strm_Sa_wind - RH strm_Sa_rh - PSRF strm_Sa_pbot - FLDS strm_Faxa_lwdn + PRECTmms Faxa_precn + FSDS Faxa_swdn + ZBOT Sa_z + TBOT Sa_tbot + WIND Sa_wind + RH Sa_rh + PSRF Sa_pbot + FLDS Faxa_lwdn null @@ -954,16 +1055,16 @@ $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/mexicocityMEX.c080124/clm1pt-1993-12.nc - ZBOT strm_Sa_z - TBOT strm_Sa_tbot - RH strm_Sa_rh - WIND strm_Sa_wind - PSRF strm_Sa_pbot - PRECTmms strm_Faxa_precn - FSDS strm_Faxa_swdn - FSDSdir strm_Faxa_swdndr - FSDSdif strm_Faxa_swdndf - FLDS strm_Faxa_lwdn + ZBOT Sa_z + TBOT Sa_tbot + RH Sa_rh + WIND Sa_wind + PSRF Sa_pbot + PRECTmms Faxa_precn + FSDS Faxa_swdn + FSDSdir Faxa_swdndr + FSDSdif Faxa_swdndf + FLDS Faxa_lwdn null @@ -994,16 +1095,16 @@ $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/vancouverCAN.c080124/clm1pt-1992-08.nc - ZBOT strm_Sa_z - TBOT strm_Sa_tbot - RH strm_Sa_rh - WIND strm_Sa_wind - PSRF strm_Sa_pbot - PRECTmms strm_Faxa_precn - FSDS strm_Faxa_swdn - FSDSdir strm_Faxa_swdndr - FSDSdif strm_Faxa_swdndf - FLDS strm_Faxa_lwdn + ZBOT Sa_z + TBOT Sa_tbot + RH Sa_rh + WIND Sa_wind + PSRF Sa_pbot + PRECTmms Faxa_precn + FSDS Faxa_swdn + FSDSdir Faxa_swdndr + FSDSdif Faxa_swdndf + FLDS Faxa_lwdn null @@ -1049,16 +1150,16 @@ $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-11.nc - ZBOT strm_Sa_z - TBOT strm_Sa_tbot - RH strm_Sa_rh - WIND strm_Sa_wind - PSRF strm_Sa_pbot - PRECTmms strm_Faxa_precn - FSDS strm_Faxa_swdn - FSDSdir strm_Faxa_swdndr - FSDSdif strm_Faxa_swdndf - FLDS strm_Faxa_lwdn + ZBOT Sa_z + TBOT Sa_tbot + RH Sa_rh + WIND Sa_wind + PSRF Sa_pbot + PRECTmms Faxa_precn + FSDS Faxa_swdn + FSDSdir Faxa_swdndr + FSDSdif Faxa_swdndf + FLDS Faxa_lwdn null @@ -1093,7 +1194,7 @@ $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/gpcp/qian/bias_correction.Prec.%y.nc - BC_PREC strm_Faxa_precsf + BC_PREC Faxa_precsf null @@ -1124,7 +1225,7 @@ $DIN_LOC_ROOT/atm/datm7/clm_output/cruncep_precip_1deg/gpcp_1deg_bias_correction/bias_correction.Prec.%y.nc - BC_PREC strm_Faxa_precsf + BC_PREC Faxa_precsf null @@ -1155,7 +1256,7 @@ $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/cmap/cruncep/bias_correction.Prec.%y.nc - BC_PREC strm_Faxa_precsf + BC_PREC Faxa_precsf null @@ -1190,14 +1291,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.allvars.ccsm4.rcp45.2006-2300.nc - huss strm_Sa_shum_af - pr strm_Faxa_prec_af - ps strm_Sa_pbot_af - rlds strm_Faxa_lwdn_af - rsds strm_Faxa_swdn_af - tas strm_Sa_tbot_af - uas strm_Sa_u_af - vas strm_Sa_v_af + huss Sa_shum_af + pr Faxa_prec_af + ps Sa_pbot_af + rlds Faxa_lwdn_af + rsds Faxa_swdn_af + tas Sa_tbot_af + uas Sa_u_af + vas Sa_v_af null @@ -1228,14 +1329,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP1-2.6/af.allvars.CESM.SSP1-2.6.2015-2100_c20220628.nc - pr strm_Faxa_prec_af - rlds strm_Faxa_lwdn_af - rsds strm_Faxa_swdn_af - huss strm_Sa_shum_af - ps strm_Sa_pbot_af - tas strm_Sa_tbot_af - uas strm_Sa_u_af - vas strm_Sa_v_af + huss Sa_shum_af + pr Faxa_prec_af + ps Sa_pbot_af + rlds Faxa_lwdn_af + rsds Faxa_swdn_af + tas Sa_tbot_af + uas Sa_u_af + vas Sa_v_af null @@ -1266,14 +1367,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP2-4.5/af.allvars.CESM.SSP2-4.5.2015-2100_c20220628.nc - pr strm_Faxa_prec_af - rlds strm_Faxa_lwdn_af - rsds strm_Faxa_swdn_af - huss strm_Sa_shum_af - ps strm_Sa_pbot_af - tas strm_Sa_tbot_af - uas strm_Sa_u_af - vas strm_Sa_v_af + huss Sa_shum_af + pr Faxa_prec_af + ps Sa_pbot_af + rlds Faxa_lwdn_af + rsds Faxa_swdn_af + tas Sa_tbot_af + uas Sa_u_af + vas Sa_v_af null @@ -1296,7 +1397,7 @@ single - + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc @@ -1304,14 +1405,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP3-7.0/af.allvars.CESM.SSP3-7.0.2015-2100_c20220628.nc - pr strm_Faxa_prec_af - rlds strm_Faxa_lwdn_af - rsds strm_Faxa_swdn_af - huss strm_Sa_shum_af - ps strm_Sa_pbot_af - tas strm_Sa_tbot_af - uas strm_Sa_u_af - vas strm_Sa_v_af + huss Sa_shum_af + pr Faxa_prec_af + ps Sa_pbot_af + rlds Faxa_lwdn_af + rsds Faxa_swdn_af + tas Sa_tbot_af + uas Sa_u_af + vas Sa_v_af null @@ -1342,14 +1443,14 @@ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP5-8.5/af.allvars.CESM.SSP5-8.5.2015-2100_c20220628.nc - huss strm_Sa_shum_af - pr strm_Faxa_prec_af - ps strm_Sa_pbot_af - rlds strm_Faxa_lwdn_af - rsds strm_Faxa_swdn_af - tas strm_Sa_tbot_af - uas strm_Sa_u_af - vas strm_Sa_v_af + huss Sa_shum_af + pr Faxa_prec_af + ps Sa_pbot_af + rlds Faxa_lwdn_af + rsds Faxa_swdn_af + tas Sa_tbot_af + uas Sa_u_af + vas Sa_v_af null @@ -1385,8 +1486,9 @@ $DIN_LOC_ROOT/atm/datm7/NYF/nyf.giss.T62.051007.nc - lwdn strm_Faxa_lwdn - swdn strm_Faxa_swdn + lwdn Faxa_lwdn + swdn Faxa_swdn + swup Faxa_swup null @@ -1417,7 +1519,7 @@ $DIN_LOC_ROOT/atm/datm7/NYF/nyf.gxgxs.T62.051007.nc - prc strm_Faxa_prec + prc Faxa_prec null @@ -1448,12 +1550,12 @@ $DIN_LOC_ROOT/atm/datm7/NYF/nyf.ncep.T62.050923.nc - dn10 strm_Sa_dens - slp_ strm_Sa_pslv - q_10 strm_Sa_shum - t_10 strm_Sa_tbot - u_10 strm_Sa_u - v_10 strm_Sa_v + dn10 Sa_dens + slp_ Sa_pslv + q_10 Sa_shum + t_10 Sa_tbot + u_10 Sa_u + v_10 Sa_v null @@ -1488,7 +1590,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.SOFS.2010.nc - dn10 strm_Sa_dens + dn10 Sa_dens null @@ -1519,7 +1621,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.SOFS.2010.nc - slp_ strm_Sa_pslv + slp_ Sa_pslv null @@ -1550,7 +1652,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - prec strm_Faxa_prec + prec Faxa_prec null @@ -1581,7 +1683,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -1612,7 +1714,38 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn + + null + + bilinear + + null + 1 + 2010 + 2011 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc + + + swup Faxa_swup null @@ -1643,7 +1776,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - q3_5 strm_Faxa_shum + q3_5 Faxa_shum null @@ -1674,7 +1807,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - t3_5 strm_Sa_tbot + t3_5 Sa_tbot null @@ -1705,7 +1838,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - u3_5 strm_Sa_u + u3_5 Sa_u null @@ -1736,7 +1869,7 @@ $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - v3_5 strm_Sa_v + v3_5 Sa_v null @@ -1768,7 +1901,7 @@ $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.%y.20120412.nc - prc strm_Faxa_prec + prc Faxa_prec null @@ -1800,7 +1933,7 @@ $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.%y.20120412.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -1832,7 +1965,7 @@ $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.%y.20120412.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn null @@ -1855,6 +1988,38 @@ single + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.%y.20120412.nc + + + swup Faxa_swup + + null + + bilinear + + null + 1 + 1948 + 2009 + 0 + + linear + + + cycle + + + 1.5 + + single + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc @@ -1866,7 +2031,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.%y.20120412.nc - dn10 strm_Sa_dens + dn10 Sa_dens null @@ -1900,7 +2065,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.%y.20120412.nc - q_10 strm_Sa_shum + q_10 Sa_shum null @@ -1934,7 +2099,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.%y.20120412.nc - slp_ strm_Sa_pslv + slp_ Sa_pslv null @@ -1968,7 +2133,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.%y.20120412.nc - t_10 strm_Sa_tbot + t_10 Sa_tbot null @@ -2002,7 +2167,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.%y.20120412.nc - u_10 strm_Sa_u + u_10 Sa_u null @@ -2036,7 +2201,7 @@ $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.%y.20120412.nc - v_10 strm_Sa_v + v_10 Sa_v null @@ -2067,7 +2232,7 @@ $DIN_LOC_ROOT/atm/datm7/CORE2/CORE2.t_10.ArcFactor.T62.1997-2004.nc - TarcFactor strm_tarcf + TarcFactor tarcf null @@ -2110,7 +2275,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.190528.nc - prec strm_Faxa_prec + prec Faxa_prec null @@ -2141,7 +2306,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.190528.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -2172,7 +2337,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.190528.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn null @@ -2203,7 +2368,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.190528.nc - q_10 strm_Sa_shum + q_10 Sa_shum null @@ -2234,7 +2399,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.190528.nc - slp strm_Sa_pslv + slp Sa_pslv null @@ -2265,7 +2430,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.190528.nc - t_10 strm_Sa_tbot + t_10 Sa_tbot null @@ -2296,7 +2461,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.190528.nc - u_10 strm_Sa_u + u_10 Sa_u null @@ -2327,7 +2492,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.190528.nc - v_10 strm_Sa_v + v_10 Sa_v null @@ -2365,7 +2530,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.prec.TL319.%y.240531.nc - prec strm_Faxa_prec + prec Faxa_prec null @@ -2399,7 +2564,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.lwdn.TL319.%y.240531.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -2433,7 +2598,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.swdn.TL319.%y.240531.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn null @@ -2467,7 +2632,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.q_10.TL319.%y.240531.nc - q_10 strm_Sa_shum + q_10 Sa_shum null @@ -2501,7 +2666,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.slp.TL319.%y.240531.nc - slp strm_Sa_pslv + slp Sa_pslv null @@ -2535,7 +2700,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.t_10.TL319.%y.240531.nc - t_10 strm_Sa_tbot + t_10 Sa_tbot null @@ -2569,7 +2734,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.u_10.TL319.%y.240531.nc - u_10 strm_Sa_u + u_10 Sa_u null @@ -2603,7 +2768,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.5_noleap/JRA.v1.5.v_10.TL319.%y.240531.nc - v_10 strm_Sa_v + v_10 Sa_v null @@ -2638,7 +2803,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_6162.JRA.v1.3.radiation.lwdn.TL319.250427.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -2669,7 +2834,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_6162.JRA.v1.3.radiation.swdn.TL319.250427.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn null @@ -2700,7 +2865,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_6162.JRA.v1.3.prec.TL319.250427.nc - prec strm_Faxa_prec + prec Faxa_prec null @@ -2731,11 +2896,11 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_6162.JRA.v1.3.states.TL319.250427.nc - u_10 strm_Sa_u - v_10 strm_Sa_v - t_10 strm_Sa_tbot - q_10 strm_Sa_shum - slp strm_Sa_pslv + u_10 Sa_u + v_10 Sa_v + t_10 Sa_tbot + q_10 Sa_shum + slp Sa_pslv null @@ -2770,7 +2935,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.radiation.lwdn.TL319.180404.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -2801,7 +2966,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.radiation.swdn.TL319.180404.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn null @@ -2832,7 +2997,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.prec.TL319.180404.nc - prec strm_Faxa_prec + prec Faxa_prec null @@ -2863,11 +3028,11 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_8485.JRA.v1.3.states.TL319.180404.nc - u_10 strm_Sa_u - v_10 strm_Sa_v - t_10 strm_Sa_tbot - q_10 strm_Sa_shum - slp strm_Sa_pslv + u_10 Sa_u + v_10 Sa_v + t_10 Sa_tbot + q_10 Sa_shum + slp Sa_pslv null @@ -2902,7 +3067,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.radiation.lwdn.TL319.180404.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -2933,7 +3098,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.radiation.swdn.TL319.180404.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn null @@ -2964,7 +3129,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.prec.TL319.180404.nc - prec strm_Faxa_prec + prec Faxa_prec null @@ -2995,11 +3160,11 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_9091.JRA.v1.3.states.TL319.180404.nc - u_10 strm_Sa_u - v_10 strm_Sa_v - t_10 strm_Sa_tbot - q_10 strm_Sa_shum - slp strm_Sa_pslv + u_10 Sa_u + v_10 Sa_v + t_10 Sa_tbot + q_10 Sa_shum + slp Sa_pslv null @@ -3034,7 +3199,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.radiation.lwdn.TL319.180404.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -3065,7 +3230,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.radiation.swdn.TL319.180404.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn null @@ -3096,7 +3261,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.prec.TL319.180404.nc - prec strm_Faxa_prec + prec Faxa_prec null @@ -3127,11 +3292,11 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_ryf/RAF_0304.JRA.v1.3.states.TL319.180404.nc - u_10 strm_Sa_u - v_10 strm_Sa_v - t_10 strm_Sa_tbot - q_10 strm_Sa_shum - slp strm_Sa_pslv + u_10 Sa_u + v_10 Sa_v + t_10 Sa_tbot + q_10 Sa_shum + slp Sa_pslv null @@ -3166,7 +3331,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.171019.nc - prec strm_Faxa_prec + prec Faxa_prec null @@ -3197,7 +3362,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.171019.nc - lwdn strm_Faxa_lwdn + lwdn Faxa_lwdn null @@ -3228,7 +3393,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.171019.nc - swdn strm_Faxa_swdn + swdn Faxa_swdn null @@ -3259,7 +3424,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.171019.nc - q_10 strm_Sa_shum + q_10 Sa_shum null @@ -3290,7 +3455,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.171019.nc - slp strm_Sa_pslv + slp Sa_pslv null @@ -3321,7 +3486,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.171019.nc - t_10 strm_Sa_tbot + t_10 Sa_tbot null @@ -3352,7 +3517,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.171019.nc - u_10 strm_Sa_u + u_10 Sa_u null @@ -3383,7 +3548,7 @@ $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.171019.nc - v_10 strm_Sa_v + v_10 Sa_v null @@ -3429,29 +3594,29 @@ $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.12.200618.nc - u10 strm_Sa_u10m - v10 strm_Sa_v10m - t2m strm_Sa_t2m - skt strm_Sa_tskn - d2m strm_Sa_tdew - msl strm_Sa_pslv - tp strm_Faxa_rain - cp strm_Faxa_rainc - lsp strm_Faxa_rainl - csf strm_Faxa_snowc - lsf strm_Faxa_snowl - ssrd strm_Faxa_swdn - ssr strm_Faxa_swnet - strd strm_Faxa_lwdn - str strm_Faxa_lwnet - aluvp strm_Faxa_swvdr - aluvd strm_Faxa_swvdf - alnip strm_Faxa_swndr - alnid strm_Faxa_swndf - sshf strm_Faxa_sen - slhf strm_Faxa_lat - ewss strm_Faxa_taux - nsss strm_Faxa_tauy + u10 Sa_u10m + v10 Sa_v10m + t2m Sa_t2m + skt Sa_tskn + d2m Sa_tdew + msl Sa_pslv + tp Faxa_rain + cp Faxa_rainc + lsp Faxa_rainl + csf Faxa_snowc + lsf Faxa_snowl + ssrd Faxa_swdn + ssr Faxa_swnet + strd Faxa_lwdn + str Faxa_lwnet + aluvp Faxa_swvdr + aluvd Faxa_swvdf + alnip Faxa_swndr + alnid Faxa_swndf + sshf Faxa_sen + slhf Faxa_lat + ewss Faxa_taux + nsss Faxa_tauy null @@ -3489,7 +3654,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_simyr_1750-2014_CMIP6_c180929.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3520,7 +3685,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_ssp585_simyr_1750-2020_CMIP6_c200324.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3551,7 +3716,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_ssp585_simyr_1750-2020_CMIP6_c200324.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3582,7 +3747,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP1-1.9_simyr_2014-2500_CMIP6_c190514.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3613,7 +3778,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP1-2.6__simyr_2014-2500_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3644,7 +3809,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP2-4.5__simyr_2014-2500_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3675,7 +3840,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/co2_datm_lat-bandsSSP3-7.0__simyr_2014-2500_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3706,7 +3871,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP4-3.4_simyr_2014-2500_CMIP6_c190514.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3737,7 +3902,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP4-6.0__simyr_2014-2500_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3768,7 +3933,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP5-3.4__simyr_2014-2500_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3799,7 +3964,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP5-8.5__simyr_2014-2500_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3830,7 +3995,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP1-1.9_simyr_2014-2501_CMIP6_c190514.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3861,7 +4026,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP1-2.6__simyr_2014-2501_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3892,7 +4057,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP2-4.5__simyr_2014-2501_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3923,7 +4088,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP3-7.0_simyr_1750-2501_CMIP6_c201101.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3954,7 +4119,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP4-3.4_simyr_2014-2501_CMIP6_c190514.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -3985,7 +4150,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP4-6.0__simyr_2014-2501_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -4016,7 +4181,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP5-3.4__simyr_2014-2501_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -4047,7 +4212,7 @@ $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP5-8.5__simyr_2014-2501_CMIP6_c190506.nc - CO2 strm_co2diag + CO2 Sa_co2diag null @@ -4082,20 +4247,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4126,20 +4291,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4170,20 +4335,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4214,20 +4379,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4258,20 +4423,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP126_b.e21.BSSP126cmip6.f09_g17.CMIP6-SSP1-2.6.001_2014-2101_monthly_0.9x1.25_c190523.nc - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4302,20 +4467,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP245_b.e21.BWSSP245cmip6.f09_g17.CMIP6-SSP2-4.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4346,20 +4511,20 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_1849-2101_monthly_0.9x1.25_c201103.nc - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4391,20 +4556,20 @@ null - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4435,20 +4600,20 @@ $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 - BCDEPWET strm_Faxabcphiwet - BCPHODRY strm_Faxabcphodry - BCPHIDRY strm_Faxabcphidry - OCDEPWET strm_Faxaocphiwet - OCPHIDRY strm_Faxaocphidry - OCPHODRY strm_Faxaocphodry - DSTX01WD strm_Faxadstwet1 - DSTX01DD strm_Faxadstdry1 - DSTX02WD strm_Faxadstwet2 - DSTX02DD strm_Faxadstdry2 - DSTX03WD strm_Faxadstwet3 - DSTX03DD strm_Faxadstdry3 - DSTX04WD strm_Faxadstwet4 - DSTX04DD strm_Faxadstdry4 + 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 null @@ -4483,7 +4648,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-historical-WACCM.001.monthly.185001-201412.nc - O3 strm_o3 + O3 Sa_o3 null @@ -4514,7 +4679,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-historical-WACCM.001.monthly.185001-201412.nc - O3 strm_o3 + O3 Sa_o3 null @@ -4545,7 +4710,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-historical-WACCM.001.monthly.185001-201412.nc - O3 strm_o3 + O3 Sa_o3 null @@ -4576,7 +4741,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-historical-WACCM.001.monthly.185001-201412.nc - O3 strm_o3 + O3 Sa_o3 null @@ -4607,7 +4772,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-SSP2-4.5-WACCM.001.monthly.201501-210012.nc - O3 strm_o3 + O3 Sa_o3 null @@ -4638,7 +4803,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-SSP3-7.0-WACCM.001.monthly.201501-210012.nc - O3 strm_o3 + O3 Sa_o3 null @@ -4669,7 +4834,7 @@ $DIN_LOC_ROOT/cdeps/datm/ozone/O3_surface.f09_g17.CMIP6-SSP5-8.5-WACCM.001.monthly.201501-210012.nc - O3 strm_o3 + O3 Sa_o3 null @@ -4706,10 +4871,11 @@ $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_CMIP_FZJ-CMIP-nitrogen-1-2_gn_185001-202212.nc - drynhx strm_Faxandep_nhx_dry - wetnhx strm_Faxa_ndep_nhx_wet - drynoy strm_Faxa_ndep_noy_dry - wetnoy strm_Faxa_ndep_noy_wet + + drynhx Faxandep_nhx_dry + wetnhx Faxa_ndep_nhx_wet + drynoy Faxa_ndep_noy_dry + wetnoy Faxa_ndep_noy_wet null @@ -4740,10 +4906,11 @@ $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_CMIP_FZJ-CMIP-nitrogen-1-2_gn_185001-202212.nc - drynhx strm_Faxa_ndep_nhx_dry - wetnhx strm_Faxa_ndep_nhx_wet - drynoy strm_Faxa_ndep_noy_dry - wetnoy strm_Faxa_ndep_noy_wet + + drynhx Faxa_ndep_nhx_dry + wetnhx Faxa_ndep_nhx_wet + drynoy Faxa_ndep_noy_dry + wetnoy Faxa_ndep_noy_wet null @@ -4766,6 +4933,39 @@ single + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc + + + + 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 @@ -4774,8 +4974,9 @@ $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 strm_Faxa_ndep_nhx - NDEP_NOy_month strm_Faxa_ndep_noy + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy null @@ -4806,8 +5007,8 @@ $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 strm_Faxa_ndep_nhx - NDEP_NOy_month strm_Faxa_ndep_noy + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy null @@ -4838,8 +5039,9 @@ $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 strm_Faxa_ndep_nhx - NDEP_NOy_month strm_Faxa_ndep_noy + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy null @@ -4870,8 +5072,9 @@ $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc - NDEP_NHx_month strm_Faxa_ndep_nhx - NDEP_NOy_month strm_Faxa_ndep_noy + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy null @@ -4902,8 +5105,9 @@ $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP2-4.5-WACCM_1849-2101_monthly_c191007.nc - NDEP_NHx_month strm_Faxa_ndep_nhx - NDEP_NOy_month strm_Faxa_ndep_noy + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy null @@ -4934,8 +5138,9 @@ $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 strm_Faxa_ndep_nhx - NDEP_NOy_month strm_Faxa_ndep_noy + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy null @@ -4967,8 +5172,9 @@ $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc - NDEP_NHx_month strm_Faxa_ndep_nhx - NDEP_NOy_month strm_Faxa_ndep_noy + + NDEP_NHx_month Faxa_ndep_nhx + NDEP_NOy_month Faxa_ndep_noy null @@ -5003,7 +5209,7 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.3h.avrg.%ymd-10800.nc - atmImp_Sa_topo strm_Sa_topo + atmImp_Sa_topo Sa_topo null @@ -5023,8 +5229,7 @@ 3.0 - single - + single @@ -5034,20 +5239,20 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.24h.avrg.%ymd-00000.nc - atmImp_Faxa_bcph1 strm_Faxa_bcphidry - atmImp_Faxa_bcph2 strm_Faxa_bcphodry - atmImp_Faxa_bcph3 strm_Faxa_bcphiwet - atmImp_Faxa_ocph1 strm_Faxa_ocphidry - atmImp_Faxa_ocph2 strm_Faxa_ocphodry - atmImp_Faxa_ocph3 strm_Faxa_ocphiwet - atmImp_Faxa_dstwet1 strm_Faxa_dstwet1 - atmImp_Faxa_dstdry1 strm_Faxa_dstdry1 - atmImp_Faxa_dstwet2 strm_Faxa_dstwet2 - atmImp_Faxa_dstdry2 strm_Faxa_dstdry2 - atmImp_Faxa_dstwet3 strm_Faxa_dstwet3 - atmImp_Faxa_dstdry3 strm_Faxa_dstdry3 - atmImp_Faxa_dstwet4 strm_Faxa_dstwet4 - atmImp_Faxa_dstdry4 strm_Faxa_dstdry4 + atmImp_Faxa_bcph1 Faxa_bcphidry + atmImp_Faxa_bcph2 Faxa_bcphodry + atmImp_Faxa_bcph3 Faxa_bcphiwet + atmImp_Faxa_ocph1 Faxa_ocphidry + atmImp_Faxa_ocph2 Faxa_ocphodry + atmImp_Faxa_ocph3 Faxa_ocphiwet + atmImp_Faxa_dstwet1 Faxa_dstwet1 + atmImp_Faxa_dstdry1 Faxa_dstdry1 + atmImp_Faxa_dstwet2 Faxa_dstwet2 + atmImp_Faxa_dstdry2 Faxa_dstdry2 + atmImp_Faxa_dstwet3 Faxa_dstwet3 + atmImp_Faxa_dstdry3 Faxa_dstdry3 + atmImp_Faxa_dstwet4 Faxa_dstwet4 + atmImp_Faxa_dstdry4 Faxa_dstdry4 null @@ -5075,11 +5280,10 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc - a2x1d_Faxa_ndep strm_Faxa_ndep + a2x1d_Faxa_ndep Faxa_ndep null @@ -5110,10 +5314,10 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.1h.inst.%ymd-03600.nc - atmImp_Faxa_swndr strm_Faxa_swndr - atmImp_Faxa_swvdr strm_Faxa_swvdr - atmImp_Faxa_swndf strm_Faxa_swndf - atmImp_Faxa_swvdf strm_Faxa_swvdf + atmImp_Faxa_swndr Faxa_swndr + atmImp_Faxa_swvdr Faxa_swvdr + atmImp_Faxa_swndf Faxa_swndf + atmImp_Faxa_swvdf Faxa_swvdf null @@ -5144,11 +5348,11 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.3h.avrg.%ymd-10800.nc - atmImp_Faxa_rainc strm_Faxa_rainc - atmImp_Faxa_rainl strm_Faxa_rainl - atmImp_Faxa_snowc strm_Faxa_snowc - atmImp_Faxa_snowl strm_Faxa_snowl - atmImp_Faxa_lwdn strm_Faxa_lwdn + atmImp_Faxa_rainc Faxa_rainc + atmImp_Faxa_rainl Faxa_rainl + atmImp_Faxa_snowc Faxa_snowc + atmImp_Faxa_snowl Faxa_snowl + atmImp_Faxa_lwdn Faxa_lwdn null @@ -5179,15 +5383,15 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.3h.avrg.%ymd-10800.nc - atmImp_Sa_z strm_Sa_z - atmImp_Sa_tbot strm_Sa_tbot - atmImp_Sa_ptem strm_Sa_ptem - atmImp_Sa_shum strm_Sa_shum - atmImp_Sa_pbot strm_Sa_pbot - atmImp_Sa_dens strm_Sa_dens - atmImp_Sa_pslv strm_Sa_pslv - atmImp_Sa_co2diag strm_co2diag - atmImp_Sa_co2prog strm_co2prog + atmImp_Sa_z Sa_z + atmImp_Sa_tbot Sa_tbot + atmImp_Sa_ptem Sa_ptem + atmImp_Sa_shum Sa_shum + atmImp_Sa_pbot Sa_pbot + atmImp_Sa_dens Sa_dens + atmImp_Sa_pslv Sa_pslv + atmImp_Sa_co2diag Sa_co2diag + atmImp_Sa_co2prog Sa_co2prog null @@ -5218,8 +5422,8 @@ $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.hx.atm.1h.avrg.%ymd-03600.nc - atmImp_Sa_u strm_Sa_u - atmImp_Sa_v strm_Sa_v + atmImp_Sa_u Sa_u + atmImp_Sa_v Sa_v null @@ -5254,7 +5458,7 @@ $DIN_LOC_ROOT/atm/datm7/topo_forcing/topodata_0.9x1.25_USGS_070110_stream_c151201.nc - TOPO strm_Sa_topo + TOPO Sa_topo null diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 9ead6ff57..be595993a 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -158,53 +158,53 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r rc = ESMF_SUCCESS ! initialize stream pointers for module level export states - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_wind' , strm_Sa_wind , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_wind' , strm_Sa_wind , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_topo' , strm_Sa_topo, rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_topo' , strm_Sa_topo, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_z' , strm_Sa_z , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_z' , strm_Sa_z , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_pbot' , strm_Sa_pbot , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_pbot' , strm_Sa_pbot , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tbot' , strm_Sa_tbot , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_shum' , strm_Sa_shum , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tdew' , strm_Sa_tdew , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_tdew' , strm_Sa_tdew , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_rh' , strm_Sa_rh , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_rh' , strm_Sa_rh , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdndf' , strm_Faxa_swdndf , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdndf' , strm_Faxa_swdndf , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdndr' , strm_Faxa_swdndr , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdndr' , strm_Faxa_swdndr , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_lwdn' , strm_Faxa_lwdn , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdn' , strm_Faxa_swdn , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_precn' , strm_Faxa_precn , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn' , strm_Faxa_precn , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! initialize stream pointers for module for bias correction - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_precsf' , strm_Faxa_precsf , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_precsf' , strm_Faxa_precsf , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! initialize stream pointers anomaly forcing - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_u_af' , strm_Sa_u_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_u_af' , strm_Sa_u_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_v_af' , strm_Sa_v_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_v_af' , strm_Sa_v_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_shum_af' , strm_Sa_shum_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum_af' , strm_Sa_shum_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tbot_af' , strm_Sa_tbot_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot_af' , strm_Sa_tbot_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_pbot_af' , strm_Sa_pbot_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_pbot_af' , strm_Sa_pbot_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_prec_af' , strm_Faxa_prec_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec_af' , strm_Faxa_prec_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdn_af' , strm_Faxa_swdn_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn_af' , strm_Faxa_swdn_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_lwdn_af' , strm_Faxa_lwdn_af , rc) + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn_af' , strm_Faxa_lwdn_af , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! initialize export state pointers diff --git a/datm/datm_datamode_core2_mod.F90 b/datm/datm_datamode_core2_mod.F90 index 91019248a..1bb5f0452 100644 --- a/datm/datm_datamode_core2_mod.F90 +++ b/datm/datm_datamode_core2_mod.F90 @@ -185,25 +185,25 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor end do ! get stream pointers - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_prec' , strm_Faxa_prec , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdn' , strm_Faxa_swdn , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swnet' , strm_Faxa_swnet , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swnet' , strm_Faxa_swnet , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_lwdn' , strm_Faxa_lwdn , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_pslv' , strm_Sa_pslv , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tbot' , strm_Sa_tbot , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_u' , strm_Sa_u , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_v' , strm_Sa_v , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_shum' , strm_Sa_shum , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_tarcf' , strm_tarcf , rc) ! required for CORE2_IAF + call shr_strdata_get_stream_pointer( sdat, 'tarcf' , strm_tarcf , rc) ! required for CORE2_IAF if (ChkErr(rc,__LINE__,u_FILE_u)) return ! get export state pointers @@ -282,7 +282,7 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor endif if (.not. associated(strm_tarcf)) then if (trim(datamode) == 'CORE2_IAF' ) then - call shr_log_error(trim(subname)//'strm_tarcf must be associated for CORE2_IAF', rc=rc) + call shr_log_error(trim(subname)//'tarcf must be associated for CORE2_IAF', rc=rc) return endif endif diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index 20ea3b7d7..d5086f5c2 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -26,16 +26,13 @@ module datm_datamode_cplhist_mod real(r8), pointer :: Sa_dens(:) => null() real(r8), pointer :: Sa_pbot(:) => null() real(r8), pointer :: Sa_pslv(:) => null() - real(r8), pointer :: Sa_u(:) => null() real(r8), pointer :: Sa_v(:) => null() - real(r8), pointer :: Faxa_rainc(:) => null() real(r8), pointer :: Faxa_rainl(:) => null() real(r8), pointer :: Faxa_snowc(:) => null() real(r8), pointer :: Faxa_snowl(:) => null() real(r8), pointer :: Faxa_lwdn(:) => null() - real(r8), pointer :: Faxa_swndr(:) => null() real(r8), pointer :: Faxa_swndf(:) => null() real(r8), pointer :: Faxa_swvdr(:) => null() @@ -50,15 +47,12 @@ module datm_datamode_cplhist_mod real(r8), pointer :: strm_Sa_pbot(:) => null() real(r8), pointer :: strm_Sa_dens(:) => null() real(r8), pointer :: strm_Sa_pslv(:) => null() - real(r8), pointer :: strm_Sa_u(:) => null() real(r8), pointer :: strm_Sa_v(:) => null() - real(r8), pointer :: strm_Faxa_swndr(:) => null() real(r8), pointer :: strm_Faxa_swvdr(:) => null() real(r8), pointer :: strm_Faxa_swndf(:) => null() real(r8), pointer :: strm_Faxa_swvdf(:) => null() - real(r8), pointer :: strm_Faxa_rainc(:) => null() real(r8), pointer :: strm_Faxa_rainl(:) => null() real(r8), pointer :: strm_Faxa_snowc(:) => null() @@ -155,12 +149,10 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_dens' , fldptr1=Sa_dens , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_rainc' , fldptr1=Faxa_rainc , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rainl' , fldptr1=Faxa_rainl , rc=rc) @@ -171,7 +163,6 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_swvdr' , fldptr1=Faxa_swvdr , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swvdf' , fldptr1=Faxa_swvdf , rc=rc) @@ -181,54 +172,104 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r call dshr_state_getfldptr(exportState, 'Faxa_swndf' , fldptr1=Faxa_swndf , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) !??? - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Set pointers into stream data - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_z' , strm_Sa_z , rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_tbog', strm_Sa_tbot, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_ptem', strm_Sa_ptem, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_shum', strm_Sa_shum, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_pbot', strm_Sa_pbot, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_dens', strm_Sa_dens, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_pslv', strm_Sa_pslv, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_dens', strm_Sa_dens, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_u', strm_Sa_u, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Sa_v', strm_Sa_v, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_rainc', strm_Faxa_rainc, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_rainl', strm_Faxa_rainl, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_snowc', strm_Faxa_snowc, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_snowl', strm_Faxa_snowl, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_lwdn', strm_Faxa_lwdn, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_swndr', strm_Faxa_swndr, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_swvdr', strm_Faxa_swvdr, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_swndf', strm_Faxa_swndf, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_swvdf', strm_Faxa_swvdf, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'strm_Faxa_lwdn', strm_Faxa_lwdn , rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_z', strm_Sa_z, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_tbog', strm_Sa_tbot, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_ptem', strm_Sa_ptem, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_shum', strm_Sa_shum, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_pbot', strm_Sa_pbot, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_pslv', strm_Sa_pslv, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_u', strm_Sa_u, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_v', strm_Sa_v, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_rainc', strm_Faxa_rainc, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_rainl', strm_Faxa_rainl, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_snowc', strm_Faxa_snowc, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_snowl', strm_Faxa_snowl, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndr', strm_Faxa_swndr, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdr', strm_Faxa_swvdr, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndf', strm_Faxa_swndf, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdf', strm_Faxa_swvdf, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! error checks for stream pointers + if (.not. associated(strm_Sa_z)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_z must be associated for cplhist datamode') + end if + if (.not. associated(strm_Sa_tbot)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for cplhist datamode') + end if + if (.not. associated(strm_Sa_ptem)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_ptem must be associated for cplhist datamode') + end if + if (.not. associated(strm_Sa_shum)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_shum must be associated for cplhist datamode') + end if + if (.not. associated(strm_Sa_pbot)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_pbot must be associated for cplhist datamode') + end if + if (.not. associated(strm_Sa_dens)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_dens must be associated for cplhist datamode') + end if + if (.not. associated(strm_Sa_pslv)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for cplhist datamode') + end if + if (.not. associated(strm_Sa_u)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_u must be associated for cplhist datamode') + end if + if (.not. associated(strm_Sa_v)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_v must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_swndr)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndr must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_swvdr)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_swndf)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndf must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_swvdf)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_rainc)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainc must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_rainl)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainl must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_snowc)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowc must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_snowl)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowl must be associated for cplhist datamode') + end if + if (.not. associated(strm_Faxa_lwdn )) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for cplhist datamode') + end if end subroutine datm_datamode_cplhist_init_pointers diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index dad08baf9..c4bf44192 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -3,7 +3,6 @@ module datm_datamode_era5_mod use ESMF , only : ESMF_State, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO 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_precip_mod , only : shr_precip_partition_rain_snow_ramp use shr_const_mod , only : shr_const_tkfrz, shr_const_rhofw, shr_const_rdair use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer @@ -44,11 +43,30 @@ 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() + real(r8), pointer :: strm_Sa_tdew(:) => null() + real(r8), pointer :: strm_Sa_t2m(:) => null() + real(r8), pointer :: strm_Sa_u10m(:) => null() + real(r8), pointer :: strm_Sa_v10m(:) => null() + real(r8), pointer :: strm_Sa_pslv(:) => null() + real(r8), pointer :: strm_Faxa_swdn(:) => null() + real(r8), pointer :: strm_Faxa_swvdr(:) => null() + real(r8), pointer :: strm_Faxa_swndr(:) => null() + real(r8), pointer :: strm_Faxa_swvdf(:) => null() + real(r8), pointer :: strm_Faxa_swndf(:) => null() + real(r8), pointer :: strm_Faxa_swnet(:) => null() + real(r8), pointer :: strm_Faxa_lwdn(:) => null() + real(r8), pointer :: strm_Faxa_lwnet(:) => null() + real(r8), pointer :: strm_Faxa_rain(:) => null() + real(r8), pointer :: strm_Faxa_rainc(:) => null() + real(r8), pointer :: strm_Faxa_rainl(:) => null() + real(r8), pointer :: strm_Faxa_snowc(:) => null() + real(r8), pointer :: strm_Faxa_snowl(:) => null() + real(r8), pointer :: strm_Faxa_sen(:) => null() + real(r8), pointer :: strm_Faxa_lat(:) => null() + real(r8), pointer :: strm_Faxa_taux(:) => null() + real(r8), pointer :: strm_Faxa_tauy(:) => null() real(r8) :: t2max ! units detector real(r8) :: td2max ! units detector @@ -65,8 +83,7 @@ module datm_datamode_era5_mod contains !=============================================================================== - subroutine datm_datamode_era5_advertise(exportState, fldsexport, & - flds_scalar_name, rc) + subroutine datm_datamode_era5_advertise(exportState, fldsexport, flds_scalar_name, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState @@ -132,7 +149,39 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) rc = ESMF_SUCCESS ! initialize pointers for module level stream arrays - call shr_strdata_get_stream_pointer( sdat, 'Sa_tdew' , strm_tdew , rc) + call shr_strdata_get_stream_pointer( sdat,'Sa_tdew', strm_Sa_tdew , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_t2m' , strm_Sa_t2m , rc=rc) ! required if Sa_t2m + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_u10m', strm_Sa_u10m, rc=rc) ! required if Sa_wspd10m + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_v10m', strm_Sa_v10m, rc=rc) ! required if Sa_wspd10m + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_v10m', strm_Sa_pslv, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swdn', strm_Faxa_swdn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdr', strm_Faxa_swvdr, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndr', strm_Faxa_swndr, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdf', strm_Faxa_swvdf, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndf', strm_Faxa_swndf, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swnet', strm_Faxa_swnet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwnet', strm_Faxa_lwnet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_sen', strm_Faxa_sen, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lat', strm_Faxa_lat, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_taux', strm_Faxa_taux, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_tauy', strm_Faxa_tauy, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! get export state pointers @@ -189,7 +238,7 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) end subroutine datm_datamode_era5_init_pointers - !=============================================================================== + !=============================================================================== subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, target_ymd, target_tod, model_calendar, rc) use ESMF, only: ESMF_VMGetCurrent, ESMF_VMAllReduce, ESMF_REDUCE_MAX, ESMF_VM @@ -216,11 +265,12 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, ta rc = ESMF_SUCCESS - lsize = size(strm_tdew) + lsize = size(strm_Sa_tdew) if (first_time) then call ESMF_VMGetCurrent(vm, rc=rc) ! determine t2max (see below for use) if (associated(Sa_t2m)) then + Sa_t2m(:) = strm_Sa_t2m(:) rtmp(1) = maxval(Sa_t2m(:)) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) @@ -229,7 +279,7 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, ta end if ! determine tdewmax (see below for use) - rtmp(1) = maxval(strm_tdew(:)) + rtmp(1) = maxval(strm_Sa_tdew(:)) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) td2max = rtmp(2) @@ -247,15 +297,15 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, ta !--- calculate wind speed --- if (associated(Sa_wspd10m)) then - Sa_wspd10m(n) = sqrt(Sa_u10m(n)*Sa_u10m(n)+Sa_v10m(n)*Sa_v10m(n)) + Sa_wspd10m(n) = sqrt(strm_Sa_u10m(n)*strm_Sa_u10m(n) + strm_Sa_v10m(n)*strm_Sa_v10m(n)) end if !--- specific humidity at 2m --- if (associated(Sa_t2m) .and. associated(Sa_pslv) .and. associated(Sa_q2m)) then t2 = Sa_t2m(n) - pslv = Sa_pslv(n) - if (td2max < 50.0_r8) strm_tdew(n) = strm_tdew(n) + tkFrz - e = datm_eSat(strm_tdew(n), t2) + pslv = strm_Sa_pslv(n) + if (td2max < 50.0_r8) strm_Sa_tdew(n) = strm_Sa_tdew(n) + tkFrz + e = datm_eSat(strm_Sa_tdew(n), t2) qsat = (0.622_r8 * e)/(pslv - 0.378_r8 * e) Sa_q2m(n) = qsat end if @@ -267,10 +317,10 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, ta !--- shortwave radiation (Faxa_* basically holds albedo) --- !--- see comments for Faxa_swnet - if (associated(Faxa_swvdr)) Faxa_swvdr(:) = Faxa_swdn(:)*Faxa_swvdr(:) - if (associated(Faxa_swndr)) Faxa_swndr(:) = Faxa_swdn(:)*Faxa_swndr(:) - if (associated(Faxa_swvdf)) Faxa_swvdf(:) = Faxa_swdn(:)*Faxa_swvdf(:) - if (associated(Faxa_swndf)) Faxa_swndf(:) = Faxa_swdn(:)*Faxa_swndf(:) + if (associated(Faxa_swvdr)) Faxa_swvdr(:) = strm_Faxa_swdn(:)*strm_Faxa_swvdr(:) + if (associated(Faxa_swndr)) Faxa_swndr(:) = strm_Faxa_swdn(:)*strm_Faxa_swndr(:) + if (associated(Faxa_swvdf)) Faxa_swvdf(:) = strm_Faxa_swdn(:)*strm_Faxa_swvdf(:) + if (associated(Faxa_swndf)) Faxa_swndf(:) = strm_Faxa_swdn(:)*strm_Faxa_swndf(:) !--- TODO: need to understand relationship between shortwave bands and !--- net shortwave rad. currently it is provided directly from ERA5 @@ -288,31 +338,31 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, ta !---------------------------------------------------------- ! convert J/m^2 to W/m^2 - if (associated(Faxa_lwdn)) Faxa_lwdn(:) = Faxa_lwdn(:)/3600.0_r8 - if (associated(Faxa_lwnet)) Faxa_lwnet(:) = Faxa_lwnet(:)/3600.0_r8 - if (associated(Faxa_swvdr)) Faxa_swvdr(:) = Faxa_swvdr(:)/3600.0_r8 - if (associated(Faxa_swndr)) Faxa_swndr(:) = Faxa_swndr(:)/3600.0_r8 - if (associated(Faxa_swvdf)) Faxa_swvdf(:) = Faxa_swvdf(:)/3600.0_r8 - if (associated(Faxa_swndf)) Faxa_swndf(:) = Faxa_swndf(:)/3600.0_r8 - if (associated(Faxa_swdn)) Faxa_swdn(:) = Faxa_swdn(:)/3600.0_r8 - if (associated(Faxa_swnet)) Faxa_swnet(:) = Faxa_swnet(:)/3600.0_r8 - if (associated(Faxa_sen)) Faxa_sen(:) = Faxa_sen(:)/3600.0_r8 - if (associated(Faxa_lat)) Faxa_lat(:) = Faxa_lat(:)/3600.0_r8 + if (associated(Faxa_lwdn)) Faxa_lwdn(:) = strm_Faxa_lwdn(:)/3600.0_r8 + if (associated(Faxa_lwnet)) Faxa_lwnet(:) = strm_Faxa_lwnet(:)/3600.0_r8 + if (associated(Faxa_swvdr)) Faxa_swvdr(:) = strm_Faxa_swvdr(:)/3600.0_r8 + if (associated(Faxa_swndr)) Faxa_swndr(:) = strm_Faxa_swndr(:)/3600.0_r8 + if (associated(Faxa_swvdf)) Faxa_swvdf(:) = strm_Faxa_swvdf(:)/3600.0_r8 + if (associated(Faxa_swndf)) Faxa_swndf(:) = strm_Faxa_swndf(:)/3600.0_r8 + if (associated(Faxa_swdn)) Faxa_swdn(:) = strm_Faxa_swdn(:)/3600.0_r8 + if (associated(Faxa_swnet)) Faxa_swnet(:) = strm_Faxa_swnet(:)/3600.0_r8 + if (associated(Faxa_sen)) Faxa_sen(:) = strm_Faxa_sen(:)/3600.0_r8 + if (associated(Faxa_lat)) Faxa_lat(:) = strm_Faxa_lat(:)/3600.0_r8 ! convert m to kg/m^2/s - if (associated(Faxa_rain)) Faxa_rain(:) = Faxa_rain(:)/3600.0_r8*rhofw - if (associated(Faxa_rainc)) Faxa_rainc(:) = Faxa_rainc(:)/3600.0_r8*rhofw - if (associated(Faxa_rainl)) Faxa_rainl(:) = Faxa_rainl(:)/3600.0_r8*rhofw - if (associated(Faxa_snowc)) Faxa_snowc(:) = Faxa_snowc(:)/3600.0_r8*rhofw - if (associated(Faxa_snowl)) Faxa_snowl(:) = Faxa_snowl(:)/3600.0_r8*rhofw + if (associated(Faxa_rain)) Faxa_rain(:) = strm_Faxa_rain(:)/3600.0_r8*rhofw + if (associated(Faxa_rainc)) Faxa_rainc(:) = strm_Faxa_rainc(:)/3600.0_r8*rhofw + if (associated(Faxa_rainl)) Faxa_rainl(:) = strm_Faxa_rainl(:)/3600.0_r8*rhofw + if (associated(Faxa_snowc)) Faxa_snowc(:) = strm_Faxa_snowc(:)/3600.0_r8*rhofw + if (associated(Faxa_snowl)) Faxa_snowl(:) = strm_Faxa_snowl(:)/3600.0_r8*rhofw ! convert N/m^2 s to N/m^2 - if (associated(Faxa_taux)) Faxa_taux(:) = Faxa_taux(:)/3600.0_r8 - if (associated(Faxa_tauy)) Faxa_tauy(:) = Faxa_tauy(:)/3600.0_r8 + if (associated(Faxa_taux)) Faxa_taux(:) = strm_Faxa_taux(:)/3600.0_r8 + if (associated(Faxa_tauy)) Faxa_tauy(:) = strm_Faxa_tauy(:)/3600.0_r8 end subroutine datm_datamode_era5_advance - !=============================================================================== + !=============================================================================== real(r8) function datm_eSat(tK,tKbot) !---------------------------------------------------------------------------- diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index 8406831f4..3e847396b 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -1,6 +1,8 @@ module datm_datamode_gefs_mod use ESMF , only : ESMF_State, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_StateGet, ESMF_Field + use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit, ESMF_GridCompGet 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_precip_mod , only : shr_precip_partition_rain_snow_ramp @@ -9,6 +11,7 @@ module datm_datamode_gefs_mod use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy implicit none private ! except @@ -47,6 +50,8 @@ module datm_datamode_gefs_mod real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg real(r8) , parameter :: rhofw = SHR_CONST_RHOFW ! density of fresh water ~ kg/m^3 + type(dfield_type) , pointer :: dfields => null() + character(*), parameter :: nullstr = 'undefined' character(*), parameter :: u_FILE_u = & __FILE__ @@ -64,6 +69,10 @@ subroutine datm_datamode_gefs_advertise(exportState, fldsexport, flds_scalar_nam integer , intent(out) :: rc ! local variables + integer :: n + integer :: fieldcount + type(ESMF_Field) :: lfield + character(ESMF_MAXSTR) ,pointer :: lfieldnames(:) type(fldlist_type), pointer :: fldList !------------------------------------------------------------------------------- @@ -100,11 +109,13 @@ subroutine datm_datamode_gefs_advertise(exportState, fldsexport, flds_scalar_nam end subroutine datm_datamode_gefs_advertise !=============================================================================== - subroutine datm_datamode_gefs_init_pointers(exportState, sdat, rc) + subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc, rc) ! input/output variables type(ESMF_State) , intent(inout) :: exportState type(shr_strdata_type) , intent(in) :: sdat + integer , intent(in) :: logunit + logical , intent(in) :: mainproc integer , intent(out) :: rc ! local variables @@ -113,6 +124,22 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, rc) rc = ESMF_SUCCESS + ! Initialize dfields arrays for export fields with no ungridded dimension + ! and that have a corresponding stream field + call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnames(fieldCount)) + call ESMF_StateGet(exportState, itemNameList=lfieldnames, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + call ESMF_LogWrite(trim(subname)//': field name = '//trim(lfieldnames(n)), ESMF_LOGMSG_INFO) + call ESMF_StateGet(exportState, itemName=trim(lfieldnames(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_dfield_add( dfields, sdat, trim(lfieldnames(n)), trim(lfieldnames(n)), & + exportState, logunit, mainproc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + ! initialize pointers for module level stream arrays call shr_strdata_get_stream_pointer( sdat, 'Sa_mask' , strm_mask , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -205,6 +232,13 @@ subroutine datm_datamode_gefs_advance(exportstate, mainproc, logunit, mpicom, ta first_time = .false. end if + ! copy all fields from streams to export state as default + ! This automatically will update the fields in the export state + call ESMF_TraceRegionEnter('datm_gefs_dfield_copy') + call dshr_dfield_copy(dfields, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TraceRegionExit('datm_gefs_dfield_copy') + do n = 1, lsize !--- temperature --- if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 6f482b81d..8f4b958ad 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -151,21 +151,21 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) end do ! Stream pointers - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_tbot' , strm_Sa_tbot , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_pslv' , strm_Sa_pslv , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_u' , strm_Sa_u , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_v' , strm_Sa_v , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Sa_shum' , strm_Sa_shum , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_prec' , strm_Faxa_prec , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_lwdn' , strm_Faxa_lwdn , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'strm_Faxa_swdn' , strm_Faxa_swdn , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , rc) ! required if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Export state pointers diff --git a/datm/datm_pres_aero_mod.F90 b/datm/datm_pres_aero_mod.F90 new file mode 100644 index 000000000..fdb3858a4 --- /dev/null +++ b/datm/datm_pres_aero_mod.F90 @@ -0,0 +1,190 @@ +module datm_pres_aero_mod + + use ESMF , only : ESMF_SUCCESS, ESMF_State + use shr_kind_mod , only : r8=>shr_kind_r8 + use shr_log_mod , only : shr_log_error + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + + implicit none + private ! except + + public :: datm_pres_aero_advertise + public :: datm_pres_aero_init_pointers + public :: datm_pres_aero_advance + + ! export state data + real(r8), pointer :: Faxa_bcph(:,:) => null() + real(r8), pointer :: Faxa_ocph(:,:) => null() + real(r8), pointer :: Faxa_dstwet(:,:) => null() + real(r8), pointer :: Faxa_dstdry(:,:) => null() + + ! stream data + real(r8), pointer :: strm_bcphidry(:) => null() + real(r8), pointer :: strm_bcphodry(:) => null() + real(r8), pointer :: strm_bcphiwet(:) => null() + + real(r8), pointer :: strm_ocphidry(:) => null() + real(r8), pointer :: strm_ocphodry(:) => null() + real(r8), pointer :: strm_ocphiwet(:) => null() + + real(r8), pointer :: strm_dstwet1(:) => null() + real(r8), pointer :: strm_dstwet2(:) => null() + real(r8), pointer :: strm_dstwet3(:) => null() + real(r8), pointer :: strm_dstwet4(:) => null() + + real(r8), pointer :: strm_dstdry1(:) => null() + real(r8), pointer :: strm_dstdry2(:) => null() + real(r8), pointer :: strm_dstdry3(:) => null() + real(r8), pointer :: strm_dstdry4(:) => null() + + character(*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine datm_pres_aero_advertise(fldsExport) + + ! input/output variables + type(fldlist_type) , pointer :: fldsexport + !---------------------------------------------------------- + + 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 subroutine datm_pres_aero_advertise + + !=============================================================================== + subroutine datm_pres_aero_init_pointers(exportState, sdat, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(datm_pres_aero_init_pointers): ' + !---------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Set module pointers into export state + + call dshr_state_getfldptr(exportState, 'Faxa_bcph', fldptr2=Faxa_bcph, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_ocph', fldptr2=Faxa_ocph, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_dstwet', fldptr2=Faxa_dstwet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_dstdry', fldptr2=Faxa_dstdry, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Set module pointers into streams and check that they are associated + + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphidry' , strm_bcphidry , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphodry' , strm_bcphodry , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphiwet' , strm_bcphiwet , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphidry' , strm_ocphidry , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphodry' , strm_ocphodry , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphiwet' , strm_ocphiwet , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry1' , strm_dstdry1 , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry2' , strm_dstdry2 , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry3' , strm_dstdry3 , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry4' , strm_dstdry4 , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet1' , strm_dstwet1 , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet2' , strm_dstwet2 , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet3' , strm_dstwet3 , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet4' , strm_dstwet4 , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! error check for stream pointers + if (.not. associated(strm_bcphidry)) then + call shr_log_error(trim(subname)//'ERROR: strm_bcphidry must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_bcphodry)) then + call shr_log_error(trim(subname)//'ERROR: strm_bcphodry must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_bcphiwet)) then + call shr_log_error(trim(subname)//'ERROR: strm_bcphiwet must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_ocphidry)) then + call shr_log_error(trim(subname)//'ERROR: strm_ocphidry must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_ocphodry)) then + call shr_log_error(trim(subname)//'ERROR: strm_ocphodry must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_ocphiwet)) then + call shr_log_error(trim(subname)//'ERROR: strm_ocphiwet must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_dstdry1)) then + call shr_log_error(trim(subname)//'ERROR: strm_dstdry1 must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_dstdry2)) then + call shr_log_error(trim(subname)//'ERROR: strm_dstdry2 must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_dstdry3)) then + call shr_log_error(trim(subname)//'ERROR: strm_dstdry3 must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_dstdry4)) then + call shr_log_error(trim(subname)//'ERROR: strm_dstdry4 must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_dstwet1)) then + call shr_log_error(trim(subname)//'ERROR: strm_dstwet1 must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_dstwet2)) then + call shr_log_error(trim(subname)//'ERROR: strm_dstwet2 must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_dstwet3)) then + call shr_log_error(trim(subname)//'ERROR: strm_dstwet3 must be associated if flds_presaero is .true.') + end if + if (.not. associated(strm_dstwet4)) then + call shr_log_error(trim(subname)//'ERROR: strm_dstwet4 must be associated if flds_presaero is .true.') + end if + + end subroutine datm_pres_aero_init_pointers + + !=============================================================================== + subroutine datm_pres_aero_advance() + + ! The following maps stream input fields to export fields that + ! have an ungridded dimension + + Faxa_bcph(1,:) = strm_bcphidry(:) + Faxa_bcph(2,:) = strm_bcphodry(:) + Faxa_bcph(3,:) = strm_bcphiwet(:) + + Faxa_ocph(1,:) = strm_ocphidry(:) + Faxa_ocph(2,:) = strm_ocphodry(:) + Faxa_ocph(3,:) = strm_ocphiwet(:) + + Faxa_dstdry(1,:) = strm_dstdry1(:) + Faxa_dstdry(2,:) = strm_dstdry2(:) + Faxa_dstdry(3,:) = strm_dstdry3(:) + Faxa_dstdry(4,:) = strm_dstdry4(:) + + Faxa_dstwet(1,:) = strm_dstwet1(:) + Faxa_dstwet(2,:) = strm_dstwet2(:) + Faxa_dstwet(3,:) = strm_dstwet3(:) + Faxa_dstwet(4,:) = strm_dstwet4(:) + + end subroutine datm_pres_aero_advance + +end module datm_pres_aero_mod diff --git a/datm/datm_pres_co2_mod.F90 b/datm/datm_pres_co2_mod.F90 new file mode 100644 index 000000000..96d57d486 --- /dev/null +++ b/datm/datm_pres_co2_mod.F90 @@ -0,0 +1,110 @@ +module datm_pres_co2_mod + + use ESMF , only : ESMF_SUCCESS, ESMF_State, ESMF_StateItem_Flag + use ESMF , only : ESMF_STATEITEM_NOTFOUND + use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl + use shr_log_mod , only : shr_log_error + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + + implicit none + private ! except + + public :: datm_pres_co2_advertise + public :: datm_pres_co2_init_pointers + public :: datm_pres_co2_advance + + ! export state data + real(r8), pointer :: Sa_co2diag(:) => null() + real(r8), pointer :: Sa_co2prog(:) => null() + + ! stream pointer + real(r8), pointer :: strm_Sa_co2diag(:) => null() + real(r8), pointer :: strm_Sa_co2prog(:) => null() + + character(len=CL) :: datamode + + character(*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine datm_pres_co2_advertise(fldsExport, datamode_in) + + ! input/output variables + type(fldlist_type) , pointer :: fldsexport + character(len=*) , intent(in) :: datamode_in + !---------------------------------------------------------- + + ! Set module variable + datamode = datamode_in + + if (datamode == 'CPLHIST') then + call dshr_fldList_add(fldsExport, 'Sa_co2diag') + call dshr_fldList_add(fldsExport, 'Sa_co2prog') + else + call dshr_fldList_add(fldsExport, 'Sa_co2diag') + end if + + end subroutine datm_pres_co2_advertise + + !=============================================================================== + subroutine datm_pres_co2_init_pointers(exportState, sdat, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(datm_co2_init_pointers): ' + !---------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Get pointer to export state + call dshr_state_getfldptr(exportState, 'Sa_co2diag', fldptr1=Sa_co2diag, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. associated(Sa_co2diag)) then + call shr_log_error(trim(subname)//'ERROR: Sa_co2diag must be associated if flds_co2 is .true.') + end if + if (datamode == 'CPLHIST') then + call dshr_state_getfldptr(exportState, 'Sa_co2prog', fldptr1=Sa_co2prog, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. associated(Sa_co2prog)) then + call shr_log_error(trim(subname)//'ERROR: Sa_co2prog must be associated if flds_co2 is .true.') + end if + end if + + ! Get pointer to stream data that will be used below - if the + ! following stream fields are not in any sdat streams, then a null value is returned + call shr_strdata_get_stream_pointer(sdat, 'Sa_co2diag', strm_Sa_co2diag, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. associated(strm_co2diag)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_co2diag must be associated if flds_co2 is .true.') + end if + if (datamode == 'CPLHIST') then + call shr_strdata_get_stream_pointer(sdat, 'Sa_co2prog', strm_Sa_co2diag, rc) + if (.not. associated(strm_Sa_co2prog)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_co2prog must be associated if flds_co2 is .true.') + end if + end if + + end subroutine datm_pres_co2_init_pointers + + !=============================================================================== + subroutine datm_pres_co2_advance() + + if (datamode == 'CPLHIST') then + Sa_co2diag(:) = strm_Sa_co2diag(:) + Sa_co2prog(:) = strm_Sa_co2prog(:) + else + Sa_co2diag(:) = strm_Sa_co2diag(:) + end if + + end subroutine datm_pres_co2_advance + +end module datm_co2_mod diff --git a/datm/datm_pres_ndep_mod.F90 b/datm/datm_pres_ndep_mod.F90 new file mode 100644 index 000000000..01c0f5f9f --- /dev/null +++ b/datm/datm_pres_ndep_mod.F90 @@ -0,0 +1,110 @@ +module datm_pres_ndep_mod + + use ESMF , only : ESMF_SUCCESS, ESMF_State, ESMF_StateItem_Flag + use ESMF , only : ESMF_STATEITEM_NOTFOUND + use shr_kind_mod , only : r8=>shr_kind_r8 + use shr_log_mod , only : shr_log_error + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + + implicit none + private ! except + + public :: datm_pres_ndep_advertise + public :: datm_pres_ndep_init_pointers + public :: datm_pres_ndep_advance + + ! export state data + real(r8), pointer :: Faxa_ndep(:,:) => null() + + ! stream data + real(r8), pointer :: strm_ndep_nhx_dry(:) => null() ! stream cmip7 ndep data + real(r8), pointer :: strm_ndep_nhx_wet(:) => null() ! stream cmip7 ndep data + real(r8), pointer :: strm_ndep_noy_dry(:) => null() ! stream cmip7 ndep data + real(r8), pointer :: strm_ndep_noy_wet(:) => null() ! stream cmip7 ndep data + + real(r8), pointer :: strm_ndep_nhx(:) => null() ! pre-cmip7 ndep data + real(r8), pointer :: strm_ndep_noy(:) => null() ! pre-cmip7 ndep data + + character(*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine datm_pres_ndep_advertise(fldsExport) + + ! input/output variables + type(fldlist_type) , pointer :: fldsexport + !---------------------------------------------------------- + + call dshr_fldList_add(fldsExport, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=2) + + end subroutine datm_pres_ndep_advertise + + !=============================================================================== + subroutine datm_pres_ndep_init_pointers(exportState, sdat, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc + + ! local variables + type(ESMF_StateItem_Flag) :: itemFlag + character(len=*), parameter :: subname='(datm_ndep_init_pointers): ' + !---------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Get pointer to export state + call dshr_state_getfldptr(exportState, 'Faxa_ndep', fldptr2=Faxa_ndep, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Get pointer to stream data that will be used below - if the + ! following stream fields are not in any sdat streams, then a null value is returned + + ! cmip7 forcing + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ndep_nhx_dry', strm_ndep_nhx_dry, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ndep_nhx_wet', strm_ndep_nhx_wet, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ndep_noy_dry', strm_ndep_noy_dry, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ndep_noy_wet', strm_ndep_noy_wet, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! older ndep forcing + call shr_strdata_get_stream_pointer( sdat, 'Faxa_ndep_nhx', strm_ndep_nhx, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_ndep_noy', strm_ndep_noy, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine datm_pres_ndep_init_pointers + + !=============================================================================== + subroutine datm_pres_ndep_advance() + + if (associated(strm_ndep_nhx_dry) .and. & + associated(strm_ndep_nhx_wet) .and. & + associated(strm_ndep_noy_dry) .and. & + associated(strm_ndep_noy_wet)) then + + Faxa_ndep(1,:) = strm_ndep_nhx_dry(:) + strm_ndep_nhx_wet(:) + Faxa_ndep(2,:) = strm_ndep_noy_dry(:) + strm_ndep_noy_wet(:) + + else if (associated(strm_ndep_nhx) .and. associated(strm_ndep_noy)) then + + ! convert ndep flux to units of kgN/m2/s (input is in gN/m2/s) + Faxa_ndep(1,:) = strm_ndep_nhx(:) / 1000._r8 + Faxa_ndep(2,:) = strm_ndep_noy(:) / 1000._r8 + + else + call shr_log_error('datm_ndep_advance: ERROR: no associated stream pointers for ndep forcing') + end if + + end subroutine datm_pres_ndep_advance + +end module datm_pres_ndep_mod diff --git a/datm/datm_pres_o3_mod.F90 b/datm/datm_pres_o3_mod.F90 new file mode 100644 index 000000000..c3b86afcb --- /dev/null +++ b/datm/datm_pres_o3_mod.F90 @@ -0,0 +1,81 @@ +module datm_pres_o3_mod + + use ESMF , only : ESMF_SUCCESS, ESMF_State, ESMF_StateItem_Flag + use ESMF , only : ESMF_STATEITEM_NOTFOUND + use shr_kind_mod , only : r8=>shr_kind_r8 + use shr_log_mod , only : shr_log_error + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + + implicit none + private ! except + + public :: datm_pres_o3_advertise + public :: datm_pres_o3_init_pointers + public :: datm_pres_o3_advance + + ! export state data + real(r8), pointer :: Sa_o3(:) => null() + + ! stream pointer + real(r8), pointer :: strm_Sa_o3(:) => null() + + character(*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine datm_pres_o3_advertise(fldsExport) + + ! input/output variables + type(fldlist_type) , pointer :: fldsexport + + call dshr_fldList_add(fldsExport, 'Sa_o3') + + end subroutine datm_pres_o3_advertise + + !=============================================================================== + subroutine datm_pres_o3_init_pointers(exportState, sdat, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(datm_o3_init_pointers): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Get pointer to export state + call dshr_state_getfldptr(exportState, 'Sa_o3', fldptr1=Sa_o3, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Get pointer to stream data that will be used below - if the + ! following stream fields are not in any sdat streams, then a null value is returned + call shr_strdata_get_stream_pointer(sdat, 'Sa_o3', strm_Sa_o3, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + + ! Error checks + if (.not. associated(Sa_o3)) then + call shr_log_error(trim(subname)//'ERROR: Sa_o3 must be associated if flds_pres_o3 is .true.') + end if + if (.not. associated(strm_Sa_o3)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_o3 must be associated if flds_pres_o3 is .true.') + end if + + end subroutine datm_pres_o3_init_pointers + + !=============================================================================== + subroutine datm_pres_o3_advance() + + Sa_o3(:) = strm_Sa_o3(:) + + end subroutine datm_pres_o3_advance + +end module datm_pres_o3_mod diff --git a/dice/dice_datamode_cplhist_mod.F90 b/dice/dice_datamode_cplhist_mod.F90 index 4bc15d225..cd1d96794 100644 --- a/dice/dice_datamode_cplhist_mod.F90 +++ b/dice/dice_datamode_cplhist_mod.F90 @@ -1,6 +1,8 @@ module dice_datamode_cplhist_mod - use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS + use ESMF , only : ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS + use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit + use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_Field 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_const_mod , only : shr_const_TkFrzsw @@ -9,6 +11,7 @@ module dice_datamode_cplhist_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add use dshr_mod , only : dshr_restart_read, dshr_restart_write use dshr_strdata_mod , only : shr_strdata_type + use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy implicit none private ! except @@ -23,19 +26,21 @@ module dice_datamode_cplhist_mod ! ice to atm in CMEPS/mediator/esmFldsExchange_ufs_mod.F90 real(r8), pointer :: Si_ifrac(:) => null() real(r8), pointer :: Si_imask(:) => null() - real(r8), pointer :: Faii_taux(:) => null() - real(r8), pointer :: Faii_tauy(:) => null() - real(r8), pointer :: Faii_lat(:) => null() - real(r8), pointer :: Faii_sen(:) => null() - real(r8), pointer :: Faii_lwup(:) => null() - real(r8), pointer :: Faii_evap(:) => null() - real(r8), pointer :: Si_vice(:) => null() - real(r8), pointer :: Si_vsno(:) => null() + real(r8), pointer :: Faii_taux(:) => null() + real(r8), pointer :: Faii_tauy(:) => null() + real(r8), pointer :: Faii_lat(:) => null() + real(r8), pointer :: Faii_sen(:) => null() + real(r8), pointer :: Faii_lwup(:) => null() + real(r8), pointer :: Faii_evap(:) => null() + real(r8), pointer :: Si_vice(:) => null() + real(r8), pointer :: Si_vsno(:) => null() real(r8), pointer :: Si_t(:) => null() - real(r8), pointer :: Si_avsdr(:) => null() - real(r8), pointer :: Si_avsdf(:) => null() - real(r8), pointer :: Si_anidr(:) => null() - real(r8), pointer :: Si_anidf(:) => null() + real(r8), pointer :: Si_avsdr(:) => null() + real(r8), pointer :: Si_avsdf(:) => null() + real(r8), pointer :: Si_anidr(:) => null() + real(r8), pointer :: Si_anidf(:) => null() + + type(dfield_type) , pointer :: dfields => null() character(*) , parameter :: u_FILE_u = & __FILE__ @@ -87,7 +92,7 @@ subroutine dice_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_ end subroutine dice_datamode_cplhist_advertise !=============================================================================== - subroutine dice_datamode_cplhist_init_pointers(importState, exportState,sdat,rc) + subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, rc) ! input/output variables type(ESMF_State) , intent(inout) :: importState @@ -96,21 +101,43 @@ subroutine dice_datamode_cplhist_init_pointers(importState, exportState,sdat,rc) integer , intent(out) :: rc ! local variables + integer :: n + type(ESMF_Field) :: lfield + character(CL) ,pointer :: lfieldnamelist(:) => null() + integer :: fieldcount character(len=*), parameter :: subname='(dice_init_pointers): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS + ! Initialize dfields data type (to map streams to export state + ! fields) Create dfields linked list - used for copying stream + ! fields with ungridded dimensions to export state fields + call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + call ESMF_StateGet(exportState, itemName=trim(lfieldNameList(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (trim(lfieldnamelist(n)) /= flds_scalar_name) then + call dshr_dfield_add( dfields, sdat, trim(lfieldnamelist(n)), trim(lfieldnamelist(n)), & + exportState, logunit, mainproc, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + end if + end do + ! initialize pointers to export fields - call dshr_state_getfldptr(exportState, 'Si_ifrac' , fldptr1=Si_ifrac , rc=rc) + call dshr_state_getfldptr(exportState,'Si_ifrac',fldptr1=Si_ifrac, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Si_imask' , fldptr1=Si_imask , rc=rc) + call dshr_state_getfldptr(exportState,'Si_imask', fldptr1=Si_imask, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faii_taux' , fldptr1=Faii_taux , allowNullReturn=.true., rc=rc) + call dshr_state_getfldptr(exportState,'Faii_taux', fldptr1=Faii_taux, allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faii_tauy' , fldptr1=Faii_tauy , allowNullReturn=.true., rc=rc) + call dshr_state_getfldptr(exportState, 'Faii_tauy', fldptr1=Faii_tauy, allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faii_lat' , fldptr1=Faii_lat , allowNullReturn=.true., rc=rc) + call dshr_state_getfldptr(exportState, 'Faii_lat', fldptr1=Faii_lat, allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faii_sen', fldptr1=Faii_sen, allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -138,10 +165,11 @@ subroutine dice_datamode_cplhist_init_pointers(importState, exportState,sdat,rc) end subroutine dice_datamode_cplhist_init_pointers !=============================================================================== - subroutine dice_datamode_cplhist_advance(rc) + subroutine dice_datamode_cplhist_advance(sdat, rc) ! input/output variables - integer, intent(out) :: rc + type(shr_strdata_type) , intent(in) :: sdat + integer, intent(out) :: rc ! local variables character(len=*), parameter :: subname='(dice_datamode_cplhist_advance): ' @@ -149,9 +177,16 @@ subroutine dice_datamode_cplhist_advance(rc) rc = ESMF_SUCCESS - !Unit conversions, calculations,.... - !Where aice=0, Si_t=0K (as missing value). Interpolation in time between ice that comes or goes then has issues - where(Si_t .LT. 10) Si_t = shr_const_TkFrzsw + ! Automatically update the fields in the export state + call ESMF_TraceRegionEnter('dice_dfield_copy') + call dshr_dfield_copy(dfields, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TraceRegionExit('dice_dfield_copy') + + ! Unit conversions, calculations,.... Where aice=0, Si_t=0K (as + ! missing value). Interpolation in time between ice that comes or + ! goes then has issues + where (Si_t < 10) Si_t = shr_const_TkFrzsw end subroutine dice_datamode_cplhist_advance diff --git a/dice/dice_datamode_ssmi_mod.F90 b/dice/dice_datamode_ssmi_mod.F90 index b484b40ae..fb813a9c6 100644 --- a/dice/dice_datamode_ssmi_mod.F90 +++ b/dice/dice_datamode_ssmi_mod.F90 @@ -25,10 +25,12 @@ module dice_datamode_ssmi_mod ! restart fields real(r8), pointer, public :: water(:) => null() + ! stream pointer + real(r8), pointer :: strm_Si_ifrac(:) => null() + ! internal fields real(r8), pointer :: yc(:) => null() ! mesh lats (degrees) integer , pointer :: imask(:) => null() - !real(r8), pointer:: ifrac0(:) => null() ! export fields real(r8), pointer :: Si_imask(:) => null() @@ -223,6 +225,13 @@ subroutine dice_datamode_ssmi_init_pointers(importState, exportState, sdat, flds lsize = sdat%model_lsize + ! Set pointer to stream data (required) + call shr_strdata_get_stream_pointer( sdat, 'Si_ifrac', strm_Si_ifrac, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. associated(strm_Si_ifrac)) then + call shr_log_error(trim(subname)//'ERROR: strm_Si_ifrac must be associated for ssmi mode') + end if + ! Set Si_imask (this corresponds to the ocean mask) call dshr_state_getfldptr(exportState, fldname='Si_imask' , fldptr1=Si_imask , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -395,6 +404,8 @@ subroutine dice_datamode_ssmi_advance(exportState, importState, cosarg, flds_i2o rc = ESMF_SUCCESS + Si_ifrac(:) = strm_Si_ifrac(:) + lsize = size(Si_ifrac) if (first_time) then @@ -411,7 +422,6 @@ subroutine dice_datamode_ssmi_advance(exportState, importState, cosarg, flds_i2o water(n) = 0.0_r8 end if end do - ! iFrac0 = iFrac ! previous step's ice fraction endif ! reset first time @@ -537,8 +547,6 @@ subroutine dice_datamode_ssmi_advance(exportState, importState, cosarg, flds_i2o !--- salt flux --- Fioi_salt(n) = 0.0_r8 end if - ! !--- save ifrac for next timestep - ! iFrac0(n) = Si_ifrac(n) end do ! Compute outgoing aerosol fluxes diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 22f3658ce..c2cdc0cd1 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -33,7 +33,6 @@ module cdeps_dice_comp use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize use dice_datamode_ssmi_mod , only : dice_datamode_ssmi_advertise @@ -96,7 +95,6 @@ module cdeps_dice_comp ! linked lists type(fldList_type) , pointer :: fldsImport => null() type(fldList_type) , pointer :: fldsExport => null() - type(dfield_type) , pointer :: dfields => null() ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() @@ -108,7 +106,7 @@ module cdeps_dice_comp real(R8) :: dt ! real model timestep logical :: diagnose_data = .true. - integer , parameter :: main_task=0 ! task number of main task + integer , parameter :: main_task=0 ! task number of main task #ifdef CESMCOUPLED character(*) , parameter :: modName = "(ice_comp_nuopc)" #else @@ -504,17 +502,6 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod if (first_time) then - ! Initialize dfields with export state data that has corresponding stream fieldi - select case (trim(datamode)) - case('ssmi','ssmi_iaf') - call dshr_dfield_add(dfields, sdat, state_fld='Si_ifrac', strm_fld='Si_ifrac', & - state=exportState, logunit=logunit, mainproc=mainproc, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - case('cplhist') - call dice_init_dfields(importState, exportState, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - end select - ! Initialize datamode module ponters select case (trim(datamode)) case('ssmi', 'ssmi_iaf') @@ -551,17 +538,6 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'dice', rc=rc) call ESMF_TraceRegionExit('dice_strdata_advance') - !-------------------- - ! copy all fields from streams to export state as default - !-------------------- - - ! This automatically will update the fields in the export state - - call ESMF_TraceRegionEnter('dice_dfield_copy') - call dshr_dfield_copy(dfields, sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('dice_dfield_copy') - !------------------------------------------------- ! Determine data model behavior based on the mode !------------------------------------------------- @@ -602,46 +578,6 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod call ESMF_TraceRegionExit('dice_datamode') call ESMF_TraceRegionExit('DICE_RUN') - contains - subroutine dice_init_dfields(importState, exportState, rc) - ! ----------------------------- - ! Initialize dfields arrays - ! ----------------------------- - - ! input/output variables - type(ESMF_State) , intent(inout) :: importState - type(ESMF_State) , intent(inout) :: exportState - integer , intent(out) :: rc - - ! local variables - integer :: n - integer :: fieldcount - type(ESMF_Field) :: lfield - character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) - character(*), parameter :: subName = "(dice_init_dfields) " - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! Initialize dfields data type (to map streams to export state fields) - ! Create dfields linked list - used for copying stream fields to export - ! state fields - call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lfieldnamelist(fieldCount)) - call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1, fieldCount - call ESMF_StateGet(exportState, itemName=trim(lfieldNameList(n)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (trim(lfieldnamelist(n)) /= flds_scalar_name) then - call dshr_dfield_add( dfields, sdat, trim(lfieldnamelist(n)), trim(lfieldnamelist(n)), exportState, & - logunit, mainproc, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - end if - end do - end subroutine dice_init_dfields - end subroutine dice_comp_run !=============================================================================== From 13ab1c526e535e626b0aa5b5c42077a147ab4e2c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 18 Dec 2025 22:09:07 +0100 Subject: [PATCH 06/61] refactored datm --- datm/atm_comp_nuopc.F90 | 8 +- datm/datm_datamode_clmncep_mod.F90 | 32 ++++-- datm/datm_datamode_cplhist_mod.F90 | 20 ++++ datm/datm_datamode_era5_mod.F90 | 152 ++++++++++++++++++++++++++++- datm/datm_datamode_gefs_mod.F90 | 17 ++-- datm/datm_pres_aero_mod.F90 | 46 ++++++--- datm/datm_pres_co2_mod.F90 | 31 +++--- datm/datm_pres_ndep_mod.F90 | 27 ++--- datm/datm_pres_o3_mod.F90 | 5 +- docn/docn_datamode_dom_mod.F90 | 126 ++++++++++++++++++++++++ 10 files changed, 392 insertions(+), 72 deletions(-) create mode 100644 docn/docn_datamode_dom_mod.F90 diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 7191a5343..0a91052f8 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -71,9 +71,9 @@ module cdeps_datm_comp use datm_pres_ndep_mod , only : datm_pres_ndep_init_pointers use datm_pres_ndep_mod , only : datm_pres_ndep_advance - use datm_pres_presaero_mod , only : datm_pres_presaero_advertise - use datm_pres_presaero_mod , only : datm_pres_presaero_init_pointers - use datm_pres_presaero_mod , only : datm_pres_presaero_advance + use datm_pres_aero_mod , only : datm_pres_aero_advertise + use datm_pres_aero_mod , only : datm_pres_aero_init_pointers + use datm_pres_aero_mod , only : datm_pres_aero_advance use datm_pres_o3_mod , only : datm_pres_o3_advertise use datm_pres_o3_mod , only : datm_pres_o3_init_pointers @@ -764,7 +764,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod target_ymd, target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('GEFS') - call datm_datamode_gefs_advance(exportstate, mainproc, logunit, mpicom, & + call datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, mpicom, & target_ymd, target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('SIMPLE') diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index be595993a..6954569c0 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -160,7 +160,7 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r ! initialize stream pointers for module level export states call shr_strdata_get_stream_pointer( sdat, 'Sa_wind' , strm_Sa_wind , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_topo' , strm_Sa_topo, rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_topo' , strm_Sa_topo , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_z' , strm_Sa_z , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -250,16 +250,34 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r ! Required stream pointers if (.not. associated(strm_Sa_wind)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_wind must be associated for clmncep datamode') - end if - if (.not. associated(strm_Sa_tbot)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for clmncep datamode') + return end if if (.not. associated(strm_Sa_topo)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_topo must be associated for clmncep datamode') + return + end if + if (.not. associated(strm_Sa_tbot)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for clmncep datamode') + return end if if (.not. associated(strm_Faxa_precn)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_precn must be associated for clmncep datamode') + return end if + if ( .not. associated(strm_Sa_shum) .and. & + .not. associated(strm_Sa_rh) .and. & + .not. associated(strm_Sa_tdew)) then + call shr_log_error(subname//'ERROR: one of strm_Sa_shum, strm_Sa_rh or strm_Sa_tdew & + must for associated to compute specific humidity in clmncep datamode') + return + endif + if ( .not. associated(strm_Faxa_swdndf) .and. & + .not. associated(strm_Faxa_swdndr) .and. & + .not. associated(strm_Faxa_swdn)) then + call shr_log_error(subName//'ERROR: either strm_Faxa_swdndf and strm_faxa_swdndr .or strm_faxa_swdn & + must be associated for computing short-wave down in clmncep datamode') + return + endif ! determine anidrmax (see below for use) call ESMF_StateGet(importstate, 'Sx_anidr', itemFlag, rc=rc) @@ -402,9 +420,6 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) e = datm_esat(strm_Sa_tdew(n),tbot) qsat = (0.622_r8 * e)/(pbot - 0.378_r8 * e) Sa_shum(n) = qsat - else - call shr_log_error(subname//'ERROR: cannot compute shum', rc=rc) - return endif !--- density --- @@ -443,9 +458,6 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) Faxa_swvdr(n) = ratio_rvrf*swvdr swvdf = strm_Faxa_swdn(n) * 0.50_r8 Faxa_swvdf(n) = (1._r8 - ratio_rvrf)*swvdf - else - call shr_log_error(subName//'ERROR: cannot compute short-wave down', rc=rc) - return endif !--- swnet: a diagnostic quantity --- diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index d5086f5c2..0740ffa87 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -5,6 +5,7 @@ module datm_datamode_cplhist_mod use ESMF , only : ESMF_StateGet 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_log_mod , only : shr_log_error use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer use dshr_strdata_mod , only : shr_strdata_type @@ -218,61 +219,80 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r ! error checks for stream pointers if (.not. associated(strm_Sa_z)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_z must be associated for cplhist datamode') + return end if if (.not. associated(strm_Sa_tbot)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for cplhist datamode') + return end if if (.not. associated(strm_Sa_ptem)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_ptem must be associated for cplhist datamode') + return end if if (.not. associated(strm_Sa_shum)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_shum must be associated for cplhist datamode') + return end if if (.not. associated(strm_Sa_pbot)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_pbot must be associated for cplhist datamode') + return end if if (.not. associated(strm_Sa_dens)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_dens must be associated for cplhist datamode') + return end if if (.not. associated(strm_Sa_pslv)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for cplhist datamode') + return end if if (.not. associated(strm_Sa_u)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_u must be associated for cplhist datamode') + return end if if (.not. associated(strm_Sa_v)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_v must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_swndr)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndr must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_swvdr)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_swndf)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndf must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_swvdf)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_rainc)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainc must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_rainl)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainl must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_snowc)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowc must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_snowl)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowl must be associated for cplhist datamode') + return end if if (.not. associated(strm_Faxa_lwdn )) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for cplhist datamode') + return end if end subroutine datm_datamode_cplhist_init_pointers + !=============================================================================== subroutine datm_datamode_cplhist_advance(mainproc, logunit, mpicom, rc) diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index c4bf44192..966be0aac 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -4,6 +4,7 @@ module datm_datamode_era5_mod 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_const_mod , only : shr_const_tkfrz, shr_const_rhofw, shr_const_rdair + use shr_log_mod , only : shr_log_error use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer use dshr_strdata_mod , only : shr_strdata_type @@ -151,13 +152,13 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) ! initialize pointers for module level stream arrays call shr_strdata_get_stream_pointer( sdat,'Sa_tdew', strm_Sa_tdew , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_t2m' , strm_Sa_t2m , rc=rc) ! required if Sa_t2m + call shr_strdata_get_stream_pointer(sdat, 'Sa_t2m' , strm_Sa_t2m , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_u10m', strm_Sa_u10m, rc=rc) ! required if Sa_wspd10m + call shr_strdata_get_stream_pointer(sdat, 'Sa_u10m', strm_Sa_u10m, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_v10m', strm_Sa_v10m, rc=rc) ! required if Sa_wspd10m + call shr_strdata_get_stream_pointer(sdat, 'Sa_v10m', strm_Sa_v10m, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_v10m', strm_Sa_pslv, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Sa_pslv', strm_Sa_pslv, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_swdn', strm_Faxa_swdn, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -236,10 +237,151 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) call dshr_state_getfldptr(exportState, 'Faxa_tauy' , fldptr1=Faxa_tauy , allowNullReturn=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Error checks + if (.not. associated(strm_Sa_tdew)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for era5 datamode') + return + end if + if (associated(Sa_wspd10m)) then + if (.not. associated(strm_Sa_u10m)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_u10m must be associated for era5 datamode') + return + end if + if (.not. associated(strm_Sa_v10m)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_v10m must be associated for era5 datamode') + return + end if + end if + if (associated(Sa_t2m)) then + if (.not. associated(strm_Sa_t2m)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_t2m must be associated for era5 datamode') + return + end if + end if + if (associated(Sa_t2m) .and. associated(Sa_pslv) .and. associated(Sa_q2m)) then + if (.not. associated(strm_Sa_pslv)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_swdn)) then + if (.not. associated(strm_Faxa_swdn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for era5 datamode') + return + end if + end if + if ( associated(Faxa_swvdr) .or. & + associated(Faxa_swndr) .or. & + associated(Faxa_swvdf) .or. & + associated(Faxa_swndf)) then + if (.not. associated(strm_Faxa_swdn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_swvdr)) then + if (.not. associated(strm_Faxa_swvdr)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_swndr)) then + if (.not. associated(strm_Faxa_swndr)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndr must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_swvdf)) then + if (.not. associated(strm_Faxa_swvdf)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_swndf)) then + if (.not. associated(strm_Faxa_swndf)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndf must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_lwdn)) then + if (.not. associated(strm_Faxa_lwdn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_lwnet)) then + if (.not. associated(strm_Faxa_lwnet)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwnet must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_swnet)) then + if (.not. associated(strm_Faxa_swnet)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swnet must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_sen)) then + if (.not. associated(strm_Faxa_sen)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_sen must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_lat)) then + if (.not. associated(strm_Faxa_lat)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lat must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_rain)) then + if (.not. associated(strm_Faxa_rain)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rain must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_rainc)) then + if (.not. associated(strm_Faxa_rainc)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainc must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_rainl)) then + if (.not. associated(strm_Faxa_rainl)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainl must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_snowc)) then + if (.not. associated(strm_Faxa_snowc)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowc must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_snowl)) then + if (.not. associated(strm_Faxa_snowl)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowl must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_taux)) then + if (.not. associated(strm_Faxa_taux)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_taux must be associated for era5 datamode') + return + end if + end if + if (associated(Faxa_tauy)) then + if (.not. associated(strm_Faxa_tauy)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_tauy must be associated for era5 datamode') + return + end if + end if + end subroutine datm_datamode_era5_init_pointers !=============================================================================== - subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, target_ymd, target_tod, model_calendar, rc) + subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, & + target_ymd, target_tod, model_calendar, rc) + use ESMF, only: ESMF_VMGetCurrent, ESMF_VMAllReduce, ESMF_REDUCE_MAX, ESMF_VM ! input/output variables diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index 3e847396b..e6b5e2661 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -1,7 +1,7 @@ module datm_datamode_gefs_mod - use ESMF , only : ESMF_State, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO - use ESMF , only : ESMF_StateGet, ESMF_Field + use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_MAXSTR + use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_Field use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit, ESMF_GridCompGet 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 @@ -70,9 +70,6 @@ subroutine datm_datamode_gefs_advertise(exportState, fldsexport, flds_scalar_nam ! local variables integer :: n - integer :: fieldcount - type(ESMF_Field) :: lfield - character(ESMF_MAXSTR) ,pointer :: lfieldnames(:) type(fldlist_type), pointer :: fldList !------------------------------------------------------------------------------- @@ -119,6 +116,10 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc integer , intent(out) :: rc ! local variables + integer :: n + integer :: fieldcount + type(ESMF_Field) :: lfield + character(ESMF_MAXSTR) ,pointer :: lfieldnames(:) character(len=*), parameter :: subname='(datm_init_pointers): ' !------------------------------------------------------------------------------- @@ -185,10 +186,14 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc end subroutine datm_datamode_gefs_init_pointers !=============================================================================== - subroutine datm_datamode_gefs_advance(exportstate, mainproc, logunit, mpicom, target_ymd, target_tod, model_calendar, rc) + subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, mpicom, & + target_ymd, target_tod, model_calendar, rc) + use ESMF, only: ESMF_VMGetCurrent, ESMF_VMAllReduce, ESMF_REDUCE_MAX, ESMF_VM + ! input/output variables type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat logical , intent(in) :: mainproc integer , intent(in) :: logunit integer , intent(in) :: mpicom diff --git a/datm/datm_pres_aero_mod.F90 b/datm/datm_pres_aero_mod.F90 index fdb3858a4..a420af37f 100644 --- a/datm/datm_pres_aero_mod.F90 +++ b/datm/datm_pres_aero_mod.F90 @@ -14,13 +14,13 @@ module datm_pres_aero_mod public :: datm_pres_aero_init_pointers public :: datm_pres_aero_advance - ! export state data + ! pointers to export state data real(r8), pointer :: Faxa_bcph(:,:) => null() real(r8), pointer :: Faxa_ocph(:,:) => null() real(r8), pointer :: Faxa_dstwet(:,:) => null() real(r8), pointer :: Faxa_dstdry(:,:) => null() - ! stream data + ! pointers to stream data real(r8), pointer :: strm_bcphidry(:) => null() real(r8), pointer :: strm_bcphodry(:) => null() real(r8), pointer :: strm_bcphiwet(:) => null() @@ -86,77 +86,91 @@ subroutine datm_pres_aero_init_pointers(exportState, sdat, rc) ! Set module pointers into streams and check that they are associated - call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphidry' , strm_bcphidry , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphidry' , strm_bcphidry, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphodry' , strm_bcphodry , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphodry' , strm_bcphodry, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphiwet' , strm_bcphiwet , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphiwet' , strm_bcphiwet, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphidry' , strm_ocphidry , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphidry' , strm_ocphidry, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphodry' , strm_ocphodry , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphodry' , strm_ocphodry, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphiwet' , strm_ocphiwet , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphiwet' , strm_ocphiwet, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry1' , strm_dstdry1 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry1' , strm_dstdry1 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry2' , strm_dstdry2 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry2' , strm_dstdry2 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry3' , strm_dstdry3 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry3' , strm_dstdry3 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry4' , strm_dstdry4 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry4' , strm_dstdry4 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet1' , strm_dstwet1 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet1' , strm_dstwet1 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet2' , strm_dstwet2 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet2' , strm_dstwet2 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet3' , strm_dstwet3 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet3' , strm_dstwet3 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet4' , strm_dstwet4 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet4' , strm_dstwet4 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! error check for stream pointers if (.not. associated(strm_bcphidry)) then call shr_log_error(trim(subname)//'ERROR: strm_bcphidry must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_bcphodry)) then call shr_log_error(trim(subname)//'ERROR: strm_bcphodry must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_bcphiwet)) then call shr_log_error(trim(subname)//'ERROR: strm_bcphiwet must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_ocphidry)) then call shr_log_error(trim(subname)//'ERROR: strm_ocphidry must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_ocphodry)) then call shr_log_error(trim(subname)//'ERROR: strm_ocphodry must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_ocphiwet)) then call shr_log_error(trim(subname)//'ERROR: strm_ocphiwet must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_dstdry1)) then call shr_log_error(trim(subname)//'ERROR: strm_dstdry1 must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_dstdry2)) then call shr_log_error(trim(subname)//'ERROR: strm_dstdry2 must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_dstdry3)) then call shr_log_error(trim(subname)//'ERROR: strm_dstdry3 must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_dstdry4)) then call shr_log_error(trim(subname)//'ERROR: strm_dstdry4 must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_dstwet1)) then call shr_log_error(trim(subname)//'ERROR: strm_dstwet1 must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_dstwet2)) then call shr_log_error(trim(subname)//'ERROR: strm_dstwet2 must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_dstwet3)) then call shr_log_error(trim(subname)//'ERROR: strm_dstwet3 must be associated if flds_presaero is .true.') + return end if if (.not. associated(strm_dstwet4)) then call shr_log_error(trim(subname)//'ERROR: strm_dstwet4 must be associated if flds_presaero is .true.') + return end if end subroutine datm_pres_aero_init_pointers diff --git a/datm/datm_pres_co2_mod.F90 b/datm/datm_pres_co2_mod.F90 index 96d57d486..caa5301d2 100644 --- a/datm/datm_pres_co2_mod.F90 +++ b/datm/datm_pres_co2_mod.F90 @@ -42,12 +42,8 @@ subroutine datm_pres_co2_advertise(fldsExport, datamode_in) ! Set module variable datamode = datamode_in - if (datamode == 'CPLHIST') then - call dshr_fldList_add(fldsExport, 'Sa_co2diag') - call dshr_fldList_add(fldsExport, 'Sa_co2prog') - else - call dshr_fldList_add(fldsExport, 'Sa_co2diag') - end if + call dshr_fldList_add(fldsExport, 'Sa_co2diag') + call dshr_fldList_add(fldsExport, 'Sa_co2prog') end subroutine datm_pres_co2_advertise @@ -60,7 +56,7 @@ subroutine datm_pres_co2_init_pointers(exportState, sdat, rc) integer , intent(out) :: rc ! local variables - character(len=*), parameter :: subname='(datm_co2_init_pointers): ' + character(len=*), parameter :: subname='(datm_pres_co2_init_pointers): ' !---------------------------------------------------------- rc = ESMF_SUCCESS @@ -71,25 +67,25 @@ subroutine datm_pres_co2_init_pointers(exportState, sdat, rc) if (.not. associated(Sa_co2diag)) then call shr_log_error(trim(subname)//'ERROR: Sa_co2diag must be associated if flds_co2 is .true.') end if - if (datamode == 'CPLHIST') then - call dshr_state_getfldptr(exportState, 'Sa_co2prog', fldptr1=Sa_co2prog, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (.not. associated(Sa_co2prog)) then - call shr_log_error(trim(subname)//'ERROR: Sa_co2prog must be associated if flds_co2 is .true.') - end if + call dshr_state_getfldptr(exportState, 'Sa_co2prog', fldptr1=Sa_co2prog, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. associated(Sa_co2prog)) then + call shr_log_error(trim(subname)//'ERROR: Sa_co2prog must be associated if flds_co2 is .true.') + return end if ! Get pointer to stream data that will be used below - if the ! following stream fields are not in any sdat streams, then a null value is returned call shr_strdata_get_stream_pointer(sdat, 'Sa_co2diag', strm_Sa_co2diag, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (.not. associated(strm_co2diag)) then + if (.not. associated(strm_Sa_co2diag)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_co2diag must be associated if flds_co2 is .true.') end if if (datamode == 'CPLHIST') then - call shr_strdata_get_stream_pointer(sdat, 'Sa_co2prog', strm_Sa_co2diag, rc) + call shr_strdata_get_stream_pointer(sdat, 'Sa_co2prog', strm_Sa_co2prog, rc) if (.not. associated(strm_Sa_co2prog)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_co2prog must be associated if flds_co2 is .true.') + return end if end if @@ -102,9 +98,12 @@ subroutine datm_pres_co2_advance() Sa_co2diag(:) = strm_Sa_co2diag(:) Sa_co2prog(:) = strm_Sa_co2prog(:) else + ! This is intentional since we don't have any Sa_co2prog - but for now + ! will set Sa_co2prog equal to Sa_co2diag Sa_co2diag(:) = strm_Sa_co2diag(:) + Sa_co2prog(:) = strm_Sa_co2diag(:) end if end subroutine datm_pres_co2_advance -end module datm_co2_mod +end module datm_pres_co2_mod diff --git a/datm/datm_pres_ndep_mod.F90 b/datm/datm_pres_ndep_mod.F90 index 01c0f5f9f..2256d916a 100644 --- a/datm/datm_pres_ndep_mod.F90 +++ b/datm/datm_pres_ndep_mod.F90 @@ -27,6 +27,8 @@ module datm_pres_ndep_mod real(r8), pointer :: strm_ndep_nhx(:) => null() ! pre-cmip7 ndep data real(r8), pointer :: strm_ndep_noy(:) => null() ! pre-cmip7 ndep data + logical :: use_cmip7_ndep + character(*), parameter :: u_FILE_u = & __FILE__ @@ -82,27 +84,30 @@ subroutine datm_pres_ndep_init_pointers(exportState, sdat, rc) call shr_strdata_get_stream_pointer( sdat, 'Faxa_ndep_noy', strm_ndep_noy, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! error checks + if (associated(strm_ndep_nhx_dry) .and. associated(strm_ndep_nhx_wet) .and. & + associated(strm_ndep_noy_dry) .and. associated(strm_ndep_noy_wet)) then + use_cmip7_ndep = .true. + else if (associated(strm_ndep_nhx) .and. associated(strm_ndep_noy)) then + use_cmip7_ndep = .false. + else + call shr_log_error('datm_ndep_advance: ERROR: no associated stream pointers for ndep forcing') + return + end if + end subroutine datm_pres_ndep_init_pointers !=============================================================================== subroutine datm_pres_ndep_advance() - if (associated(strm_ndep_nhx_dry) .and. & - associated(strm_ndep_nhx_wet) .and. & - associated(strm_ndep_noy_dry) .and. & - associated(strm_ndep_noy_wet)) then - + if (use_cmip7_ndep) then + ! assume data is in kgN/m2/s Faxa_ndep(1,:) = strm_ndep_nhx_dry(:) + strm_ndep_nhx_wet(:) Faxa_ndep(2,:) = strm_ndep_noy_dry(:) + strm_ndep_noy_wet(:) - - else if (associated(strm_ndep_nhx) .and. associated(strm_ndep_noy)) then - + else ! convert ndep flux to units of kgN/m2/s (input is in gN/m2/s) Faxa_ndep(1,:) = strm_ndep_nhx(:) / 1000._r8 Faxa_ndep(2,:) = strm_ndep_noy(:) / 1000._r8 - - else - call shr_log_error('datm_ndep_advance: ERROR: no associated stream pointers for ndep forcing') end if end subroutine datm_pres_ndep_advance diff --git a/datm/datm_pres_o3_mod.F90 b/datm/datm_pres_o3_mod.F90 index c3b86afcb..41ced32b9 100644 --- a/datm/datm_pres_o3_mod.F90 +++ b/datm/datm_pres_o3_mod.F90 @@ -60,13 +60,10 @@ subroutine datm_pres_o3_init_pointers(exportState, sdat, rc) call shr_strdata_get_stream_pointer(sdat, 'Sa_o3', strm_Sa_o3, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Error checks - if (.not. associated(Sa_o3)) then - call shr_log_error(trim(subname)//'ERROR: Sa_o3 must be associated if flds_pres_o3 is .true.') - end if if (.not. associated(strm_Sa_o3)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_o3 must be associated if flds_pres_o3 is .true.') + return end if end subroutine datm_pres_o3_init_pointers diff --git a/docn/docn_datamode_dom_mod.F90 b/docn/docn_datamode_dom_mod.F90 new file mode 100644 index 000000000..a6628f56d --- /dev/null +++ b/docn/docn_datamode_dom_mod.F90 @@ -0,0 +1,126 @@ +module docn_datamode_copyall_mod + + use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS + 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_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal + use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + use dshr_strdata_mod , only : shr_strdata_type + + implicit none + private ! except + + public :: docn_datamode_copyall_advertise + public :: docn_datamode_copyall_init_pointers + public :: docn_datamode_copyall_advance + + ! export fields + real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator + real(r8), pointer :: So_t(:) => null() + real(r8), pointer :: So_u(:) => null() + real(r8), pointer :: So_v(:) => null() + real(r8), pointer :: So_s(:) => null() + + real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) + real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity + + character(*) , parameter :: nullstr = 'null' + character(*) , parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine docn_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) + + ! input/output variables + type(esmf_State) , intent(inout) :: exportState + type(fldlist_type) , pointer :: fldsexport + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(out) :: rc + + ! local variables + type(fldlist_type), pointer :: fldList + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Advertise export fields + call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) + call dshr_fldList_add(fldsExport, 'So_omask' ) + call dshr_fldList_add(fldsExport, 'So_t' ) + call dshr_fldList_add(fldsExport, 'So_s' ) + call dshr_fldList_add(fldsExport, 'So_u' ) + call dshr_fldList_add(fldsExport, 'So_v' ) + + fldlist => fldsExport ! the head of the linked list + do while (associated(fldlist)) + call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite('(docn_comp_advertise): Fr_ocn'//trim(fldList%stdname), ESMF_LOGMSG_INFO) + fldList => fldList%next + enddo + + end subroutine docn_datamode_copyall_advertise + + !=============================================================================== + subroutine docn_datamode_copyall_init_pointers(exportState, ocn_fraction, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + real(r8) , intent(in) :: ocn_fraction(:) + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(docn_init_pointers): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! initialize pointers to export fields + call dshr_state_getfldptr(exportState, 'So_omask' , fldptr1=So_omask , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'So_t' , fldptr1=So_t , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'So_s' , fldptr1=So_s , allowNullReturn=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'So_u' , fldptr1=So_u , allowNullReturn=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'So_v' , fldptr1=So_v , allowNullReturn=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (associated(So_u)) then + So_u(:) = 0.0_r8 + end if + if (associated(So_v)) then + So_v(:) = 0.0_r8 + end if + if (associated(So_s)) then + So_s(:) = ocnsalt + end if + So_t(:) = TkFrz + + ! Set export state ocean fraction (So_omask) + So_omask(:) = ocn_fraction(:) + + end subroutine docn_datamode_copyall_init_pointers + + !=============================================================================== + subroutine docn_datamode_copyall_advance(rc) + + ! input/output variables + integer, intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(docn_datamode_copyall_advance): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + So_t(:) = So_t(:) + TkFrz + + end subroutine docn_datamode_copyall_advance + +end module docn_datamode_copyall_mod From 1330bda66353b9e36dc19829b70de4f185826504 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 18 Dec 2025 22:11:42 +0100 Subject: [PATCH 07/61] refactored docn, dice and dlnd stream usage --- dice/dice_datamode_cplhist_mod.F90 | 9 +- dice/ice_comp_nuopc.F90 | 5 +- dlnd/dlnd_datamode_glc_forcing_mod.F90 | 18 +- dlnd/dlnd_datamode_rof_forcing_mod.F90 | 19 +- dlnd/lnd_comp_nuopc.F90 | 21 +-- docn/CMakeLists.txt | 3 +- docn/cime_config/config_component.xml | 2 +- docn/cime_config/namelist_definition_docn.xml | 7 +- docn/docn_datamode_copyall_mod.F90 | 126 ------------- docn/docn_datamode_cplhist_mod.F90 | 65 +++++-- docn/docn_datamode_dom_mod.F90 | 58 +++--- docn/docn_datamode_iaf_mod.F90 | 172 ------------------ docn/docn_datamode_multilev_cplhist_mod.F90 | 1 + docn/docn_datamode_multilev_dom_mod.F90 | 63 ++++--- docn/docn_datamode_multilev_mod.F90 | 34 ++-- docn/docn_datamode_som_mod.F90 | 86 +++++++-- docn/ocn_comp_nuopc.F90 | 123 +++---------- 17 files changed, 295 insertions(+), 517 deletions(-) delete mode 100644 docn/docn_datamode_copyall_mod.F90 delete mode 100644 docn/docn_datamode_iaf_mod.F90 diff --git a/dice/dice_datamode_cplhist_mod.F90 b/dice/dice_datamode_cplhist_mod.F90 index cd1d96794..1dcf83b4f 100644 --- a/dice/dice_datamode_cplhist_mod.F90 +++ b/dice/dice_datamode_cplhist_mod.F90 @@ -1,5 +1,8 @@ module dice_datamode_cplhist_mod + ! The dice cplhist datamode is only used by UFS currently and does not have + ! a corresponding entry in the cime_config/stream_defintition.xml file + use ESMF , only : ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_Field @@ -92,11 +95,15 @@ subroutine dice_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_ end subroutine dice_datamode_cplhist_advertise !=============================================================================== - subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, rc) + subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & + flds_scalar_name, logunit, mainproc, rc) ! input/output variables type(ESMF_State) , intent(inout) :: importState type(ESMF_State) , intent(inout) :: exportState + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(in) :: logunit + logical , intent(in) :: mainproc type(shr_strdata_type) , intent(in) :: sdat integer , intent(out) :: rc diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index c2cdc0cd1..e71ebc546 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -508,7 +508,8 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod call dice_datamode_ssmi_init_pointers(importState, exportState, sdat, flds_i2o_per_cat, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return case('cplhist') - call dice_datamode_cplhist_init_pointers(importState,exportState,sdat,rc) + call dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & + flds_scalar_name, logunit, mainproc, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return end select @@ -551,7 +552,7 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod flux_swpf, flux_Qmin, flux_Qacc, flux_Qacc0, dt, logunit, restart_read, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('cplhist') - call dice_datamode_cplhist_advance(rc) + call dice_datamode_cplhist_advance(sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select diff --git a/dlnd/dlnd_datamode_glc_forcing_mod.F90 b/dlnd/dlnd_datamode_glc_forcing_mod.F90 index 541827759..535529efb 100644 --- a/dlnd/dlnd_datamode_glc_forcing_mod.F90 +++ b/dlnd/dlnd_datamode_glc_forcing_mod.F90 @@ -1,13 +1,14 @@ module dlnd_datamode_glc_forcing_mod use ESMF , only : ESMF_SUCCESS, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_State + use ESMF , only : ESMF_TraceRegionExit, ESMF_TraceRegionEnter use ESMF , only : ESMF_StateItem_Flag, ESMF_GridComp use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add + use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use glc_elevclass_mod, only : glc_elevclass_as_string, glc_elevclass_init implicit none @@ -22,6 +23,8 @@ module dlnd_datamode_glc_forcing_mod integer :: glc_nec + type(dfield_type), pointer :: dfields => null() + character(*), parameter :: nullstr = 'null' character(*), parameter :: u_FILE_u = & __FILE__ @@ -86,12 +89,11 @@ subroutine dlnd_datamode_glc_forcing_advertise(gcomp, exportState, fldsExport, f end subroutine dlnd_datamode_glc_forcing_advertise !=============================================================================== - subroutine dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, dfields, model_frac, datamode, logunit, mainproc, rc) + subroutine dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, model_frac, datamode, logunit, mainproc, rc) ! input/output variables type(ESMF_State) , intent(inout) :: exportState type(shr_strdata_type), intent(in) :: sdat - type(dfield_type) , pointer :: dfields real(r8) , intent(in) :: model_frac(:) character(len=*) , intent(in) :: datamode integer , intent(in) :: logunit @@ -160,10 +162,11 @@ subroutine dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, dfields, m end subroutine dlnd_datamode_glc_forcing_init_pointers !=============================================================================== - subroutine dlnd_datamode_glc_forcing_advance(exportState, rc) + subroutine dlnd_datamode_glc_forcing_advance(exportState, sdat, rc) ! input/output variables type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type), intent(in) :: sdat integer , intent(out) :: rc ! local variables @@ -174,6 +177,13 @@ subroutine dlnd_datamode_glc_forcing_advance(exportState, rc) rc = ESMF_SUCCESS + ! copy all fields from streams to export state as default + ! This automatically will update the fields in the export state + call ESMF_TraceRegionEnter('dlnd_dfield_copy') + call dshr_dfield_copy(dfields, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TraceRegionExit('dlnd_dfield_copy') + ! Set special value over masked points call dshr_state_getfldptr(exportState, 'Sl_tsrf_elev', fldptr2=fldptr2, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return diff --git a/dlnd/dlnd_datamode_rof_forcing_mod.F90 b/dlnd/dlnd_datamode_rof_forcing_mod.F90 index 2576e5ac5..86deba943 100644 --- a/dlnd/dlnd_datamode_rof_forcing_mod.F90 +++ b/dlnd/dlnd_datamode_rof_forcing_mod.F90 @@ -1,14 +1,14 @@ module dlnd_datamode_rof_forcing_mod use ESMF , only : ESMF_SUCCESS, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_State - use ESMF , only : ESMF_StateItem_Flag + use ESMF , only : ESMF_TraceRegionExit, ESMF_TraceRegionEnter 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_string_mod , only : shr_string_listGetNum, shr_string_listGetName use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add + use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use shr_lnd2rof_tracers_mod , only : shr_lnd2rof_tracers_readnl implicit none @@ -33,6 +33,8 @@ module dlnd_datamode_rof_forcing_mod integer :: ntracers_nonh2o + type(dfield_type), pointer :: dfields => null() + character(*), parameter :: nullstr = 'null' character(*), parameter :: u_FILE_u = & __FILE__ @@ -107,12 +109,11 @@ end subroutine dlnd_datamode_rof_forcing_advertise !=============================================================================== - subroutine dlnd_datamode_rof_forcing_init_pointers(exportState, sdat, dfields, model_frac, logunit, mainproc, rc) + subroutine dlnd_datamode_rof_forcing_init_pointers(exportState, sdat, model_frac, logunit, mainproc, rc) ! input/output variables type(ESMF_State) , intent(inout) :: exportState type(shr_strdata_type), intent(in) :: sdat - type(dfield_type) , pointer :: dfields real(r8) , intent(in) :: model_frac(:) integer , intent(in) :: logunit logical , intent(in) :: mainproc @@ -165,10 +166,11 @@ subroutine dlnd_datamode_rof_forcing_init_pointers(exportState, sdat, dfields, m end subroutine dlnd_datamode_rof_forcing_init_pointers !=============================================================================== - subroutine dlnd_datamode_rof_forcing_advance(exportState, rc) + subroutine dlnd_datamode_rof_forcing_advance(exportState, sdat, rc) ! input/output variables type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type), intent(in) :: sdat integer , intent(out) :: rc ! local variables @@ -181,6 +183,13 @@ subroutine dlnd_datamode_rof_forcing_advance(exportState, rc) rc = ESMF_SUCCESS + ! copy all fields from streams to export state as default + ! This automatically will update the fields in the export state + call ESMF_TraceRegionEnter('dlnd_dfield_copy') + call dshr_dfield_copy(dfields, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TraceRegionExit('dlnd_dfield_copy') + if (ntracers_nonh2o > 0) then ! Set special value over masked points if (ntracers_nonh2o == 1) then diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index bc40bb32e..fc262193f 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -32,7 +32,6 @@ module cdeps_dlnd_comp use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_check_restart_alarm use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize ! Datamode specialized modules @@ -91,7 +90,6 @@ module cdeps_dlnd_comp ! linked lists type(fldList_type) , pointer :: fldsExport => null() - type(dfield_type) , pointer :: dfields => null() ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() @@ -458,16 +456,16 @@ subroutine dlnd_comp_run(importState, exportState, target_ymd, target_tod, rc) !-------------------- if (first_time) then - ! Initialize datamode module pointers AND dfields + ! Initialize datamode module pointers and dfields select case (trim(datamode)) case('glc_forcing_mct') - call dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, dfields, model_frac, datamode, logunit, mainproc, rc) + call dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, model_frac, datamode, logunit, mainproc, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('glc_forcing') - call dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, dfields, model_frac, datamode, logunit, mainproc, rc) + call dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, model_frac, datamode, logunit, mainproc, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('rof_forcing') - call dlnd_datamode_rof_forcing_init_pointers(exportState, sdat, dfields, model_frac, logunit, mainproc, rc) + call dlnd_datamode_rof_forcing_init_pointers(exportState, sdat, model_frac, logunit, mainproc, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select @@ -484,18 +482,11 @@ subroutine dlnd_comp_run(importState, exportState, target_ymd, target_tod, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dlnd_strdata_advance') - ! copy all fields from streams to export state as default - ! This automatically will update the fields in the export state - call ESMF_TraceRegionEnter('dlnd_dfield_copy') - call dshr_dfield_copy(dfields, sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('dlnd_dfield_copy') - if (trim(datamode) == 'glc_forcing_mct' .or. trim(datamode) == 'glc_forcing' ) then - call dlnd_datamode_glc_forcing_advance(exportState, rc=rc) + call dlnd_datamode_glc_forcing_advance(exportState, sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else if (trim(datamode) == 'rof_forcing') then - call dlnd_datamode_rof_forcing_advance(exportState, rc=rc) + call dlnd_datamode_rof_forcing_advance(exportState, sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index ab12861cd..1484c7844 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -1,9 +1,8 @@ project(docn Fortran) set(SRCFILES ocn_comp_nuopc.F90 - docn_datamode_copyall_mod.F90 + docn_datamode_dom_mod.F90 docn_datamode_som_mod.F90 docn_datamode_aquaplanet_mod.F90 - docn_datamode_iaf_mod.F90 docn_datamode_cplhist_mod.F90 docn_datamode_multilev_mod.F90 docn_datamode_multilev_dom_mod.F90 diff --git a/docn/cime_config/config_component.xml b/docn/cime_config/config_component.xml index 114eb7f8d..35bedecc8 100644 --- a/docn/cime_config/config_component.xml +++ b/docn/cime_config/config_component.xml @@ -52,9 +52,9 @@ prescribed prescribed + interannual som som_aquap - interannual sst_aquap1 sst_aquap2 sst_aquap3 diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index 03b43af9d..b132643f7 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -56,8 +56,6 @@ to the data ocean model. They are normally found in the same file because the SST and ice fraction data are derived from the same observational data sets and are consistent with each other. - ==> dataMode = "iaf" - iaf is the interannually varying version of sstdata The ocean salinity is set to a constant reference salinity value. All other fields other than SST and ocean salinity are set to zero. ==> dataMode = "som" @@ -75,8 +73,8 @@ application. A tool is available to derive valid SOM forcing. (1) map the xml variable DOCN_MODE => config variable docn_mode => namelist variable datamode - compset="_DOCN%DOM_" => docn_mode=prescribed => datamode=prescribed - compset="_DOCN%IAF_" => docn_mode=interannual => datamode=interannual + compset="_DOCN%DOM_" => docn_mode=prescribed => datamode=sstdata + compset="_DOCN%IAF_" => docn_mode=interannual => datamode=sstdata compset="_DOCN%SOM_" => docn_mode=som => datamode=som compset="_DOCN%SOMAQP_" => docn_mode=som_aquap => datamode=som_aquap compset="_DOCN%AQP1_" => docn_mode=sst_aquap1 => datamode=sst_aquap1 @@ -96,7 +94,6 @@ sstdata som som_aquap - iaf sst_aquap1 sst_aquap2 sst_aquap3 diff --git a/docn/docn_datamode_copyall_mod.F90 b/docn/docn_datamode_copyall_mod.F90 deleted file mode 100644 index a6628f56d..000000000 --- a/docn/docn_datamode_copyall_mod.F90 +++ /dev/null @@ -1,126 +0,0 @@ -module docn_datamode_copyall_mod - - use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS - 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_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal - use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr - use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use dshr_strdata_mod , only : shr_strdata_type - - implicit none - private ! except - - public :: docn_datamode_copyall_advertise - public :: docn_datamode_copyall_init_pointers - public :: docn_datamode_copyall_advance - - ! export fields - real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator - real(r8), pointer :: So_t(:) => null() - real(r8), pointer :: So_u(:) => null() - real(r8), pointer :: So_v(:) => null() - real(r8), pointer :: So_s(:) => null() - - real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) - real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity - - character(*) , parameter :: nullstr = 'null' - character(*) , parameter :: u_FILE_u = & - __FILE__ - -!=============================================================================== -contains -!=============================================================================== - - subroutine docn_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) - - ! input/output variables - type(esmf_State) , intent(inout) :: exportState - type(fldlist_type) , pointer :: fldsexport - character(len=*) , intent(in) :: flds_scalar_name - integer , intent(out) :: rc - - ! local variables - type(fldlist_type), pointer :: fldList - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! Advertise export fields - call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) - call dshr_fldList_add(fldsExport, 'So_omask' ) - call dshr_fldList_add(fldsExport, 'So_t' ) - call dshr_fldList_add(fldsExport, 'So_s' ) - call dshr_fldList_add(fldsExport, 'So_u' ) - call dshr_fldList_add(fldsExport, 'So_v' ) - - fldlist => fldsExport ! the head of the linked list - do while (associated(fldlist)) - call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite('(docn_comp_advertise): Fr_ocn'//trim(fldList%stdname), ESMF_LOGMSG_INFO) - fldList => fldList%next - enddo - - end subroutine docn_datamode_copyall_advertise - - !=============================================================================== - subroutine docn_datamode_copyall_init_pointers(exportState, ocn_fraction, rc) - - ! input/output variables - type(ESMF_State) , intent(inout) :: exportState - real(r8) , intent(in) :: ocn_fraction(:) - integer , intent(out) :: rc - - ! local variables - character(len=*), parameter :: subname='(docn_init_pointers): ' - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! initialize pointers to export fields - call dshr_state_getfldptr(exportState, 'So_omask' , fldptr1=So_omask , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_t' , fldptr1=So_t , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_s' , fldptr1=So_s , allowNullReturn=.true., rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_u' , fldptr1=So_u , allowNullReturn=.true., rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_v' , fldptr1=So_v , allowNullReturn=.true., rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - if (associated(So_u)) then - So_u(:) = 0.0_r8 - end if - if (associated(So_v)) then - So_v(:) = 0.0_r8 - end if - if (associated(So_s)) then - So_s(:) = ocnsalt - end if - So_t(:) = TkFrz - - ! Set export state ocean fraction (So_omask) - So_omask(:) = ocn_fraction(:) - - end subroutine docn_datamode_copyall_init_pointers - - !=============================================================================== - subroutine docn_datamode_copyall_advance(rc) - - ! input/output variables - integer, intent(out) :: rc - - ! local variables - character(len=*), parameter :: subname='(docn_datamode_copyall_advance): ' - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - So_t(:) = So_t(:) + TkFrz - - end subroutine docn_datamode_copyall_advance - -end module docn_datamode_copyall_mod diff --git a/docn/docn_datamode_cplhist_mod.F90 b/docn/docn_datamode_cplhist_mod.F90 index 7228e094d..d70c0757f 100644 --- a/docn/docn_datamode_cplhist_mod.F90 +++ b/docn/docn_datamode_cplhist_mod.F90 @@ -3,10 +3,11 @@ module docn_datamode_cplhist_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS 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_log_mod , only : shr_log_error use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use dshr_strdata_mod , only : shr_strdata_type + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer implicit none private ! except @@ -15,13 +16,19 @@ module docn_datamode_cplhist_mod public :: docn_datamode_cplhist_init_pointers public :: docn_datamode_cplhist_advance - ! export fields + ! export field pointers real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator real(r8), pointer :: So_t(:) => null() real(r8), pointer :: So_u(:) => null() real(r8), pointer :: So_v(:) => null() real(r8), pointer :: So_bldepth(:) => null() + ! stream field pointers + real(r8), pointer :: strm_So_bldepth(:) => null() + real(r8), pointer :: strm_So_t(:) => null() + real(r8), pointer :: strm_So_u(:) => null() + real(r8), pointer :: strm_So_v(:) => null() + real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity @@ -66,12 +73,13 @@ subroutine docn_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_ end subroutine docn_datamode_cplhist_advertise !=============================================================================== - subroutine docn_datamode_cplhist_init_pointers(exportState, ocn_fraction, rc) + subroutine docn_datamode_cplhist_init_pointers(exportState, sdat, ocn_fraction, rc) ! input/output variables - type(ESMF_State) , intent(inout) :: exportState - real(r8) , intent(in) :: ocn_fraction(:) - integer , intent(out) :: rc + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + real(r8) , intent(in) :: ocn_fraction(:) + integer , intent(out) :: rc ! local variables character(len=*), parameter :: subname='(docn_init_pointers): ' @@ -91,7 +99,35 @@ subroutine docn_datamode_cplhist_init_pointers(exportState, ocn_fraction, rc) call dshr_state_getfldptr(exportState, 'So_bldepth', fldptr1=So_bldepth, allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - !Allocation depends on exchanged fields, so check before filling arrays with values here + ! initialize stream pointers + call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_u', strm_So_u, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_v', strm_So_v, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_bldepth', strm_So_bldepth, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Error checks + if (.not. associated(strm_So_t)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_t must be associated for docn cplhist mode') + return + end if + if (.not. associated(strm_So_u)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_u must be associated for docn cplhist mode') + return + end if + if (.not. associated(strm_So_v)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_v must be associated for docn cplhist mode') + return + end if + if (.not. associated(strm_So_bldepth)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_bldepth must be associated for docn cplhist mode') + return + end if + + ! Allocation depends on exchanged fields, so check before filling arrays with values here if (associated(So_u)) So_u(:) = 0.0_r8 if (associated(So_v)) So_v(:) = 0.0_r8 if (associated(So_t)) So_t(:) = TkFrz @@ -115,13 +151,18 @@ subroutine docn_datamode_cplhist_advance(sst_constant_value, rc) !------------------------------------------------------------------------------- rc = ESMF_SUCCESS + + So_t(:) = strm_So_t(:) + So_u(:) = strm_So_u(:) + So_v(:) = strm_So_v(:) + So_bldepth(:) = strm_So_bldepth(:) + + ! If need unit conversion for So_t (C-->K), + ! use existing nml variable sst_constant_value to signal units of input + ! i.e., 0-->Celsius, 273.15-->K - !If need unit conversion for So_t (C-->K), - !use existing nml variable sst_constant_value to signal units of input - !i.e., 0-->Celsius, 273.15-->K - if (present(sst_constant_value)) then - if(sst_constant_value .GT. 230.0_r8) then !interpret input SST in K + if (sst_constant_value > 230.0_r8) then !interpret input SST in K units_CToK = .false. !in K already, don't convert endif endif diff --git a/docn/docn_datamode_dom_mod.F90 b/docn/docn_datamode_dom_mod.F90 index a6628f56d..aead7bea1 100644 --- a/docn/docn_datamode_dom_mod.F90 +++ b/docn/docn_datamode_dom_mod.F90 @@ -1,8 +1,9 @@ -module docn_datamode_copyall_mod +module docn_datamode_dom_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS 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_log_mod , only : shr_log_error use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add @@ -11,9 +12,9 @@ module docn_datamode_copyall_mod implicit none private ! except - public :: docn_datamode_copyall_advertise - public :: docn_datamode_copyall_init_pointers - public :: docn_datamode_copyall_advance + public :: docn_datamode_dom_advertise + public :: docn_datamode_dom_init_pointers + public :: docn_datamode_dom_advance ! export fields real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator @@ -22,6 +23,9 @@ module docn_datamode_copyall_mod real(r8), pointer :: So_v(:) => null() real(r8), pointer :: So_s(:) => null() + ! pointer to stream field + real(r8), pointer :: strm_So_t(:) => null() + real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity @@ -33,7 +37,7 @@ module docn_datamode_copyall_mod contains !=============================================================================== - subroutine docn_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) + subroutine docn_datamode_dom_advertise(exportState, fldsexport, flds_scalar_name, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState @@ -63,15 +67,16 @@ subroutine docn_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_ fldList => fldList%next enddo - end subroutine docn_datamode_copyall_advertise + end subroutine docn_datamode_dom_advertise !=============================================================================== - subroutine docn_datamode_copyall_init_pointers(exportState, ocn_fraction, rc) + subroutine docn_datamode_dom_init_pointers(exportState, sdat, ocn_fraction, rc) ! input/output variables - type(ESMF_State) , intent(inout) :: exportState - real(r8) , intent(in) :: ocn_fraction(:) - integer , intent(out) :: rc + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + real(r8) , intent(in) :: ocn_fraction(:) + integer , intent(out) :: rc ! local variables character(len=*), parameter :: subname='(docn_init_pointers): ' @@ -91,36 +96,39 @@ subroutine docn_datamode_copyall_init_pointers(exportState, ocn_fraction, rc) call dshr_state_getfldptr(exportState, 'So_v' , fldptr1=So_v , allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - if (associated(So_u)) then - So_u(:) = 0.0_r8 - end if - if (associated(So_v)) then - So_v(:) = 0.0_r8 - end if - if (associated(So_s)) then - So_s(:) = ocnsalt + ! initialize pointer to stream field + call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Error checks + if (.not. associated(strm_So_t)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_t must be associated for docn iaf mode') + return end if - So_t(:) = TkFrz - ! Set export state ocean fraction (So_omask) + ! Initialize value of export state So_omask(:) = ocn_fraction(:) + So_t(:) = TkFrz + if (associated(So_u)) So_u(:) = 0.0_r8 + if (associated(So_v)) So_v(:) = 0.0_r8 + if (associated(So_s)) So_s(:) = ocnsalt - end subroutine docn_datamode_copyall_init_pointers + end subroutine docn_datamode_dom_init_pointers !=============================================================================== - subroutine docn_datamode_copyall_advance(rc) + subroutine docn_datamode_dom_advance(rc) ! input/output variables integer, intent(out) :: rc ! local variables - character(len=*), parameter :: subname='(docn_datamode_copyall_advance): ' + character(len=*), parameter :: subname='(docn_datamode_dom_advance): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS So_t(:) = So_t(:) + TkFrz - end subroutine docn_datamode_copyall_advance + end subroutine docn_datamode_dom_advance -end module docn_datamode_copyall_mod +end module docn_datamode_dom_mod diff --git a/docn/docn_datamode_iaf_mod.F90 b/docn/docn_datamode_iaf_mod.F90 deleted file mode 100644 index a4d0dc5ae..000000000 --- a/docn/docn_datamode_iaf_mod.F90 +++ /dev/null @@ -1,172 +0,0 @@ -module docn_datamode_iaf_mod - - use ESMF , only : ESMF_SUCCESS, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_State - 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_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal - use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type - use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr - use dshr_strdata_mod , only : shr_strdata_type - use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - - implicit none - private ! except - - public :: docn_datamode_iaf_advertise - public :: docn_datamode_iaf_init_pointers - public :: docn_datamode_iaf_advance - - ! export fields - real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator - real(r8), pointer :: So_t(:) => null() - real(r8), pointer :: So_s(:) => null() - real(r8), pointer :: So_u(:) => null() - real(r8), pointer :: So_v(:) => null() - - ! import fields - real(r8), pointer :: Foxx_swnet(:) => null() - real(r8), pointer :: Foxx_lwup(:) => null() - real(r8), pointer :: Foxx_sen(:) => null() - real(r8), pointer :: Foxx_lat(:) => null() - real(r8), pointer :: Faxa_lwdn(:) => null() - real(r8), pointer :: Faxa_snow(:) => null() - real(r8), pointer :: Fioi_melth(:) => null() - real(r8), pointer :: Foxx_rofi(:) => null() - - real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) - real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity - - character(*) , parameter :: u_FILE_u = & - __FILE__ - -!=============================================================================== -contains -!=============================================================================== - - subroutine docn_datamode_iaf_advertise(importState, exportState, fldsimport, fldsexport, flds_scalar_name, rc) - - ! input/output variables - type(esmf_State) , intent(inout) :: importState - type(esmf_State) , intent(inout) :: exportState - type(fldlist_type) , pointer :: fldsimport - type(fldlist_type) , pointer :: fldsexport - character(len=*) , intent(in) :: flds_scalar_name - integer , intent(out) :: rc - - ! local variables - type(fldlist_type), pointer :: fldList - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! Advertise export fields - call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) - call dshr_fldList_add(fldsExport, 'So_omask' ) - call dshr_fldList_add(fldsExport, 'So_t' ) - call dshr_fldList_add(fldsExport, 'So_s' ) - call dshr_fldList_add(fldsExport, 'So_u' ) - call dshr_fldList_add(fldsExport, 'So_v' ) - - ! Advertise import fields - call dshr_fldList_add(fldsImport, trim(flds_scalar_name)) - call dshr_fldList_add(fldsImport, 'Foxx_swnet' ) - call dshr_fldList_add(fldsImport, 'Foxx_lwup' ) - call dshr_fldList_add(fldsImport, 'Foxx_sen' ) - call dshr_fldList_add(fldsImport, 'Foxx_lat' ) - call dshr_fldList_add(fldsImport, 'Faxa_lwdn' ) - call dshr_fldList_add(fldsImport, 'Faxa_snow' ) - call dshr_fldList_add(fldsImport, 'Fioi_melth' ) - call dshr_fldList_add(fldsImport, 'Foxx_rofi' ) - - fldlist => fldsExport ! the head of the linked list - do while (associated(fldlist)) - call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite('(docn_comp_advertise): Fr_ocn'//trim(fldList%stdname), ESMF_LOGMSG_INFO) - fldList => fldList%next - enddo - - fldlist => fldsImport ! the head of the linked list - do while (associated(fldlist)) - call NUOPC_Advertise(importState, standardName=fldlist%stdname, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite('(docn_comp_advertise): Fr_ocn'//trim(fldList%stdname), ESMF_LOGMSG_INFO) - fldList => fldList%next - enddo - - end subroutine docn_datamode_iaf_advertise - - !=============================================================================== - subroutine docn_datamode_iaf_init_pointers(importState, exportState, ocn_fraction, rc) - - ! input/output variables - type(ESMF_State) , intent(inout) :: exportState - type(ESMF_State) , intent(inout) :: importState - real(r8) , intent(in) :: ocn_fraction(:) - integer , intent(out) :: rc - - ! local variables - character(len=*), parameter :: subname='(docn_init_pointers): ' - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! initialize pointers to export fields - call dshr_state_getfldptr(exportState, 'So_omask' , fldptr1=So_omask , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_t' , fldptr1=So_t , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_s' , fldptr1=So_s , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_u' , fldptr1=So_u , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_v' , fldptr1=So_v , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! initialize pointers to import fields - call dshr_state_getfldptr(importState, 'Foxx_swnet' , fldptr1=Foxx_swnet , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Foxx_lwup' , fldptr1=Foxx_lwup , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Foxx_lwup' , fldptr1=Foxx_lwup , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Foxx_sen' , fldptr1=Foxx_sen , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Foxx_lat' , fldptr1=Foxx_lat , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Faxa_snow' , fldptr1=Faxa_snow , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Fioi_melth' , fldptr1=Fioi_melth , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Foxx_rofi' , fldptr1=Foxx_rofi , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! Set export state ocean fraction (So_omask) - So_omask(:) = ocn_fraction(:) - - ! Initialize export state pointers to non-zero - So_t(:) = TkFrz - So_s(:) = ocnsalt - - end subroutine docn_datamode_iaf_init_pointers - - !=============================================================================== - subroutine docn_datamode_iaf_advance(rc) - - ! input/output variables - integer, intent(out) :: rc - - ! local variables - character(len=*), parameter :: subname='(docn_datamode_iaf): ' - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - So_t(:) = So_t(:) + TkFrz - So_s(:) = ocnsalt - - end subroutine docn_datamode_iaf_advance - -end module docn_datamode_iaf_mod diff --git a/docn/docn_datamode_multilev_cplhist_mod.F90 b/docn/docn_datamode_multilev_cplhist_mod.F90 index 2f79cd117..fb1f13f08 100644 --- a/docn/docn_datamode_multilev_cplhist_mod.F90 +++ b/docn/docn_datamode_multilev_cplhist_mod.F90 @@ -3,6 +3,7 @@ module docn_datamode_multilev_cplhist_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS 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_log_mod , only : shr_log_error use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal, shr_const_spval use shr_sys_mod , only : shr_sys_abort use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr diff --git a/docn/docn_datamode_multilev_dom_mod.F90 b/docn/docn_datamode_multilev_dom_mod.F90 index e292b8ade..b03d6530c 100644 --- a/docn/docn_datamode_multilev_dom_mod.F90 +++ b/docn/docn_datamode_multilev_dom_mod.F90 @@ -26,8 +26,9 @@ module docn_datamode_multilev_dom_mod real(r8), pointer :: So_s(:) => null() ! pointers to stream fields - real(r8), pointer :: stream_So_t_depth(:,:) => null() - real(r8), pointer :: stream_So_s_depth(:,:) => null() + real(r8), pointer :: strm_So_t(:) + real(r8), pointer :: strm_So_t_depth(:,:) => null() + real(r8), pointer :: strm_So_s_depth(:,:) => null() integer, parameter :: nlev_export = 30 real(r8) :: vertical_levels(nlev_export) = (/ & @@ -66,10 +67,10 @@ subroutine docn_datamode_multilev_dom_advertise(exportState, fldsexport, flds_sc call dshr_fldList_add(fldsExport, 'So_omask') call dshr_fldList_add(fldsExport, 'So_t_depth', ungridded_lbound=1, ungridded_ubound=nlev_export) call dshr_fldList_add(fldsExport, 'So_s_depth', ungridded_lbound=1, ungridded_ubound=nlev_export) - call dshr_fldList_add(fldsExport, 'So_t' ) - call dshr_fldList_add(fldsExport, 'So_s' ) - call dshr_fldList_add(fldsExport, 'So_u' ) - call dshr_fldList_add(fldsExport, 'So_v' ) + call dshr_fldList_add(fldsExport, 'So_t') + call dshr_fldList_add(fldsExport, 'So_s') + call dshr_fldList_add(fldsExport, 'So_u') + call dshr_fldList_add(fldsExport, 'So_v') fldlist => fldsExport ! the head of the linked list do while (associated(fldlist)) @@ -98,11 +99,30 @@ subroutine docn_datamode_multilev_dom_init_pointers(exportState, sdat, ocn_fract ! initialize pointers to stream fields ! this has the full set of leveles in the stream data - call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', stream_So_t_depth, rc=rc) + call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', stream_So_s_depth, rc=rc) + call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + ! error checks for stream pointers + if (.not. associated(strm_So_t)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_t must be associated for docn multilev_dom mode') + return + end if + if (.not. associated(strm_So_t_depth)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_dom mode') + return + end if + if (.not. associated(strm_So_s_depth)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_s_depth must be associated for docn multilev_dom mode') + return + end if + + ! initialize pointers to export fields + call dshr_state_getfldptr(exportState, 'So_omask', fldptr1=So_omask , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'So_t', fldptr1=So_t, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'So_s', fldptr1=So_s, rc=rc) @@ -111,14 +131,9 @@ subroutine docn_datamode_multilev_dom_init_pointers(exportState, sdat, ocn_fract if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'So_v', fldptr1=So_v, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! initialize pointers to export fields - ! the export state has only nlev_export levels - call dshr_state_getfldptr(exportState, 'So_omask' , fldptr1=So_omask , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_t_depth' , fldptr2=So_t_depth , rc=rc) + call dshr_state_getfldptr(exportState, 'So_t_depth', fldptr2=So_t_depth , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_s_depth' , fldptr2=So_s_depth , rc=rc) + call dshr_state_getfldptr(exportState, 'So_s_depth', fldptr2=So_s_depth , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return ! Initialize export state pointers to non-zero @@ -158,7 +173,7 @@ subroutine docn_datamode_multilev_dom_advance(sdat, logunit, mainproc, rc) rc = ESMF_SUCCESS - So_t(:) = So_t(:) + TkFrz + So_t(:) = strm_So_t(:) + TkFrz ! Determine number of vertical levels for multi level stream nstreams = shr_strdata_get_stream_count(sdat) @@ -190,21 +205,21 @@ subroutine docn_datamode_multilev_dom_advance(sdat, logunit, mainproc, rc) So_s_depth(ko,i) = shr_const_spval else ! Assume input T forcing is in degrees C - if (stream_So_t_depth(ki+1,i) > 1.e10) then - if (stream_So_t_depth(ki,i) > 1.e10) then + if (strm_So_t_depth(ki+1,i) > 1.e10) then + if (strm_So_t_depth(ki,i) > 1.e10) then So_t_depth(ko,i) = shr_const_spval So_s_depth(ko,i) = shr_const_spval else - So_t_depth(ko,i) = stream_So_t_depth(ki,i) + shr_const_tkfrz - So_s_depth(ko,i) = stream_So_s_depth(ki,i) + So_t_depth(ko,i) = strm_So_t_depth(ki,i) + shr_const_tkfrz + So_s_depth(ko,i) = strm_So_s_depth(ki,i) end if else - factor = (stream_So_t_depth(ki+1,i)-stream_So_t_depth(ki,i))/(stream_vlevs(ki+1)-stream_vlevs(ki)) - So_t_depth(ko,i) = stream_So_t_depth(ki,i) + (vertical_levels(ko)-stream_vlevs(ki))*factor + factor = (strm_So_t_depth(ki+1,i)-strm_So_t_depth(ki,i))/(stream_vlevs(ki+1)-stream_vlevs(ki)) + So_t_depth(ko,i) = strm_So_t_depth(ki,i) + (vertical_levels(ko)-stream_vlevs(ki))*factor So_t_depth(ko,i) = So_t_depth(ko,i) + shr_const_tkfrz - factor = (stream_So_s_depth(ki+1,i)-stream_So_s_depth(ki,i))/(stream_vlevs(ki+1)-stream_vlevs(ki)) - So_s_depth(ko,i) = stream_So_s_depth(ki,i) + (vertical_levels(ko)-stream_vlevs(ki))*factor + factor = (strm_So_s_depth(ki+1,i)-strm_So_s_depth(ki,i))/(stream_vlevs(ki+1)-stream_vlevs(ki)) + So_s_depth(ko,i) = strm_So_s_depth(ki,i) + (vertical_levels(ko)-stream_vlevs(ki))*factor end if end if end do diff --git a/docn/docn_datamode_multilev_mod.F90 b/docn/docn_datamode_multilev_mod.F90 index c3949a702..c9b24312d 100644 --- a/docn/docn_datamode_multilev_mod.F90 +++ b/docn/docn_datamode_multilev_mod.F90 @@ -21,8 +21,8 @@ module docn_datamode_multilev_mod real(r8), pointer :: So_s_depth(:,:) => null() ! pointers to stream fields - real(r8), pointer :: stream_So_t_depth(:,:) => null() - real(r8), pointer :: stream_So_s_depth(:,:) => null() + real(r8), pointer :: strm_So_t_depth(:,:) => null() + real(r8), pointer :: strm_So_s_depth(:,:) => null() integer, parameter :: nlev_export = 30 real(r8) :: vertical_levels(nlev_export) = (/ & @@ -86,11 +86,21 @@ subroutine docn_datamode_multilev_init_pointers(exportState, sdat, ocn_fraction, ! initialize pointers to stream fields ! this has the full set of leveles in the stream data - call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', stream_So_t_depth, rc=rc) + call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', stream_So_s_depth, rc=rc) + call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + ! error checks for stream pointers + if (.not. associated(strm_So_t_depth)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_dom mode') + return + end if + if (.not. associated(strm_So_s_depth)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_s_depth must be associated for docn multilev_dom mode') + return + end if + ! initialize pointers to export fields ! the export state has only nlev_export levels call dshr_state_getfldptr(exportState, 'So_omask' , fldptr1=So_omask , rc=rc) @@ -154,21 +164,21 @@ subroutine docn_datamode_multilev_advance(sdat, logunit, mainproc, rc) So_s_depth(ko,i) = shr_const_spval else ! Assume input T forcing is in degrees C - if (stream_So_t_depth(ki+1,i) > 1.e10) then - if (stream_So_t_depth(ki,i) > 1.e10) then + if (strm_So_t_depth(ki+1,i) > 1.e10) then + if (strm_So_t_depth(ki,i) > 1.e10) then So_t_depth(ko,i) = shr_const_spval So_s_depth(ko,i) = shr_const_spval else - So_t_depth(ko,i) = stream_So_t_depth(ki,i) + shr_const_tkfrz - So_s_depth(ko,i) = stream_So_s_depth(ki,i) + So_t_depth(ko,i) = strm_So_t_depth(ki,i) + shr_const_tkfrz + So_s_depth(ko,i) = strm_So_s_depth(ki,i) end if else - factor = (stream_So_t_depth(ki+1,i)-stream_So_t_depth(ki,i))/(stream_vlevs(ki+1)-stream_vlevs(ki)) - So_t_depth(ko,i) = stream_So_t_depth(ki,i) + (vertical_levels(ko)-stream_vlevs(ki))*factor + factor = (strm_So_t_depth(ki+1,i)-strm_So_t_depth(ki,i))/(stream_vlevs(ki+1)-stream_vlevs(ki)) + So_t_depth(ko,i) = strm_So_t_depth(ki,i) + (vertical_levels(ko)-stream_vlevs(ki))*factor So_t_depth(ko,i) = So_t_depth(ko,i) + shr_const_tkfrz - factor = (stream_So_s_depth(ki+1,i)-stream_So_s_depth(ki,i))/(stream_vlevs(ki+1)-stream_vlevs(ki)) - So_s_depth(ko,i) = stream_So_s_depth(ki,i) + (vertical_levels(ko)-stream_vlevs(ki))*factor + factor = (strm_So_s_depth(ki+1,i)-strm_So_s_depth(ki,i))/(stream_vlevs(ki+1)-stream_vlevs(ki)) + So_s_depth(ko,i) = strm_So_s_depth(ki,i) + (vertical_levels(ko)-stream_vlevs(ki))*factor end if end if end do diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index b3947d697..991dafa6e 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -6,6 +6,7 @@ module docn_datamode_som_mod use ESMF , only : ESMF_LogWrite 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_log_mod , only : shr_log_error use shr_const_mod , only : shr_const_cpsw, shr_const_rhosw, shr_const_TkFrz use shr_const_mod , only : shr_const_TkFrzSw, shr_const_latice, shr_const_ocn_ref_sal use shr_const_mod , only : shr_const_zsrflyr, shr_const_pi @@ -47,9 +48,15 @@ module docn_datamode_som_mod real(r8), pointer :: Fioi_melth(:) => null() real(r8), pointer :: Foxx_rofi(:) => null() - ! internal stream type - real(r8), pointer :: strm_h(:) => null() - real(r8), pointer :: strm_qbot(:) => null() + ! pointers to stream fields + real(r8), pointer :: strm_So_t(:) => null() + real(r8), pointer :: strm_So_s(:) => null() + real(r8), pointer :: strm_So_u(:) => null() + real(r8), pointer :: strm_So_v(:) => null() + real(r8), pointer :: strm_So_dhdx(:) => null() + real(r8), pointer :: strm_So_dhdy(:) => null() + real(r8), pointer :: strm_So_h(:) => null() + real(r8), pointer :: strm_So_qbot(:) => null() ! restart fields real(R8), public, pointer :: somtp(:) ! SOM ocean temperature needed for restart @@ -150,12 +157,6 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f rc = ESMF_SUCCESS - ! initialize pointers to stream fields - call shr_strdata_get_stream_pointer( sdat, 'So_qbot', strm_qbot, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_h' , strm_h , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - ! initialize pointers to import fields call dshr_state_getfldptr(importState, 'Foxx_swnet' , fldptr1=Foxx_swnet , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -204,6 +205,58 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f So_fswpen(:) = swp end if + ! Initialize pointers to stream fields + call shr_strdata_get_stream_pointer( sdat, 'So_t' , strm_So_t, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_s' , strm_So_s, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_u' , strm_So_u, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_v' , strm_So_v, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_dhdx' , strm_So_dhdx, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_dhdy' , strm_So_dhdy, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_h' , strm_So_h, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_qbot' , strm_So_qbot, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Error checks for stream pointers + if (.not. associated(strm_So_t)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_t must be associated for docn som mode') + return + end if + if (.not. associated(strm_So_s)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_s must be associated for docn som mode') + return + end if + if (.not. associated(strm_So_u)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_u must be associated for docn som mode') + return + end if + if (.not. associated(strm_So_v)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_v must be associated for docn som mode') + return + end if + if (.not. associated(strm_So_dhdx)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_dhdx must be associated for docn som mode') + return + end if + if (.not. associated(strm_So_dhdy)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_dhdy must be associated for docn som mode') + return + end if + if (.not. associated(strm_So_h)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_h must be associated for docn som mode') + return + end if + if (.not. associated(strm_So_qbot)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_qbot must be associated for docn som mode') + return + end if + ! Set export state ocean fraction (So_omask) So_omask(:) = ocn_fraction(:) @@ -240,6 +293,13 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re rc = ESMF_SUCCESS + So_u(:) = strm_So_u(:) + So_u(:) = strm_So_v(:) + So_s(:) = strm_So_s(:) + So_dhdx(:) = strm_So_dhdx(:) + So_dhdy(:) = strm_So_dhdy(:) + So_t(:) = strm_So_t(:) + lsize = size(So_t) if (first_time) then @@ -273,16 +333,16 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re end if allocate(tfreeze(lsize)) - tfreeze(:) = shr_frz_freezetemp(So_s(:)) + TkFrz + tfreeze(:) = shr_frz_freezetemp(strm_So_s(:)) + TkFrz do n = 1,lsize if (So_omask(n) /= 0._r8) then ! compute new temp (last term is latent by prec and roff) So_t(n) = somtp(n) + & ( Foxx_swnet(n) + Foxx_lwup(n) + Faxa_lwdn(n) + Foxx_sen(n) + Foxx_lat(n) + & - Fioi_melth(n) - strm_qbot(n) - (Faxa_snow(n)+Foxx_rofi(n))*latice) * dt/(cpsw*rhosw* strm_h(n)) + Fioi_melth(n) - strm_So_qbot(n) - (Faxa_snow(n)+Foxx_rofi(n))*latice ) * dt/(cpsw*rhosw* strm_So_h(n)) ! compute ice formed or melt potential - Fioo_q(n) = (tfreeze(n) - So_t(n))*(cpsw*rhosw*strm_h(n))/dt ! ice formed q>0 + Fioo_q(n) = (tfreeze(n) - So_t(n))*(cpsw*rhosw*strm_So_h(n))/dt ! ice formed q>0 ! reset temp if (reset_temp) then @@ -291,7 +351,7 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re ! save somtp to restart file somtp(n) = So_t(n) - So_bldepth(n) = strm_h(n) + So_bldepth(n) = strm_So_h(n) endif end do deallocate(tfreeze) diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 5aab1dead..927bcfaa9 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -37,32 +37,36 @@ module cdeps_docn_comp use nuopc_shr_methods, only : shr_get_rpointer_name ! Datamode specialized modules - use docn_datamode_copyall_mod , only : docn_datamode_copyall_advertise - use docn_datamode_copyall_mod , only : docn_datamode_copyall_init_pointers - use docn_datamode_copyall_mod , only : docn_datamode_copyall_advance - use docn_datamode_iaf_mod , only : docn_datamode_iaf_advertise - use docn_datamode_iaf_mod , only : docn_datamode_iaf_init_pointers - use docn_datamode_iaf_mod , only : docn_datamode_iaf_advance + use docn_datamode_dom_mod , only : docn_datamode_dom_advertise + use docn_datamode_dom_mod , only : docn_datamode_dom_init_pointers + use docn_datamode_dom_mod , only : docn_datamode_dom_advance + use docn_datamode_som_mod , only : docn_datamode_som_advertise use docn_datamode_som_mod , only : docn_datamode_som_init_pointers use docn_datamode_som_mod , only : docn_datamode_som_advance use docn_datamode_som_mod , only : docn_datamode_som_restart_read use docn_datamode_som_mod , only : docn_datamode_som_restart_write + use docn_datamode_aquaplanet_mod , only : docn_datamode_aquaplanet_advertise use docn_datamode_aquaplanet_mod , only : docn_datamode_aquaplanet_init_pointers use docn_datamode_aquaplanet_mod , only : docn_datamode_aquaplanet_advance + use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_advertise use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_init_pointers use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_advance + use docn_datamode_multilev_cplhist_mod , only : docn_datamode_multilev_cplhist_advertise use docn_datamode_multilev_cplhist_mod , only : docn_datamode_multilev_cplhist_init_pointers use docn_datamode_multilev_cplhist_mod , only : docn_datamode_multilev_cplhist_advance + use docn_datamode_multilev_dom_mod , only : docn_datamode_multilev_dom_advertise use docn_datamode_multilev_dom_mod , only : docn_datamode_multilev_dom_init_pointers use docn_datamode_multilev_dom_mod , only : docn_datamode_multilev_dom_advance + use docn_datamode_multilev_mod , only : docn_datamode_multilev_advertise use docn_datamode_multilev_mod , only : docn_datamode_multilev_init_pointers use docn_datamode_multilev_mod , only : docn_datamode_multilev_advance + use docn_import_data_mod , only : docn_import_data_advertise implicit none @@ -301,7 +305,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Validate datamode if ( trim(datamode) == 'sstdata' .or. & ! read stream, no import data - trim(datamode) == 'iaf' .or. & ! read stream, needs import data? trim(datamode) == 'sst_aquap_file' .or. & ! read stream, no import data trim(datamode) == 'som' .or. & ! read stream, needs import data trim(datamode) == 'som_aquap' .or. & ! read stream, needs import data @@ -326,10 +329,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call docn_datamode_som_advertise(importState, exportState, fldsImport, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else if (trim(datamode) == 'sstdata' .or. trim(datamode) == 'sst_aquap_file') then - call docn_datamode_copyall_advertise(exportState, fldsExport, flds_scalar_name, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (trim(datamode) == 'iaf') then - call docn_datamode_iaf_advertise(importState, exportState, fldsImport, fldsExport, flds_scalar_name, rc) + call docn_datamode_dom_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else if (trim(datamode) == 'cplhist') then call docn_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, rc) @@ -551,19 +551,10 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar if (first_time) then - if (trim(datamode) /= 'multilev_cplhist') then - ! with multilev_cplhist we explicitly create initilize dfields - ! within the rpointer call - call docn_init_dfields(importState, exportState, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - endif ! Initialize datamode module pointers select case (trim(datamode)) case('sstdata', 'sst_aquap_file') - call docn_datamode_copyall_init_pointers(exportState, model_frac, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('iaf') - call docn_datamode_iaf_init_pointers(importState, exportState, model_frac, rc) + call docn_datamode_dom_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som', 'som_aquap') call docn_datamode_som_init_pointers(importState, exportState, sdat, model_frac, rc) @@ -573,7 +564,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar call docn_datamode_aquaplanet_init_pointers(exportState, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('cplhist') - call docn_datamode_cplhist_init_pointers(exportState, model_frac, rc) + call docn_datamode_cplhist_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('multilev') call docn_datamode_multilev_init_pointers(exportState, sdat, model_frac, rc) @@ -582,11 +573,11 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar call docn_datamode_multilev_dom_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('multilev_cplhist') + ! Note that there is no call to docn_init_dfields since the + ! initialization of dfields is done in the above routine call docn_datamode_multilev_cplhist_init_pointers(dfields, & exportState, sdat, model_frac, logunit, mainproc, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Note that there is no call to docn_init_dfields since the - ! initialization of dfields is done in the above routine end select ! Read restart if needed @@ -595,7 +586,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar if (ChkErr(rc,__LINE__,u_FILE_u)) return select case (trim(datamode)) - case('sstdata', 'sst_aquap_file', 'iaf', 'cplhist', 'multilev', 'mulitilev_dom', 'multilev_cplhist') + case('sstdata', 'sst_aquap_file', 'cplhist', 'multilev', 'mulitilev_dom', 'multilev_cplhist') call dshr_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som', 'som_aquap') @@ -617,22 +608,10 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('docn_strdata_advance') - ! Copy all fields from streams to export state as default - ! This automatically will update the fields in the export state - call ESMF_TraceRegionEnter('docn_dfield_copy') - if (.not. aquaplanet) then - call dshr_dfield_copy(dfields, sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - endif - call ESMF_TraceRegionExit('docn_dfield_copy') - ! Perform data mode specific calculations select case (trim(datamode)) case('sstdata','sst_aquap_file') - call docn_datamode_copyall_advance(rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('iaf') - call docn_datamode_iaf_advance(rc) + call docn_datamode_dom_advance(rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som','som_aquap') call docn_datamode_som_advance(importState, exportState, clock, restart_read, datamode, rc) @@ -663,21 +642,20 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar if (ChkErr(rc,__LINE__,u_FILE_u)) return select case (trim(datamode)) - case('sstdata', 'sst_aquap_file', 'iaf', 'cplhist', 'multilev', 'mulitilev_dom', 'multilev_cplhist') + case('sstdata', 'sst_aquap_file', 'cplhist', 'multilev', 'mulitilev_dom', 'multilev_cplhist') call dshr_restart_write(rpfile, case_name, 'docn', inst_suffix, target_ymd, target_tod, logunit, & my_task, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som', 'som_aquap') call docn_datamode_som_restart_write(rpfile, case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - case('sst_aquap_analytic', 'sst_aquap_constant') - ! Do nothing - case default - call shr_log_error(subName//'datamode '//trim(datamode)//' not recognized', rc=rc) - return - end select - - endif + case('sst_aquap_analytic', 'sst_aquap_constant') + ! Do nothing + case default + call shr_log_error(subName//'datamode '//trim(datamode)//' not recognized', rc=rc) + return + end select + endif call ESMF_TraceRegionExit('DOCN_RUN') @@ -687,57 +665,6 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - contains - - subroutine docn_init_dfields(importState, exportState, rc) - ! ----------------------------- - ! Initialize dfields arrays - ! ----------------------------- - - ! input/output variables - type(ESMF_State) , intent(inout) :: importState - type(ESMF_State) , intent(inout) :: exportState - integer , intent(out) :: rc - - ! local variables - integer :: n - integer :: fieldcount - integer :: dimcount - type(ESMF_Field) :: lfield - character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) - character(ESMF_MAXSTR) :: fieldname(1) - character(*), parameter :: subName = "(docn_init_dfields) " - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! Initialize dfields data type (to map streams to export state fields) - ! Create dfields linked list - used for copying stream fields to export state fields - call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lfieldnamelist(fieldCount)) - call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1, fieldCount - call ESMF_StateGet(exportState, itemName=trim(lfieldNameList(n)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (trim(lfieldnamelist(n)) /= flds_scalar_name) then - call ESMF_FieldGet(lfield, dimcount=dimCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (dimcount == 2) then - fieldname(1) = trim(lfieldnamelist(n)) - call dshr_dfield_add( dfields, sdat, trim(lfieldnamelist(n)), fieldname, exportState, & - logunit, mainproc, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - else - call dshr_dfield_add( dfields, sdat, trim(lfieldnamelist(n)), trim(lfieldnamelist(n)), exportState, & - logunit, mainproc, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - endif - end if - end do - end subroutine docn_init_dfields - end subroutine docn_comp_run !=============================================================================== From a7d27bdd2a12e620a33efd4b9f12f1af713619af Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 20 Dec 2025 15:38:10 +0100 Subject: [PATCH 08/61] updated to feature/new_datm_optional_streams --- datm/cime_config/config_component.xml | 20 +-- datm/cime_config/stream_definition_datm.xml | 2 +- datm/datm_pres_aero_mod.F90 | 158 +++++++++++--------- datm/datm_pres_co2_mod.F90 | 31 ++-- datm/datm_pres_ndep_mod.F90 | 29 ++-- datm/datm_pres_o3_mod.F90 | 5 +- 6 files changed, 129 insertions(+), 116 deletions(-) diff --git a/datm/cime_config/config_component.xml b/datm/cime_config/config_component.xml index c3b5269e7..275335fec 100644 --- a/datm/cime_config/config_component.xml +++ b/datm/cime_config/config_component.xml @@ -102,18 +102,18 @@ char - none,clim_1850,clim_2000,clim_2010,hist,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP5-3.4,SSP5-8.5,cplhist + none,clim_1850,clim_1850_cmip7,clim_2000,clim_2010,hist,hist_cmip7,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP5-3.4,SSP5-8.5,cplhist clim_2000 - clim_1850 - clim_2000 - clim_2010 - SSP1-2.6 - SSP2-4.5 - SSP3-7.0 - SSP5-8.5 - hist - hist + clim_1850 + clim_2000 + clim_2010 + SSP1-2.6 + SSP2-4.5 + SSP3-7.0 + SSP5-8.5 + hist + hist cplhist none diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index 6ddd48343..b709b6b50 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -4872,7 +4872,7 @@ - drynhx Faxandep_nhx_dry + drynhx Faxa_ndep_nhx_dry wetnhx Faxa_ndep_nhx_wet drynoy Faxa_ndep_noy_dry wetnoy Faxa_ndep_noy_wet diff --git a/datm/datm_pres_aero_mod.F90 b/datm/datm_pres_aero_mod.F90 index fdb3858a4..2d0eb8d96 100644 --- a/datm/datm_pres_aero_mod.F90 +++ b/datm/datm_pres_aero_mod.F90 @@ -14,30 +14,30 @@ module datm_pres_aero_mod public :: datm_pres_aero_init_pointers public :: datm_pres_aero_advance - ! export state data + ! pointers to export state data real(r8), pointer :: Faxa_bcph(:,:) => null() real(r8), pointer :: Faxa_ocph(:,:) => null() real(r8), pointer :: Faxa_dstwet(:,:) => null() real(r8), pointer :: Faxa_dstdry(:,:) => null() - ! stream data - real(r8), pointer :: strm_bcphidry(:) => null() - real(r8), pointer :: strm_bcphodry(:) => null() - real(r8), pointer :: strm_bcphiwet(:) => null() + ! pointers to stream data + real(r8), pointer :: strm_Faxa_bcphidry(:) => null() + real(r8), pointer :: strm_Faxa_bcphiwet(:) => null() + real(r8), pointer :: strm_Faxa_bcphodry(:) => null() - real(r8), pointer :: strm_ocphidry(:) => null() - real(r8), pointer :: strm_ocphodry(:) => null() - real(r8), pointer :: strm_ocphiwet(:) => null() + real(r8), pointer :: strm_Faxa_ocphidry(:) => null() + real(r8), pointer :: strm_Faxa_ocphiwet(:) => null() + real(r8), pointer :: strm_Faxa_ocphodry(:) => null() - real(r8), pointer :: strm_dstwet1(:) => null() - real(r8), pointer :: strm_dstwet2(:) => null() - real(r8), pointer :: strm_dstwet3(:) => null() - real(r8), pointer :: strm_dstwet4(:) => null() + real(r8), pointer :: strm_Faxa_dstwet1(:) => null() + real(r8), pointer :: strm_Faxa_dstwet2(:) => null() + real(r8), pointer :: strm_Faxa_dstwet3(:) => null() + real(r8), pointer :: strm_Faxa_dstwet4(:) => null() - real(r8), pointer :: strm_dstdry1(:) => null() - real(r8), pointer :: strm_dstdry2(:) => null() - real(r8), pointer :: strm_dstdry3(:) => null() - real(r8), pointer :: strm_dstdry4(:) => null() + real(r8), pointer :: strm_Faxa_dstdry1(:) => null() + real(r8), pointer :: strm_Faxa_dstdry2(:) => null() + real(r8), pointer :: strm_Faxa_dstdry3(:) => null() + real(r8), pointer :: strm_Faxa_dstdry4(:) => null() character(*), parameter :: u_FILE_u = & __FILE__ @@ -86,77 +86,91 @@ subroutine datm_pres_aero_init_pointers(exportState, sdat, rc) ! Set module pointers into streams and check that they are associated - call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphidry' , strm_bcphidry , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphidry' , strm_Faxa_bcphidry, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphodry' , strm_bcphodry , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphodry' , strm_Faxa_bcphodry, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphiwet' , strm_bcphiwet , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphiwet' , strm_Faxa_bcphiwet, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphidry' , strm_ocphidry , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphidry' , strm_Faxa_ocphidry, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphodry' , strm_ocphodry , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphodry' , strm_Faxa_ocphodry, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphiwet' , strm_ocphiwet , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphiwet' , strm_Faxa_ocphiwet, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry1' , strm_dstdry1 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry1' , strm_Faxa_dstdry1 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry2' , strm_dstdry2 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry2' , strm_Faxa_dstdry2 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry3' , strm_dstdry3 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry3' , strm_Faxa_dstdry3 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry4' , strm_dstdry4 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry4' , strm_Faxa_dstdry4 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet1' , strm_dstwet1 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet1' , strm_Faxa_dstwet1 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet2' , strm_dstwet2 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet2' , strm_Faxa_dstwet2 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet3' , strm_dstwet3 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet3' , strm_Faxa_dstwet3 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet4' , strm_dstwet4 , rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet4' , strm_Faxa_dstwet4 , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! error check for stream pointers - if (.not. associated(strm_bcphidry)) then - call shr_log_error(trim(subname)//'ERROR: strm_bcphidry must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_bcphidry)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_bcphidry must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_bcphodry)) then - call shr_log_error(trim(subname)//'ERROR: strm_bcphodry must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_bcphodry)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_bcphodry must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_bcphiwet)) then - call shr_log_error(trim(subname)//'ERROR: strm_bcphiwet must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_bcphiwet)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_bcphiwet must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_ocphidry)) then - call shr_log_error(trim(subname)//'ERROR: strm_ocphidry must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_ocphidry)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_ocphidry must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_ocphodry)) then - call shr_log_error(trim(subname)//'ERROR: strm_ocphodry must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_ocphodry)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_ocphodry must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_ocphiwet)) then - call shr_log_error(trim(subname)//'ERROR: strm_ocphiwet must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_ocphiwet)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_ocphiwet must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_dstdry1)) then - call shr_log_error(trim(subname)//'ERROR: strm_dstdry1 must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_dstdry1)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_dstdry1 must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_dstdry2)) then - call shr_log_error(trim(subname)//'ERROR: strm_dstdry2 must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_dstdry2)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_dstdry2 must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_dstdry3)) then - call shr_log_error(trim(subname)//'ERROR: strm_dstdry3 must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_dstdry3)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_dstdry3 must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_dstdry4)) then - call shr_log_error(trim(subname)//'ERROR: strm_dstdry4 must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_dstdry4)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_dstdry4 must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_dstwet1)) then - call shr_log_error(trim(subname)//'ERROR: strm_dstwet1 must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_dstwet1)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_dstwet1 must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_dstwet2)) then - call shr_log_error(trim(subname)//'ERROR: strm_dstwet2 must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_dstwet2)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_dstwet2 must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_dstwet3)) then - call shr_log_error(trim(subname)//'ERROR: strm_dstwet3 must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_dstwet3)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_dstwet3 must be associated if flds_presaero is .true.') + return end if - if (.not. associated(strm_dstwet4)) then - call shr_log_error(trim(subname)//'ERROR: strm_dstwet4 must be associated if flds_presaero is .true.') + if (.not. associated(strm_Faxa_dstwet4)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_dstwet4 must be associated if flds_presaero is .true.') + return end if end subroutine datm_pres_aero_init_pointers @@ -167,23 +181,23 @@ subroutine datm_pres_aero_advance() ! The following maps stream input fields to export fields that ! have an ungridded dimension - Faxa_bcph(1,:) = strm_bcphidry(:) - Faxa_bcph(2,:) = strm_bcphodry(:) - Faxa_bcph(3,:) = strm_bcphiwet(:) + Faxa_bcph(1,:) = strm_Faxa_bcphidry(:) + Faxa_bcph(2,:) = strm_Faxa_bcphodry(:) + Faxa_bcph(3,:) = strm_Faxa_bcphiwet(:) - Faxa_ocph(1,:) = strm_ocphidry(:) - Faxa_ocph(2,:) = strm_ocphodry(:) - Faxa_ocph(3,:) = strm_ocphiwet(:) + Faxa_ocph(1,:) = strm_Faxa_ocphidry(:) + Faxa_ocph(2,:) = strm_Faxa_ocphodry(:) + Faxa_ocph(3,:) = strm_Faxa_ocphiwet(:) - Faxa_dstdry(1,:) = strm_dstdry1(:) - Faxa_dstdry(2,:) = strm_dstdry2(:) - Faxa_dstdry(3,:) = strm_dstdry3(:) - Faxa_dstdry(4,:) = strm_dstdry4(:) + Faxa_dstdry(1,:) = strm_Faxa_dstdry1(:) + Faxa_dstdry(2,:) = strm_Faxa_dstdry2(:) + Faxa_dstdry(3,:) = strm_Faxa_dstdry3(:) + Faxa_dstdry(4,:) = strm_Faxa_dstdry4(:) - Faxa_dstwet(1,:) = strm_dstwet1(:) - Faxa_dstwet(2,:) = strm_dstwet2(:) - Faxa_dstwet(3,:) = strm_dstwet3(:) - Faxa_dstwet(4,:) = strm_dstwet4(:) + Faxa_dstwet(1,:) = strm_Faxa_dstwet1(:) + Faxa_dstwet(2,:) = strm_Faxa_dstwet2(:) + Faxa_dstwet(3,:) = strm_Faxa_dstwet3(:) + Faxa_dstwet(4,:) = strm_Faxa_dstwet4(:) end subroutine datm_pres_aero_advance diff --git a/datm/datm_pres_co2_mod.F90 b/datm/datm_pres_co2_mod.F90 index 96d57d486..caa5301d2 100644 --- a/datm/datm_pres_co2_mod.F90 +++ b/datm/datm_pres_co2_mod.F90 @@ -42,12 +42,8 @@ subroutine datm_pres_co2_advertise(fldsExport, datamode_in) ! Set module variable datamode = datamode_in - if (datamode == 'CPLHIST') then - call dshr_fldList_add(fldsExport, 'Sa_co2diag') - call dshr_fldList_add(fldsExport, 'Sa_co2prog') - else - call dshr_fldList_add(fldsExport, 'Sa_co2diag') - end if + call dshr_fldList_add(fldsExport, 'Sa_co2diag') + call dshr_fldList_add(fldsExport, 'Sa_co2prog') end subroutine datm_pres_co2_advertise @@ -60,7 +56,7 @@ subroutine datm_pres_co2_init_pointers(exportState, sdat, rc) integer , intent(out) :: rc ! local variables - character(len=*), parameter :: subname='(datm_co2_init_pointers): ' + character(len=*), parameter :: subname='(datm_pres_co2_init_pointers): ' !---------------------------------------------------------- rc = ESMF_SUCCESS @@ -71,25 +67,25 @@ subroutine datm_pres_co2_init_pointers(exportState, sdat, rc) if (.not. associated(Sa_co2diag)) then call shr_log_error(trim(subname)//'ERROR: Sa_co2diag must be associated if flds_co2 is .true.') end if - if (datamode == 'CPLHIST') then - call dshr_state_getfldptr(exportState, 'Sa_co2prog', fldptr1=Sa_co2prog, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (.not. associated(Sa_co2prog)) then - call shr_log_error(trim(subname)//'ERROR: Sa_co2prog must be associated if flds_co2 is .true.') - end if + call dshr_state_getfldptr(exportState, 'Sa_co2prog', fldptr1=Sa_co2prog, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. associated(Sa_co2prog)) then + call shr_log_error(trim(subname)//'ERROR: Sa_co2prog must be associated if flds_co2 is .true.') + return end if ! Get pointer to stream data that will be used below - if the ! following stream fields are not in any sdat streams, then a null value is returned call shr_strdata_get_stream_pointer(sdat, 'Sa_co2diag', strm_Sa_co2diag, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (.not. associated(strm_co2diag)) then + if (.not. associated(strm_Sa_co2diag)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_co2diag must be associated if flds_co2 is .true.') end if if (datamode == 'CPLHIST') then - call shr_strdata_get_stream_pointer(sdat, 'Sa_co2prog', strm_Sa_co2diag, rc) + call shr_strdata_get_stream_pointer(sdat, 'Sa_co2prog', strm_Sa_co2prog, rc) if (.not. associated(strm_Sa_co2prog)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_co2prog must be associated if flds_co2 is .true.') + return end if end if @@ -102,9 +98,12 @@ subroutine datm_pres_co2_advance() Sa_co2diag(:) = strm_Sa_co2diag(:) Sa_co2prog(:) = strm_Sa_co2prog(:) else + ! This is intentional since we don't have any Sa_co2prog - but for now + ! will set Sa_co2prog equal to Sa_co2diag Sa_co2diag(:) = strm_Sa_co2diag(:) + Sa_co2prog(:) = strm_Sa_co2diag(:) end if end subroutine datm_pres_co2_advance -end module datm_co2_mod +end module datm_pres_co2_mod diff --git a/datm/datm_pres_ndep_mod.F90 b/datm/datm_pres_ndep_mod.F90 index 01c0f5f9f..3e0361100 100644 --- a/datm/datm_pres_ndep_mod.F90 +++ b/datm/datm_pres_ndep_mod.F90 @@ -1,7 +1,6 @@ module datm_pres_ndep_mod use ESMF , only : ESMF_SUCCESS, ESMF_State, ESMF_StateItem_Flag - use ESMF , only : ESMF_STATEITEM_NOTFOUND use shr_kind_mod , only : r8=>shr_kind_r8 use shr_log_mod , only : shr_log_error use dshr_methods_mod , only : dshr_state_getfldptr, chkerr @@ -27,6 +26,8 @@ module datm_pres_ndep_mod real(r8), pointer :: strm_ndep_nhx(:) => null() ! pre-cmip7 ndep data real(r8), pointer :: strm_ndep_noy(:) => null() ! pre-cmip7 ndep data + logical :: use_cmip7_ndep + character(*), parameter :: u_FILE_u = & __FILE__ @@ -53,7 +54,6 @@ subroutine datm_pres_ndep_init_pointers(exportState, sdat, rc) integer , intent(out) :: rc ! local variables - type(ESMF_StateItem_Flag) :: itemFlag character(len=*), parameter :: subname='(datm_ndep_init_pointers): ' !---------------------------------------------------------- @@ -82,27 +82,30 @@ subroutine datm_pres_ndep_init_pointers(exportState, sdat, rc) call shr_strdata_get_stream_pointer( sdat, 'Faxa_ndep_noy', strm_ndep_noy, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! error checks + if (associated(strm_ndep_nhx_dry) .and. associated(strm_ndep_nhx_wet) .and. & + associated(strm_ndep_noy_dry) .and. associated(strm_ndep_noy_wet)) then + use_cmip7_ndep = .true. + else if (associated(strm_ndep_nhx) .and. associated(strm_ndep_noy)) then + use_cmip7_ndep = .false. + else + call shr_log_error('datm_ndep_advance: ERROR: no associated stream pointers for ndep forcing') + return + end if + end subroutine datm_pres_ndep_init_pointers !=============================================================================== subroutine datm_pres_ndep_advance() - if (associated(strm_ndep_nhx_dry) .and. & - associated(strm_ndep_nhx_wet) .and. & - associated(strm_ndep_noy_dry) .and. & - associated(strm_ndep_noy_wet)) then - + if (use_cmip7_ndep) then + ! assume data is in kgN/m2/s Faxa_ndep(1,:) = strm_ndep_nhx_dry(:) + strm_ndep_nhx_wet(:) Faxa_ndep(2,:) = strm_ndep_noy_dry(:) + strm_ndep_noy_wet(:) - - else if (associated(strm_ndep_nhx) .and. associated(strm_ndep_noy)) then - + else ! convert ndep flux to units of kgN/m2/s (input is in gN/m2/s) Faxa_ndep(1,:) = strm_ndep_nhx(:) / 1000._r8 Faxa_ndep(2,:) = strm_ndep_noy(:) / 1000._r8 - - else - call shr_log_error('datm_ndep_advance: ERROR: no associated stream pointers for ndep forcing') end if end subroutine datm_pres_ndep_advance diff --git a/datm/datm_pres_o3_mod.F90 b/datm/datm_pres_o3_mod.F90 index c3b86afcb..41ced32b9 100644 --- a/datm/datm_pres_o3_mod.F90 +++ b/datm/datm_pres_o3_mod.F90 @@ -60,13 +60,10 @@ subroutine datm_pres_o3_init_pointers(exportState, sdat, rc) call shr_strdata_get_stream_pointer(sdat, 'Sa_o3', strm_Sa_o3, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Error checks - if (.not. associated(Sa_o3)) then - call shr_log_error(trim(subname)//'ERROR: Sa_o3 must be associated if flds_pres_o3 is .true.') - end if if (.not. associated(strm_Sa_o3)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_o3 must be associated if flds_pres_o3 is .true.') + return end if end subroutine datm_pres_o3_init_pointers From e13cf241dcbfb0c8e7468e4010bf8062fb20ebba Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 22 Dec 2025 11:47:21 +0100 Subject: [PATCH 09/61] updated to feature/new_datm_optional_streams --- streams/dshr_methods_mod.F90 | 20 ++- streams/dshr_strdata_mod.F90 | 245 ++++++++++++++++++++++++++--------- 2 files changed, 202 insertions(+), 63 deletions(-) diff --git a/streams/dshr_methods_mod.F90 b/streams/dshr_methods_mod.F90 index 59500d11d..6cd4c2b01 100644 --- a/streams/dshr_methods_mod.F90 +++ b/streams/dshr_methods_mod.F90 @@ -14,7 +14,7 @@ module dshr_methods_mod use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl use shr_log_mod , only : shr_log_error - + implicit none public @@ -54,6 +54,7 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur integer , intent(out) :: rc ! local variables + integer :: ni, nj type(ESMF_Field) :: lfield integer :: itemCount character(len=*), parameter :: subname='(dshr_state_getfldptr)' @@ -74,7 +75,9 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur if (chkerr(rc,__LINE__,u_FILE_u)) return else ! the call to just returns if it cannot find the field - call ESMF_LogWrite(trim(subname)//" Could not find the field: "//trim(fldname)//" just returning", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(trim(subname)//" Could not find the field: "//trim(fldname)//& + " just returning", ESMF_LOGMSG_INFO) + return end if else call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) @@ -84,6 +87,19 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur if (chkerr(rc,__LINE__,u_FILE_u)) return end if + ! Initialize pointer value + if (present(fldptr1)) then + do ni = 1,size(fldptr1) + fldptr1(ni) = huge(1._r8) + end do + else if (present(fldptr2)) then + do nj = 1,size(fldptr2, dim=2) + do ni = 1,size(fldptr2, dim=1) + fldptr2(ni,nj) = huge(1._r8) + end do + end do + end if + end subroutine dshr_state_getfldptr !=============================================================================== diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 5c1ba395c..68110b821 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -45,7 +45,6 @@ module dshr_strdata_mod use dshr_methods_mod , only : dshr_fldbun_getfldptr, dshr_fldbun_getfieldN, dshr_fldbun_fldchk, chkerr use dshr_methods_mod , only : dshr_fldbun_diagnose, dshr_fldbun_regrid, dshr_field_getfldptr use shr_sys_mod , only : shr_sys_abort - use pio , only : file_desc_t, iosystem_desc_t, io_desc_t, var_desc_t use pio , only : pio_openfile, pio_closefile, pio_nowrite use pio , only : pio_seterrorhandling, pio_initdecomp, pio_freedecomp @@ -1975,6 +1974,8 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) integer, allocatable :: dimlens(:) type(ESMF_DistGrid) :: distGrid integer :: lsize + integer :: logunit + logical :: mainproc integer, pointer :: compdof(:) integer, pointer :: compdof3d(:) integer :: rCode ! pio return code (only used when pio error handling is PIO_BCAST_ERROR) @@ -1991,6 +1992,10 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) nullify(compdof) nullify(compdof3d) + ! set logunit and mainproc + logunit = sdat%stream(1)%logunit + mainproc = sdat%mainproc + ! set the number of vertical levels to a local variable stream_nlev = per_stream%stream_nlev @@ -2017,7 +2022,35 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) if (stream_nlev > 1) then allocate(compdof3d(stream_nlev*lsize)) ! Assume that first 2 dimensions correspond to the compdof - gsize2d = dimlens(1)*dimlens(2) + if (trim(dimname) == 'time' .or. trim(dimname) == 'nt') then + if (ndims == 3) then + ! second dimension is lev and third dimension is time + gsize2d = dimlens(1) + else if (ndims == 4) then + ! third dimension is lev and fourth dimension is time + gsize2d = dimlens(1)*dimlens(2) + else + write(6,*)'ERROR: dimlens= ',dimlens + call shr_log_error(trim(subname)//' only ndims of 3 and 4 '//& + ' total dimensions are currently supported for multiple level fields '// & + ' with a time dimension', rc=rc) + return + end if + else + if (ndims == 2) then + ! second dimension is lev + gsize2d = dimlens(1) + else if (ndims == 3) then + ! third dimension is lev + gsize2d = dimlens(1)*dimlens(2) + else + write(6,*)'ERROR: dimlens= ',dimlens + call shr_log_error(trim(subname)//' only ndims of 2 and 3'// & + ' total dimensions are currently supported for multiple level fields'// & + ' without a time dimension', rc=rc) + return + end if + end if cnt = 0 do n = 1,stream_nlev do m = 1,size(compdof) @@ -2031,56 +2064,90 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) rcode = pio_inq_vartype(pioid, varid, pio_iovartype) ! determine io descriptor + !------------------------------- if (ndims == 2) then + !------------------------------- rcode = pio_inq_dimname(pioid, dimids(ndims), dimname) - if (trim(dimname) == 'time' .or. trim(dimname) == 'nt') then - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,F03) 'setting iodesc for : '//trim(fldname)// & - ' with dimlens(1) = ',dimlens(1),' and the variable has a time dimension ' + if ((trim(dimname) == 'time' .or. trim(dimname) == 'nt')) then + if (mainproc) then + write(logunit,F03) 'setting iodesc for 2d: '//trim(fldname)// & + ' with dimlens(1) = ',dimlens(1),& + ' and dimlens(2) is a time dimension ' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1)/), compdof, & per_stream%stream_pio_iodesc) + else if (stream_nlev > 1) then + if (mainproc) then + write(logunit,F01) 'setting iodesc for 2d: '//trim(fldname)// & + ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2), & + ' and dimlens(2) is a vertical dimension' + end if + call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1)/), compdof3d, & + per_stream%stream_pio_iodesc) else - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,F00) 'setting iodesc for : '//trim(fldname)// & - ' with dimlens(1), dimlens(2) = ',dimlens(1),dimlens(2),& - ' variable has no time dimension ' + if (mainproc) then + write(logunit,F01) 'setting iodesc for 2d: '//trim(fldname)// & + ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2), & + ' and the variable has no time or vertical dimension ' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, & per_stream%stream_pio_iodesc) end if + !------------------------------- else if (ndims == 3) then + !------------------------------- rcode = pio_inq_dimname(pioid, dimids(ndims), dimname) - if (stream_nlev > 1) then - write(sdat%stream(1)%logunit,F01) 'setting iodesc for : '//trim(fldname)// & - ' with dimlens(1), dimlens(2), dimlens(3) = ',dimlens(1),dimlens(2), dimlens(3), & - ' variable has no time dimension '//trim(dimname) - call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2),dimlens(3)/), compdof3d, & - per_stream%stream_pio_iodesc) - else if (trim(dimname) == 'time' .or. trim(dimname) == 'nt') then - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,F01) 'setting iodesc for : '//trim(fldname)// & - ' with dimlens(1), dimlens(2) = ',dimlens(1),dimlens(2),& - ' variable as time dimension '//trim(dimname) + if (trim(dimname) == 'time' .or. trim(dimname) == 'nt') then + if (stream_nlev > 1) then + if (mainproc) then + write(logunit,F01) 'setting iodesc for 3d: '//trim(fldname)// & + ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2),& + ' where dimlen(2) is a vertical dimension and dimlen(3) is time dimension ' + end if + call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof3d, & + per_stream%stream_pio_iodesc) + else + if (mainproc) then + write(logunit,F01) 'setting iodesc for 3d: '//trim(fldname)// & + ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2),& + ' and dimlen(3) is a time dimension ' + end if + call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, & + per_stream%stream_pio_iodesc) + end if + else + if (stream_nlev > 1) then + if (mainproc) then + write(logunit,F01) 'setting iodesc for 3d: '//trim(fldname)// & + ' with dimlens(1), dimlens(2), dimlens(3) = ',dimlens(1),dimlens(2), dimlens(3), & + ' where dimlens(3) is a vertical dimension' + end if + call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2),dimlens(3)/), compdof3d, & + per_stream%stream_pio_iodesc) + else + write(6,*)'ERROR: dimlens= ',dimlens + call shr_log_error(trim(subname)//& + ' the third dimension of a 3d field must be either time or a vertical level', rc=rc) + return end if - call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, & - per_stream%stream_pio_iodesc) end if + !------------------------------- else if (ndims == 4) then + !------------------------------- rcode = pio_inq_dimname(pioid, dimids(ndims), dimname) if (stream_nlev > 1 .and. (trim(dimname) == 'time' .or. trim(dimname) == 'nt')) then - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,F02) 'setting iodesc for : '//trim(fldname)// & + if (mainproc) then + write(logunit,F02) 'setting iodesc for 4d: '//trim(fldname)// & ' with dimlens(1), dimlens(2),dimlens(3) = ',dimlens(1),dimlens(2),dimlens(3),& - ' variable has time dimension ' + ' where dimlens(3) is a vertical dimension and dimlens(4) is a time dimension ' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2),dimlens(3)/), compdof3d, & per_stream%stream_pio_iodesc) else write(6,*)'ERROR: dimlens= ',dimlens - call shr_log_error(trim(subname)//' dimlens = 4 assumes a time dimension', rc=rc) + call shr_log_error(trim(subname)//' dimlens = 4 assumes a time dimension and a vertical dimension', rc=rc) return end if @@ -2099,83 +2166,139 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) end subroutine shr_strdata_set_stream_iodesc !=============================================================================== - subroutine shr_strdata_get_stream_pointer_1d(sdat, strm_fld, strm_ptr, rc) + subroutine shr_strdata_get_stream_pointer_1d(sdat, strm_fld, strm_ptr, & + rc, requirePointer, errmsg) ! Set a pointer, strm_ptr, for field, strm_fld, into sdat fldbun_model field bundle ! input/output variables - type(shr_strdata_type) , intent(in) :: sdat - character(len=*) , intent(in) :: strm_fld - real(r8) , pointer :: strm_ptr(:) - integer , intent(out) :: rc + type(shr_strdata_type) , intent(in) :: sdat + character(len=*) , intent(in) :: strm_fld + real(r8) , pointer :: strm_ptr(:) + integer , intent(out) :: rc + logical, optional , intent(in) :: requirePointer + character(len=*), optional , intent(in) :: errmsg ! local variables - integer :: ns, nf + integer :: ns, nf, ni + integer :: logunit + logical :: mainproc logical :: found - character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer_1d)' + character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer_1d) ' character(*) , parameter :: F00 = "('(shr_strdata_get_stream_pointer_1d) ',8a)" ! ---------------------------------------------- rc = ESMF_SUCCESS + logunit = sdat%stream(1)%logunit + mainproc = sdat%mainproc + found = .false. + ! loop over all input streams and determine if the strm_fld is in the field bundle of the target stream - do ns = 1, shr_strdata_get_stream_count(sdat) - found = .false. - ! Check if requested stream field is read in - and if it is then point into the stream field bundle - do nf = 1,size(sdat%pstrm(ns)%fldlist_model) + stream_loop: do ns = 1, shr_strdata_get_stream_count(sdat) + ! Check if requested stream field is read in - and if it is set pointer + fld_loop: do nf = 1,size(sdat%pstrm(ns)%fldlist_model) if (trim(strm_fld) == trim(sdat%pstrm(ns)%fldlist_model(nf))) then call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, trim(sdat%pstrm(ns)%fldlist_model(nf)), & fldptr1=strm_ptr, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,F00)' strm_ptr is allocated for stream field strm_'//trim(strm_fld) - end if found = .true. - exit + exit stream_loop end if + end do fld_loop + end do stream_loop + + if (found) then + ! If pointer found, preset value + if (mainproc) then + write(logunit,F00)' strm_ptr is allocated and preset to huge for stream field strm_'//trim(strm_fld) + end if + do ni = 1,size(strm_ptr) + strm_ptr(ni) = huge(1._r8) end do - if (found) exit - end do + else + ! What to do if fldbun pointer is not found + if (present(requirePointer)) then + if (requirePointer) then + if (present(errmsg)) then + if (sdat%mainproc) write(sdat%stream(1)%logunit,F00) trim(errmsg) + end if + call shr_log_error(subName//"ERROR: pointer not found for "//trim(strm_fld), rc=rc) + return + end if + end if + end if + end subroutine shr_strdata_get_stream_pointer_1d !=============================================================================== - subroutine shr_strdata_get_stream_pointer_2d(sdat, strm_fld, strm_ptr, rc) + subroutine shr_strdata_get_stream_pointer_2d(sdat, strm_fld, strm_ptr, & + rc, requirePointer, errmsg) ! Set a pointer, strm_ptr, for field, strm_fld, into sdat fldbun_model field bundle ! input/output variables - type(shr_strdata_type) , intent(in) :: sdat - character(len=*) , intent(in) :: strm_fld - real(r8) , pointer :: strm_ptr(:,:) - integer , intent(out) :: rc + type(shr_strdata_type) , intent(in) :: sdat + character(len=*) , intent(in) :: strm_fld + real(r8) , pointer :: strm_ptr(:,:) + integer , intent(out) :: rc + logical, optional , intent(in) :: requirePointer + character(len=*), optional , intent(in) :: errmsg ! local variables - integer :: ns, nf + integer :: ns, nf, ni, nj + integer :: logunit + logical :: mainproc logical :: found - character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer_2d)' + character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer_2d) ' character(*) , parameter :: F00 = "('(shr_strdata_get_stream_pointer_2d) ',8a)" ! ---------------------------------------------- rc = ESMF_SUCCESS + logunit = sdat%stream(1)%logunit + mainproc = sdat%mainproc + found = .false. + ! loop over all input streams and determine if the strm_fld is in the field bundle of the target stream - do ns = 1, shr_strdata_get_stream_count(sdat) - found = .false. - ! Check if requested stream field is read in - and if it is then point into the stream field bundle - do nf = 1,size(sdat%pstrm(ns)%fldlist_model) + stream_loop: do ns = 1, shr_strdata_get_stream_count(sdat) + ! Check if requested stream field is read in - and if it is set pointer + fld_loop: do nf = 1,size(sdat%pstrm(ns)%fldlist_model) if (trim(strm_fld) == trim(sdat%pstrm(ns)%fldlist_model(nf))) then call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, trim(sdat%pstrm(ns)%fldlist_model(nf)), & fldptr2=strm_ptr, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,F00)' strm_ptr is allocated for stream field strm_'//trim(strm_fld) - end if found = .true. - exit + exit stream_loop end if + end do fld_loop + end do stream_loop + + if (found) then + ! If pointer found, preset value + if (mainproc) then + write(logunit,F00)' strm_ptr is allocated and preset to huge for stream field strm_'//trim(strm_fld) + end if + do nj = 1,size(strm_ptr, dim=2) + do ni = 1,size(strm_ptr, dim=1) + strm_ptr(ni,nj) = huge(1._r8) + end do end do - if (found) exit - end do + else + ! What to do if fldbun pointer is not found + if (present(requirePointer)) then + if (requirePointer) then + if (present(errmsg)) then + if (mainproc) then + write(logunit,F00) trim(errmsg) + end if + end if + call shr_log_error(subName//"ERROR: pointer not found for "//trim(strm_fld), rc=rc) + return + end if + end if + end if + end subroutine shr_strdata_get_stream_pointer_2d end module dshr_strdata_mod From 8d4d313c817bd632fe4c2aa55ae8038b10040c4a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 22 Dec 2025 11:49:04 +0100 Subject: [PATCH 10/61] updated CMakeLists.txt to match feature/new_datm_optional_streams --- datm/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index 75c31772a..8225f5c1f 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -8,10 +8,11 @@ set(SRCFILES atm_comp_nuopc.F90 datm_datamode_era5_mod.F90 datm_datamode_simple_mod.F90 datm_pres_aero_mod.F90 - datm_pres_ndep_mod.F90 datm_pres_co2_mod.F90 + datm_pres_ndep_mod.F90 datm_pres_o3_mod.F90) + foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.datm/${FILE}") list(REMOVE_ITEM SRCFILES ${FILE}) From 0b01ef7f7bf9bfba2ad7ac64ccc69c1d48b2a4f7 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 22 Dec 2025 11:50:41 +0100 Subject: [PATCH 11/61] updated to feature/new_datm_optional_streams --- datm/cime_config/buildnml | 4 ++-- datm/cime_config/stream_definition_datm.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index 3653c81c9..788a9e1fa 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -213,7 +213,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path if clm_usrdat_name == 'NEON.PRISM': streamlist.append(clm_usrdat_name+"_PRECIP."+neonsite) if clm_usrdat_name == 'NEON': - streamlist.append(clm_usrdat_name+".NEON_PRECIP."+neonsite) + streamlist.append(clm_usrdat_name+".NEON_PRECIP."+neonsite) if clm_usrdat_name == 'PLUMBER2': streamlist.append(clm_usrdat_name+"."+plumber2site) @@ -243,7 +243,7 @@ def _create_drv_flds_in(case, confdir): # for now we are hard-coding this file name and values because we only need it for ozone if datm_preso3 != "none": - + # Generate drv_flds_in file outfile = os.path.join(confdir, "drv_flds_in") ozone_nl_name = "&ozone_coupling_nl" diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index b709b6b50..74da7589c 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -4868,7 +4868,7 @@ $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_ESMFmesh_cdf5_c20251211.nc - $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_CMIP_FZJ-CMIP-nitrogen-1-2_gn_185001-202212.nc + $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_CMIP_FZJ-CMIP-nitrogen-1-2_gn_185001-185012-clim_c20251222.nc @@ -4903,7 +4903,7 @@ $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_ESMFmesh_cdf5_c20251211.nc - $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_CMIP_FZJ-CMIP-nitrogen-1-2_gn_185001-202212.nc + $DIN_LOC_ROOT/atm/ndep/cmip7/ndep_input4MIPs_surfaceFluxes_CMIP_FZJ-CMIP-nitrogen-1-2_gn_185001-202212_c20251222.nc From 3fe54b6f11097dfef2ce6c6697c5e389baf19399 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 24 Dec 2025 20:08:43 +0100 Subject: [PATCH 12/61] udpated streams share code feature/fix_unstructured_multilev_input --- dlnd/stream_definition_dlnd.xml | 88 ------- streams/dshr_methods_mod.F90 | 8 +- streams/dshr_strdata_mod.F90 | 410 +++++++++++++++++--------------- streams/dshr_stream_mod.F90 | 342 +++++++++++++++----------- 4 files changed, 423 insertions(+), 425 deletions(-) delete mode 100644 dlnd/stream_definition_dlnd.xml diff --git a/dlnd/stream_definition_dlnd.xml b/dlnd/stream_definition_dlnd.xml deleted file mode 100644 index 0de561caf..000000000 --- a/dlnd/stream_definition_dlnd.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - $LND_DOMAIN_MESH - - - - $DLND_DIR/$DLND_CASE.cpl.hl2x1yr_glc.%y-01-01.nc - - - lndImp_Sl_tsrf_elev%glc Sl_tsrf_elev%glc - lndImp_Sl_topo_elev%glc Sl_topo_elev%glc - lndImp_Flgl_qice_elev%glc Flgl_qice_elev%glc - - null - - bilinear - - null - $DLND_YR_ALIGN - $DLND_YR_START - $DLND_YR_END - 0 - - lower - - - cycle - - - 1.5 - - single - - - - - $LND_DOMAIN_MESH - - - TBD - - - lndImp_Flrl_rofsur_nonh2o%rof Flrl_rofsur_nonh2o%rof - lndImp_Flrl_rofsur Flrl_rofsur - lndImp_Flrl_rofsub Flrl_rofsub - lndImp_Flrl_rofgwl Flrl_rofgwl - lndImp_Flrl_rofi Flrl_rofi - - null - - bilinear - - null - $DLND_YR_ALIGN - $DLND_YR_START - $DLND_YR_END - 0 - - lower - - - cycle - - - 1.5 - - single - - - diff --git a/streams/dshr_methods_mod.F90 b/streams/dshr_methods_mod.F90 index 6cd4c2b01..848df90c6 100644 --- a/streams/dshr_methods_mod.F90 +++ b/streams/dshr_methods_mod.F90 @@ -41,6 +41,8 @@ module dshr_methods_mod subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullReturn, rc) + use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) + ! ---------------------------------------------- ! Get pointer to a state field ! ---------------------------------------------- @@ -50,7 +52,7 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur character(len=*) , intent(in) :: fldname real(R8) , pointer, intent(inout), optional :: fldptr1(:) real(R8) , pointer, intent(inout), optional :: fldptr2(:,:) - logical , intent(in),optional :: allowNullReturn + logical , intent(in) , optional :: allowNullReturn integer , intent(out) :: rc ! local variables @@ -90,12 +92,12 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur ! Initialize pointer value if (present(fldptr1)) then do ni = 1,size(fldptr1) - fldptr1(ni) = huge(1._r8) + fldptr1(ni) = nan end do else if (present(fldptr2)) then do nj = 1,size(fldptr2, dim=2) do ni = 1,size(fldptr2, dim=1) - fldptr2(ni,nj) = huge(1._r8) + fldptr2(ni,nj) = nan end do end do end if diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 68110b821..4bea381ae 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -19,7 +19,7 @@ module dshr_strdata_mod use ESMF , only : ESMF_FieldReGridStore, ESMF_FieldRedistStore, ESMF_UNMAPPEDACTION_IGNORE 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 + use ESMF , only : ESMF_LOGMSG_INFO use shr_kind_mod , only : r8=>shr_kind_r8, r4=>shr_kind_r4, i2=>shr_kind_I2 use shr_kind_mod , only : cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx, cx=>shr_kind_cx use shr_log_mod , only : shr_log_error @@ -57,7 +57,10 @@ module dshr_strdata_mod implicit none private + ! Public data types public :: shr_strdata_type + + ! Public routines public :: shr_strdata_init_from_config public :: shr_strdata_init_from_inline public :: shr_strdata_setOrbs @@ -68,16 +71,17 @@ module dshr_strdata_mod public :: shr_strdata_get_stream_fieldbundle public :: shr_strdata_print - private :: shr_strdata_init_model_domain - private :: shr_strdata_get_stream_nlev - private :: shr_strdata_readLBUB - interface shr_strdata_get_stream_pointer module procedure shr_strdata_get_stream_pointer_1d module procedure shr_strdata_get_stream_pointer_2d end interface shr_strdata_get_stream_pointer - ! public data members: + ! Private routines + private :: shr_strdata_init_model_domain + private :: shr_strdata_get_stream_nlev + private :: shr_strdata_readLBUB + + ! Public data members: integer :: debug = 0 ! local debug flag character(len=*) ,parameter, public :: shr_strdata_nullstr = 'null' character(len=*) ,parameter :: shr_strdata_unset = 'NOT_SET' @@ -114,7 +118,7 @@ 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 - logical :: mainproc + logical :: mainproc ! not used, needed for cmeps backwards compatibility integer :: io_type ! pio info integer :: io_format ! pio info integer :: modeldt = 0 ! model dt in seconds @@ -140,6 +144,9 @@ module dshr_strdata_mod type(ESMF_Field) :: field_vector_dst ! needed for vector fields + logical :: mainproc ! root processor + integer :: logout ! log unit for mainproc output + real(r8) ,parameter :: deg2rad = SHR_CONST_PI/180.0_r8 character(*) ,parameter :: u_FILE_u = & __FILE__ @@ -194,12 +201,15 @@ subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, integer , intent(out) :: rc ! local variables - type(ESMF_VM) :: vm integer :: localPet + type(ESMF_VM) :: vm + integer :: stream_count character(len=*), parameter :: subname='(shr_strdata_init_from_config)' ! ---------------------------------------------- rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + + ! Set module variable logout + logout = logunit #ifdef CESMCOUPLED ! Initialize sdat pio @@ -208,23 +218,27 @@ subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, sdat%io_format = shr_pio_getioformat(trim(compname)) #endif + ! Initialize module variable mainproc call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMGet(vm, localPet=localPet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + mainproc = (localPet == main_task) - ! Initialize sdat streams (read xml file for streams) - sdat%mainproc = (localPet == main_task) - + ! Initialize sdat streams #ifdef DISABLE_FoX - call shr_stream_init_from_esmfconfig(streamfilename, sdat%stream, logunit, & + ! Read input ESMF config file + call shr_stream_init_from_esmfconfig(streamfilename, sdat%stream, logout, & sdat%pio_subsystem, sdat%io_type, sdat%io_format, rc=rc) #else - call shr_stream_init_from_xml(streamfilename, sdat%stream, sdat%mainproc, logunit, & + ! Read input xml file + call shr_stream_init_from_xml(streamfilename, sdat%stream, mainproc, logout, & sdat%pio_subsystem, sdat%io_type, sdat%io_format, trim(compname), rc=rc) #endif - allocate(sdat%pstrm(shr_strdata_get_stream_count(sdat))) + ! Allocate pstrm array + stream_count = shr_strdata_get_stream_count(sdat) + allocate(sdat%pstrm(stream_count)) ! Initialize sdat model domain sdat%model_mesh = model_mesh @@ -272,14 +286,35 @@ subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, & integer, optional , intent(out) :: rc ! error code ! local variables - integer :: src_mask = 0 - integer :: dst_mask = 0 + integer :: src_mask = 0 + integer :: dst_mask = 0 + type(ESMF_VM) :: vm + integer :: localpet + character(len=*), parameter :: subname='(shr_strdata_init_from_inline)' ! ---------------------------------------------- rc = ESMF_SUCCESS - ! Initialize sdat%logunit and sdat%mainproc - sdat%mainproc = (my_task == main_task) + ! Initialize module variable mainproc + call ESMF_VmGetCurrent(vm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_VMGet(vm, localpet=localPet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + mainproc = (localPet == main_task) + + ! Set module variable logout + if (mainproc) then + logout = logunit + end if + + if (mainproc) then + if (present(stream_name)) then + write(logout,'(3a)') trim(subname),' inline call for stream ',trim(stream_name) + else + write(logout,'(2a)') trim(subname),' inline call for generic stream stream_data' + end if + end if + #ifdef CESMCOUPLED ! Initialize sdat pio sdat%pio_subsystem => shr_pio_getiosys(trim(compname)) @@ -306,7 +341,7 @@ subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, & stream_yearFirst, stream_yearLast, stream_yearAlign, & stream_offset, stream_taxmode, stream_tintalgo, stream_dtlimit, & stream_fldlistFile, stream_fldListModel, stream_fileNames, & - logunit, trim(compname), src_mask, dst_mask) + logout, trim(compname), mainproc, src_mask, dst_mask) ! Now finish initializing sdat call shr_strdata_init(sdat, model_clock, stream_name, rc) @@ -396,10 +431,8 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) type(ESMF_Field) :: lfield ! temporary type(ESMF_Field) :: lfield_dst ! temporary integer :: srcTermProcessing_Value = 0 ! should this be a module variable? - integer :: localpet logical :: fileExists type(ESMF_VM) :: vm - logical :: mainproc integer :: nvars integer :: i, stream_nlev, index character(CL) :: stream_vector_names @@ -408,34 +441,32 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) rc = ESMF_SUCCESS + ! Obtain vm (needed in following loop) call ESMF_VmGetCurrent(vm, rc=rc) - call ESMF_VMGet(vm, localpet=localPet, rc=rc) - mainproc= (localPet==main_task) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Loop over streams - do ns = 1,shr_strdata_get_stream_count(sdat) + loop_over_streams1: do ns = 1,shr_strdata_get_stream_count(sdat) ! Initialize calendar for stream n call ESMF_VMBroadCast(vm, sdat%stream(ns)%calendar, CS, 0, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Set pointer for stream_mesh stream_mesh => sdat%pstrm(ns)%stream_mesh ! Create the target stream mesh from the stream mesh file - ! TODO: add functionality if the stream mesh needs to be created from a grid call shr_stream_getMeshFileName (sdat%stream(ns), filename) if (filename /= 'none' .and. mainproc) then inquire(file=trim(filename),exist=fileExists) if (.not. fileExists) then - call shr_log_error(subName//"ERROR: file does not exist: "//trim(fileName), rc=rc) + call shr_log_error(trim(subname)//"ERROR: stream mesh file does not exist: "//trim(fileName), rc=rc) return end if endif - ! - ! We do not yet have mask information, but we are required to set it here and change it - ! later. - ! - if(filename /= 'none') then + + ! We do not yet have mask information, but we are required to set it here and change it later. + if (filename /= 'none') then stream_mesh = ESMF_MeshCreate(trim(filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif @@ -459,8 +490,8 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) sdat%pstrm(ns)%stream_ub = 2 allocate(sdat%pstrm(ns)%fldbun_data(2)) if (mainproc) then - write(sdat%stream(1)%logunit,'(a,i8)') trim(subname)//" Creating field bundle array fldbun_data of size 2 for stream ",& - ns + write(logout,'(2a,i0)') 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 @@ -486,7 +517,8 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (mainproc) then if (i == 1) then - write(sdat%stream(1)%logunit,'(a,i8)') " adding field "//trim(sdat%pstrm(ns)%fldlist_model(nfld))//& + write(logout,'(2a,i0)') trim(subname),& + " adding field "//trim(sdat%pstrm(ns)%fldlist_model(nfld))//& " to fldbun_data for stream ",ns end if end if @@ -605,10 +637,11 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) end if end if - end do ! end of loop over streams + end do loop_over_streams1 ! end of loop over streams ! Check for vector pairs in the stream - BOTH ucomp and vcomp MUST BE IN THE SAME STREAM - do ns = 1,shr_strdata_get_stream_count(sdat) + loop_over_stream2: do ns = 1,shr_strdata_get_stream_count(sdat) + stream_mesh => sdat%pstrm(ns)%stream_mesh stream_nlev = sdat%pstrm(ns)%stream_nlev stream_vector_names = trim(sdat%stream(ns)%stream_vectors) @@ -637,11 +670,11 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) ungriddedLbound=(/1/), ungriddedUbound=(/2/), gridToFieldMap=(/2/), rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (mainproc) then - write(sdat%stream(1)%logunit,'(a,i8)') "creating ESMF stream vector field with names" //& + write(logout,'(2a,i0)') trim(subname)," creating ESMF stream vector field with names" //& trim(stream_vector_names)//" for stream ",ns end if end if - enddo + enddo loop_over_stream2 ! initialize sdat model clock and calendar sdat%model_clock = model_clock @@ -663,7 +696,7 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) else call shr_strdata_print(sdat, 'stream_data') end if - write(sdat%stream(1)%logunit,*) ' successfully initialized sdat' + write(logout,'(2a)') trim(subname),' successfully initialized sdat' endif end subroutine shr_strdata_init @@ -688,7 +721,7 @@ subroutine shr_strdata_get_stream_nlev(sdat, stream_index, rc) integer :: stream_nlev integer :: old_handle ! previous setting of pio error handling character(CS) :: units - character(*), parameter :: subname = '(shr_strdata_set_stream_domain) ' + character(*), parameter :: subname = '(shr_strdata_get_stream_nlev) ' ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -699,10 +732,11 @@ subroutine shr_strdata_get_stream_nlev(sdat, stream_index, rc) else call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (sdat%mainproc) then + if (mainproc) then call shr_stream_getData(sdat%stream(stream_index), 1, filename) end if call ESMF_VMBroadCast(vm, filename, CX, 0, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) rcode = pio_inq_dimid(pioid, trim(sdat%stream(stream_index)%lev_dimname), dimid) rcode = pio_inq_dimlen(pioid, dimid, stream_nlev) @@ -722,10 +756,11 @@ subroutine shr_strdata_get_stream_nlev(sdat, stream_index, rc) end if call pio_closefile(pioid) end if - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,*) trim(subname)//' stream_nlev = ',stream_nlev + if (mainproc) then + write(logout,*) + write(logout,'(2a,2x,i0)') trim(subname),' stream_nlev = ',stream_nlev if (stream_nlev /= 1) then - write(sdat%stream(1)%logunit,*)' stream vertical levels = ',sdat%pstrm(stream_index)%stream_vlevs + write(logout,'(3a)') trim(subname),' stream vertical levels = ',sdat%pstrm(stream_index)%stream_vlevs end if end if @@ -765,10 +800,11 @@ subroutine shr_strdata_get_stream_domain(sdat, stream_index, fldname, flddata, r if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Determine the file to open - if (sdat%mainproc) then + if (mainproc) then call shr_stream_getData(sdat%stream(stream_index), 1, filename) end if call ESMF_VMBroadCast(vm, filename, CX, 0, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Open the file rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) @@ -900,12 +936,13 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) integer ,parameter :: tadj = 2 character(len=*) ,parameter :: timname = "_strd_adv" character(*) ,parameter :: subname = "(shr_strdata_advance) " - character(*) ,parameter :: F00 = "('(shr_strdata_advance) ',a)" - character(*) ,parameter :: F01 = "('(shr_strdata_advance) ',a,a,i4,2(f10.5,2x))" !------------------------------------------------------------------------------- rc = ESMF_SUCCESS + ! Note that input variable logunit is no longer used, but is kept in place here for + ! backwards compatibility + nullify(dataptr1d) nullify(dataptr1d_ub) nullify(dataptr1d_lb) @@ -926,7 +963,7 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) lstr = trim(istr) ! To avoid an unused dummy variable warning if(present(timers)) then - write(sdat%stream(1)%logunit,*) trim(subname),'optional variable timers present but unused' + write(logout,'(2a)') trim(subname),'optional variable timers present but unused' endif call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_total') @@ -971,15 +1008,15 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) case ('full_file') ! TODO: need to put in capability to read all stream data at once case default - write(logunit,F00) "ERROR: Unsupported readmode : ", trim(sdat%stream(ns)%readmode) + write(logout,'(2a)') "ERROR: Unsupported readmode : ", trim(sdat%stream(ns)%readmode) call shr_log_error(subName//"ERROR: Unsupported readmode: "//trim(sdat%stream(ns)%readmode), rc=rc) return end select - if (debug > 0 .and. sdat%mainproc) then - write(sdat%stream(1)%logunit,*) trim(subname),' newData flag = ',ns,newData(ns) - write(sdat%stream(1)%logunit,*) trim(subname),' LB ymd,tod = ',ns,sdat%pstrm(ns)%ymdLB,sdat%pstrm(ns)%todLB - write(sdat%stream(1)%logunit,*) trim(subname),' UB ymd,tod = ',ns,sdat%pstrm(ns)%ymdUB,sdat%pstrm(ns)%todUB + if (debug>0 .and. mainproc) then + write(logout,'(2a,2x,i0,2x,a,2x,l4)') trim(subname),' newData flag for stream = ',ns,' is ',newData(ns) + write(logout,'(2a,2x,3(i0,2x))') trim(subname),' LB ymd,tod = ',ns,sdat%pstrm(ns)%ymdLB,sdat%pstrm(ns)%todLB + write(logout,'(2a,2x,3(i0,2x))') trim(subname),' UB ymd,tod = ',ns,sdat%pstrm(ns)%ymdUB,sdat%pstrm(ns)%todUB endif ! --------------------------------------------------------- @@ -998,7 +1035,7 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) else if (.not. ( trim(sdat%model_calendar) == trim(shr_cal_gregorian)) .and. & (trim(sdat%stream(ns)%calendar) == trim(shr_cal_noleap))) then ! case (3), abort - write(logunit,*) trim(subname),' ERROR: mismatch calendar ', & + write(logout,'(3a)') trim(subname),' ERROR: mismatch calendar ', & trim(sdat%model_calendar),':',trim(sdat%stream(ns)%calendar) call shr_log_error(trim(subname)//' ERROR: mismatch calendar ', rc=rc) return @@ -1035,8 +1072,9 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) if (.not. sdat%pstrm(ns)%override_annual_cycle) then if(sdat%stream(ns)%dtlimit == -1) then sdat%pstrm(ns)%override_annual_cycle = .true. - if(sdat%mainproc) then - write(logunit,*) trim(subname),' WARNING: Stream ',ns,' is not cycling on annual boundaries, and dtlimit check has been overridden' + if (mainproc) then + write(logout,'(2a,2x,i0,a)') trim(subname),' WARNING: Stream ',& + ns,' is not cycling on annual boundaries, and dtlimit check has been overridden' endif else dtime = abs(real(dday,r8) + real(sdat%pstrm(ns)%todUB-sdat%pstrm(ns)%todLB,r8)/shr_const_cDay) @@ -1045,19 +1083,15 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) sdat%pstrm(ns)%dtmax = max(sdat%pstrm(ns)%dtmax,dtime) if ((sdat%pstrm(ns)%dtmax/sdat%pstrm(ns)%dtmin) > sdat%stream(ns)%dtlimit) then - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,'(a,i8)') trim(subname),' ERROR: for stream ',ns - write(sdat%stream(1)%logunit,'(a,i8)') trim(subname),' ERROR: dday = ',dday - write(sdat%stream(1)%logunit,'(a,4(f15.5,2x))') trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',& + if (mainproc) then + write(logout,'(2a,i0)') trim(subname),' ERROR: for stream ',ns + write(logout,'(3a)') trim(subname),' ERROR: calendar = ',trim(calendar) + write(logout,'(2a,i0)') trim(subname),' ERROR: dday = ',dday + write(logout,'(2a,4(es13.6,2x))') trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',& dtime, sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit - write(sdat%stream(1)%logunit,'(a,4(i10,2x))') trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', & + write(logout,'(a,4(i0,2x))') trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', & sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB end if - write(6,*) trim(subname),' ERROR: for stream ',ns, ' and calendar ',trim(calendar) - write(6,*) trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',& - dtime, sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit - write(6,*) trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', & - sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB call shr_log_error(trim(subName)//' ERROR dt limit for stream, see atm.log output', rc=rc) return endif @@ -1090,11 +1124,11 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_coszenC') call shr_tInterp_getCosz(coszen, sdat%model_lon, sdat%model_lat, ymdmod(ns), todmod, & sdat%eccen, sdat%mvelpp, sdat%lambm0, sdat%obliqr, sdat%stream(ns)%calendar, & - sdat%mainproc, sdat%stream(1)%logunit) + mainproc, logout) call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_coszenC') - if (debug > 0 .and. sdat%mainproc) then + if (debug > 0 .and. mainproc) then do n = 1,size(coszen) - write(sdat%stream(1)%logunit,'(a,i4,2x,2(i18,2x),i8,d20.10)')' stream,ymdmod,todmod,n,coszen= ',& + write(logout,'(a,i0,2x,2(i0,2x),i0,es13.6)')' stream,ymdmod,todmod,n,coszen= ',& ns, ymd, tod, n, coszen(n) end do end if @@ -1109,11 +1143,12 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) call shr_tInterp_getAvgCosz(sdat%tavCoszen, sdat%model_lon, sdat%model_lat, & sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB, & sdat%eccen, sdat%mvelpp, sdat%lambm0, sdat%obliqr, sdat%modeldt, & - sdat%stream(ns)%calendar, sdat%mainproc, sdat%stream(1)%logunit, rc=rc) + sdat%stream(ns)%calendar, mainproc, logout, rc=rc) call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_coszenN') - if (debug > 0 .and. sdat%mainproc) then + if (debug > 0 .and. mainproc) then do n = 1,size(coszen) - write(sdat%stream(1)%logunit,'(a,i4,2x,4(i18,2x),i8,d20.10)')' stream,lbymd,lbsec,ubymd,ubsec,newdata,n,tavgCoszen= ',& + write(logout,'(2a,i0,2x,4(i0,2x),i0,es13.6)') trim(subname), & + ' stream,lbymd,lbsec,ubymd,ubsec,newdata,n,tavgCoszen= ',& ns, sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB, & n, sdat%tavCoszen(n) end do @@ -1165,12 +1200,13 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_tint') call shr_tInterp_getFactors(sdat%pstrm(ns)%ymdlb, sdat%pstrm(ns)%todlb, & sdat%pstrm(ns)%ymdub, sdat%pstrm(ns)%todub, & - ymdmod(ns), todmod, flb, fub, calendar=sdat%stream(ns)%calendar, logunit=sdat%stream(1)%logunit, & + ymdmod(ns), todmod, flb, fub, calendar=sdat%stream(ns)%calendar, logunit=logout, & algo=trim(sdat%stream(ns)%tinterpalgo), rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - if (debug > 0 .and. sdat%mainproc) then - write(sdat%stream(1)%logunit,'(a,i4,2(f10.5,2x))') & + if (debug > 0 .and. mainproc) then + write(logout,'(a,i4,2(f10.5,2x))') & trim(subname)//' non-cosz-interp stream, flb, fub= ',ns,flb,fub + write(logout,'(a)') '------------------------------------------------------' endif do nf = 1,size(sdat%pstrm(ns)%fldlist_model) if (sdat%pstrm(ns)%stream_nlev > 1) then @@ -1270,39 +1306,32 @@ subroutine shr_strdata_print(sdat, name) ! local variables integer :: ns character(*),parameter :: subName = "(shr_strdata_print) " - character(*),parameter :: F00 = "('(shr_strdata_print) ',8a)" - character(*),parameter :: F01 = "('(shr_strdata_print) ',a,i6,a)" - character(*),parameter :: F02 = "('(shr_strdata_print) ',a,es13.6)" - character(*),parameter :: F03 = "('(shr_strdata_print) ',a,i2,a,a)" - character(*),parameter :: F04 = "('(shr_strdata_print) ',a)" - character(*),parameter :: F05 = "('(shr_strdata_print) ',a,i2,a,es13.6)" - character(*),parameter :: F06 = "('(shr_strdata_print) ',a,i2,a,i1)" - character(*),parameter :: F90 = "('(shr_strdata_print) ',58('-'))" !------------------------------------------------------------------------------- - write(sdat%stream(1)%logunit,*) - write(sdat%stream(1)%logunit,F90) - write(sdat%stream(1)%logunit,F00) "name = ",trim(name) - write(sdat%stream(1)%logunit,F00) "calendar = ",trim(sdat%model_calendar) - write(sdat%stream(1)%logunit,F02) "eccen = ",sdat%eccen - write(sdat%stream(1)%logunit,F02) "mvelpp = ",sdat%mvelpp - write(sdat%stream(1)%logunit,F02) "lambm0 = ",sdat%lambm0 - write(sdat%stream(1)%logunit,F02) "obliqr = ",sdat%obliqr - write(sdat%stream(1)%logunit,F01) "pio_iotype = ",sdat%io_type - write(sdat%stream(1)%logunit,F01) "nstreams = ",shr_strdata_get_stream_count(sdat) - write(sdat%stream(1)%logunit,F04) "Per stream information " + write(logout,*) + write(logout,'(a)') '------------------------------------------------------' + write(logout,'(3a)') trim(subname)," name = ",trim(name) + write(logout,'(3a)') trim(subname)," calendar = ",trim(sdat%model_calendar) + write(logout,'(2a,2x,es13.6)') trim(subname)," eccen = ",sdat%eccen + write(logout,'(2a,2x,es13.6)') trim(subname)," mvelpp = ",sdat%mvelpp + write(logout,'(2a,2x,es13.6)') trim(subname)," lambm0 = ",sdat%lambm0 + write(logout,'(2a,2x,es13.6)') trim(subname)," obliqr = ",sdat%obliqr + write(logout,'(2a,i0)') trim(subname)," pio_iotype = ",sdat%io_type + write(logout,'(2a,2x,i0)') trim(subname)," nstreams = ",shr_strdata_get_stream_count(sdat) + write(logout,'(2a)') trim(subname)," Per stream information " do ns = 1, shr_strdata_get_stream_count(sdat) - write(sdat%stream(1)%logunit,F03) " taxMode (",ns,") = ",trim(sdat%stream(ns)%taxmode) - write(sdat%stream(1)%logunit,F05) " dtlimit (",ns,") = ",sdat%stream(ns)%dtlimit - write(sdat%stream(1)%logunit,F03) " mapalgo (",ns,") = ",trim(sdat%stream(ns)%mapalgo) - write(sdat%stream(1)%logunit,F03) " tintalgo(",ns,") = ",trim(sdat%stream(ns)%tinterpalgo) - write(sdat%stream(1)%logunit,F03) " readmode(",ns,") = ",trim(sdat%stream(ns)%readmode) - write(sdat%stream(1)%logunit,F03) " vectors (",ns,") = ",trim(sdat%stream(ns)%stream_vectors) - write(sdat%stream(1)%logunit,F06) " src_mask(",ns,") = ",sdat%stream(ns)%src_mask_val - write(sdat%stream(1)%logunit,F06) " dst_mask(",ns,") = ",sdat%stream(ns)%dst_mask_val - write(sdat%stream(1)%logunit,F01) " " + write(logout,'(2a,i0,2a)') trim(subname)," taxMode (",ns,") = ",trim(sdat%stream(ns)%taxmode) + write(logout,'(2a,i0,a,es13.6)') trim(subname)," dtlimit (",ns,") = ",sdat%stream(ns)%dtlimit + write(logout,'(2a,i0,2a)') trim(subname)," tintalgo(",ns,") = ",trim(sdat%stream(ns)%tinterpalgo) + write(logout,'(2a,i0,2a)') trim(subname)," mapalgo (",ns,") = ",trim(sdat%stream(ns)%mapalgo) + write(logout,'(2a,i0,2a)') trim(subname)," readmode(",ns,") = ",trim(sdat%stream(ns)%readmode) + write(logout,'(2a,i0,2a)') trim(subname)," vectors (",ns,") = ",trim(sdat%stream(ns)%stream_vectors) + write(logout,'(2a,i0,a,i0)') trim(subname)," src_mask(",ns,") = ",sdat%stream(ns)%src_mask_val + write(logout,'(2a,i0,a,i0)') trim(subname)," dst_mask(",ns,") = ",sdat%stream(ns)%dst_mask_val + write(logout,'(2a)') trim(subname)," " end do - write(sdat%stream(1)%logunit,F90) + write(logout,'(a)') '------------------------------------------------------' + write(logout,*) end subroutine shr_strdata_print @@ -1325,7 +1354,6 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) ! local variables type(shr_stream_streamType), pointer :: stream type(ESMF_Mesh) , pointer :: stream_mesh - type(ESMF_VM) :: vm logical :: fileexists integer :: oDateLB,oSecLB,dDateLB integer :: oDateUB,oSecUB,dDateUB @@ -1338,8 +1366,6 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) character(CX) :: filename_prev logical :: find_bounds character(*), parameter :: subname = '(shr_strdata_readLBUB) ' - character(*), parameter :: F00 = "('(shr_strdata_readLBUB) ',8a)" - character(*), parameter :: F01 = "('(shr_strdata_readLBUB) ',a,5i8)" !------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -1348,8 +1374,6 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) call ESMF_TraceRegionEnter(trim(istr)//'_setup') ! allocate streamdat instance on all tasks - call ESMF_VMGetCurrent(vm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return newData = .false. n_lb = -1 @@ -1372,39 +1396,49 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) ! if model current date is outside of model lower or upper bound - find the stream bounds find_bounds = (rDateM < rDateLB .or. rDateM >= rDateUB) - if (debug > 0 .and. sdat%mainproc) then - write(sdat%stream(1)%logunit,'(a,i4,2x,6(i18,2x),l7)')' stream,lbymd,lbsec,mdate,msec,ubymd,ubsec,newdata= ',ns,& - sdat%pstrm(ns)%ymdLB,sdat%pstrm(ns)%todLB, & - mdate,msec, & - sdat%pstrm(ns)%ymdUB,sdat%pstrm(ns)%todUB,find_bounds - write(sdat%stream(1)%logunit,'(a,i4,2x,3(f20.3,2x),l7)')' stream,rdateLB,rdateM,rdateUB,newdata= ',& - ns,rdateLB,rdateM,rdateUB,find_bounds - end if if (find_bounds) then call ESMF_TraceRegionEnter(trim(istr)//'_fbound') - call shr_stream_findBounds(stream, mDate, mSec, sdat%mainproc, & + call shr_stream_findBounds(stream, mDate, mSec, & sdat%pstrm(ns)%ymdLB, dDateLB, sdat%pstrm(ns)%todLB, n_lb, filename_lb, & sdat%pstrm(ns)%ymdUB, dDateUB, sdat%pstrm(ns)%todUB, n_ub, filename_ub) call ESMF_TraceRegionExit(trim(istr)//'_fbound') - if (debug > 0 .and. sdat%mainproc) then - write(sdat%stream(1)%logunit,'(a,i4,2x,6(i18,2x),l7)')' stream,lbymd,lbsec,mdate,msec,ubymd,ubsec,newdata= ',ns,& - sdat%pstrm(ns)%ymdLB,sdat%pstrm(ns)%todLB,& - mdate,msec, & - sdat%pstrm(ns)%ymdUB,sdat%pstrm(ns)%todUB - write(sdat%stream(1)%logunit,'(a,i4,2x,3(f20.3,2x),l7)')' stream,rdateLB,rdateM,rdateUB,newdata= ',& - ns,rdateLB,rdateM,rdateUB,find_bounds - end if - endif + end if ! determine if need to read in new stream data newdata = (sdat%pstrm(ns)%ymdLB /= oDateLB .or. sdat%pstrm(ns)%todLB /= oSecLB) + + ! write time bounds info + if (debug > 0 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname),' stream number is: ',ns + write(logout,'(2a,l7,a,l7)') trim(subname), & + ' find_bounds = ',find_bounds,' newdata is = ',newdata + write(logout,'(2a,4(2x,i0))') trim(subname), & + ' oDateLB, OSecLb, oDateUB, OsecUB = ',& + oDateLB, OSecLb, oDateUB, OsecUB + write(logout,'(2a,2x,3(f13.6,2x),l4)') trim(subname), & + ' rdateLB,rdateM,rdateUB = ',& + rdateLB, rdateM, rdateUB + write(logout,'(2a,2x,6(i0,2x))') trim(subname), & + ' lbymd,lbsec,mdate,msec,ubymd,ubsec = ',& + sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, & + mdate, msec, & + sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB + end if + + ! if newdata, determine if do a copy or read in new lower bound data if (newdata) then if (sdat%pstrm(ns)%ymdLB == oDateUB .and. sdat%pstrm(ns)%todLB == oSecUB) then + if (debug > 0 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname),' Copying upper bound bound of data to lower bound for stream ',ns + end if ! copy fldbun_stream_ub to fldbun_stream_lb i = sdat%pstrm(ns)%stream_ub sdat%pstrm(ns)%stream_ub = sdat%pstrm(ns)%stream_lb sdat%pstrm(ns)%stream_lb = i else + if (debug > 0 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname),' Reading in new lower bound of data for stream ',ns + end if ! read lower bound of data call shr_strdata_readstrm(sdat, sdat%pstrm(ns), stream, & sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_lb), & @@ -1419,11 +1453,14 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_ub), & filename_ub, n_ub, istr=trim(istr)//'_UB', boundstr='ub', rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + if (debug > 0 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname),' Reading in new upper bound of data for stream ',ns + end if endif ! determine previous & next data files in list of files call ESMF_TraceRegionEnter(trim(istr)//'_filemgt') - if (sdat%mainproc .and. newdata) then + if (mainproc .and. newdata) then call shr_stream_getPrevFileName(stream, filename_lb, filename_prev) call shr_stream_getNextFileName(stream, filename_ub, filename_next) inquire(file=trim(filename_next),exist=fileExists) @@ -1494,10 +1531,8 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & character(CS) :: uname, vname integer :: i, lev logical :: checkflag = .false. - character(*), parameter :: subname = '(shr_strdata_readstrm) ' - character(*), parameter :: F00 = "('(shr_strdata_readstrm) ',8a)" - character(*), parameter :: F02 = "('(shr_strdata_readstrm) ',2a,i8)" character(CL) :: errmsg + character(*), parameter :: subname = '(shr_strdata_readstrm) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -1513,7 +1548,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & nullify(data_v_dst) ! Set up file to read from - if (sdat%mainproc) then + if (mainproc) then inquire(file=trim(fileName),exist=fileExists) if (.not. fileExists) then call shr_log_error(subName//"ERROR: file does not exist: "//trim(fileName), rc=rc) @@ -1529,10 +1564,14 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & else ! otherwise close the old file if open and open new file if (fileopen) then - if (sdat%mainproc) write(sdat%stream(1)%logunit,F00) 'close : ',trim(currfile) + if (mainproc) then + write(logout,'(3a)') trim(subname),' closing : ',trim(currfile) + end if call pio_closefile(pioid) endif - if (sdat%mainproc) write(sdat%stream(1)%logunit,F00) 'opening : ',trim(filename) + if (mainproc) then + write(logout,'(3a)') trim(subname),' opening : ',trim(filename) + end if rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) call shr_stream_setCurrFile(stream, fileopen=.true., currfile=trim(filename), currpioid=pioid) endif @@ -1545,7 +1584,9 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & if (ESMF_MeshIsCreated(per_stream%stream_mesh)) then if (.not. per_stream%stream_pio_iodesc_set) then - if (sdat%mainproc) write(sdat%stream(1)%logunit,F00) 'setting pio descriptor : ',trim(filename) + if (mainproc) then + write(logout,'(3a)') trim(subname),' setting pio descriptor : ',trim(filename) + end if call shr_strdata_set_stream_iodesc(sdat, per_stream, trim(per_stream%fldlist_stream(1)), & pioid, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -1575,8 +1616,8 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & ! ****************************************************************************** call ESMF_TraceRegionEnter(trim(istr)//'_readpio') - if (sdat%mainproc) then - write(sdat%stream(1)%logunit,F02) 'reading file ' // trim(boundstr) //': ',trim(filename), nt + if (mainproc) then + write(logout,'(3a,2x)') trim(subname),' reading file ' // trim(boundstr) //': ',trim(filename) endif if (ESMF_FieldIsCreated(per_stream%field_stream_vector)) then @@ -1638,9 +1679,10 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & if(rcode == PIO_NOERR) handlefill=.true. call PIO_seterrorhandling(pioid, old_error_handle) - if (debug>0 .and. sdat%mainproc) then - write(sdat%stream(1)%logunit,F02)' reading '//& - trim(per_stream%fldlist_stream(nf))//' into '//trim(per_stream%fldlist_model(nf)),& + if (debug>0 .and. mainproc) then + write(logout,'(3a,2x,i0)') trim(subname),& + ' reading '//trim(per_stream%fldlist_stream(nf))//& + ' into '//trim(per_stream%fldlist_model(nf)), & ' at time index: ',nt end if @@ -1665,7 +1707,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & ! Single point streams are not allowed to have missing values if (stream%mapalgo == 'none' .and. any(data_real2d == fillvalue_r4)) then write(errmsg,*) ' ERROR: _Fillvalue found in stream input variable: '// trim(per_stream%fldlist_stream(nf)) - if(sdat%mainproc) write(sdat%stream(1)%logunit,*) trim(errmsg) + if(mainproc) write(logout,'(2a)') trim(subname),trim(errmsg) call shr_log_error(errmsg, rc=rc) return endif @@ -1700,7 +1742,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & ! Single point streams are not allowed to have missing values if (stream%mapalgo == 'none' .and. any(data_real1d == fillvalue_r4)) then write(errmsg,*) ' ERROR: _Fillvalue found in stream input variable: '// trim(per_stream%fldlist_stream(nf)) - if(sdat%mainproc) write(sdat%stream(1)%logunit,*) trim(errmsg) + if(mainproc) write(logout,'(2a)') trim(subname),trim(errmsg) call shr_log_error(errmsg, rc=rc) return endif @@ -1770,7 +1812,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & ! Single point streams are not allowed to have missing values if (stream%mapalgo == 'none' .and. any(data_dbl1d == fillvalue_r8)) then write(errmsg,*) ' ERROR: _Fillvalue found in stream input variable: '// trim(per_stream%fldlist_stream(nf)) - call shr_log_error(errmsg, rc=rc) + call shr_log_error(trim(subname)//trim(errmsg), rc=rc) return endif do n = 1,size(dataptr1d) @@ -1974,16 +2016,10 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) integer, allocatable :: dimlens(:) type(ESMF_DistGrid) :: distGrid integer :: lsize - integer :: logunit - logical :: mainproc 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)" - character(*), parameter :: F01 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,a)" - character(*), parameter :: F02 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,i8,2x,a)" - character(*), parameter :: F03 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,a)" !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -1992,10 +2028,6 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) nullify(compdof) nullify(compdof3d) - ! set logunit and mainproc - logunit = sdat%stream(1)%logunit - mainproc = sdat%mainproc - ! set the number of vertical levels to a local variable stream_nlev = per_stream%stream_nlev @@ -2030,7 +2062,6 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) ! third dimension is lev and fourth dimension is time gsize2d = dimlens(1)*dimlens(2) else - write(6,*)'ERROR: dimlens= ',dimlens call shr_log_error(trim(subname)//' only ndims of 3 and 4 '//& ' total dimensions are currently supported for multiple level fields '// & ' with a time dimension', rc=rc) @@ -2044,9 +2075,8 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) ! third dimension is lev gsize2d = dimlens(1)*dimlens(2) else - write(6,*)'ERROR: dimlens= ',dimlens - call shr_log_error(trim(subname)//' only ndims of 2 and 3'// & - ' total dimensions are currently supported for multiple level fields'// & + call shr_log_error(trim(subname)//' only ndims of 2 and 3 '// & + ' total dimensions are currently supported for multiple level fields '// & ' without a time dimension', rc=rc) return end if @@ -2070,15 +2100,14 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) rcode = pio_inq_dimname(pioid, dimids(ndims), dimname) if ((trim(dimname) == 'time' .or. trim(dimname) == 'nt')) then if (mainproc) then - write(logunit,F03) 'setting iodesc for 2d: '//trim(fldname)// & - ' with dimlens(1) = ',dimlens(1),& - ' and dimlens(2) is a time dimension ' + write(logout,'(2a,2(i0,2x),a)') trim(subname),' setting iodesc for 2d: '//trim(fldname)// & + ' with dimlens(1) = ',dimlens(1),' and dimlens(2) is a time dimension ' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1)/), compdof, & per_stream%stream_pio_iodesc) else if (stream_nlev > 1) then if (mainproc) then - write(logunit,F01) 'setting iodesc for 2d: '//trim(fldname)// & + write(logout,'(2a,2x,i0,2x,i0,a)') trim(subname),' setting iodesc for 2d: '//trim(fldname)// & ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2), & ' and dimlens(2) is a vertical dimension' end if @@ -2086,8 +2115,8 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) per_stream%stream_pio_iodesc) else if (mainproc) then - write(logunit,F01) 'setting iodesc for 2d: '//trim(fldname)// & - ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2), & + write(logout,'(2a,2x,2(i0,2x),a)') trim(subname),' setting iodesc for 2d: '//trim(fldname)// & + ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2),& ' and the variable has no time or vertical dimension ' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, & @@ -2101,16 +2130,18 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) if (trim(dimname) == 'time' .or. trim(dimname) == 'nt') then if (stream_nlev > 1) then if (mainproc) then - write(logunit,F01) 'setting iodesc for 3d: '//trim(fldname)// & - ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2),& + write(logout,'(2a,2x,2(i0,2x),a)') trim(subname), & + 'setting iodesc for 3d: '//trim(fldname)//' with dimlens(1),dimlens(2) = ', & + dimlens(1),dimlens(2), & ' where dimlen(2) is a vertical dimension and dimlen(3) is time dimension ' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof3d, & per_stream%stream_pio_iodesc) else if (mainproc) then - write(logunit,F01) 'setting iodesc for 3d: '//trim(fldname)// & - ' with dimlens(1),dimlens(2) = ',dimlens(1),dimlens(2),& + write(logout,'(2a,2x,2(i0,2x),a)') trim(subname),& + ' setting iodesc for 3d: '//trim(fldname)//' with dimlens(1),dimlens(2) = ', & + dimlens(1),dimlens(2), & ' and dimlen(3) is a time dimension ' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, & @@ -2119,14 +2150,14 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) else if (stream_nlev > 1) then if (mainproc) then - write(logunit,F01) 'setting iodesc for 3d: '//trim(fldname)// & - ' with dimlens(1), dimlens(2), dimlens(3) = ',dimlens(1),dimlens(2), dimlens(3), & + write(logout,'(2a,2x,3(i0,2x),a)') trim(subname), & + ' setting iodesc for 3d: '//trim(fldname)//' with dimlens(1), dimlens(2), dimlens(3) = ',& + dimlens(1),dimlens(2), dimlens(3), & ' where dimlens(3) is a vertical dimension' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2),dimlens(3)/), compdof3d, & per_stream%stream_pio_iodesc) else - write(6,*)'ERROR: dimlens= ',dimlens call shr_log_error(trim(subname)//& ' the third dimension of a 3d field must be either time or a vertical level', rc=rc) return @@ -2139,20 +2170,19 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) rcode = pio_inq_dimname(pioid, dimids(ndims), dimname) if (stream_nlev > 1 .and. (trim(dimname) == 'time' .or. trim(dimname) == 'nt')) then if (mainproc) then - write(logunit,F02) 'setting iodesc for 4d: '//trim(fldname)// & - ' with dimlens(1), dimlens(2),dimlens(3) = ',dimlens(1),dimlens(2),dimlens(3),& + write(logout,'(2a,2x,3(i0,2x),a)') trim(subname), & + ' setting iodesc for 4d: '//trim(fldname)//' with dimlens(1), dimlens(2),dimlens(3) = ',& + dimlens(1),dimlens(2),dimlens(3), & ' where dimlens(3) is a vertical dimension and dimlens(4) is a time dimension ' end if call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2),dimlens(3)/), compdof3d, & per_stream%stream_pio_iodesc) else - write(6,*)'ERROR: dimlens= ',dimlens call shr_log_error(trim(subname)//' dimlens = 4 assumes a time dimension and a vertical dimension', rc=rc) return end if else - write(6,*)'ERROR: dimlens= ',dimlens call shr_log_error(trim(subname)//' only ndims of 2 and 3 and 4 are currently supported', rc=rc) return end if @@ -2169,6 +2199,8 @@ end subroutine shr_strdata_set_stream_iodesc subroutine shr_strdata_get_stream_pointer_1d(sdat, strm_fld, strm_ptr, & rc, requirePointer, errmsg) + use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) + ! Set a pointer, strm_ptr, for field, strm_fld, into sdat fldbun_model field bundle ! input/output variables @@ -2181,17 +2213,12 @@ subroutine shr_strdata_get_stream_pointer_1d(sdat, strm_fld, strm_ptr, & ! local variables integer :: ns, nf, ni - integer :: logunit - logical :: mainproc logical :: found character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer_1d) ' - character(*) , parameter :: F00 = "('(shr_strdata_get_stream_pointer_1d) ',8a)" ! ---------------------------------------------- rc = ESMF_SUCCESS - logunit = sdat%stream(1)%logunit - mainproc = sdat%mainproc found = .false. ! loop over all input streams and determine if the strm_fld is in the field bundle of the target stream @@ -2211,17 +2238,20 @@ subroutine shr_strdata_get_stream_pointer_1d(sdat, strm_fld, strm_ptr, & if (found) then ! If pointer found, preset value if (mainproc) then - write(logunit,F00)' strm_ptr is allocated and preset to huge for stream field strm_'//trim(strm_fld) + write(logout,'(2a)') trim(subname), & + ' strm_ptr is allocated and preset to nan for stream field strm_'//trim(strm_fld) end if do ni = 1,size(strm_ptr) - strm_ptr(ni) = huge(1._r8) + strm_ptr(ni) = nan end do else ! What to do if fldbun pointer is not found if (present(requirePointer)) then if (requirePointer) then if (present(errmsg)) then - if (sdat%mainproc) write(sdat%stream(1)%logunit,F00) trim(errmsg) + if (mainproc) then + write(logout,'(2a)') trim(subname), trim(errmsg) + end if end if call shr_log_error(subName//"ERROR: pointer not found for "//trim(strm_fld), rc=rc) return @@ -2235,6 +2265,8 @@ end subroutine shr_strdata_get_stream_pointer_1d subroutine shr_strdata_get_stream_pointer_2d(sdat, strm_fld, strm_ptr, & rc, requirePointer, errmsg) + use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) + ! Set a pointer, strm_ptr, for field, strm_fld, into sdat fldbun_model field bundle ! input/output variables @@ -2247,17 +2279,12 @@ subroutine shr_strdata_get_stream_pointer_2d(sdat, strm_fld, strm_ptr, & ! local variables integer :: ns, nf, ni, nj - integer :: logunit - logical :: mainproc logical :: found character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer_2d) ' - character(*) , parameter :: F00 = "('(shr_strdata_get_stream_pointer_2d) ',8a)" ! ---------------------------------------------- rc = ESMF_SUCCESS - logunit = sdat%stream(1)%logunit - mainproc = sdat%mainproc found = .false. ! loop over all input streams and determine if the strm_fld is in the field bundle of the target stream @@ -2277,11 +2304,12 @@ subroutine shr_strdata_get_stream_pointer_2d(sdat, strm_fld, strm_ptr, & if (found) then ! If pointer found, preset value if (mainproc) then - write(logunit,F00)' strm_ptr is allocated and preset to huge for stream field strm_'//trim(strm_fld) + write(logout,'(2a)') trim(subname), & + ' strm_ptr is allocated and preset to nan for stream field strm_'//trim(strm_fld) end if do nj = 1,size(strm_ptr, dim=2) do ni = 1,size(strm_ptr, dim=1) - strm_ptr(ni,nj) = huge(1._r8) + strm_ptr(ni,nj) = nan end do end do else @@ -2290,7 +2318,7 @@ subroutine shr_strdata_get_stream_pointer_2d(sdat, strm_fld, strm_ptr, & if (requirePointer) then if (present(errmsg)) then if (mainproc) then - write(logunit,F00) trim(errmsg) + write(logout,'(2a)') trim(subname),trim(errmsg) end if end if call shr_log_error(subName//"ERROR: pointer not found for "//trim(strm_fld), rc=rc) diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index 0b5026169..72fd7109f 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -103,7 +103,6 @@ module dshr_stream_mod type(iosystem_desc_t), pointer :: pio_subsystem integer :: pio_iotype integer :: pio_ioformat - integer :: logunit ! stdout log unit logical :: init = .false. ! has stream been initialized integer :: nFiles = 0 ! number of data files integer :: yearFirst = -1 ! first year to use in t-axis (yyyymmdd) @@ -138,6 +137,10 @@ module dshr_stream_mod !----- parameters ----- integer :: debug = 0 ! edit/turn-on for debug write statements real(R8) , parameter :: spd = shr_const_cday ! seconds per day + + integer :: logout + logical :: mainproc + character(*) , parameter :: u_FILE_u = & __FILE__ @@ -148,9 +151,10 @@ module dshr_stream_mod #ifndef DISABLE_FoX subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logunit, & pio_subsystem, io_type, io_format, compname, rc) + use FoX_DOM, only : extractDataContent, destroy, Node, NodeList, parseFile, getElementsByTagname use FoX_DOM, only : getLength, item - use ESMF, only : ESMF_VM, ESMF_VMGetCurrent, ESMF_VMBroadCast, ESMF_SUCCESS + use ESMF , only : ESMF_VM, ESMF_VMGetCurrent, ESMF_VMBroadCast, ESMF_SUCCESS ! --------------------------------------------------------------------- ! The xml format of a stream txt file will look like the following @@ -206,7 +210,10 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu nstrms = 0 - if (isroot_task) then + ! Set module variables logout and mainproc + logout = logunit + mainproc = isroot_task + if (mainproc) then Sdoc => parseFile(streamfilename, iostat=status) if (status /= 0) then @@ -216,7 +223,7 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu streamlist => getElementsByTagname(Sdoc, "stream_info") nstrms = getLength(streamlist) - ! allocate an array of shr_streamtype objects on just isroot_task + ! allocate an array of shr_streamtype objects on just mainproc allocate(streamdat(nstrms)) ! fill in non-default values for the streamdat attributes @@ -365,12 +372,12 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu call ESMF_VMBroadCast(vm, tmp, 1, 0, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return nstrms = tmp(1) - if (.not. isroot_task) then + if (.not. mainproc) then allocate(streamdat(nstrms)) endif ! broadcast the contents of streamdat from the main task to all tasks - do i=1,nstrms + loop_over_streams: do i=1,nstrms tmp(1) = streamdat(i)%nfiles tmp(2) = streamdat(i)%nvars tmp(3) = streamdat(i)%yearFirst @@ -385,7 +392,7 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu streamdat(i)%yearLast = tmp(4) streamdat(i)%yearAlign = tmp(5) streamdat(i)%offset = tmp(6) - if(.not. isroot_task) then + if(.not. mainproc) then allocate(streamdat(i)%file(streamdat(i)%nfiles)) allocate(streamdat(i)%varlist(streamdat(i)%nvars)) endif @@ -432,10 +439,13 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu streamdat(i)%pio_iotype = io_type streamdat(i)%pio_ioformat = io_format #endif - ! Set logunit - streamdat(i)%logunit = logunit - + if (mainproc) then + write(logout,'(2a,i0)') trim(subname),' getting calendar for stream ',i + end if call shr_stream_getCalendar(streamdat(i), 1, streamdat(i)%calendar) + if (mainproc) then + write(logout,'(2a,i0,2a)') trim(subname),' calendar for stream ',i,' is ',trim(streamdat(i)%calendar) + end if ! Error check if (trim(streamdat(i)%taxmode) == shr_stream_taxis_extend .and. streamdat(i)%dtlimit < 1.e10) then @@ -444,8 +454,7 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu end if ! initialize flag that stream has been set streamdat(i)%init = .true. - enddo - + enddo loop_over_streams end subroutine shr_stream_init_from_xml @@ -459,7 +468,9 @@ subroutine shr_stream_init_from_inline(streamdat, & stream_yearFirst, stream_yearLast, stream_yearAlign, & stream_offset, stream_taxmode, stream_tintalgo, stream_dtlimit, & stream_fldlistFile, stream_fldListModel, stream_fileNames, & - logunit, compname, stream_src_mask_val, stream_dst_mask_val) + logunit, compname, isroot_task, stream_src_mask_val, stream_dst_mask_val) + + use ESMF, only : ESMF_VM, ESMF_VMGetCurrent ! -------------------------------------------------------- ! set values of stream datatype independent of a reading in a stream text file @@ -486,17 +497,30 @@ subroutine shr_stream_init_from_inline(streamdat, & character(*) ,intent(in) :: stream_filenames(:) ! stream data filenames (full pathnamesa) integer ,intent(in) :: logunit ! stdout unit character(len=*) ,intent(in) :: compname ! component name (e.g. ATM, OCN...) + logical ,intent(in) :: isroot_task ! mainproc integer ,optional, intent(in) :: stream_src_mask_val ! source mask value integer ,optional, intent(in) :: stream_dst_mask_val ! destination mask value ! local variables - integer :: n - integer :: nfiles - integer :: nvars - character(CS) :: calendar ! stream calendar + integer :: n + integer :: nfiles + integer :: nvars + character(CS) :: calendar ! stream calendar character(*),parameter :: subName = '(shr_stream_init_from_inline) ' ! -------------------------------------------------------- + ! Set module variagble logout + logout = logunit + + ! Initialize module variable mainproc + mainproc = isroot_task + + ! call ESMF_VMGetCurrent(vm, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call ESMF_VMGet(vm, localPet=localPet, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! mainproc = (localPet == main_task) + ! Assume only 1 stream allocate(streamdat(1)) @@ -548,9 +572,6 @@ subroutine shr_stream_init_from_inline(streamdat, & streamdat(1)%varlist(n)%nameinmodel = trim(stream_fldlistModel(n)) end do - ! Initialize logunit - streamdat(:)%logunit = logunit - ! Get stream calendar call shr_stream_getCalendar(streamdat(1), 1, calendar) streamdat(1)%calendar = trim(calendar) @@ -565,13 +586,14 @@ subroutine shr_stream_init_from_inline(streamdat, & end subroutine shr_stream_init_from_inline !=============================================================================== - subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, & + + subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, & pio_subsystem, io_type, io_format, rc) - use esmf , only : ESMF_VM, ESMF_VMGetCurrent, ESMF_VMBroadCast - use esmf , only : ESMF_SUCCESS, ESMF_ConfigCreate, ESMF_ConfigLoadFile - use esmf , only : ESMF_ConfigGetLen, ESMF_ConfigGetAttribute - use esmf , only : ESMF_Config, ESMF_MAXSTR + use esmf , only : ESMF_VM, ESMF_VMGetCurrent, ESMF_VMBroadCast, ESMF_VMGet + use esmf , only : ESMF_SUCCESS, ESMF_ConfigCreate, ESMF_ConfigLoadFile + use esmf , only : ESMF_ConfigGetLen, ESMF_ConfigGetAttribute + use esmf , only : ESMF_Config, ESMF_MAXSTR !!--------------------------------------------------------------------- !! The configuration file is a text file that can have following entries @@ -609,20 +631,27 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, type(ESMF_VM) :: vm type(ESMF_Config) :: cf integer :: i, n, nstrms + integer :: myid character(2) :: mystrm - character(*),parameter :: subName = '(shr_stream_init_from_esmfconfig)' character(len=ESMF_MAXSTR), allocatable :: strm_tmpstrings(:) - character(*) , parameter :: u_FILE_u = __FILE__ - + character(*), parameter :: u_FILE_u = __FILE__ + character(*), parameter :: subName = '(shr_stream_init_from_esmfconfig)' ! --------------------------------------------------------------------- rc = ESMF_SUCCESS - nstrms = 0 + ! Set module variable logout + logout = logunit - ! allocate streamdat instance on all tasks + ! Set module variable mainproc call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_VMGet(vm, localPet=myid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + mainproc = (myid == 0) + + ! allocate streamdat instance on all tasks + nstrms = 0 ! set ESMF config cf = ESMF_ConfigCreate(rc=RC) @@ -633,7 +662,7 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, nstrms = ESMF_ConfigGetLen(config=CF, label='stream_info:', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! allocate an array of shr_stream_streamtype objects on just isroot_task + ! allocate an array of shr_stream_streamtype objects on just mainproc if( nstrms > 0 ) then allocate(streamdat(nstrms)) else @@ -746,8 +775,6 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, streamdat(i)%pio_subsystem => pio_subsystem streamdat(i)%pio_iotype = io_type streamdat(i)%pio_ioformat = io_format - ! Set logunit - streamdat(i)%logunit = logunit call shr_stream_getCalendar(streamdat(i), 1, streamdat(i)%calendar) @@ -770,8 +797,9 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, streamdat(:)%init = .true. end subroutine shr_stream_init_from_esmfconfig + !=============================================================================== - subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & + subroutine shr_stream_findBounds(strm, mDateIn, secIn, & mDateLB, dDateLB, secLB, n_lb, fileLB, mDateUB, dDateUB, secUB, n_ub, fileUB) !------------------------------------------------------------------------------- @@ -788,7 +816,6 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & type(shr_stream_streamType) ,intent(inout):: strm ! data stream to query integer ,intent(in) :: mDateIn ! model date (yyyymmdd) integer ,intent(in) :: secIn ! elapsed sec on model date - logical ,intent(in) :: isroot_task ! is mpi task root communicator task integer ,intent(out) :: mDateLB ! model date of LB integer ,intent(out) :: dDateLB ! data date of LB integer ,intent(out) :: secLB ! elap sec of LB @@ -823,15 +850,10 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & logical :: cycle ! is cycling on or off logical :: limit ! is limiting on or off character(*),parameter :: subName = '(shr_stream_findBounds) ' - character(*),parameter :: F00 = "('(shr_stream_findBounds) ',8a)" - character(*),parameter :: F01 = "('(shr_stream_findBounds) ',a,i9.8,a)" - character(*),parameter :: F02 = "('(shr_stream_findBounds) ',a,2i9.8,i6,i5,1x,a)" - character(*),parameter :: F03 = "('(shr_stream_findBounds) ',a,i4)" - character(*),parameter :: F04 = "('(shr_stream_findBounds) ',2a,i4)" !------------------------------------------------------------------------------- - if (debug>0 .and. isroot_task) then - write(strm%logunit,F02) "DEBUG: ---------- enter ------------------" + if (debug>0 .and. mainproc) then + write(logout,'(a,a)') trim(subname),"DEBUG: ---------- enter ------------------" end if if ( .not. strm%init ) then @@ -865,23 +887,26 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & n = 0 if (cycle) then dYear = yrFirst + modulo(mYear-yrAlign+(2*nYears),nYears) ! current data year - if(debug>0 .and. isroot_task) then - write(strm%logunit, *) trim(subname), ' dyear, yrfirst, myear, yralign, nyears =', dyear, yrfirst, myear, yralign, nyears + if(debug>0 .and. mainproc) then + write(logout,'(2a,4(2x,i0))') trim(subname), ' dyear, yrfirst, myear, yralign, nyears =', & + dyear, yrfirst, myear, yralign, nyears endif else dYear = yrFirst + mYear - yrAlign endif if (dYear < 0) then - write(strm%logunit,*) trim(subName),' ERROR: dyear lt zero = ',dYear + if (mainproc) then + write(logout,'(2a,2x,i0)') trim(subName),' ERROR: dyear lt zero = ',dYear + end if call shr_sys_abort(trim(subName)//' ERROR: dyear lt zero') endif dDateIn = dYear*10000 + modulo(mDateIn,10000) ! mDateIn mapped to range of data years rDateIn = dDateIn + secIn/spd ! dDateIn + fraction of a day - if (debug>0 .and. isroot_task) then - write(strm%logunit,'(a,2(i8,2x),2(f20.4,2x))') 'mYear,dYear,dDateIn,rDateIn = ',mYear,dYear,dDateIn,rDateIn - write(strm%logunit,'(a,2(i8,2x),2(f20.4,2x))') 'yrFirst,yrLast,yrAlign,nYears= ',yrFirst,yrLast,yrAlign,nYears + if (debug>0 .and. mainproc) then + write(logout,'(a,2(i8,2x),2(f20.4,2x))') 'mYear,dYear,dDateIn,rDateIn = ',mYear,dYear,dDateIn,rDateIn + write(logout,'(a,2(i8,2x),2(f20.4,2x))') 'yrFirst,yrLast,yrAlign,nYears= ',yrFirst,yrLast,yrAlign,nYears endif !---------------------------------------------------------------------------- @@ -891,7 +916,7 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & if (.not. strm%found_lvd) then A: do k=1,strm%nFiles if (.not. strm%file(k)%haveData) then - call shr_stream_readtCoord(strm, k, isroot_task, rCode) + call shr_stream_readtCoord(strm, k, rCode) if ( rCode /= 0 )then call shr_sys_abort(trim(subName)//" ERROR: readtCoord1") end if @@ -911,12 +936,14 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & else !--- LVD is in or beyond yearFirst, verify it is not beyond yearLast --- if ( dDateL <= strm%file(strm%k_lvd)%date(strm%n_lvd) ) then - write(strm%logunit,F00) "ERROR: LVD not found, all data is after yearLast" + if (mainproc) then + write(logout,'(2a)') trim(subname)," ERROR: LVD not found, all data is after yearLast" + end if call shr_sys_abort(trim(subName)//" ERROR: LVD not found, all data is after yearLast") end if end if - if (debug>1 .and. isroot_task ) then - if (strm%found_lvd) write(strm%logunit,F01) " found LVD = ",strm%file(k)%date(n) + if (debug>1 .and. mainproc) then + if (strm%found_lvd) write(logout,'(2a,2x,i0)') trim(subname)," found LVD = ",strm%file(k)%date(n) end if end if @@ -925,7 +952,9 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & n = strm%n_lvd rDatelvd = strm%file(k)%date(n) + strm%file(k)%secs(n)/spd ! LVD date + frac day else - write(strm%logunit,F00) "ERROR: LVD not found yet" + if (mainproc) then + write(logout,'(2a)') trim(subname)," ERROR: LVD not found yet" + end if call shr_sys_abort(trim(subName)//" ERROR: LVD not found yet") endif @@ -936,8 +965,8 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & else rDategvd = 99991231.0 endif - if (debug>0 .and. isroot_task) then - write(strm%logunit,'(a,3(f20.4,2x))') 'rDateIn,rDatelvd,rDategvd = ',rDateIn,rDatelvd,rDategvd + if (debug>0 .and. mainproc) then + write(logout,'(2a,3(f20.4,2x))') trim(subname),' rDateIn,rDatelvd,rDategvd = ',rDateIn,rDatelvd,rDategvd endif !----------------------------------------------------------- @@ -949,7 +978,9 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & if (rDateIn < rDatelvd) then if (limit) then - write(strm%logunit,*) trim(subName)," ERROR: limit on and rDateIn lt rDatelvd",rDateIn,rDatelvd + if (mainproc) then + write(logout,'(2a,2(i0,2x))') trim(subName)," ERROR: limit on and rDateIn lt rDatelvd",rDateIn,rDatelvd + end if call shr_sys_abort(trim(subName)//" ERROR: rDateIn lt rDatelvd limit true") endif @@ -979,7 +1010,7 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & B: do k=strm%nFiles,1,-1 !--- read data for file number k --- if (.not. strm%file(k)%haveData) then - call shr_stream_readtCoord(strm, k, isroot_task, rCode) + call shr_stream_readtCoord(strm, k, rCode) if ( rCode /= 0 )then call shr_sys_abort(trim(subName)//" ERROR: readtCoord2") end if @@ -991,8 +1022,8 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & strm%n_gvd = n strm%found_gvd = .true. rDategvd = strm%file(k)%date(n) + strm%file(k)%secs(n)/spd ! GVD date + frac day - if (debug>1 .and. isroot_task) then - write(strm%logunit,F01) " found GVD ",strm%file(k)%date(n) + if (debug>1 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname)," found GVD ",strm%file(k)%date(n) end if exit B end if @@ -1001,7 +1032,9 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & end if if (.not. strm%found_gvd) then - write(strm%logunit,F00) "ERROR: GVD not found1" + if (mainproc) then + write(logout,'(2a)') trim(subname)," ERROR: GVD not found1" + end if call shr_sys_abort(trim(subName)//" ERROR: GVD not found1") endif @@ -1035,7 +1068,9 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & else if (strm%found_gvd .and. rDateIn >= rDategvd) then if (limit) then - write(strm%logunit,*) trim(subName)," ERROR: limit on and rDateIn >= rDategvd",rDateIn,rDategvd + if (mainproc) then + write(logout,'(2a,2(d13.5,2x))') trim(subName)," ERROR: limit on and rDateIn >= rDategvd",rDateIn,rDategvd + end if call shr_sys_abort(trim(subName)//" ERROR: rDateIn >= rDategvd limit true") endif @@ -1089,7 +1124,7 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & C: do k=strm%k_lvd,strm%nFiles !--- read data for file number k --- if (.not. strm%file(k)%haveData) then - call shr_stream_readtCoord(strm, k, isroot_task, rCode) + call shr_stream_readtCoord(strm, k, rCode) if ( rCode /= 0 )then call shr_sys_abort(trim(subName)//" ERROR: readtCoord3") end if @@ -1135,7 +1170,9 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & if (strm%found_gvd .and. rDateIn >= rDategvd) then if (limit) then - write(strm%logunit,*) trim(subName)," ERROR: limit on and rDateIn >= rDategvd",rDateIn,rDategvd + if (mainproc) then + write(logout,'(2a,2(d13.5,2x))') trim(subName)," ERROR: limit on and rDateIn >= rDategvd",rDateIn,rDategvd + end if call shr_sys_abort(trim(subName)//" ERROR: rDateIn >= rDategvd limit true") endif @@ -1209,7 +1246,9 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & call shr_cal_date2ymd(dDateUB,yy,mm,dd) yy = yy + (mYear-dYear) if(mm == 2 .and. dd==29 .and. .not. shr_cal_leapyear(yy)) then - if(isroot_task) write(strm%logunit, *) 'Found leapyear mismatch', myear, dyear, yy + if (mainproc) then + write(logout,'(2a,3(i0,2x))') trim(subname),' Found leapyear mismatch', myear, dyear, yy + end if mm = 3 dd = 1 endif @@ -1228,14 +1267,13 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & end subroutine shr_stream_findBounds !=============================================================================== - subroutine shr_stream_readTCoord(strm, k, isroot_task, rc) + subroutine shr_stream_readTCoord(strm, k, rc) ! Read in time coordinates with possible offset (require that time coordinate is 'time') ! input/output parameters: type(shr_stream_streamType) ,intent(inout) :: strm ! data stream to query integer ,intent(in) :: k ! stream file index - logical ,intent(in) :: isroot_task integer,optional ,intent(out) :: rc ! return code ! local variables @@ -1266,8 +1304,8 @@ subroutine shr_stream_readTCoord(strm, k, isroot_task, rc) ! open file if needed if (.not. pio_file_is_open(strm%file(k)%fileid)) then - if (debug>1 .and. isroot_task) then - write(strm%logunit, '(a)') trim(subname)//' opening stream filename = '//trim(filename) + if (debug>1 .and. mainproc) then + write(logout, '(2a)') trim(subname),' opening stream filename = '//trim(filename) end if rcode = pio_openfile(strm%pio_subsystem, strm%file(k)%fileid, strm%pio_iotype, filename, pio_nowrite) endif @@ -1327,8 +1365,8 @@ subroutine shr_stream_readTCoord(strm, k, isroot_task, rc) deallocate(tvar) ! close file - if (debug>1 .and. isroot_task) then - write(strm%logunit, '(a)') trim(subname)//' closing stream filename = '//trim(filename) + if (debug>1 .and. mainproc) then + write(logout, '(2a)') trim(subname),' closing stream filename = '//trim(filename) end if call pio_closefile(strm%file(k)%fileid) @@ -1347,7 +1385,9 @@ subroutine shr_stream_readTCoord(strm, k, isroot_task, rc) call shr_cal_advDateInt(offin,'seconds',din,sin,dout,sout,calendar) strm%file(k)%date(n) = dout strm%file(k)%secs(n) = sout - ! write(strm%logunit,*) 'debug ',n,strm%offset,din,sin,dout,sout + ! if (mainproc) then + ! write(logout,'(2a,6(i0,2x))') 'debug ',n,strm%offset,din,sin,dout,sout + ! end if enddo endif @@ -1376,9 +1416,7 @@ subroutine verifyTCoord(strm,k,rc) integer :: date2,secs2 ! date and seconds for next time coord logical :: checkIt ! have data / do comparison character(*),parameter :: subName = '(shr_stream_verifyTCoord) ' - character(*),parameter :: F00 = "('(shr_stream_verifyTCoord) ',8a)" - character(*),parameter :: F01 = "('(shr_stream_verifyTCoord) ',a,2i7)" - character(*),parameter :: F02 = "('(shr_stream_verifyTCoord) ',a,2i9.8)" + !------------------------------------------------------------------------------- ! Notes: ! o checks that dates are increasing (must not decrease) @@ -1390,17 +1428,19 @@ subroutine verifyTCoord(strm,k,rc) !------------------------------------------------------------------------------- rc = 0 - if (debug>1 .and. isroot_task) then - write(strm%logunit,F01) "checking t-coordinate data for file k =",k + if (debug>1 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname)," checking t-coordinate data for file k =",k end if if ( .not. strm%file(k)%haveData) then rc = 1 - write(strm%logunit,F01) "Don't have data for file ",k + if (mainproc) then + write(logout,'(2a,i0)') trim(subname)," ERROR: do not have data for file ",k + end if call shr_sys_abort(subName//"ERROR: can't check -- file not read.") end if - do n=1,strm%file(k)%nt+1 + stream_file_times:do n=1,strm%file(k)%nt+1 checkIt = .false. !--- do we have data for two consecutive dates? --- @@ -1414,7 +1454,9 @@ subroutine verifyTCoord(strm,k,rc) date2 = strm%file(k )%date(n) secs2 = strm%file(k )%secs(n) checkIt = .true. - if (debug>1 .and. isroot_task) write(strm%logunit,F01) "comparing with previous file for file k =",k + if (debug>1 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname)," comparing with previous file for file k =",k + end if end if end if else if (n==strm%file(k)%nt+1) then @@ -1427,7 +1469,9 @@ subroutine verifyTCoord(strm,k,rc) date2 = strm%file(k+1)%date(1) secs2 = strm%file(k+1)%secs(1) checkIt = .true. - if (debug>1 .and. isroot_task) write(strm%logunit,F01) "comparing with next file for file k =",k + if (debug>1 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname)," comparing with next file for file k =",k + end if end if end if else @@ -1443,28 +1487,35 @@ subroutine verifyTCoord(strm,k,rc) if (checkIt) then if ( date1 > date2 ) then rc = 1 - write(strm%logunit,F01) "ERROR: calendar dates must be increasing" - write(strm%logunit,F02) "date(n), date(n+1) = ",date1,date2 + if (mainproc) then + write(logout,'(2a)') trim(subname)," ERROR: calendar dates must be increasing" + write(logout,'(2a,2(i0,2x))') trim(subname)," date(n), date(n+1) = ",date1,date2 + end if call shr_sys_abort(subName//"ERROR: calendar dates must be increasing") else if ( date1 == date2 ) then if ( secs1 >= secs2 ) then rc = 1 - write(strm%logunit,F01) "ERROR: elapsed seconds on a date must be strickly increasing" - write(strm%logunit,F02) "secs(n), secs(n+1) = ",secs1,secs2 + if (mainproc) then + write(logout,'(2a)') trim(subname), "ERROR: elapsed seconds on a date must be strickly increasing" + write(logout,'(2a,2(i0,2x))') trim(subname)," secs(n), secs(n+1) = ",secs1,secs2 + end if call shr_sys_abort(subName//"ERROR: elapsed seconds must be increasing") end if end if if ( secs1 < 0 .or. spd < secs1 ) then rc = 1 - write(strm%logunit,F01) "ERROR: elapsed seconds out of valid range [0,spd]" - write(strm%logunit,F02) "secs(n) = ",secs1 + if (mainproc) then + write(logout,'(2a)') trim(subname)," ERROR: elapsed seconds out of valid range [0,spd]" + write(logout,'(2a,i0)') trim(subname), " secs(n) = ",secs1 + end if call shr_sys_abort(subName//"ERROR: elapsed seconds out of range") end if end if - end do - - if (debug>0 .and. isroot_task) write(strm%logunit,F01) "data is OK (non-decreasing) for file k =",k + end do stream_file_times + if (debug>0 .and. mainproc) then + write(logout,'(2a,i0)') trim(subname)," data is OK (non-decreasing) for file k =",k + end if end subroutine verifyTCoord end subroutine shr_stream_readTCoord @@ -1521,8 +1572,10 @@ end subroutine shr_stream_getStreamFieldList !=============================================================================== subroutine shr_stream_getCalendar(strm, k, calendar) + use pio, only : PIO_set_log_level, PIO_OFFSET_KIND use ESMF, only: ESMF_VM, ESMF_VMGet, ESMF_VMGetCurrent + ! Returns calendar name ! input/output parameters: @@ -1531,15 +1584,12 @@ subroutine shr_stream_getCalendar(strm, k, calendar) character(*) ,intent(out) :: calendar ! calendar name ! local - type(ESMF_VM) :: vm - integer :: myid integer :: vid, n character(CX) :: fileName character(CL) :: lcal integer(PIO_OFFSET_KIND) :: attlen integer :: old_handle integer :: rCode - integer :: rc character(*),parameter :: subName = '(shr_stream_getCalendar) ' !------------------------------------------------------------------------------- @@ -1547,23 +1597,21 @@ subroutine shr_stream_getCalendar(strm, k, calendar) calendar = ' ' if (k > strm%nfiles) call shr_sys_abort(subname//' ERROR: k gt nfiles') - call ESMF_VMGetCurrent(vm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_VMGet(vm, localPet=myid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fileName = strm%file(k)%name if (.not. pio_file_is_open(strm%file(k)%fileid)) then - if(myid == 0) write(strm%logunit, '(a)') trim(subname)//' opening stream filename = '//trim(filename) + if (debug>0 .and. mainproc) then + write(logout,'(3x,2a)') trim(subname),' opening stream filename = '//trim(filename) + end if rcode = pio_openfile(strm%pio_subsystem, strm%file(k)%fileid, strm%pio_iotype, trim(filename)) - else if(myid == 0) then - write(strm%logunit, '(a)') trim(subname)//' reading stream filename = '//trim(filename) + else + if (debug>0 .and. mainproc) then + write(logout,'(3x,2a)') trim(subname),' reading stream filename = '//trim(filename) + end if endif rCode = pio_inq_varid(strm%file(k)%fileid, 'time', vid) - if(vid .lt. 0) then + if (vid .lt. 0) then call shr_sys_abort(subName//"ERROR: time variable id incorrect") endif call pio_seterrorhandling(strm%file(k)%fileid, PIO_BCAST_ERROR, old_handle) @@ -1579,15 +1627,19 @@ subroutine shr_stream_getCalendar(strm, k, calendar) if(n>0) then if (ichar(lcal(n:n)) == 0 ) lcal(n:n) = ' ' else - write(strm%logunit,*) 'calendar attribute to time variable not found in file, using default noleap' + if (debug>0 .and. mainproc) then + write(logout,'(2a)') trim(subname),& + 'calendar attribute to time variable not found in file, using default noleap' + end if call shr_sys_abort(subName//"ERROR: calendar attribute not found in file "//trim(filename)) lcal = trim(shr_cal_noleap) endif call shr_string_leftalign_and_convert_tabs(lcal) calendar = trim(shr_cal_calendarName(trim(lcal))) - - if(myid == 0) write(strm%logunit, '(a)') trim(subname)//' closing stream filename = '//trim(filename) + if (debug>0 .and. mainproc) then + write(logout, '(3x,2a)') trim(subname),' closing stream filename = '//trim(filename) + end if call pio_closefile(strm%file(k)%fileid) end subroutine shr_stream_getCalendar @@ -1646,7 +1698,6 @@ subroutine shr_stream_getNextFileName(strm, fn, fnNext,rc) integer :: n ! loop index logical :: found ! file name found? character(*),parameter :: subName = '(shr_stream_getNextFileName) ' - character(*),parameter :: F00 = "('(shr_stream_getNextFileName) ',8a)" !------------------------------------------------------------------------------- rCode = 0 @@ -1661,7 +1712,9 @@ subroutine shr_stream_getNextFileName(strm, fn, fnNext,rc) end do if (.not. found) then rCode = 1 - write(strm%logunit,F00) "ERROR: input file name is not in stream: ",trim(fn) + if (mainproc) then + write(logout,'(3a)') trim(subname)," ERROR: input file name is not in stream file: ",trim(fn) + end if call shr_sys_abort(subName//"ERROR: file name not in stream: "//trim(fn)) end if @@ -1696,7 +1749,7 @@ subroutine shr_stream_getPrevFileName(strm, fn, fnPrev,rc) integer :: n ! loop index logical :: found ! file name found? character(*),parameter :: subName = '(shr_stream_getPrevFileName) ' - character(*),parameter :: F00 = "('(shr_stream_getPrevFileName) ',8a)" + !------------------------------------------------------------------------------- !------------------------------------------------------------------------------- ! Note: will wrap-around data loop if lvd & gvd are known @@ -1715,7 +1768,9 @@ subroutine shr_stream_getPrevFileName(strm, fn, fnPrev,rc) end do if (.not. found) then rCode = 1 - write(strm%logunit,F00) "ERROR: input file name is not in stream: ",trim(fn) + if (mainproc) then + write(logout,'(3a)') trim(subname)," ERROR: input file name is not in stream: ",trim(fn) + end if call shr_sys_abort(subName//"ERROR: file name not in stream: "//trim(fn)) end if @@ -1765,9 +1820,8 @@ subroutine shr_stream_restIO(pioid, streams, mode) integer :: n, k, maxnfiles=0 integer :: maxnt = 0 integer, allocatable :: tmp(:) - integer :: logunit character(len=CX) :: fname, rfname, rsfname - + character(*),parameter :: subName = '(shr_stream_restIO) ' !------------------------------------------------------------------------------- if (mode .eq. 'define') then @@ -1775,7 +1829,6 @@ subroutine shr_stream_restIO(pioid, streams, mode) rcode = pio_def_dim(pioid, 'strlen', CX, dimid_str) do k=1,size(streams) ! maxnfiles is the maximum number of files across all streams - logunit = streams(k)%logunit if (streams(k)%nfiles > maxnfiles) then maxnfiles = streams(k)%nfiles endif @@ -1964,28 +2017,35 @@ subroutine shr_stream_restIO(pioid, streams, mode) rcode = pio_inq_varid(pioid, 'timeofday', tvarid) rcode = pio_inq_varid(pioid, 'haveData' , hdvarid) do k=1,size(streams) - logunit = streams(k)%logunit do n=1,streams(k)%nfiles ! read in filename rcode = pio_get_var(pioid, varid, (/1,n,k/), fname) - + if(trim(fname) /= trim(streams(k)%file(n)%name)) then - write(logunit,*) 'Filename does not match restart record, checking realpath' + if (mainproc) then + write(logout,'(2a)') trim(subname),'Filename does not match restart record, checking realpath' + end if call shr_file_get_real_path(fname, rfname) call shr_file_get_real_path(trim(streams(k)%file(n)%name), rsfname) if (trim(rfname) /= trim(rsfname)) then - write(logunit,*) 'Filename path does not match restartfile, checking filename' + if (mainproc) then + write(logout,'(2a)') trim(subname),'Filename path does not match restartfile, checking filename' + end if rfname = fname(index(fname,'/',.true.):) rsfname = streams(k)%file(n)%name(index(streams(k)%file(n)%name, '/',.true.):) if (trim(rfname) /= trim(rsfname)) then - write(logunit,*) trim(rfname), '<>', trim(rsfname) - write(logunit,'(a)')' fname = '//trim(fname) - write(logunit,'(a,i8,2x,i8,2x,a)')' k,n,streams(k)%file(n)%name = ',k,n,trim(streams(k)%file(n)%name) + if (mainproc) then + write(logout,'(2a)') trim(subname),trim(rfname), '<>', trim(rsfname) + write(logout,'(2a)') trim(subname),' fname = '//trim(fname) + write(logout,'(2a,i8,2x,i8,2x,a)') trim(subname),' k,n,streams(k)%file(n)%name = ',& + k,n,trim(streams(k)%file(n)%name) + end if call shr_sys_abort('ERROR reading in filename') endif endif endif + ! read in nt allocate(tmp(1)) rcode = pio_get_var(pioid, ntvarid, (/n,k/), tmp(1)) @@ -2040,35 +2100,31 @@ subroutine shr_stream_dataDump(strm) ! input/output parameters: type(shr_stream_streamType),intent(in) :: strm ! data stream - !----- local ----- - integer :: k ! generic loop index - integer :: logunit - character(*),parameter :: F00 = "('(shr_stream_dataDump) ',8a)" - character(*),parameter :: F01 = "('(shr_stream_dataDump) ',a,3i5)" - character(*),parameter :: F02 = "('(shr_stream_dataDump) ',a,365i9.8)" - character(*),parameter :: F03 = "('(shr_stream_dataDump) ',a,365i6)" + ! local variables + integer :: nf,nt ! generic loop indices + character(*),parameter :: subName = '(shr_stream_dataDump) ' !------------------------------------------------------------------------------- - logunit = strm%logunit - - if (debug > 0) then - write(logunit,F00) "dump internal data for debugging..." - write(logunit,F01) "nFiles = ", strm%nFiles - do k=1,strm%nFiles - write(logunit,F01) "data for file k = ",k - write(logunit,F00) "* file(k)%name = ", trim(strm%file(k)%name) - if ( strm%file(k)%haveData ) then - write(logunit,F01) "* file(k)%nt = ", strm%file(k)%nt - write(logunit,F02) "* file(k)%date(:) = ", strm%file(k)%date(:) - write(logunit,F03) "* file(k)%Secs(:) = ", strm%file(k)%secs(:) + if (debug>0 .and. mainproc) then + write(logout,'(2a)') trim(subname),"dump internal data for debugging..." + write(logout,'(2a,i0)') trim(subname)," nFiles = ", strm%nFiles + do nf = 1,strm%nFiles + write(logout,'(2a,i0)') trim(subname)," data for file nf = ",nf + write(logout,'(2a)') trim(subname)," file(nf)%name = ", trim(strm%file(nf)%name) + if ( strm%file(nf)%haveData ) then + write(logout,'(2a,i0)') trim(subname)," file(nf)%nt = ", strm%file(nf)%nt + do nt = 1, size(strm%file(nf)%date) + write(logout,'(2a,2(i0,2x))') trim(subname)," file(nf)%date(nt) = ",nt,strm%file(nf)%date(nt) + write(logout,'(2a,2(i0,2x))') trim(subname)," file(nf)%secs(nt) = ",nt,strm%file(nf)%secs(nt) + end do else - write(logunit,F00) "* time coord data not read in yet for this file" + write(logout,'(2a)') trim(subname),' time coord data not read in yet for this file' end if end do - write(logunit,F01) "yearF/L/A = ", strm%yearFirst,strm%yearLast,strm%yearAlign - write(logunit,F01) "offset = ", strm%offset - write(logunit,F00) "taxMode = ", trim(strm%taxMode) - write(logunit,F00) "meshfile = ", trim(strm%meshfile) + write(logout,'(2a,3(2x,i0))') trim(subname),"yearF/L/A = ",strm%yearFirst,strm%yearLast,strm%yearAlign + write(logout,'(2a,i0)') trim(subname),"offset = ",strm%offset + write(logout,'(3a)') trim(subname),"taxMode = ",trim(strm%taxMode) + write(logout,'(3a)') trim(subname),"meshfile = ",trim(strm%meshfile) end if end subroutine shr_stream_dataDump From 49937f276861903f7a40ad78f154bb8e5d37a6e6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 24 Dec 2025 20:09:20 +0100 Subject: [PATCH 13/61] updated datm code --- datm/atm_comp_nuopc.F90 | 15 +- datm/datm_datamode_clmncep_mod.F90 | 77 +++++----- datm/datm_datamode_core2_mod.F90 | 106 ++++++-------- datm/datm_datamode_cplhist_mod.F90 | 224 +++++++++++------------------ datm/datm_datamode_era5_mod.F90 | 203 ++++++++++---------------- datm/datm_datamode_gefs_mod.F90 | 12 +- datm/datm_datamode_jra_mod.F90 | 81 ++++------- 7 files changed, 273 insertions(+), 445 deletions(-) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 0a91052f8..30c98f14e 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -602,7 +602,9 @@ end subroutine ModelAdvance !=============================================================================== subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod, target_mon, & orbEccen, orbMvelpp, orbLambm0, orbObliqr, restart_write, rc) + use nuopc_shr_methods, only : shr_get_rpointer_name + ! ---------------------------------- ! run method for datm model ! ---------------------------------- @@ -754,22 +756,19 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod call datm_datamode_jra_advance(exportstate, target_ymd, target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CLMNCEP') - call datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) + call datm_datamode_clmncep_advance(mainproc, logunit, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CPLHIST') - call datm_datamode_cplhist_advance(mainproc, logunit, mpicom, rc) + call datm_datamode_cplhist_advance(rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') - call datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, & - target_ymd, target_tod, sdat%model_calendar, rc) + call datm_datamode_era5_advance(exportstate, mainproc, logunit, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('GEFS') - call datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, mpicom, & - target_ymd, target_tod, sdat%model_calendar, rc) + call datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('SIMPLE') - call datm_datamode_simple_advance(target_ymd, target_tod, target_mon, & - sdat%model_calendar, rc) + call datm_datamode_simple_advance(target_ymd, target_tod, target_mon, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 6954569c0..be9a6f781 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -157,16 +157,23 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r rc = ESMF_SUCCESS - ! initialize stream pointers for module level export states - call shr_strdata_get_stream_pointer( sdat, 'Sa_wind' , strm_Sa_wind , rc) + ! initialize stream pointers for export state + call shr_strdata_get_stream_pointer( sdat, 'Sa_wind' , strm_Sa_wind, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_wind must be associated for datm clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_topo' , strm_Sa_topo , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_topo' , strm_Sa_topo, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_topo must be associated for datm clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_z' , strm_Sa_z , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for datm clmncep datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn' , strm_Faxa_precn, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_precn must be associated for datm clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_pbot' , strm_Sa_pbot , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_z' , strm_Sa_z , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -182,8 +189,22 @@ 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_swdn' , strm_Faxa_swdn , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn' , strm_Faxa_precn , rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! additional error checks on stream pointers for export state + if ( .not. associated(strm_Sa_shum) .and. & + .not. associated(strm_Sa_rh) .and. & + .not. associated(strm_Sa_tdew)) then + call shr_log_error(subname//'ERROR: one of strm_Sa_shum, strm_Sa_rh or strm_Sa_tdew '// & + 'must for associated to compute specific humidity in clmncep datamode', rc=rc) + return + endif + if ( .not. associated(strm_Faxa_swdndf) .and. & + .not. associated(strm_Faxa_swdndr) .and. & + .not. associated(strm_Faxa_swdn)) then + call shr_log_error(subName//'ERROR: either strm_Faxa_swdndf and strm_faxa_swdndr .or strm_faxa_swdn '//& + 'must be associated for computing short-wave down in clmncep datamode', rc=rc) + return + endif ! initialize stream pointers for module for bias correction call shr_strdata_get_stream_pointer( sdat, 'Faxa_precsf' , strm_Faxa_precsf , rc) @@ -247,38 +268,6 @@ 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 - ! Required stream pointers - if (.not. associated(strm_Sa_wind)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_wind must be associated for clmncep datamode') - return - end if - if (.not. associated(strm_Sa_topo)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_topo must be associated for clmncep datamode') - return - end if - if (.not. associated(strm_Sa_tbot)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for clmncep datamode') - return - end if - if (.not. associated(strm_Faxa_precn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_precn must be associated for clmncep datamode') - return - end if - if ( .not. associated(strm_Sa_shum) .and. & - .not. associated(strm_Sa_rh) .and. & - .not. associated(strm_Sa_tdew)) then - call shr_log_error(subname//'ERROR: one of strm_Sa_shum, strm_Sa_rh or strm_Sa_tdew & - must for associated to compute specific humidity in clmncep datamode') - return - endif - if ( .not. associated(strm_Faxa_swdndf) .and. & - .not. associated(strm_Faxa_swdndr) .and. & - .not. associated(strm_Faxa_swdn)) then - call shr_log_error(subName//'ERROR: either strm_Faxa_swdndf and strm_faxa_swdndr .or strm_faxa_swdn & - must be associated for computing short-wave down in clmncep datamode') - return - endif - ! determine anidrmax (see below for use) call ESMF_StateGet(importstate, 'Sx_anidr', itemFlag, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -297,14 +286,14 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r end subroutine datm_datamode_clmncep_init_pointers !=============================================================================== - subroutine datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) + subroutine datm_datamode_clmncep_advance(mainproc, logunit, rc) + use ESMF, only: ESMF_VMGetCurrent, ESMF_VMAllReduce, ESMF_REDUCE_MAX, ESMF_VM ! input/output variables - logical , intent(in) :: mainproc - integer , intent(in) :: logunit - integer , intent(in) :: mpicom - integer , intent(out) :: rc + logical , intent(in) :: mainproc + integer , intent(in) :: logunit + integer , intent(out) :: rc ! local variables logical :: first_time = .true. diff --git a/datm/datm_datamode_core2_mod.F90 b/datm/datm_datamode_core2_mod.F90 index 1bb5f0452..605d211c2 100644 --- a/datm/datm_datamode_core2_mod.F90 +++ b/datm/datm_datamode_core2_mod.F90 @@ -167,44 +167,43 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor rc = ESMF_SUCCESS - lsize = sdat%model_lsize - - ! allocate module arrays - allocate(windFactor(lsize)) - allocate(winddFactor(lsize)) - allocate(qsatFactor(lsize)) - - call ESMF_MeshGet(sdat%model_mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ownedElemCoords(spatialDim*numOwnedElements)) - allocate(yc(numOwnedElements)) - call ESMF_MeshGet(sdat%model_mesh, ownedElemCoords=ownedElemCoords) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do n = 1,numOwnedElements - yc(n) = ownedElemCoords(2*n) - end do - ! get stream pointers - call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_prec must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swdn must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swnet' , strm_Faxa_swnet , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swnet' , strm_Faxa_swnet , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swnet must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'tarcf' , strm_tarcf , rc) ! required for CORE2_IAF + + call shr_strdata_get_stream_pointer( sdat, 'tarcf', strm_tarcf, rc) ! required for CORE2_IAF if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (trim(datamode) == 'CORE2_IAF' ) then + if (.not. associated(strm_tarcf)) then + call shr_log_error(trim(subname)//'tarcf must be associated for CORE2_IAF', rc=rc) + return + endif + endif ! get export state pointers call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) @@ -248,46 +247,23 @@ 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 - if (.not. associated(strm_Faxa_prec)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_prec must be associated for CORE2', rc=rc) - return - endif - if (.not. associated(strm_Faxa_swdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for CORE2', rc=rc) - return - endif - if (.not. associated(strm_Faxa_swnet)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swnet must be associated for CORE2', rc=rc) - return - endif - if (.not. associated(strm_Faxa_lwdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for CORE2', rc=rc) - return - endif - if (.not. associated(strm_Sa_pslv)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for CORE2', rc=rc) - return - endif - if (.not. associated(strm_Sa_tbot)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for CORE2', rc=rc) - return - endif - if (.not. associated(strm_Sa_u)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_u must be associated for CORE2', rc=rc) - return - endif - if (.not. associated(strm_Sa_v)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_v must be associated for CORE2', rc=rc) - return - endif - if (.not. associated(strm_tarcf)) then - if (trim(datamode) == 'CORE2_IAF' ) then - call shr_log_error(trim(subname)//'tarcf must be associated for CORE2_IAF', rc=rc) - return - endif - endif + ! create yc + call ESMF_MeshGet(sdat%model_mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(ownedElemCoords(spatialDim*numOwnedElements)) + allocate(yc(numOwnedElements)) + call ESMF_MeshGet(sdat%model_mesh, ownedElemCoords=ownedElemCoords) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do n = 1,numOwnedElements + yc(n) = ownedElemCoords(2*n) + end do + deallocate(ownedElemCoords) ! create adjustment factor arrays + lsize = sdat%model_lsize + allocate(windFactor(lsize)) + allocate(winddFactor(lsize)) + allocate(qsatFactor(lsize)) call datm_get_adjustment_factors(sdat, factorFn_mesh, factorFn_data, windFactor, winddFactor, qsatFactor, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index 0740ffa87..6c92ad43b 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -175,132 +175,74 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r ! Set pointers into stream data - call shr_strdata_get_stream_pointer(sdat, 'Sa_z', strm_Sa_z, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_tbog', strm_Sa_tbot, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_ptem', strm_Sa_ptem, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_shum', strm_Sa_shum, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_pbot', strm_Sa_pbot, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_pslv', strm_Sa_pslv, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_u', strm_Sa_u, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_v', strm_Sa_v, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_rainc', strm_Faxa_rainc, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_rainl', strm_Faxa_rainl, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_snowc', strm_Faxa_snowc, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_snowl', strm_Faxa_snowl, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndr', strm_Faxa_swndr, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdr', strm_Faxa_swvdr, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndf', strm_Faxa_swndf, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdf', strm_Faxa_swvdf, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! error checks for stream pointers - if (.not. associated(strm_Sa_z)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_z must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Sa_tbot)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Sa_ptem)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_ptem must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Sa_shum)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_shum must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Sa_pbot)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_pbot must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Sa_dens)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_dens must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Sa_pslv)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Sa_u)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_u must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Sa_v)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_v must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_swndr)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndr must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_swvdr)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_swndf)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndf must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_swvdf)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_rainc)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainc must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_rainl)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainl must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_snowc)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowc must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_snowl)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowl must be associated for cplhist datamode') - return - end if - if (.not. associated(strm_Faxa_lwdn )) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for cplhist datamode') - return - end if + call shr_strdata_get_stream_pointer(sdat, 'Sa_z', strm_Sa_z, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_z must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_tbot', strm_Sa_tbot, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_ptem', strm_Sa_ptem, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_ptem must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_shum', strm_Sa_shum, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_pbot', strm_Sa_pbot, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_pbot must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_wind must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_pslv', strm_Sa_pslv, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_dens must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_u', strm_Sa_u, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Sa_v', strm_Sa_v, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_rainc', strm_Faxa_rainc, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_rainc must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_rainl', strm_Faxa_rainl, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_rainl must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_snowc', strm_Faxa_snowc, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_snowc must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_snowl', strm_Faxa_snowl, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_snowl must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndr', strm_Faxa_swndr, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swndr must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdr', strm_Faxa_swvdr, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndf', strm_Faxa_swndf, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swndf must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdf', strm_Faxa_swvdf, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for clmncep datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine datm_datamode_cplhist_init_pointers - !=============================================================================== - subroutine datm_datamode_cplhist_advance(mainproc, logunit, mpicom, rc) + subroutine datm_datamode_cplhist_advance(rc) ! input/output variables - logical , intent(in) :: mainproc - integer , intent(in) :: logunit - integer , intent(in) :: mpicom - integer , intent(out) :: rc + integer, intent(out) :: rc ! local variables character(len=*), parameter :: subname='(datm_datamode_cplhist_advance): ' @@ -308,28 +250,26 @@ subroutine datm_datamode_cplhist_advance(mainproc, logunit, mpicom, rc) rc = ESMF_SUCCESS - Sa_z(:) = strm_Sa_z(:) - Sa_tbot(:) = strm_Sa_tbot(:) - Sa_ptem(:) = strm_Sa_ptem(:) - Sa_shum(:) = strm_Sa_shum(:) - Sa_dens(:) = strm_Sa_dens(:) - Sa_pbot(:) = strm_Sa_pbot(:) - Sa_pslv(:) = strm_Sa_pslv(:) - - Sa_u(:) = strm_Sa_u(:) - Sa_v(:) = strm_Sa_v(:) - - Faxa_rainc(:) = strm_Faxa_rainc(:) - Faxa_rainl(:) = strm_Faxa_rainl(:) - Faxa_snowc(:) = strm_Faxa_snowc(:) - Faxa_snowl(:) = strm_Faxa_snowl(:) - Faxa_lwdn(:) = strm_Faxa_lwdn (:) - - Faxa_swndr(:) = strm_Faxa_swndr(:) - Faxa_swndf(:) = strm_Faxa_swvdr(:) - Faxa_swvdr(:) = strm_Faxa_swndf(:) - Faxa_swvdf(:) = strm_Faxa_swvdf(:) - + Sa_z(:) = strm_Sa_z(:) + Sa_tbot(:) = strm_Sa_tbot(:) + Sa_ptem(:) = strm_Sa_ptem(:) + Sa_shum(:) = strm_Sa_shum(:) + Sa_dens(:) = strm_Sa_dens(:) + Sa_pbot(:) = strm_Sa_pbot(:) + Sa_pslv(:) = strm_Sa_pslv(:) + Sa_u(:) = strm_Sa_u(:) + Sa_v(:) = strm_Sa_v(:) + + Faxa_rainc(:) = strm_Faxa_rainc(:) + Faxa_rainl(:) = strm_Faxa_rainl(:) + Faxa_snowc(:) = strm_Faxa_snowc(:) + Faxa_snowl(:) = strm_Faxa_snowl(:) + Faxa_lwdn(:) = strm_Faxa_lwdn (:) + Faxa_swndr(:) = strm_Faxa_swndr(:) + Faxa_swndf(:) = strm_Faxa_swvdr(:) + Faxa_swvdr(:) = strm_Faxa_swndf(:) + Faxa_swvdf(:) = strm_Faxa_swvdf(:) + end subroutine datm_datamode_cplhist_advance end module datm_datamode_cplhist_mod diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index 966be0aac..8339c00b7 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -7,7 +7,6 @@ module datm_datamode_era5_mod use shr_log_mod , only : shr_log_error use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer - use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none @@ -160,29 +159,29 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_pslv', strm_Sa_pslv, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swdn', strm_Faxa_swdn, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swdn', strm_Faxa_swdn, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdr', strm_Faxa_swvdr, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdr', strm_Faxa_swvdr, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndr', strm_Faxa_swndr, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndr', strm_Faxa_swndr, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdf', strm_Faxa_swvdf, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdf', strm_Faxa_swvdf, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndf', strm_Faxa_swndf, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndf', strm_Faxa_swndf, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_swnet', strm_Faxa_swnet, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_swnet', strm_Faxa_swnet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwnet', strm_Faxa_lwnet, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwnet', strm_Faxa_lwnet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_sen', strm_Faxa_sen, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_sen', strm_Faxa_sen, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_lat', strm_Faxa_lat, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_lat', strm_Faxa_lat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_taux', strm_Faxa_taux, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_taux', strm_Faxa_taux, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Faxa_tauy', strm_Faxa_tauy, rc=rc) + call shr_strdata_get_stream_pointer(sdat, 'Faxa_tauy', strm_Faxa_tauy, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! get export state pointers @@ -238,149 +237,109 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Error checks - if (.not. associated(strm_Sa_tdew)) then + if (.not. associated(strm_Sa_tdew)) then call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for era5 datamode') return end if - if (associated(Sa_wspd10m)) then - if (.not. associated(strm_Sa_u10m)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_u10m must be associated for era5 datamode') - return - end if - if (.not. associated(strm_Sa_v10m)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_v10m must be associated for era5 datamode') - return - end if + + if (associated(Sa_wspd10m) .and. .not. associated(strm_Sa_u10m)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_u10m must be associated for era5 datamode', rc=rc) + return end if - if (associated(Sa_t2m)) then - if (.not. associated(strm_Sa_t2m)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_t2m must be associated for era5 datamode') - return - end if + if (associated(Sa_wspd10m) .and. .not. associated(strm_Sa_v10m)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_v10m must be associated for era5 datamode', rc=rc) + return end if - if (associated(Sa_t2m) .and. associated(Sa_pslv) .and. associated(Sa_q2m)) then - if (.not. associated(strm_Sa_pslv)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for era5 datamode') - return - end if + if (associated(Sa_t2m) .and. .not. associated(strm_Sa_t2m)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_t2m must be associated for era5 datamode', rc=rc) + return + end if + if (associated(Sa_t2m) .and. associated(Sa_pslv) .and. associated(Sa_q2m) .and. .not. associated(strm_Sa_pslv)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for era5 datamode', rc=rc) + return end if if (associated(Faxa_swdn)) then if (.not. associated(strm_Faxa_swdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for era5 datamode') + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for era5 datamode', rc=rc) return end if end if - if ( associated(Faxa_swvdr) .or. & - associated(Faxa_swndr) .or. & - associated(Faxa_swvdf) .or. & - associated(Faxa_swndf)) then + if ( associated(Faxa_swvdr) .or. associated(Faxa_swndr) .or. associated(Faxa_swvdf) .or. associated(Faxa_swndf)) then if (.not. associated(strm_Faxa_swdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for era5 datamode') + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for era5 datamode', rc=rc) return end if end if - if (associated(Faxa_swvdr)) then - if (.not. associated(strm_Faxa_swvdr)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for era5 datamode') - return + if (associated(Faxa_swvdr) .and. .not. associated(strm_Faxa_swvdr)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for era5 datamode', rc=rc) + return end if end if - if (associated(Faxa_swndr)) then - if (.not. associated(strm_Faxa_swndr)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndr must be associated for era5 datamode') - return - end if + if (associated(Faxa_swndr) .and. .not. associated(strm_Faxa_swndr)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndr must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_swvdf)) then - if (.not. associated(strm_Faxa_swvdf)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for era5 datamode') - return - end if + if (associated(Faxa_swvdf) .and. .not. associated(strm_Faxa_swvdf)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_swndf)) then - if (.not. associated(strm_Faxa_swndf)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndf must be associated for era5 datamode') - return - end if + if (associated(Faxa_swndf) .and. not. associated(strm_Faxa_swndf)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndf must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_lwdn)) then - if (.not. associated(strm_Faxa_lwdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for era5 datamode') - return - end if + if (associated(Faxa_lwdn) .and. .not. associated(strm_Faxa_lwdn)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_lwnet)) then - if (.not. associated(strm_Faxa_lwnet)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwnet must be associated for era5 datamode') - return - end if + if (associated(Faxa_lwnet) .and. .not. associated(strm_Faxa_lwnet)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwnet must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_swnet)) then - if (.not. associated(strm_Faxa_swnet)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swnet must be associated for era5 datamode') - return - end if + if (associated(Faxa_swnet) .and. .not. associated(strm_Faxa_swnet)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swnet must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_sen)) then - if (.not. associated(strm_Faxa_sen)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_sen must be associated for era5 datamode') - return - end if + if (associated(Faxa_sen) .and. .not. associated(strm_Faxa_sen)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_sen must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_lat)) then - if (.not. associated(strm_Faxa_lat)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lat must be associated for era5 datamode') - return - end if + if (associated(Faxa_lat) .and. .not. associated(strm_Faxa_lat)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lat must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_rain)) then - if (.not. associated(strm_Faxa_rain)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rain must be associated for era5 datamode') - return - end if + if (associated(Faxa_rain) .and. .not. associated(strm_Faxa_rain)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rain must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_rainc)) then - if (.not. associated(strm_Faxa_rainc)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainc must be associated for era5 datamode') - return - end if + if (associated(Faxa_rainc) .and. .not. associated(strm_Faxa_rainc)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainc must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_rainl)) then - if (.not. associated(strm_Faxa_rainl)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainl must be associated for era5 datamode') - return - end if + if (associated(Faxa_rainl) .and. .not. associated(strm_Faxa_rainl)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainl must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_snowc)) then - if (.not. associated(strm_Faxa_snowc)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowc must be associated for era5 datamode') - return - end if + if (associated(Faxa_snowc) .and. .not. associated(strm_Faxa_snowc)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowc must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_snowl)) then - if (.not. associated(strm_Faxa_snowl)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowl must be associated for era5 datamode') - return - end if + if (associated(Faxa_snowl) .and. .not. associated(strm_Faxa_snowl)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowl must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_taux)) then - if (.not. associated(strm_Faxa_taux)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_taux must be associated for era5 datamode') - return - end if + if (associated(Faxa_taux) .and. .not. associated(strm_Faxa_taux)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_taux must be associated for era5 datamode', rc=rc) + return end if - if (associated(Faxa_tauy)) then - if (.not. associated(strm_Faxa_tauy)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_tauy must be associated for era5 datamode') - return - end if + if (associated(Faxa_tauy) .and. .not. associated(strm_Faxa_tauy)) then + call shr_log_error(trim(subname)//'ERROR: strm_Faxa_tauy must be associated for era5 datamode', rc=rc) + return end if end subroutine datm_datamode_era5_init_pointers !=============================================================================== - subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, & - target_ymd, target_tod, model_calendar, rc) + subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, rc) use ESMF, only: ESMF_VMGetCurrent, ESMF_VMAllReduce, ESMF_REDUCE_MAX, ESMF_VM @@ -388,10 +347,6 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, mpicom, & type(ESMF_State) , intent(inout) :: exportState logical , intent(in) :: mainproc integer , intent(in) :: logunit - integer , intent(in) :: mpicom - integer , intent(in) :: target_ymd - integer , intent(in) :: target_tod - character(len=*) , intent(in) :: model_calendar integer , intent(out) :: rc ! local variables diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index e6b5e2661..5b033f69e 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -111,12 +111,12 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc ! input/output variables type(ESMF_State) , intent(inout) :: exportState type(shr_strdata_type) , intent(in) :: sdat - integer , intent(in) :: logunit + integer , intent(in) :: logunit logical , intent(in) :: mainproc integer , intent(out) :: rc ! local variables - integer :: n + integer :: n integer :: fieldcount type(ESMF_Field) :: lfield character(ESMF_MAXSTR) ,pointer :: lfieldnames(:) @@ -186,8 +186,8 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc end subroutine datm_datamode_gefs_init_pointers !=============================================================================== - subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, mpicom, & - target_ymd, target_tod, model_calendar, rc) + subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, rc) + use ESMF, only: ESMF_VMGetCurrent, ESMF_VMAllReduce, ESMF_REDUCE_MAX, ESMF_VM @@ -196,10 +196,6 @@ subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, mpic type(shr_strdata_type) , intent(in) :: sdat logical , intent(in) :: mainproc integer , intent(in) :: logunit - integer , intent(in) :: mpicom - integer , intent(in) :: target_ymd - integer , intent(in) :: target_tod - character(len=*) , intent(in) :: model_calendar integer , intent(out) :: rc ! local variables diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 8f4b958ad..a86349f01 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -1,15 +1,14 @@ module datm_datamode_jra_mod - 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 ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_MeshGet 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_log_mod , only : shr_log_error use shr_cal_mod , only : shr_cal_date2julian use shr_const_mod , only : shr_const_tkfrz, shr_const_pi, shr_const_rdair use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type - use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, dshr_fldbun_regrid, chkerr + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add @@ -128,18 +127,15 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) ! local variables integer :: n - integer :: lsize 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): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - lsize = sdat%model_lsize - + ! determine yc call ESMF_MeshGet(sdat%model_mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return allocate(ownedElemCoords(spatialDim*numOwnedElements)) @@ -150,25 +146,36 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) yc(n) = ownedElemCoords(2*n) end do - ! Stream pointers - call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , rc) ! required + ! initialize stream pointers + call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_prec must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swdn must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swnet' , strm_Faxa_swnet , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swnet must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , rc) ! required + call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Export state pointers + ! initialize export state pointers call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) @@ -210,40 +217,6 @@ 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 - ! error check - if (.not. associated(strm_Sa_tbot)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_tbot required for CORE_IAF_JRA', rc=rc) - return - endif - if (.not. associated(strm_Sa_pslv)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv required for CORE_IAF_JRA', rc=rc) - return - endif - if (.not. associated(strm_Sa_u)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_u required for CORE_IAF_JRA', rc=rc) - return - endif - if (.not. associated(strm_Sa_v)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_v required for CORE_IAF_JRA', rc=rc) - return - endif - if (.not. associated(strm_Sa_shum)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_shum required for CORE_IAF_JRA', rc=rc) - return - endif - if (.not. associated(strm_Faxa_prec)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_prec required for CORE_IAF_JRA', rc=rc) - return - endif - if (.not. associated(strm_Faxa_lwdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn required for CORE_IAF_JRA', rc=rc) - return - endif - if (.not. associated(strm_Faxa_swdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn required for CORE_IAF_JRA', rc=rc) - return - endif - end subroutine datm_datamode_jra_init_pointers !=============================================================================== @@ -279,8 +252,8 @@ subroutine datm_datamode_jra_advance(exportstate, target_ymd, target_tod, model_ ! Set export fields as copies directly from streams Sa_pslv(n) = strm_Sa_pslv(n) Sa_tbot(n) = strm_Sa_tbot(n) - Sa_u(n) = strm_Sa_u(n) - Sa_v(n) = strm_Sa_v(n) + Sa_u(n) = strm_Sa_u(n) + Sa_v(n) = strm_Sa_v(n) Sa_shum(n) = strm_Sa_shum(n) ! Set Sa_pbot from Sa_pslv From 34e979b7cee9d9ce20f3131ed48ad32201ca0cbc Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 24 Dec 2025 20:10:56 +0100 Subject: [PATCH 14/61] updated rof_comp_nuopc.F90 to work with preseting of stream and export field pointers to nans --- drof/rof_comp_nuopc.F90 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 1a1cc6669..4b5852c84 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -4,7 +4,6 @@ module rof_comp_nuopc module cdeps_drof_comp #endif - !---------------------------------------------------------------------------- ! This is the NUOPC cap for DROF !---------------------------------------------------------------------------- @@ -29,8 +28,8 @@ module cdeps_drof_comp use shr_cal_mod , only : shr_cal_ymd2date use shr_log_mod , only : shr_log_setLogUnit, shr_log_error use dshr_methods_mod , only : dshr_state_getfldptr, dshr_state_diagnose, chkerr, memcheck - use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_get_stream_domain - use dshr_strdata_mod , only : shr_strdata_init_from_config + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance + use dshr_strdata_mod , only : shr_strdata_init_from_config, shr_strdata_get_stream_pointer use dshr_mod , only : dshr_model_initphase, dshr_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init @@ -95,10 +94,14 @@ module cdeps_drof_comp real(r8), pointer :: model_frac(:) => null() integer , pointer :: model_mask(:) => null() - ! module pointer arrays + ! export state pointer arrays real(r8), pointer :: Forr_rofl(:) => null() real(r8), pointer :: Forr_rofi(:) => null() + ! stream pointer arrays + real(r8), pointer :: strm_Forr_rofl(:) => null() ! always required + real(r8), pointer :: strm_Forr_rofi(:) => null() ! sometimes present in stream + character(*) , parameter :: u_FILE_u = & __FILE__ @@ -413,6 +416,16 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri call dshr_state_getfldptr(exportState, 'Forr_rofi' , fldptr1=Forr_rofi , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + ! Initialize module pointers + call shr_strdata_get_stream_pointer( sdat, 'Forr_rofl', strm_Forr_rofl, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Forr_rofl must be associated for drof', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Forr_rofi', strm_Forr_rofi, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. associated(strm_Forr_rofi)) then + Forr_rofi(:) = 0._r8 + end if + ! Read restart if needed if (restart_read .and. .not. skip_restart_read) then call shr_get_rpointer_name(gcomp, 'rof', target_ymd, target_tod, rpfile, 'read', rc) From dd43ff48a781f2cb33f79ed117610eee67d8341e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 25 Dec 2025 21:54:50 +0100 Subject: [PATCH 15/61] more refactoring --- dice/dice_datamode_ssmi_mod.F90 | 26 ++- dice/ice_comp_nuopc.F90 | 12 +- docn/docn_datamode_cplhist_mod.F90 | 56 ++--- drof/cime_config/config_component.xml | 66 +++--- drof/rof_comp_nuopc.F90 | 176 +++++++--------- dwav/wav_comp_nuopc.F90 | 282 ++++++++++---------------- 6 files changed, 263 insertions(+), 355 deletions(-) diff --git a/dice/dice_datamode_ssmi_mod.F90 b/dice/dice_datamode_ssmi_mod.F90 index fb813a9c6..755c2bbf4 100644 --- a/dice/dice_datamode_ssmi_mod.F90 +++ b/dice/dice_datamode_ssmi_mod.F90 @@ -226,14 +226,12 @@ subroutine dice_datamode_ssmi_init_pointers(importState, exportState, sdat, flds lsize = sdat%model_lsize ! Set pointer to stream data (required) - call shr_strdata_get_stream_pointer( sdat, 'Si_ifrac', strm_Si_ifrac, rc) + call shr_strdata_get_stream_pointer( sdat, 'Si_ifrac', strm_Si_ifrac, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Si_ifrac must be associated for ssmi datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (.not. associated(strm_Si_ifrac)) then - call shr_log_error(trim(subname)//'ERROR: strm_Si_ifrac must be associated for ssmi mode') - end if ! Set Si_imask (this corresponds to the ocean mask) - call dshr_state_getfldptr(exportState, fldname='Si_imask' , fldptr1=Si_imask , rc=rc) + call dshr_state_getfldptr(exportState, fldname='Si_imask', fldptr1=Si_imask, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return allocate(imask(sdat%model_lsize)) call ESMF_MeshGet(sdat%model_mesh, numOwnedElements=numOwnedElements, elementdistGrid=distGrid, rc=rc) @@ -405,7 +403,7 @@ subroutine dice_datamode_ssmi_advance(exportState, importState, cosarg, flds_i2o rc = ESMF_SUCCESS Si_ifrac(:) = strm_Si_ifrac(:) - + lsize = size(Si_ifrac) if (first_time) then @@ -574,7 +572,7 @@ end subroutine dice_datamode_ssmi_advance !=============================================================================== subroutine dice_datamode_ssmi_restart_write(rpfile, case_name, inst_suffix, ymd, tod, & - logunit, my_task, sdat) + logunit, my_task, sdat, rc) ! input/output variables character(len=*) , intent(in) :: rpfile @@ -585,8 +583,11 @@ subroutine dice_datamode_ssmi_restart_write(rpfile, case_name, inst_suffix, ymd, integer , intent(in) :: logunit integer , intent(in) :: my_task type(shr_strdata_type) , intent(inout) :: sdat + integer , intent(out) :: rc !------------------------------------------------------------------------------- - integer :: rc + + rc = ESMF_SUCCESS + call dshr_restart_write(rpfile, case_name, 'dice', inst_suffix, ymd, tod, & logunit, my_task, sdat, rc, fld=water, fldname='water') if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -594,7 +595,7 @@ subroutine dice_datamode_ssmi_restart_write(rpfile, case_name, inst_suffix, ymd, end subroutine dice_datamode_ssmi_restart_write !=============================================================================== - subroutine dice_datamode_ssmi_restart_read(rest_filem, rpfile, logunit, my_task, mpicom, sdat) + subroutine dice_datamode_ssmi_restart_read(rest_filem, rpfile, logunit, my_task, mpicom, sdat, rc) ! input/output arguments character(len=*) , intent(inout) :: rest_filem @@ -603,13 +604,16 @@ subroutine dice_datamode_ssmi_restart_read(rest_filem, rpfile, logunit, my_task, integer , intent(in) :: my_task integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat + integer , intent(out) :: rc !------------------------------------------------------------------------------- - integer :: rc + + rc = ESMF_SUCCESS + ! allocate module memory for restart fields that are read in allocate(water(sdat%model_lsize)) ! read restart - call dshr_restart_read(rest_filem, rpfile, logunit, my_task, mpicom, sdat, rc,& + call dshr_restart_read(rest_filem, rpfile, logunit, my_task, mpicom, sdat, rc, & fld=water, fldname='water') if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index e71ebc546..187407249 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -278,7 +278,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) endif ! Advertise import and export fields - if ( trim(datamode) == 'ssmi' .or. trim(datamode) == 'ssmi_iaf') then + if ( trim(datamode) == 'ssmi' .or. trim(datamode) == 'ssmi_iaf') then call NUOPC_CompAttributeGet(gcomp, name='flds_i2o_per_cat', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) flds_i2o_per_cat ! module variable @@ -519,9 +519,10 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod if (ChkErr(rc,__LINE__,u_FILE_u)) return select case (trim(datamode)) case('ssmi', 'ssmi_iaf') - call dice_datamode_ssmi_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat) + call dice_datamode_ssmi_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case('cplhist') - call dice_datamode_cplhist_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat) + call dice_datamode_cplhist_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat) end select end if @@ -553,7 +554,7 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('cplhist') call dice_datamode_cplhist_advance(sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select ! Write restarts if needed @@ -563,7 +564,8 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod select case (trim(datamode)) case('ssmi', 'ssmi_iaf') call dice_datamode_ssmi_restart_write(rpfile, case_name, inst_suffix, target_ymd, target_tod, & - logunit, my_task, sdat) + logunit, my_task, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('cplhist') call dice_datamode_cplhist_restart_write(rpfile, case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) diff --git a/docn/docn_datamode_cplhist_mod.F90 b/docn/docn_datamode_cplhist_mod.F90 index d70c0757f..4aa373f9d 100644 --- a/docn/docn_datamode_cplhist_mod.F90 +++ b/docn/docn_datamode_cplhist_mod.F90 @@ -2,10 +2,10 @@ module docn_datamode_cplhist_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS 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_kind_mod , only : r8=>shr_kind_r8 use shr_log_mod , only : shr_log_error use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal - use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer @@ -87,11 +87,13 @@ subroutine docn_datamode_cplhist_init_pointers(exportState, sdat, ocn_fraction, rc = ESMF_SUCCESS - ! initialize pointers to export fields + ! initialize pointers to required export fields call dshr_state_getfldptr(exportState, 'So_omask' , fldptr1=So_omask , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'So_t' , fldptr1=So_t , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! initialize pointers to optional export fields call dshr_state_getfldptr(exportState, 'So_u' , fldptr1=So_u , allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'So_v' , fldptr1=So_v , allowNullReturn=.true., rc=rc) @@ -99,38 +101,36 @@ subroutine docn_datamode_cplhist_init_pointers(exportState, sdat, ocn_fraction, call dshr_state_getfldptr(exportState, 'So_bldepth', fldptr1=So_bldepth, allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! initialize stream pointers - call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, rc) + ! initialize pointers to required stream fields + call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_u', strm_So_u, rc) + + ! initialize pointers to optional stream fields + call shr_strdata_get_stream_pointer( sdat, 'So_u', strm_So_u, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_v', strm_So_v, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_v', strm_So_v, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_bldepth', strm_So_bldepth, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_bldepth', strm_So_bldepth, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Error checks - if (.not. associated(strm_So_t)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_t must be associated for docn cplhist mode') + if (associated(So_u) .and. .not. associate(strm_So_u)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_u must be associated for docn cplhist mode', rc=rc) return end if - if (.not. associated(strm_So_u)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_u must be associated for docn cplhist mode') + if (associated(So_v) .and. .not. associate(strm_So_v)) then + call shr_log_error(trim(subname)//'ERROR: strm_So_v must be associated for docn cplhist mode', rc=rc) return end if - if (.not. associated(strm_So_v)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_v must be associated for docn cplhist mode') - return - end if - if (.not. associated(strm_So_bldepth)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_bldepth must be associated for docn cplhist mode') + if (associated(Sobldepth) .and. .not. associate(strm_Sobldepth)) then + call shr_log_error(trim(subname)//'ERROR: strm_Sobldepth must be associated for docn cplhist mode', rc=rc) return end if ! Allocation depends on exchanged fields, so check before filling arrays with values here + So_t(:) = TkFrz if (associated(So_u)) So_u(:) = 0.0_r8 if (associated(So_v)) So_v(:) = 0.0_r8 - if (associated(So_t)) So_t(:) = TkFrz if (associated(So_bldepth)) So_bldepth(:) = 0.0_r8 ! Set export state ocean fraction (So_omask) @@ -151,11 +151,16 @@ subroutine docn_datamode_cplhist_advance(sst_constant_value, rc) !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - - So_t(:) = strm_So_t(:) - So_u(:) = strm_So_u(:) - So_v(:) = strm_So_v(:) - So_bldepth(:) = strm_So_bldepth(:) + + if (associate(So_u)) then + So_u(:) = strm_So_u(:) + end if + if (associate(So_v)) then + So_v(:) = strm_So_v(:) + end if + if (associate(So_bldepth)) then + So_bldepth(:) = strm_So_bldepth(:) + end if ! If need unit conversion for So_t (C-->K), ! use existing nml variable sst_constant_value to signal units of input @@ -167,6 +172,7 @@ subroutine docn_datamode_cplhist_advance(sst_constant_value, rc) endif endif + So_t(:) = strm_So_t(:) if (units_CToK) then So_t(:) = So_t(:) + TkFrz endif diff --git a/drof/cime_config/config_component.xml b/drof/cime_config/config_component.xml index 9ad49e455..af0a640a7 100644 --- a/drof/cime_config/config_component.xml +++ b/drof/cime_config/config_component.xml @@ -14,22 +14,22 @@ Data runoff model - NULL mode - COREv2 normal year forcing: - COREv2 interannual year forcing: - COREv2 interannual year forcing: - COREv2 interannual year forcing: - COREv2 interannual year forcing: - CPLHIST mode: - JRA55 interannual forcing, v1.4, through 2018 - JRA55 interannual forcing, v1.4, through 2018, no rofi around AIS - JRA55 interannual forcing, v1.4, through 2018, no rofl around AIS - JRA55 interannual forcing, v1.4, through 2018, no rofi or rofl around AIS - JRA55 interannual forcing - JRA55 Repeat Year Forcing v1.3 1961-1962 - JRA55 Repeat Year Forcing v1.3 1984-1985 - JRA55 Repeat Year Forcing v1.3 1990-1991 - JRA55 Repeat Year Forcing v1.3 2003-2004 + NULL mode + COREv2 normal year forcing: + COREv2 interannual year forcing: + COREv2 interannual year forcing: + COREv2 interannual year forcing: + COREv2 interannual year forcing: + JRA55 interannual forcing, v1.4, through 2018 + JRA55 interannual forcing, v1.4, through 2018, no rofi around AIS + JRA55 interannual forcing, v1.4, through 2018, no rofl around AIS + JRA55 interannual forcing, v1.4, through 2018, no rofi or rofl around AIS + JRA55 interannual forcing + JRA55 Repeat Year Forcing v1.3 1961-1962 + JRA55 Repeat Year Forcing v1.3 1984-1985 + JRA55 Repeat Year Forcing v1.3 1990-1991 + JRA55 Repeat Year Forcing v1.3 2003-2004 + CPLHIST mode: @@ -46,26 +46,26 @@ CPLHIST,DIATREN_ANN_RX1,DIATREN_IAF_RX1,DIATREN_IAF_AIS00_RX1,DIATREN_IAF_AIS45_RX1,DIATREN_IAF_AIS55_RX1,IAF_JRA,IAF_JRA_1p4_2018,IAF_JRA_1p4_2018_AIS0ICE,IAF_JRA_1p4_2018_AIS0LIQ,IAF_JRA_1p4_2018_AIS0ROF,RYF6162_JRA,RYF8485_JRA,RYF9091_JRA,RYF0304_JRA,NULL DIATREN_ANN_RX1 - NULL - DIATREN_ANN_RX1 - DIATREN_ANN_AIS00_RX1 - DIATREN_ANN_AIS45_RX1 - DIATREN_ANN_AIS55_RX1 - DIATREN_IAF_RX1 - DIATREN_IAF_AIS00_RX1 - DIATREN_IAF_AIS45_RX1 - DIATREN_IAF_AIS55_RX1 - CPLHIST - IAF_JRA - IAF_JRA_1p4_2018 + NULL + DIATREN_ANN_RX1 + DIATREN_ANN_AIS00_RX1 + DIATREN_ANN_AIS45_RX1 + DIATREN_ANN_AIS55_RX1 + DIATREN_IAF_RX1 + DIATREN_IAF_AIS00_RX1 + DIATREN_IAF_AIS45_RX1 + DIATREN_IAF_AIS55_RX1 + IAF_JRA + IAF_JRA_1p4_2018 IAF_JRA_1p4_2018_AIS0ICE IAF_JRA_1p4_2018_AIS0LIQ IAF_JRA_1p4_2018_AIS0ROF - RYF6162_JRA - RYF8485_JRA - RYF9091_JRA - RYF0304_JRA - NULL + RYF6162_JRA + RYF8485_JRA + RYF9091_JRA + RYF0304_JRA + CPLHIST + NULL run_component_drof env_run.xml diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 4b5852c84..2457159aa 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -22,19 +22,15 @@ module cdeps_drof_comp use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize use NUOPC_Model , only : NUOPC_ModelGet, SetVM - use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs - use shr_kind_mod , only : cx=>shr_kind_cx - use shr_const_mod , only : SHR_CONST_SPVAL + use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs, cx=>shr_kind_cx use shr_cal_mod , only : shr_cal_ymd2date use shr_log_mod , only : shr_log_setLogUnit, shr_log_error - use dshr_methods_mod , only : dshr_state_getfldptr, dshr_state_diagnose, chkerr, memcheck - use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance - use dshr_strdata_mod , only : shr_strdata_init_from_config, shr_strdata_get_stream_pointer + use dshr_methods_mod , only : state_diagnose, chkerr, memcheck + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config use dshr_mod , only : dshr_model_initphase, dshr_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy - use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_realize use nuopc_shr_methods, only : shr_get_rpointer_name implicit none @@ -42,6 +38,7 @@ module cdeps_drof_comp public :: SetServices public :: SetVM + private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -53,33 +50,33 @@ module cdeps_drof_comp !-------------------------------------------------------------------------- type(shr_strdata_type) :: sdat - type(ESMF_Mesh) :: model_mesh ! model mesh + type(ESMF_Mesh) :: model_mesh ! model mesh character(len=CS) :: flds_scalar_name = '' integer :: flds_scalar_num = 0 integer :: flds_scalar_index_nx = 0 integer :: flds_scalar_index_ny = 0 - integer :: mpicom ! mpi communicator - integer :: my_task ! my task in mpi communicator mpicom - logical :: mainproc ! true of my_task == main_task - character(len=16) :: inst_suffix = "" ! char string associated with instance (ie. "_0001" or "") - integer :: logunit ! logging unit number + integer :: mpicom ! mpi communicator + integer :: my_task ! my task in mpi communicator mpicom + logical :: mainproc ! true of my_task == main_task + character(len=16) :: inst_suffix = "" ! char string associated with instance (ie. "_0001" or "") + integer :: logunit ! logging unit number logical :: restart_read - character(CL) :: case_name ! case name + character(CL) :: case_name ! case name character(*) , parameter :: nullstr = 'null' - ! drof_in namelist input - character(CX) :: streamfilename = nullstr ! filename to obtain stream info from - character(CX) :: nlfilename = nullstr ! filename to obtain namelist info from - character(CL) :: dataMode = nullstr ! flags physics options wrt input data - character(CX) :: model_meshfile = nullstr ! full pathname to model meshfile - character(CX) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CX) :: restfilm = nullstr ! model restart file namelist + ! drof_in namelist input + character(CX) :: streamfilename = nullstr ! filename to obtain stream info from + character(CX) :: nlfilename = nullstr ! filename to obtain namelist info from + character(CL) :: dataMode = nullstr ! flags physics options wrt input data + character(CX) :: model_meshfile = nullstr ! full pathname to model meshfile + character(CX) :: model_maskfile = nullstr ! full pathname to obtain mask from + character(CX) :: restfilm = nullstr ! model restart file namelist integer :: nx_global integer :: ny_global - logical :: skip_restart_read = .false. ! true => skip restart read - logical :: export_all = .false. ! true => export all fields, do not check connected or not + logical :: skip_restart_read = .false. ! true => skip restart read + logical :: export_all = .false. ! true => export all fields, do not check connected or not logical :: diagnose_data = .true. - integer , parameter :: main_task=0 ! task number of main task + integer , parameter :: main_task=0 ! task number of main task #ifdef CESMCOUPLED character(*) , parameter :: modName = "(rof_comp_nuopc)" #else @@ -88,19 +85,6 @@ module cdeps_drof_comp ! linked lists type(fldList_type) , pointer :: fldsExport => null() - type(dfield_type) , pointer :: dfields => null() - - ! model mask and model fraction - real(r8), pointer :: model_frac(:) => null() - integer , pointer :: model_mask(:) => null() - - ! export state pointer arrays - real(r8), pointer :: Forr_rofl(:) => null() - real(r8), pointer :: Forr_rofi(:) => null() - - ! stream pointer arrays - real(r8), pointer :: strm_Forr_rofl(:) => null() ! always required - real(r8), pointer :: strm_Forr_rofi(:) => null() ! sometimes present in stream character(*) , parameter :: u_FILE_u = & __FILE__ @@ -156,7 +140,9 @@ end subroutine SetServices !=============================================================================== subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) + use shr_nl_mod, only: shr_nl_find_group_name + ! input/output variables type(ESMF_GridComp) :: gcomp type(ESMF_State) :: importState, exportState @@ -169,12 +155,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: ierr ! error code type(fldlist_type), pointer :: fldList type(ESMF_VM) :: vm - integer :: bcasttmp(4) + integer :: bcasttmp(4) character(len=*),parameter :: subname=trim(modName)//':(InitializeAdvertise) ' - character(*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)" - character(*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)" - character(*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)" - !------------------------------------------------------------------------------- + !-------------------------------- namelist / drof_nml / datamode, model_meshfile, model_maskfile, & restfilm, nx_global, ny_global, skip_restart_read, export_all @@ -203,24 +186,26 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) close(nu) if (ierr > 0) then rc = ierr + write(logunit,'(a,i0)') trim(subname),' ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) return end if ! write namelist input to standard out - write(logunit,F00)' datamode = ',trim(datamode) - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - write(logunit,F01)' nx_global = ',nx_global - write(logunit,F01)' ny_global = ',ny_global - write(logunit,F00)' restfilm = ',trim(restfilm) - write(logunit,F02)' skip_restart_read = ',skip_restart_read - write(logunit,F02)' export_all = ', export_all + write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) + write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global + write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global + write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read + write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + bcasttmp = 0 bcasttmp(1) = nx_global bcasttmp(2) = ny_global - if(skip_restart_read) bcasttmp(3) = 1 - if(export_all) bcasttmp(4) = 1 + if (skip_restart_read) bcasttmp(3) = 1 + if (export_all) bcasttmp(4) = 1 end if ! broadcast namelist input @@ -237,6 +222,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadcast(vm, bcasttmp, 3, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + nx_global = bcasttmp(1) ny_global = bcasttmp(2) skip_restart_read = (bcasttmp(3) == 1) @@ -244,23 +230,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Validate datamode if (trim(datamode) == 'copyall') then - if (mainproc) write(logunit,*) 'drof datamode = ',trim(datamode) + if (mainproc) then + write(logunit,'(2a)') trim(subname),'drof datamode = ',trim(datamode) + end if else call shr_log_error(' ERROR illegal drof datamode = '//trim(datamode), rc=rc) return end if - call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) - call dshr_fldlist_add(fldsExport, "Forr_rofl") - call dshr_fldlist_add(fldsExport, "Forr_rofi") - - fldlist => fldsExport ! the head of the linked list - do while (associated(fldlist)) - call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite('(drof_comp_advertise): Fr_rof '//trim(fldList%stdname), ESMF_LOGMSG_INFO) - fldList => fldList%next - enddo + ! Advertise export fields + call drof_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine InitializeAdvertise @@ -280,9 +260,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date - character(len=*), parameter :: F00 = "('" // trim(modName) // ": ')',8a)" character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' - !------------------------------------------------------------------------------- + !-------------------------------- rc = ESMF_SUCCESS @@ -345,12 +324,13 @@ subroutine ModelAdvance(gcomp, rc) integer :: day ! day in month logical :: restart_write ! restart alarm is ringing character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' - !------------------------------------------------------------------------------- + !-------------------------------- rc = ESMF_SUCCESS call memcheck(subname, 5, mainproc) call shr_log_setLogUnit(logunit) + ! query the Component for its clock, importState and exportState call NUOPC_ModelGet(gcomp, modelClock=clock, importState=importState, exportState=exportState, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -365,7 +345,7 @@ subroutine ModelAdvance(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yr, mon, day, next_ymd) - ! write restart if alarm is ringing + ! determine if restart if alarm is ringing restart_write = dshr_check_restart_alarm(clock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -391,11 +371,13 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri integer , intent(out) :: rc ! local variables - logical :: first_time = .true. - integer :: n + logical :: first_time = .true. + integer :: n character(len=CL) :: rpfile character(*), parameter :: subName = "(drof_comp_run) " - !------------------------------------------------------------------------------- + !-------------------------------- + + rc = ESMF_SUCESS call ESMF_TraceRegionEnter('DROF_RUN') @@ -404,27 +386,12 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri !-------------------- if (first_time) then - ! Initialize dfields - call dshr_dfield_add(dfields, sdat, 'Forr_rofl', 'Forr_rofl', exportState, logunit, mainproc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_dfield_add(dfields, sdat, 'Forr_rofi', 'Forr_rofi', exportState, logunit, mainproc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Initialize module ponters - call dshr_state_getfldptr(exportState, 'Forr_rofl' , fldptr1=Forr_rofl , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Forr_rofi' , fldptr1=Forr_rofi , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! Initialize module pointers - call shr_strdata_get_stream_pointer( sdat, 'Forr_rofl', strm_Forr_rofl, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Forr_rofl must be associated for drof', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Forr_rofi', strm_Forr_rofi, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (.not. associated(strm_Forr_rofi)) then - Forr_rofi(:) = 0._r8 - end if + ! Initialize stream and export state pointers + select case (trim(datamode)) + case('copyall') + call drof_datamode_copyall_init_pointers(exportState, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end select ! Read restart if needed if (restart_read .and. .not. skip_restart_read) then @@ -444,29 +411,20 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri ! time and spatially interpolate to model time and grid call ESMF_TraceRegionEnter('drof_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'drof', rc=rc) - call ESMF_TraceRegionExit('drof_strdata_advance') - - ! copy all fields from streams to export state as default - ! This automatically will update the fields in the export state - call ESMF_TraceRegionEnter('drof_dfield_copy') - call dshr_dfield_copy(dfields, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('drof_dfield_copy') + call ESMF_TraceRegionExit('drof_strdata_advance') - ! determine data model behavior based on the mode + ! perform data mode specific calculations call ESMF_TraceRegionEnter('drof_datamode') select case (trim(datamode)) case('copyall') - ! zero out "special values" of export fields - do n = 1, size(Forr_rofl) - if (abs(Forr_rofl(n)) > 1.0e28) Forr_rofl(n) = 0.0_r8 - if (abs(Forr_rofi(n)) > 1.0e28) Forr_rofi(n) = 0.0_r8 - enddo + call drof_datamode_copyall_advance() end select ! write restarts if needed if (restart_write) then - if(trim(datamode) .eq. 'copyall') then + select case (trim(datamode)) + case('copyall') call shr_get_rpointer_name(gcomp, 'rof', target_ymd, target_tod, rpfile, 'write', rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_restart_write(rpfile, case_name, 'drof', inst_suffix, target_ymd, target_tod, & @@ -481,15 +439,17 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - call ESMF_TraceRegionExit('drof_datamode') call ESMF_TraceRegionExit('DROF_RUN') end subroutine drof_comp_run !=============================================================================== subroutine ModelFinalize(gcomp, rc) + type(ESMF_GridComp) :: gcomp integer, intent(out) :: rc + !-------------------------------- + rc = ESMF_SUCCESS if (mainproc) then write(logunit,*) diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index b002c5fbc..9a2812755 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -22,17 +22,14 @@ module cdeps_dwav_comp use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize use NUOPC_Model , only : NUOPC_ModelGet, SetVM - use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs - use shr_kind_mod , only : cx=>shr_kind_cx + use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs, cx=>shr_kind_cx use shr_cal_mod , only : shr_cal_ymd2date use shr_log_mod , only : shr_log_setLogUnit, shr_log_error - use dshr_methods_mod , only : dshr_state_getfldptr, chkerr, memcheck, dshr_state_diagnose - use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance - use dshr_strdata_mod , only : shr_strdata_init_from_config - use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_check_restart_alarm - use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance + use dshr_methods_mod , only : state_diagnose, chkerr, memcheck + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config + use dshr_mod , only : dshr_model_initphase, dshr_init + use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize use nuopc_shr_methods, only : shr_get_rpointer_name @@ -41,13 +38,12 @@ module cdeps_dwav_comp public :: SetServices public :: SetVM + private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance - private :: ModelFinalize - private :: dwav_comp_advertise - private :: dwav_comp_realize private :: dwav_comp_run + private :: ModelFinalize !-------------------------------------------------------------------------- ! Private module data @@ -91,7 +87,6 @@ module cdeps_dwav_comp ! linked lists type(fldList_type) , pointer :: fldsExport => null() - type(dfield_type) , pointer :: dfields => null() ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() @@ -190,32 +185,33 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) mainproc = (my_task == main_task) ! Read dwav_nml from nlfilename - if (my_task == main_task) then + if (mainproc) then nlfilename = "dwav_in"//trim(inst_suffix) open (newunit=nu,file=trim(nlfilename),status="old",action="read") call shr_nl_find_group_name(nu, 'dwav_nml', status=ierr) read (nu,nml=dwav_nml,iostat=ierr) close(nu) if (ierr > 0) then - write(logunit,*) 'ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr + write(logunit,'(a,i0)') trim(subname),' ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) return end if ! write namelist input to standard out - write(logunit,F00)' datamode = ',trim(datamode) - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - write(logunit,F01)' nx_global = ',nx_global - write(logunit,F01)' ny_global = ',ny_global - write(logunit,F00)' restfilm = ',trim(restfilm) - write(logunit,F02)' skip_restart_read = ',skip_restart_read - write(logunit,F02)' export_all = ', export_all + write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) + write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global + write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global + write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read + write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + bcasttmp = 0 bcasttmp(1) = nx_global bcasttmp(2) = ny_global - if(skip_restart_read) bcasttmp(3) = 1 - if(export_all) bcasttmp(4) = 1 + if (skip_restart_read) bcasttmp(3) = 1 + if (export_all) bcasttmp(4) = 1 endif ! broadcast namelist input @@ -232,19 +228,22 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadcast(vm, bcasttmp, 3, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + nx_global = bcasttmp(1) ny_global = bcasttmp(2) skip_restart_read = (bcasttmp(3) == 1) export_all = (bcasttmp(4) == 1) - ! Call advertise phase + ! Validate datamode if (trim(datamode) == 'copyall') then if (my_task == main_task) write(logunit,*) 'dwav datamode = ',trim(datamode) else call shr_log_error(' ERROR illegal dwav datamode = '//trim(datamode), rc=rc) return end if - call dwav_comp_advertise(importState, exportState, rc=rc) + + ! Advertise export fields + call dwav_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine InitializeAdvertise @@ -285,9 +284,9 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dwav_strdata_init') - ! Realize the actively coupled fields, now that a mesh is established and - ! initialize dfields data type (to map streams to export state fields) - call dwav_comp_realize(importState, exportState, export_all, rc=rc) + ! Realize the actively coupled fields, now that a mesh is established + call dshr_fldlist_realize( exportState, fldsExport, flds_scalar_name, flds_scalar_num, model_mesh, & + subname//':dwavExport', export_all, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Get the time to interpolate the stream data to @@ -297,7 +296,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(current_year, current_mon, current_day, current_ymd) - ! Read restart if necessary if (restart_read .and. .not. skip_restart_read) then call shr_get_rpointer_name(gcomp, 'wav', current_ymd, current_tod, rpfile, 'read', rc) @@ -326,25 +324,23 @@ subroutine ModelAdvance(gcomp, rc) integer, intent(out) :: rc ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock - type(ESMF_Time) :: currTime, nextTime type(ESMF_TimeInterval) :: timeStep - type(ESMF_State) :: importState, exportState + type(ESMF_Time) :: currTime, nextTime + integer :: next_ymd ! model date + integer :: next_tod ! model sec into model date integer :: yr ! year integer :: mon ! month integer :: day ! day in month - integer :: next_ymd ! model date - integer :: next_tod ! model sec into model date - logical :: write_restart - character(len=CL):: rpfile + logical :: restart_write character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - call shr_log_setLogUnit(logunit) - call ESMF_TraceRegionEnter(subname) call memcheck(subname, 5, my_task == main_task) + call shr_log_setLogUnit(logunit) ! query the Component for its clock, importState and exportState call NUOPC_ModelGet(gcomp, modelClock=clock, importState=importState, exportState=exportState, rc=rc) @@ -360,178 +356,118 @@ subroutine ModelAdvance(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yr, mon, day, next_ymd) - ! run dwav - call dwav_comp_run(logunit, next_ymd, next_tod, sdat, rc=rc) + ! determine if restart if alarm is ringing + restart_write = dshr_check_restart_alarm(clock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! write_restart if alarm is ringing - write_restart = dshr_check_restart_alarm(clock, rc=rc) + ! run dwav + call dwav_comp_run(logunit, next_ymd, next_tod, sdat, restart_write,rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (write_restart) then - call ESMF_TraceRegionEnter('dwav_restart') - call NUOPC_CompAttributeGet(gcomp, name='case_name', value=case_name, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_get_rpointer_name(gcomp, 'wav', next_ymd, next_tod, rpfile, 'write', rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call dshr_restart_write(rpfile, case_name, 'dwav', inst_suffix, next_ymd, next_tod, & - logunit, my_task, sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('dwav_restart') - endif - - ! Write Diagnostics - if (diagnose_data) then - call dshr_state_diagnose(exportState, flds_scalar_name, subname//':ES',rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - call ESMF_TraceRegionExit(subname) end subroutine ModelAdvance !=============================================================================== - subroutine ModelFinalize(gcomp, rc) - - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - if (my_task == main_task) then - write(logunit,*) - write(logunit,*) ' dwav : end of main integration loop' - write(logunit,*) - end if + subroutine dwav_comp_run(gcomp, exportState, target_ymd, target_tod, restart_write, rc) - end subroutine ModelFinalize - - !=============================================================================== - subroutine dwav_comp_advertise(importState, exportState, rc) - - ! determine export and import fields to advertise to mediator + ! -------------------------- + ! advance dwav + ! -------------------------- - ! input/output arguments - type(ESMF_State) , intent(inout) :: importState + ! input/output variables: + type(ESMF_GridComp), intent(in) :: gcomp type(ESMF_State) , intent(inout) :: exportState + integer , intent(in) :: target_ymd ! model date + integer , intent(in) :: target_tod ! model sec into model date + logical , intent(in) :: restart_write integer , intent(out) :: rc ! local variables - type(fldlist_type), pointer :: fldList + logical :: first_time = .true. + integer :: n + character(len=CL) :: rpfile + character(*), parameter :: subName = "(dwav_comp_run) " !------------------------------------------------------------------------------- - rc = ESMF_SUCCESS - - !------------------- - ! Advertise export fields - !------------------- - - call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) - call dshr_fldList_add(fldsExport, 'Sw_lamult' ) - call dshr_fldList_add(fldsExport, 'Sw_ustokes') - call dshr_fldList_add(fldsExport, 'Sw_vstokes') - - fldlist => fldsExport ! the head of the linked list - do while (associated(fldlist)) - call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite('(dwav_comp_advertise): Fr_wav '//trim(fldList%stdname), ESMF_LOGMSG_INFO) - fldList => fldList%next - enddo - - ! currently there is no import state to dwav + rc = ESMF_SUCESS - end subroutine dwav_comp_advertise - - !=============================================================================== - subroutine dwav_comp_realize(importState, exportState, export_all, rc) - - ! input/output variables - type(ESMF_State) , intent(inout) :: importState - type(ESMF_State) , intent(inout) :: exportState - logical , intent(in) :: export_all - integer , intent(out) :: rc - - ! local variables - character(*), parameter :: subName = "(dwav_comp_realize) " - ! ---------------------------------------------- - - rc = ESMF_SUCCESS - - ! ------------------------------------- - ! NUOPC_Realize "realizes" a previously advertised field in the importState and exportState - ! by replacing the advertised fields with the newly created fields of the same name. - ! ------------------------------------- - - call dshr_fldlist_realize( exportState, fldsExport, flds_scalar_name, flds_scalar_num, model_mesh, & - subname//':dwavExport', export_all, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Create stream-> export state mapping - - call dshr_dfield_add(dfields, sdat, state_fld='Sw_lamult' , strm_fld='Sw_lamult' , state=exportstate, & - logunit=logunit, mainproc=mainproc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_dfield_add(dfields, sdat, state_fld='Sw_ustokes', strm_fld='Sw_ustokes', state=exportstate, & - logunit=logunit, mainproc=mainproc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_dfield_add(dfields, sdat, state_fld='Sw_vstokes', strm_fld='Sw_vstokes', state=exportstate, & - logunit=logunit, mainproc=mainproc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - end subroutine dwav_comp_realize - - !=============================================================================== - subroutine dwav_comp_run(logunit, target_ymd, target_tod, sdat, rc) - - ! -------------------------- - ! advance dwav - ! -------------------------- + call ESMF_TraceRegionEnter('DWAV_RUN') - ! input/output variables: - integer , intent(in) :: logunit - integer , intent(in) :: target_ymd ! model date - integer , intent(in) :: target_tod ! model sec into model date - type(shr_strdata_type) , intent(inout) :: sdat - integer , intent(out) :: rc - !------------------------------------------------------------------------------- + if (first_time) then + ! Initialize stream and export state pointers + select case (trim(datamode)) + case('copyall') + call dwav_datamode_copyall_init_pointers(exportState, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end select + + ! Read restart if needed + if (restart_read .and. .not. skip_restart_read) then + call shr_get_rpointer_name(gcomp, 'wav', target_ymd, target_tod, rpfile, 'read', rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + end if - call ESMF_TraceRegionEnter('DWAV_RUN') + first_time = .false. + end if !-------------------- - ! advance dwav streams + ! advance dwav streams and update export state !-------------------- ! time and spatially interpolate to model time and grid call ESMF_TraceRegionEnter('dwav_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'dwav', rc=rc) - call ESMF_TraceRegionExit('dwav_strdata_advance') - - !-------------------- - ! copy all fields from streams to export state as default - !-------------------- - - ! This automatically will update the fields in the export state - call ESMF_TraceRegionEnter('dwav_strdata_copy') - call dshr_dfield_copy(dfields, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('dwav_strdata_copy') - - !------------------------------------------------- - ! determine data model behavior based on the mode - !------------------------------------------------- + call ESMF_TraceRegionExit('dwav_strdata_advance') + ! perform data mode specific calculations call ESMF_TraceRegionEnter('dwav_datamode') select case (trim(datamode)) case('copyall') - ! do nothing + call dwav_datamode_copyall_advance() + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select call ESMF_TraceRegionExit('dwav_datamode') + ! write restarts if needed + if (restart_write) then + select case (trim(datamode)) + case('copyall') + call shr_get_rpointer_name(gcomp, 'wav', target_ymd, target_tod, rpfile, 'write', rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_restart_write(rpfile, case_name, 'dwav', inst_suffix, target_ymd, target_tod, & + logunit, my_task, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif + end if + + ! write diagnostics + if (diagnose_data) then + call dshr_state_diagnose(exportState, flds_scalar_name, subname//':ES',rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + call ESMF_TraceRegionExit('DWAV_RUN') end subroutine dwav_comp_run + !=============================================================================== + subroutine ModelFinalize(gcomp, rc) + + type(ESMF_GridComp) :: gcomp + integer, intent(out) :: rc + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + if (my_task == main_task) then + write(logunit,*) + write(logunit,*) ' dwav : end of main integration loop' + write(logunit,*) + end if + + end subroutine ModelFinalize + #ifdef CESMCOUPLED end module wav_comp_nuopc #else From d54c30928f9b2c5b8c55ee3457bde6f98bec08f3 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 26 Dec 2025 17:26:16 +0100 Subject: [PATCH 16/61] refactor to make stream pointers explicit rather than use dfields --- datm/atm_comp_nuopc.F90 | 96 ++++++-------- datm/datm_datamode_era5_mod.F90 | 3 +- datm/datm_datamode_gefs_mod.F90 | 1 - datm/datm_datamode_jra_mod.F90 | 65 ++++------ dglc/dglc_datamode_noevolve_mod.F90 | 13 +- dglc/glc_comp_nuopc.F90 | 73 +---------- dice/ice_comp_nuopc.F90 | 59 ++++----- dlnd/dlnd_datamode_glc_forcing_mod.F90 | 14 +-- dlnd/dlnd_datamode_rof_forcing_mod.F90 | 6 +- dlnd/lnd_comp_nuopc.F90 | 31 ++--- docn/docn_datamode_cplhist_mod.F90 | 21 ++-- docn/docn_datamode_dom_mod.F90 | 14 +-- docn/docn_datamode_multilev_cplhist_mod.F90 | 112 +++++++++-------- docn/docn_datamode_multilev_dom_mod.F90 | 38 ++---- docn/docn_datamode_multilev_mod.F90 | 39 ++---- docn/docn_datamode_som_mod.F90 | 100 ++++++--------- docn/ocn_comp_nuopc.F90 | 133 ++++++++++---------- drof/rof_comp_nuopc.F90 | 32 +++-- dwav/wav_comp_nuopc.F90 | 45 +++---- 19 files changed, 379 insertions(+), 516 deletions(-) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index b93d84a67..a155a4bd8 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -139,6 +139,7 @@ module cdeps_datm_comp integer :: ny_global ! global ny logical :: skip_restart_read = .false. ! true => skip restart read in continuation run logical :: export_all = .false. ! true => export all fields, do not check connected or not + logical :: first_call = .true. ! linked lists type(fldList_type) , pointer :: fldsImport => null() @@ -227,9 +228,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) character(CL) :: nextsw_cday_calc type(ESMF_VM) :: vm character(len=*),parameter :: subname=trim(modName) // ':(InitializeAdvertise) ' - character(*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)" - character(*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)" - character(*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)" !------------------------------------------------------------------------------- namelist / datm_nml / & @@ -287,6 +285,26 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) return end if + + ! write namelist input to standard out + write(logunit,'(3a)') trim(subname),' case_name = ',trim(case_name) + write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) + write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global + write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global + write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) + write(logunit,'(2a,i0)') trim(subname),' iradsw = ',iradsw + write(logunit,'(3a)') trim(subname),' nextsw_cday_calc = ', trim(nextsw_cday_calc) + write(logunit,'(3a)') trim(subname),' factorFn_data = ',trim(factorFn_data) + write(logunit,'(3a)') trim(subname),' factorFn_mesh = ',trim(factorFn_mesh) + write(logunit,'(2a,l6)') trim(subname),' flds_presaero = ',flds_presaero + write(logunit,'(2a,l6)') trim(subname),' flds_presndep = ',flds_presndep + write(logunit,'(2a,l6)') trim(subname),' flds_preso3 = ',flds_preso3 + write(logunit,'(2a,l6)') trim(subname),' flds_co2 = ',flds_co2 + write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read + write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + bcasttmp = 0 bcasttmp(1) = nx_global bcasttmp(2) = ny_global @@ -298,9 +316,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if(skip_restart_read) bcasttmp(8) = 1 if(export_all) bcasttmp(9) = 1 end if + + ! Broadcast namelist input call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMBroadcast(vm, datamode, CL, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadcast(vm, bias_correct, CL, main_task, rc=rc) @@ -321,6 +340,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadcast(vm, bcasttmp, 10, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + nx_global = bcasttmp(1) ny_global = bcasttmp(2) iradsw = bcasttmp(3) @@ -340,45 +360,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) return end if - ! write namelist input to standard out - if (my_task == main_task) then - write(logunit,F00)' case_name = ',trim(case_name) - write(logunit,F00)' datamode = ',trim(datamode) - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - write(logunit,F01)' nx_global = ',nx_global - write(logunit,F01)' ny_global = ',ny_global - write(logunit,F00)' restfilm = ',trim(restfilm) - write(logunit,F01)' iradsw = ',iradsw - write(logunit,F00)' nextsw_cday_calc = ', trim(nextsw_cday_calc) - 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_preso3 = ',flds_preso3 - write(logunit,F02)' flds_co2 = ',flds_co2 - write(logunit,F02)' skip_restart_read = ',skip_restart_read - write(logunit,F02)' export_all = ',export_all - end if - ! Validate sdat datamode if (mainproc) write(logunit,*) ' datm datamode = ',trim(datamode) - if ( trim(datamode) == 'CORE2_NYF' .or. & - trim(datamode) == 'CORE2_IAF' .or. & - trim(datamode) == 'CORE_IAF_JRA' .or. & - trim(datamode) == 'CORE_RYF6162_JRA' .or. & - trim(datamode) == 'CORE_RYF8485_JRA' .or. & - trim(datamode) == 'CORE_RYF9091_JRA' .or. & - trim(datamode) == 'CORE_RYF0304_JRA' .or. & - trim(datamode) == 'CLMNCEP' .or. & - trim(datamode) == 'CPLHIST' .or. & - trim(datamode) == 'GEFS' .or. & - trim(datamode) == 'ERA5' .or. & - trim(datamode) == 'SIMPLE') then - else + select case (trim(datamode)) + case ('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA', & + 'CORE_RYF6162_JRA','CORE_RYF8485_JRA','CORE_RYF9091_JRA','CORE_RYF0304_JRA', & + 'CLMNCEP','CPLHIST','GEFS','ERA5','SIMPLE') + if (mainproc) write(logunit,'(3a)') trim(subname),'datm datamode = ',trim(datamode) + case default call shr_log_error(' ERROR illegal datm datamode = '//trim(datamode), rc=rc) return - endif + end select ! Advertise fields that are not datamode specific if (flds_co2) then @@ -624,7 +616,6 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod integer , intent(out) :: rc ! local variables - logical :: first_time = .true. character(len=CL) :: rpfile character(*), parameter :: subName = '(datm_comp_run) ' !------------------------------------------------------------------------------- @@ -637,7 +628,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod ! First time initialization !-------------------- - if (first_time) then + if_first_call: if (first_call) then ! Initialize data pointers for co2 (non datamode specific) if (flds_co2) then call datm_pres_co2_init_pointers(exportState, sdat, rc=rc) @@ -662,10 +653,6 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - ! Initialize dfields - call datm_init_dfields(rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Initialize datamode module pointers select case (trim(datamode)) case('CORE2_NYF','CORE2_IAF') @@ -708,48 +695,41 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod end select end if - ! reset first_time - first_time = .false. - end if + first_call = .false. + end if if_first_call !-------------------- ! Advance datm streams !-------------------- - ! set data needed for cosz t-interp method + ! Set data needed for cosz t-interp method call shr_strdata_setOrbs(sdat, orbEccen, orbMvelpp, orbLambm0, orbObliqr, idt) - ! time and spatially interpolate to model time and grid + ! Time and spatially interpolate to model time and grid call ESMF_TraceRegionEnter('datm_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'datm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('datm_strdata_advance') - ! update export state co2 if appropriate + ! Update export state for non data-mode specific fields if (flds_co2) then call datm_pres_co2_advance() if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - - ! update export state o3 if appropriate if (flds_preso3) then call datm_pres_o3_advance() if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - - ! ungridded dimension output - update export state nitrogen deposition if appropriate if (flds_presndep) then call datm_pres_ndep_advance() if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - - ! ungridded dimension output - upate prescribed aerosol if appropriate if (flds_presaero) then call datm_pres_aero_advance() if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - ! Determine data model behavior based on the mode + ! Determine data-mode specific behavior call ESMF_TraceRegionEnter('datm_datamode') select case (trim(datamode)) case('CORE2_NYF','CORE2_IAF') diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index 8339c00b7..b8032308d 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -273,7 +273,6 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) if (associated(Faxa_swvdr) .and. .not. associated(strm_Faxa_swvdr)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for era5 datamode', rc=rc) return - end if end if if (associated(Faxa_swndr) .and. .not. associated(strm_Faxa_swndr)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndr must be associated for era5 datamode', rc=rc) @@ -283,7 +282,7 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for era5 datamode', rc=rc) return end if - if (associated(Faxa_swndf) .and. not. associated(strm_Faxa_swndf)) then + if (associated(Faxa_swndf) .and. .not. associated(strm_Faxa_swndf)) then call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndf must be associated for era5 datamode', rc=rc) return end if diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index 5b033f69e..b6d367146 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -69,7 +69,6 @@ subroutine datm_datamode_gefs_advertise(exportState, fldsexport, flds_scalar_nam integer , intent(out) :: rc ! local variables - integer :: n type(fldlist_type), pointer :: fldList !------------------------------------------------------------------------------- diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 646ba962a..c8577bf80 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -3,13 +3,11 @@ module datm_datamode_jra_mod use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_MeshGet 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_log_mod , only : shr_log_error + use shr_kind_mod , only : r8=>shr_kind_r8 use shr_cal_mod , only : shr_cal_date2julian use shr_const_mod , only : shr_const_tkfrz, shr_const_pi, shr_const_rdair use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type use dshr_methods_mod , only : dshr_state_getfldptr, chkerr - use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none @@ -41,7 +39,7 @@ module datm_datamode_jra_mod real(r8), pointer :: Faxa_swvdf(:) => null() real(r8), pointer :: Faxa_swnet(:) => null() - ! stream data + ! stream data pointers real(r8), pointer :: strm_Sa_tbot(:) => null() real(r8), pointer :: strm_Sa_pslv(:) => null() real(r8), pointer :: strm_Sa_u(:) => null() @@ -146,35 +144,6 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) yc(n) = ownedElemCoords(2*n) end do - ! initialize stream pointers - call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_prec must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swdn must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swnet' , strm_Faxa_swnet , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swnet must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for jra datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! initialize export state pointers call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -217,11 +186,31 @@ 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 - ! erro check - if (.not. associated(strm_prec) .or. .not. associated(strm_swdn)) then - call shr_log_error(trim(subname)//'ERROR: prec and swdn must be in streams for CORE_IAF_JRA', rc=rc) - return - endif + ! initialize stream pointers + call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_prec must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swdn must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for jra datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine datm_datamode_jra_init_pointers diff --git a/dglc/dglc_datamode_noevolve_mod.F90 b/dglc/dglc_datamode_noevolve_mod.F90 index 48cf4a17e..dc7bf4539 100644 --- a/dglc/dglc_datamode_noevolve_mod.F90 +++ b/dglc/dglc_datamode_noevolve_mod.F90 @@ -262,7 +262,6 @@ subroutine dglc_datamode_noevolve_advance(gcomp, pio_subsystem, io_type, io_form real(r8) :: loc_pos_smb(1), Tot_pos_smb(1) ! Sum of positive smb values on each ice sheet for hole-filling real(r8) :: loc_neg_smb(1), Tot_neg_smb(1) ! Sum of negative smb values on each ice sheet for hole-filling real(r8) :: rat ! Ratio of hole-filling flux to apply - character(len=*), parameter :: subname='(dglc_datamode_noevolve_advance): ' !------------------------------------------------------------------------------- @@ -436,7 +435,7 @@ subroutine dglc_datamode_noevolve_advance(gcomp, pio_subsystem, io_type, io_form ! where there is no negative smb. In that case the ice ! runoff is exactly equal to the input smb. if(abs(Tot_pos_smb(1)) >= abs(Tot_neg_smb(1))) then - do ng = 1,lsize + do ng = 1,lsize if (Sg_icemask_coupled_fluxes(ns)%ptr(ng) > 0.d0) then if(Flgl_qice(ns)%ptr(ng) > 0.d0) then rat = Flgl_qice(ns)%ptr(ng)/Tot_pos_smb(1) @@ -465,7 +464,7 @@ subroutine dglc_datamode_noevolve_advance(gcomp, pio_subsystem, io_type, io_form Fgrg_rofi(ns)%ptr(ng) = 0.d0 end if end do - + end if ! More neg or pos smb end do ! Each ice sheet @@ -473,7 +472,7 @@ subroutine dglc_datamode_noevolve_advance(gcomp, pio_subsystem, io_type, io_form ! Set initialized flag initialized_noevolve = .true. - + end subroutine dglc_datamode_noevolve_advance !=============================================================================== @@ -583,7 +582,7 @@ subroutine dglc_datamode_noevolve_restart_write(model_meshes, case_name, & if (ChkErr(rc,__LINE__,u_FILE_u)) return call pio_initdecomp(pio_subsystem, pio_double, (/nx_global(ns),ny_global(ns)/), gindex, pio_iodesc(ns)) call pio_write_darray(pioid, varid(ns), pio_iodesc(ns), Fgrg_rofi(ns)%ptr, rcode, fillval=shr_const_spval) - + ! Deallocate gindex deallocate (gindex) end do @@ -661,12 +660,12 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, write(logunit, '(a)') trim(subname)//' file not found, skipping '//trim(restfilem) return end if - + ! Read restart file if (my_task == main_task) then write(logunit, '(a)') trim(subname)//' reading data model restart '//trim(restfilem) end if - + rcode = pio_openfile(pio_subsystem, pioid, io_type, trim(restfilem), pio_nowrite) do ns = 1,num_icesheets diff --git a/dglc/glc_comp_nuopc.F90 b/dglc/glc_comp_nuopc.F90 index 4d87b606e..1d9f6a5b4 100644 --- a/dglc/glc_comp_nuopc.F90 +++ b/dglc/glc_comp_nuopc.F90 @@ -39,9 +39,9 @@ module cdeps_dglc_comp use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_realize use nuopc_shr_methods, only : shr_get_rpointer_name, alarmInit + ! Datamode specialized modules use dglc_datamode_noevolve_mod, only : dglc_datamode_noevolve_advertise use dglc_datamode_noevolve_mod, only : dglc_datamode_noevolve_init_pointers @@ -102,15 +102,12 @@ module cdeps_dglc_comp character(CX) :: restfilm = nullstr ! model restart file namelist logical :: skip_restart_read = .false. ! true => skip restart read in continuation run logical :: export_all = .false. ! true => export all fields, do not check connected or not + logical :: first_call = .true. ! linked lists type(fldList_type) , pointer :: fldsImport => null() type(fldList_type) , pointer :: fldsExport => null() - type dfields_icesheets_type - type(dfield_type), pointer :: dfields => null() - end type dfields_icesheets_type - type(dfields_icesheets_type), allocatable :: dfields_icesheets(:) ! constants logical :: diagnose_data = .true. @@ -531,7 +528,6 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va ! local variables character(len=CS) :: cnum integer :: ns ! ice sheet index - logical :: first_time = .true. character(len=CS) :: rpfile character(*), parameter :: subName = "(dglc_comp_run) " !------------------------------------------------------------------------------- @@ -544,13 +540,7 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va ! First time initialization !-------------------- - if (first_time) then - ! Initialize dfields for all ice sheets - if (trim(datamode) /= 'noevolve') then - call dglc_init_dfields(rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - + if (first_call) then ! Initialize datamode module ponters select case (trim(datamode)) case('noevolve') @@ -568,8 +558,7 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - ! Reset first_time - first_time = .false. + first_call = .false. end if !-------------------- @@ -577,10 +566,6 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va !-------------------- if (trim(datamode) /= 'noevolve') then - if (.not. allocated(dfields_icesheets)) then - allocate(dfields_icesheets(num_icesheets)) - end if - ! Loop over ice sheets do ns = 1,num_icesheets ! Advance data model streams - time and spatially interpolate to model time and grid @@ -589,13 +574,6 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va call shr_strdata_advance(sdat(ns), target_ymd, target_tod, logunit, 'dglc', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dglc_strdata_advance') - - ! Copy all fields from streams to export state as default - ! This automatically will update the fields in the export state - call ESMF_TraceRegionEnter('dglc_dfield_copy') - call dshr_dfield_copy(dfields_icesheets(ns)%dfields, sdat(ns), rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('dglc_dfield_copy') end do end if @@ -610,7 +588,6 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va end select ! Write restarts if needed - if (restart_write) then if (trim(datamode) == 'noevolve') then if (my_task == main_task) then @@ -636,48 +613,6 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va call ESMF_TraceRegionExit('DGLC_RUN') - contains - - subroutine dglc_init_dfields(rc) - ! ----------------------------- - ! Initialize dfields arrays - ! ----------------------------- - - ! input/output variables - integer, intent(out) :: rc - - ! local variables - integer :: nf, ns - integer :: fieldcount - type(ESMF_Field) :: lfield - character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) - character(*), parameter :: subName = "(dglc_init_dfields) " - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! Loop over ice sheets - ! Initialize dfields data type (to map streams to export state fields) - ! Create dfields linked list - used for copying stream fields to export state fields - do ns = 1,num_icesheets - call ESMF_StateGet(NStateExp(ns), itemCount=fieldCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lfieldnamelist(fieldCount)) - call ESMF_StateGet(NStateExp(ns), itemNameList=lfieldnamelist, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do nf = 1, fieldCount - call ESMF_StateGet(NStateExp(ns), itemName=trim(lfieldNameList(nf)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (trim(lfieldnamelist(nf)) /= flds_scalar_name) then - call dshr_dfield_add( dfields_icesheets(ns)%dfields, sdat(ns), & - trim(lfieldnamelist(nf)), trim(lfieldnamelist(nf)), NStateExp(ns), logunit, mainproc, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - end if - end do - deallocate(lfieldnamelist) - end do - end subroutine dglc_init_dfields - end subroutine dglc_comp_run !=============================================================================== diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 187407249..534abbd77 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -91,6 +91,7 @@ module cdeps_dice_comp integer :: nx_global integer :: ny_global logical :: export_all = .false. ! true => export all fields, do not check connected or not + logical :: first_call = .true. ! linked lists type(fldList_type) , pointer :: fldsImport => null() @@ -101,6 +102,7 @@ module cdeps_dice_comp integer , pointer :: model_mask(:) => null() logical :: valid_ice = .true. ! used for single column logic (ocn mask > 0) + ! constants logical :: flds_i2o_per_cat ! .true. if select per ice thickness real(R8) :: dt ! real model timestep @@ -181,10 +183,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) real(r8) :: rbcasttmp(3) type(ESMF_VM) :: vm character(len=*),parameter :: subname=trim(modName)//':(InitializeAdvertise) ' - character(*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)" - character(*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)" - character(*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)" - character(*) ,parameter :: F03 = "('(" // trim(modName) // ") ',a,d13.5)" !------------------------------------------------------------------------------- namelist / dice_nml / datamode, & @@ -208,7 +206,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) mainproc = (my_task == main_task) ! Read dice_nml from nlfilename - if (my_task == main_task) then + if (mainproc) then nlfilename = "dice_in"//trim(inst_suffix) open (newunit=nu,file=trim(nlfilename),status="old",action="read") call shr_nl_find_group_name(nu, 'dice_nml', status=ierr) @@ -222,17 +220,18 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if ! write namelist input to standard out - write(logunit,F00)' datamode = ',trim(datamode) - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - write(logunit,F01)' nx_global = ',nx_global - write(logunit,F01)' ny_global = ',ny_global - write(logunit,F03)' flux_swpf = ',flux_swpf - write(logunit,F03)' flux_Qmin = ',flux_Qmin - write(logunit,F02)' flux_Qacc = ',flux_Qacc - write(logunit,F03)' flux_Qacc0 = ',flux_Qacc0 - write(logunit,F00)' restfilm = ',trim(restfilm) - write(logunit,F02)' export_all = ',export_all + write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) + write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global + write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global + write(logunit,'(2a,d13.5)') trim(subname),' flux_swpf = ',flux_swpf + write(logunit,'(2a,d13.5)') trim(subname),' flux_Qmin = ',flux_Qmin + write(logunit,'(2a,l6)') trim(subname),' flux_Qacc = ',flux_Qacc + write(logunit,'(2a,d13.5)') trim(subname),' flux_Qacc0 = ',flux_Qacc0 + write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + bcasttmp = 0 bcasttmp(1) = nx_global bcasttmp(2) = ny_global @@ -270,23 +269,20 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) flux_Qacc0 = rbcasttmp(3) ! Validate datamode - if ( trim(datamode) == 'ssmi' .or. trim(datamode) == 'ssmi_iaf' .or. trim(datamode) == 'cplhist') then - if (my_task == main_task) write(logunit,*) ' dice datamode = ',trim(datamode) - else + select case (trim(datamode)) + case('ssmi','ssmi_iaf','cplhist') + if (mainproc) write(logunit,'(3a)') trim(subname),' dice datamode = ',trim(datamode) + case default call shr_log_error(' ERROR illegal dice datamode = '//trim(datamode), rc=rc) return - endif + end select ! Advertise import and export fields - if ( trim(datamode) == 'ssmi' .or. trim(datamode) == 'ssmi_iaf') then - call NUOPC_CompAttributeGet(gcomp, name='flds_i2o_per_cat', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) flds_i2o_per_cat ! module variable - endif - - !datamode already validated select case (trim(datamode)) case('ssmi','ssmi_iaf') + call NUOPC_CompAttributeGet(gcomp, name='flds_i2o_per_cat', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) flds_i2o_per_cat ! module variable call dice_datamode_ssmi_advertise(importState, exportState, fldsimport, fldsexport, & flds_scalar_name, flds_i2o_per_cat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -407,6 +403,7 @@ end subroutine InitializeRealize !=============================================================================== subroutine ModelAdvance(gcomp, rc) + ! input/output variables type(ESMF_GridComp) :: gcomp integer, intent(out) :: rc @@ -487,7 +484,6 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod integer , intent(out) :: rc ! local variables - logical :: first_time = .true. character(len=CL) :: rpfile character(*), parameter :: subName = "(dice_comp_run) " !------------------------------------------------------------------------------- @@ -500,7 +496,7 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod ! first time initialization !-------------------- - if (first_time) then + if (first_call) then ! Initialize datamode module ponters select case (trim(datamode)) @@ -526,8 +522,7 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod end select end if - ! reset first_time - first_time = .false. + first_call = .false. end if !-------------------- @@ -590,7 +585,7 @@ subroutine ModelFinalize(gcomp, rc) !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - if (my_task == main_task) then + if (mainproc) then write(logunit,*) write(logunit,*) 'dice : end of main integration loop' write(logunit,*) diff --git a/dlnd/dlnd_datamode_glc_forcing_mod.F90 b/dlnd/dlnd_datamode_glc_forcing_mod.F90 index 0865c7a96..90862ccf6 100644 --- a/dlnd/dlnd_datamode_glc_forcing_mod.F90 +++ b/dlnd/dlnd_datamode_glc_forcing_mod.F90 @@ -24,7 +24,7 @@ module dlnd_datamode_glc_forcing_mod ! stream pointers (1d) type, public :: stream_pointer_type - real(r8), pointer :: strm_ptr(:) + real(r8), pointer :: ptr(:) end type stream_pointer_type type(stream_pointer_type), allocatable :: strm_Sl_tsrf_elev(:) type(stream_pointer_type), allocatable :: strm_Sl_topo_elev(:) @@ -139,17 +139,17 @@ subroutine dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, model_frac write(nec_str,'(i0)') ng end if strm_fld = 'Sl_tsrf_elev'//trim(nec_str) - call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Sl_tsrf_elev(ng)%strm_ptr, requirePointer=.true., & + call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Sl_tsrf_elev(ng)%ptr, requirePointer=.true., & errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return strm_fld = 'Sl_topo_elev'//trim(nec_str) - call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Sl_topo_elev(ng)%strm_ptr, requirePointer=.true., & + call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Sl_topo_elev(ng)%ptr, requirePointer=.true., & errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return strm_fld = 'Flgl_qice_elev'//trim(nec_str) - call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Flgl_qice_elev(ng)%strm_ptr, requirePointer=.true., & + call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Flgl_qice_elev(ng)%ptr, requirePointer=.true., & errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do @@ -172,7 +172,7 @@ subroutine dlnd_datamode_glc_forcing_advance() if (lfrac(ni) == 0._r8) then Sl_tsrf_elev(ng,ni) = 1.e30_r8 else - Sl_tsrf_elev(ng,ni) = strm_Sl_tsrf_elev(ng)%strm_ptr(ni) + Sl_tsrf_elev(ng,ni) = strm_Sl_tsrf_elev(ng)%ptr(ni) end if end do @@ -180,7 +180,7 @@ subroutine dlnd_datamode_glc_forcing_advance() if (lfrac(ni) == 0._r8) then Sl_topo_elev(ng,ni) = 1.e30_r8 else - Sl_topo_elev(ng,ni) = strm_Sl_topo_elev(ng)%strm_ptr(ni) + Sl_topo_elev(ng,ni) = strm_Sl_topo_elev(ng)%ptr(ni) end if end do @@ -188,7 +188,7 @@ subroutine dlnd_datamode_glc_forcing_advance() if (lfrac(ni) == 0._r8) then Flgl_qice_elev(ng,ni) = 1.e30_r8 else - Flgl_qice_elev(ng,ni) = strm_Flgl_qice_elev(ng)%strm_ptr(ni) + Flgl_qice_elev(ng,ni) = strm_Flgl_qice_elev(ng)%ptr(ni) end if end do end do elev_class_loop diff --git a/dlnd/dlnd_datamode_rof_forcing_mod.F90 b/dlnd/dlnd_datamode_rof_forcing_mod.F90 index f02684302..c246f9d74 100644 --- a/dlnd/dlnd_datamode_rof_forcing_mod.F90 +++ b/dlnd/dlnd_datamode_rof_forcing_mod.F90 @@ -29,7 +29,7 @@ module dlnd_datamode_rof_forcing_mod ! stream field pointers type, public :: stream_pointer_type - real(r8), pointer :: strm_ptr(:) + real(r8), pointer :: ptr(:) end type stream_pointer_type type(stream_pointer_type), allocatable :: strm_Flrl_rofsur_nonh2o_2d(:) ! 2dple nonh2o tracers real(r8), pointer :: strm_Flrl_rofsur_nonh2o_1d(:) ! onlyl 1 nonh2o tracer @@ -161,7 +161,7 @@ subroutine dlnd_datamode_rof_forcing_init_pointers(exportState, sdat, model_frac do nf = 1,ntracers_nonh2o write(nchar,'(i2.2)') nf strm_fld = trim('Flrl_rofsur_nonh2o') // trim(nchar) - call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Flrl_rofsur_nonh2o_2d(nf)%strm_ptr, & + call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Flrl_rofsur_nonh2o_2d(nf)%ptr, & requirePointer=.true., & errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//& ' must be associated for dlnd rof_forcing datamode', rc=rc) @@ -209,7 +209,7 @@ subroutine dlnd_datamode_rof_forcing_advance() if (lfrac(ni) == 0._r8) then Flrl_rofsur_nonh2o_2d(nf,ni) = 1.e30_r8 else - Flrl_rofsur_nonh2o_2d(nf,ni) = strm_Flrl_rofsur_nonh2o_2d(nf)%strm_ptr(ni) + Flrl_rofsur_nonh2o_2d(nf,ni) = strm_Flrl_rofsur_nonh2o_2d(nf)%ptr(ni) end if end do end do diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index d77c85e2a..36b7acc95 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -7,6 +7,7 @@ module cdeps_dlnd_comp !---------------------------------------------------------------------------- ! This is the NUOPC cap for DLND !---------------------------------------------------------------------------- + use ESMF , only : ESMF_VM, ESMF_VMBroadcast, ESMF_GridCompGet use ESMF , only : ESMF_Mesh, ESMF_GridComp, ESMF_SUCCESS, ESMF_LOGMSG_INFO use ESMF , only : ESMF_LogWrite, ESMF_TraceRegionExit, ESMF_TraceRegionEnter @@ -86,6 +87,7 @@ module cdeps_dlnd_comp integer :: ny_global ! global ny dimension of model mesh logical :: skip_restart_read = .false. ! true => skip restart read in continuation logical :: export_all = .false. ! true => export all fields, do not check connected or not + logical :: first_call = .true. ! linked lists type(fldList_type) , pointer :: fldsExport => null() @@ -102,6 +104,7 @@ module cdeps_dlnd_comp #else character(*) , parameter :: modName = "(cdeps_dlnd_comp)" #endif + character(*) , parameter :: u_FILE_u = & __FILE__ @@ -194,7 +197,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) nlfilename = "dlnd_in"//trim(inst_suffix) open (newunit=nu, file=trim(nlfilename), status="old", action="read") call shr_nl_find_group_name(nu, 'dlnd_nml', status=ierr) - read (nu,nml=dlnd_nml,iostat=ierr) close(nu) if (ierr > 0) then @@ -202,6 +204,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) return end if + bcasttmp = 0 bcasttmp(1) = nx_global bcasttmp(2) = ny_global @@ -222,6 +225,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadcast(vm, bcasttmp, 3, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + nx_global = bcasttmp(1) ny_global = bcasttmp(2) skip_restart_read = (bcasttmp(3) == 1) @@ -240,23 +244,23 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) endif ! Validate sdat datamode - if ( trim(datamode) == 'glc_forcing_mct' .or. & - trim(datamode) == 'glc_forcing' .or. & - trim(datamode) == 'rof_forcing') then - if (my_task == main_task) write(logunit,*) 'dlnd datamode = ',trim(datamode) - else + select case (trim(datamode)) + case('glc_forcing_mct','glc_forcing','rof_forcing') + if (my_task == main_task) write(logunit,'(3a)') trim(subname),' dlnd datamode = ',trim(datamode) + case default call shr_log_error(' ERROR illegal dlnd datamode = '//trim(datamode), rc=rc) return - end if + end select ! Advertise the export fields - if (trim(datamode) == 'glc_forcing' .or. trim(datamode) == 'glc_forcing_mct') then + select case (trim(datamode)) + case('glc_forcing_mct','glc_forcing') call dlnd_datamode_glc_forcing_advertise(gcomp, exportState, fldsExport, flds_scalar_name, logunit, mainproc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (trim(datamode) == 'rof_forcing') then + case('rof_forcing') call dlnd_datamode_rof_forcing_advertise(exportState, fldsExport, flds_scalar_name, logunit, mainproc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + end select end subroutine InitializeAdvertise @@ -438,9 +442,6 @@ subroutine dlnd_comp_run(importState, exportState, target_ymd, target_tod, rc) integer , intent(in) :: target_ymd ! model date integer , intent(in) :: target_tod ! model sec into model date integer , intent(out) :: rc - - ! local variables - logical :: first_time = .true. !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -451,7 +452,7 @@ subroutine dlnd_comp_run(importState, exportState, target_ymd, target_tod, rc) ! First time initialization !-------------------- - if (first_time) then + if (first_call) then ! Initialize datamode export state and stream pointers select case (trim(datamode)) case('glc_forcing_mct','glc_forcing') @@ -462,7 +463,7 @@ subroutine dlnd_comp_run(importState, exportState, target_ymd, target_tod, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select - first_time = .false. + first_call = .false. end if !-------------------- diff --git a/docn/docn_datamode_cplhist_mod.F90 b/docn/docn_datamode_cplhist_mod.F90 index 4aa373f9d..898a8d421 100644 --- a/docn/docn_datamode_cplhist_mod.F90 +++ b/docn/docn_datamode_cplhist_mod.F90 @@ -114,16 +114,19 @@ subroutine docn_datamode_cplhist_init_pointers(exportState, sdat, ocn_fraction, call shr_strdata_get_stream_pointer( sdat, 'So_bldepth', strm_So_bldepth, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (associated(So_u) .and. .not. associate(strm_So_u)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_u must be associated for docn cplhist mode', rc=rc) + if (associated(So_u) .and. .not. associated(strm_So_u)) then + call shr_log_error(trim(subname)//& + 'ERROR: strm_So_u must be associated if So_u is associated for docn cplhist mode', rc=rc) return end if - if (associated(So_v) .and. .not. associate(strm_So_v)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_v must be associated for docn cplhist mode', rc=rc) + if (associated(So_v) .and. .not. associated(strm_So_v)) then + call shr_log_error(trim(subname)//& + 'ERROR: strm_So_v must be associated if So_v is associated for docn cplhist mode', rc=rc) return end if - if (associated(Sobldepth) .and. .not. associate(strm_Sobldepth)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sobldepth must be associated for docn cplhist mode', rc=rc) + if (associated(So_bldepth) .and. .not. associated(strm_So_bldepth)) then + call shr_log_error(trim(subname)//& + 'ERROR: strm_So_bldepth must be associated if So_bldepth is associated for docn cplhist mode', rc=rc) return end if @@ -152,13 +155,13 @@ subroutine docn_datamode_cplhist_advance(sst_constant_value, rc) rc = ESMF_SUCCESS - if (associate(So_u)) then + if (associated(So_u)) then So_u(:) = strm_So_u(:) end if - if (associate(So_v)) then + if (associated(So_v)) then So_v(:) = strm_So_v(:) end if - if (associate(So_bldepth)) then + if (associated(So_bldepth)) then So_bldepth(:) = strm_So_bldepth(:) end if diff --git a/docn/docn_datamode_dom_mod.F90 b/docn/docn_datamode_dom_mod.F90 index aead7bea1..0e0777ef6 100644 --- a/docn/docn_datamode_dom_mod.F90 +++ b/docn/docn_datamode_dom_mod.F90 @@ -7,7 +7,7 @@ module docn_datamode_dom_mod use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use dshr_strdata_mod , only : shr_strdata_type + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer implicit none private ! except @@ -97,15 +97,10 @@ subroutine docn_datamode_dom_init_pointers(exportState, sdat, ocn_fraction, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return ! initialize pointer to stream field - call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, & + errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn dom datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Error checks - if (.not. associated(strm_So_t)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_t must be associated for docn iaf mode') - return - end if - ! Initialize value of export state So_omask(:) = ocn_fraction(:) So_t(:) = TkFrz @@ -127,7 +122,8 @@ subroutine docn_datamode_dom_advance(rc) rc = ESMF_SUCCESS - So_t(:) = So_t(:) + TkFrz + ! Assume stream sst data is in degrees C + So_t(:) = strm_So_t(:) + TkFrz end subroutine docn_datamode_dom_advance diff --git a/docn/docn_datamode_multilev_cplhist_mod.F90 b/docn/docn_datamode_multilev_cplhist_mod.F90 index fb1f13f08..1655ccf8e 100644 --- a/docn/docn_datamode_multilev_cplhist_mod.F90 +++ b/docn/docn_datamode_multilev_cplhist_mod.F90 @@ -9,7 +9,6 @@ module docn_datamode_multilev_cplhist_mod use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add implicit none private ! except @@ -18,14 +17,21 @@ module docn_datamode_multilev_cplhist_mod public :: docn_datamode_multilev_cplhist_init_pointers public :: docn_datamode_multilev_cplhist_advance - ! pointers to export fields + ! export state pointers real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator + real(r8), pointer :: So_t_depth(:,:) => null() + real(r8), pointer :: So_s_depth(:,:) => null() + ! stream field pointers + type, public :: stream_pointer_type + real(r8), pointer :: ptr(:) + end type stream_pointer_type + type(stream_pointer_type), allocatable :: strm_So_t_depth(:) + type(stream_pointer_type), allocatable :: strm_So_s_depth(:) + ! number of multi-level ocean fields integer, parameter :: nlev_export = 30 - ! constants - character(*) , parameter :: nullstr = 'null' character(*) , parameter :: u_FILE_u = & __FILE__ @@ -64,54 +70,55 @@ subroutine docn_datamode_multilev_cplhist_advertise(exportState, fldsexport, fld end subroutine docn_datamode_multilev_cplhist_advertise !=============================================================================== - subroutine docn_datamode_multilev_cplhist_init_pointers(dfields, & - exportState, sdat, ocn_fraction, logunit, mainproc, rc) + subroutine docn_datamode_multilev_cplhist_init_pointers(exportState, sdat, ocn_fraction, rc) ! input/output variables - type(dfield_type) , pointer :: dfields type(ESMF_State) , intent(inout) :: exportState type(shr_strdata_type) , intent(in) :: sdat real(r8) , intent(in) :: ocn_fraction(:) - integer , intent(in) :: logunit - logical , intent(in) :: mainproc integer , intent(out) :: rc ! local variables - integer :: n - character(len=2) :: num_str - character(CS), allocatable :: strm_flds_t_depth(:) - character(CS), allocatable :: strm_flds_s_depth(:) + integer :: ilev + character(len=2) :: num_str + character(CS) :: strm_fld character(len=*), parameter :: subname='(docn_init_pointers): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! Note - docn_datamode_multilev_mod the assumption is that the stream files contain single - ! stream fields which contain the full set of levels in the stream data (i.e. 2d) - ! Whereas here we are assuming a different stream field for each vertical level - ! However, in both cases the export field contains an ungridded dimension for each vertical level - - ! Create stream-> export state mapping - ! Note that strm_flds is the model name for the stream field - ! Note that state_fld is the model name for the export field - - allocate(strm_flds_t_depth(1:nlev_export)) - allocate(strm_flds_s_depth(1:nlev_export)) - do n = 1,nlev_export - write(num_str, '(i0)') n - strm_flds_t_depth(n) = 'So_t_depth' // trim(num_str) - strm_flds_s_depth(n) = 'So_s_depth' // trim(num_str) - end do + ! We are assuming a different stream field for each vertical level, + ! whereas export field contains an ungridded dimension for each vertical level + + ! Set export state pointers + call dshr_state_getfldptr(exportState, fldname='So_omask', fldptr1=So_omask, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, fldname='So_t_depth', fldptr2=So_t_depth, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, fldname='So_s_depth', fldptr2=So_s_depth, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return - ! The following maps stream input multiple fields to export field that has an ungridded dimension - call dshr_dfield_add(dfields, sdat, state_fld='So_t_depth', strm_flds=strm_flds_t_depth, state=exportState, & - logunit=logunit, mainproc=mainproc, rc=rc) - call dshr_dfield_add(dfields, sdat, state_fld='So_s_depth', strm_flds=strm_flds_s_depth, state=exportState, & - logunit=logunit, mainproc=mainproc, rc=rc) + ! Set stream field pointers + allocate(strm_So_t_depth(1:nlev_export)) + allocate(strm_So_s_depth(1:nlev_export)) + do ilev = 1,nlev_export + write(num_str, '(i0)') ilev + strm_fld = 'So_t_depth' // trim(num_str) + call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_So_t_depth(ilev)%ptr, & + requirePointer=.true., & + errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//& + ' must be associated for docn multiplev_cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + strm_fld = 'So_s_depth' // trim(num_str) + call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_So_s_depth(ilev)%ptr, & + requirePointer=.true., & + errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//& + ' must be associated for docn multiplev_cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do ! Set export state ocean fraction (So_omask) - call dshr_state_getfldptr(exportState, 'So_omask', fldptr1=So_omask , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return So_omask(:) = ocn_fraction(:) end subroutine docn_datamode_multilev_cplhist_init_pointers @@ -119,36 +126,33 @@ end subroutine docn_datamode_multilev_cplhist_init_pointers !=============================================================================== subroutine docn_datamode_multilev_cplhist_advance(exportState, rc) - use dshr_methods_mod , only : dshr_state_getfldptr - ! input/output variables - type(ESMF_State) , intent(inout) :: exportState - integer , intent(out) :: rc + type(ESMF_State) , intent(inout) :: exportState + integer , intent(out) :: rc ! local variables - integer :: idim1,idim2 - real(r8), pointer :: fldptr2(:,:) + integer :: ilev,ig character(len=*), parameter :: subname='(docn_datamode_multilev): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - call dshr_state_getfldptr(exportState, 'So_t_depth', fldptr2=fldptr2, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do idim2 = 1,size(fldptr2,dim=2) - do idim1 = 1,size(fldptr2,dim=1) - if (fldptr2(idim1,idim2) == 0._r8) then - fldptr2(idim1,idim2) = 1.e30_r8 + do ilev = 1,size(So_t_depth,dim=1) + do ig = 1,size(So_t_depth,dim=2) + if (strm_So_t_depth(ilev)%ptr(ig) == 0._r8) then + So_t_depth(ilev,ig) = 1.e30_r8 + else + So_t_depth(ilev,ig) = strm_So_t_depth(ilev)%ptr(ig) end if end do end do - call dshr_state_getfldptr(exportState, 'So_s_depth', fldptr2=fldptr2, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do idim2 = 1,size(fldptr2,dim=2) - do idim1 = 1,size(fldptr2,dim=1) - if (fldptr2(idim1,idim2) == 0._r8) then - fldptr2(idim1,idim2) = 1.e30_r8 + do ilev = 1,size(So_t_depth,dim=1) + do ig = 1,size(So_t_depth,dim=2) + if (strm_So_t_depth(ilev)%ptr(ig) == 0._r8) then + So_t_depth(ilev,ig) = 1.e30_r8 + else + So_t_depth(ilev,ig) = strm_So_t_depth(ilev)%ptr(ig) end if end do end do diff --git a/docn/docn_datamode_multilev_dom_mod.F90 b/docn/docn_datamode_multilev_dom_mod.F90 index b03d6530c..9e297c6af 100644 --- a/docn/docn_datamode_multilev_dom_mod.F90 +++ b/docn/docn_datamode_multilev_dom_mod.F90 @@ -39,8 +39,6 @@ module docn_datamode_multilev_dom_mod real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity - ! constants - character(*) , parameter :: nullstr = 'null' character(*) , parameter :: u_FILE_u = & __FILE__ @@ -97,29 +95,6 @@ subroutine docn_datamode_multilev_dom_init_pointers(exportState, sdat, ocn_fract rc = ESMF_SUCCESS - ! initialize pointers to stream fields - ! this has the full set of leveles in the stream data - call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! error checks for stream pointers - if (.not. associated(strm_So_t)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_t must be associated for docn multilev_dom mode') - return - end if - if (.not. associated(strm_So_t_depth)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_dom mode') - return - end if - if (.not. associated(strm_So_s_depth)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_s_depth must be associated for docn multilev_dom mode') - return - end if - ! initialize pointers to export fields call dshr_state_getfldptr(exportState, 'So_omask', fldptr1=So_omask , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -136,6 +111,18 @@ subroutine docn_datamode_multilev_dom_init_pointers(exportState, sdat, ocn_fract call dshr_state_getfldptr(exportState, 'So_s_depth', fldptr2=So_s_depth , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + ! initialize pointers to stream fields + ! this has the full set of leveles in the stream data + call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, & + errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn multilev_dom datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, & + errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_dom datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, & + errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_dom datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Initialize export state pointers to non-zero So_t_depth(:,:) = shr_const_TkFrz So_s_depth(:,:) = shr_const_ocn_ref_sal @@ -173,6 +160,7 @@ subroutine docn_datamode_multilev_dom_advance(sdat, logunit, mainproc, rc) rc = ESMF_SUCCESS + ! Set ocean sst So_t(:) = strm_So_t(:) + TkFrz ! Determine number of vertical levels for multi level stream diff --git a/docn/docn_datamode_multilev_mod.F90 b/docn/docn_datamode_multilev_mod.F90 index c9b24312d..b60fe4a34 100644 --- a/docn/docn_datamode_multilev_mod.F90 +++ b/docn/docn_datamode_multilev_mod.F90 @@ -84,25 +84,7 @@ subroutine docn_datamode_multilev_init_pointers(exportState, sdat, ocn_fraction, rc = ESMF_SUCCESS - ! initialize pointers to stream fields - ! this has the full set of leveles in the stream data - call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! error checks for stream pointers - if (.not. associated(strm_So_t_depth)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_dom mode') - return - end if - if (.not. associated(strm_So_s_depth)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_s_depth must be associated for docn multilev_dom mode') - return - end if - - ! initialize pointers to export fields - ! the export state has only nlev_export levels + ! Set export state pointers (has only nlev_export levels) call dshr_state_getfldptr(exportState, 'So_omask' , fldptr1=So_omask , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'So_t_depth' , fldptr2=So_t_depth , rc=rc) @@ -110,11 +92,17 @@ subroutine docn_datamode_multilev_init_pointers(exportState, sdat, ocn_fraction, call dshr_state_getfldptr(exportState, 'So_s_depth' , fldptr2=So_s_depth , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + ! Set stream pointers (this has the full set of leveles in the stream data) + call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, & + errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, & + errmsg=trim(subname)//'ERROR: strm_So_s_depth must be associated for docn multilev datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Initialize export state pointers to non-zero So_t_depth(:,:) = shr_const_TkFrz So_s_depth(:,:) = shr_const_ocn_ref_sal - - ! Set export state ocean fraction (So_omask) So_omask(:) = ocn_fraction(:) end subroutine docn_datamode_multilev_init_pointers @@ -123,9 +111,9 @@ end subroutine docn_datamode_multilev_init_pointers subroutine docn_datamode_multilev_advance(sdat, logunit, mainproc, rc) ! input/output variables - type(shr_strdata_type) , intent(in) :: sdat - integer , intent(in) :: logunit - logical , intent(in) :: mainproc + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(in) :: logunit + logical , intent(in) :: mainproc integer , intent(out) :: rc ! local variables @@ -134,8 +122,8 @@ subroutine docn_datamode_multilev_advance(sdat, logunit, mainproc, rc) integer :: stream_index logical :: level_found real(r8) :: factor + logical :: first_time = .true. real(r8), allocatable :: stream_vlevs(:) - logical :: first_time = .true. character(len=*), parameter :: subname='(docn_datamode_multilev): ' !------------------------------------------------------------------------------- @@ -189,7 +177,6 @@ subroutine docn_datamode_multilev_advance(sdat, logunit, mainproc, rc) return end if end do - first_time = .false. end subroutine docn_datamode_multilev_advance diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index 991dafa6e..a93410350 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -26,7 +26,7 @@ module docn_datamode_som_mod public :: docn_datamode_som_restart_read public :: docn_datamode_som_restart_write - ! export fields + ! pointers to export fields real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator real(r8), pointer :: So_t(:) => null() real(r8), pointer :: So_s(:) => null() @@ -38,7 +38,7 @@ module docn_datamode_som_mod real(r8), pointer :: Fioo_q(:) => null() real(r8), pointer :: So_fswpen(:) => null() - ! import fields + ! pointers to import fields real(r8), pointer :: Foxx_swnet(:) => null() real(r8), pointer :: Foxx_lwup(:) => null() real(r8), pointer :: Foxx_sen(:) => null() @@ -61,7 +61,7 @@ module docn_datamode_som_mod ! restart fields real(R8), public, pointer :: somtp(:) ! SOM ocean temperature needed for restart - real(R8) :: dt ! real model timestep + real(R8) :: dt ! real model timestep ! constants real(r8) , parameter :: cpsw = shr_const_cpsw ! specific heat of sea h2o ~ j/kg/k @@ -71,7 +71,6 @@ module docn_datamode_som_mod real(r8) , parameter :: latice = shr_const_latice ! latent heat of fusion real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity - character(*) , parameter :: nullstr = 'null' character(*) , parameter :: u_FILE_u = & __FILE__ @@ -206,57 +205,31 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f end if ! Initialize pointers to stream fields - call shr_strdata_get_stream_pointer( sdat, 'So_t' , strm_So_t, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_t' , strm_So_t, & + errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_s' , strm_So_s, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_s' , strm_So_s, & + errmsg=trim(subname)//'ERROR: strm_So_s must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_u' , strm_So_u, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_u' , strm_So_u, & + errmsg=trim(subname)//'ERROR: strm_So_u must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_v' , strm_So_v, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_v' , strm_So_v, & + errmsg=trim(subname)//'ERROR: strm_So_v must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_dhdx' , strm_So_dhdx, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_dhdx' , strm_So_dhdx, & + errmsg=trim(subname)//'ERROR: strm_So_dhdx must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_dhdy' , strm_So_dhdy, rc) + call shr_strdata_get_stream_pointer( sdat, 'So_dhdy' , strm_So_dhdy, & + errmsg=trim(subname)//'ERROR: strm_So_dhdy must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_h' , strm_So_h, rc=rc) + call shr_strdata_get_stream_pointer( sdat, 'So_h' , strm_So_h, & + errmsg=trim(subname)//'ERROR: strm_So_h must be associated for docn som datamode', rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'So_qbot' , strm_So_qbot, rc=rc) + call shr_strdata_get_stream_pointer( sdat, 'So_qbot' , strm_So_qbot, & + errmsg=trim(subname)//'ERROR: strm_So_qbot must be associated for docn som datamode', rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! Error checks for stream pointers - if (.not. associated(strm_So_t)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_t must be associated for docn som mode') - return - end if - if (.not. associated(strm_So_s)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_s must be associated for docn som mode') - return - end if - if (.not. associated(strm_So_u)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_u must be associated for docn som mode') - return - end if - if (.not. associated(strm_So_v)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_v must be associated for docn som mode') - return - end if - if (.not. associated(strm_So_dhdx)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_dhdx must be associated for docn som mode') - return - end if - if (.not. associated(strm_So_dhdy)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_dhdy must be associated for docn som mode') - return - end if - if (.not. associated(strm_So_h)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_h must be associated for docn som mode') - return - end if - if (.not. associated(strm_So_qbot)) then - call shr_log_error(trim(subname)//'ERROR: strm_So_qbot must be associated for docn som mode') - return - end if - ! Set export state ocean fraction (So_omask) So_omask(:) = ocn_fraction(:) @@ -283,8 +256,8 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re ! local variables logical :: first_time = .true. type(ESMF_TimeInterval) :: timeStep - integer :: idt ! integer model timestep - real(r8), allocatable :: tfreeze(:) ! SOM ocean freezing temperature + integer :: idt ! integer model timestep + real(r8), allocatable :: tfreeze(:) ! SOM ocean freezing temperature integer :: lsize integer :: n logical :: reset_temp @@ -298,7 +271,7 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re So_s(:) = strm_So_s(:) So_dhdx(:) = strm_So_dhdx(:) So_dhdy(:) = strm_So_dhdy(:) - So_t(:) = strm_So_t(:) + So_t(:) = strm_So_t(:) ! assume input is in degrees C lsize = size(So_t) @@ -364,7 +337,7 @@ end subroutine docn_datamode_som_advance !=============================================================================== subroutine docn_datamode_som_restart_write(rpfile, case_name, inst_suffix, ymd, tod, & - logunit, my_task, sdat) + logunit, my_task, sdat, rc) ! write restart file @@ -377,8 +350,11 @@ subroutine docn_datamode_som_restart_write(rpfile, case_name, inst_suffix, ymd, integer , intent(in) :: logunit integer , intent(in) :: my_task type(shr_strdata_type) , intent(inout) :: sdat + integer , intent(out) :: rc !------------------------------------------------------------------------------- - integer :: rc + + rc = ESMF_SUCCESS + call dshr_restart_write(rpfile, case_name, 'docn', inst_suffix, ymd, tod, & logunit, my_task, sdat, rc, fld=somtp, fldname='somtp') if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -386,23 +362,27 @@ subroutine docn_datamode_som_restart_write(rpfile, case_name, inst_suffix, ymd, end subroutine docn_datamode_som_restart_write !=============================================================================== - subroutine docn_datamode_som_restart_read(rest_filem, rpfile, logunit, my_task, mpicom, sdat) + subroutine docn_datamode_som_restart_read(rest_filem, rpfile, logunit, my_task, mpicom, sdat, rc) ! read restart file ! input/output arguments - character(len=*) , intent(inout) :: rest_filem - character(len=*) , intent(in) :: rpfile - integer , intent(in) :: logunit - integer , intent(in) :: my_task - integer , intent(in) :: mpicom - type(shr_strdata_type) , intent(inout) :: sdat + character(len=*) , intent(inout) :: rest_filem + character(len=*) , intent(in) :: rpfile + integer , intent(in) :: logunit + integer , intent(in) :: my_task + integer , intent(in) :: mpicom + type(shr_strdata_type) , intent(inout) :: sdat + integer , intent(out) :: rc !------------------------------------------------------------------------------- - integer :: rc + + rc = ESMF_SUCCESS + ! allocate module memory for restart fields that are read in allocate(somtp(sdat%model_lsize)) + ! read restart - call dshr_restart_read(rest_filem, rpfile, logunit, my_task, mpicom, sdat, rc,& + call dshr_restart_read(rest_filem, rpfile, logunit, my_task, mpicom, sdat, rc, & fld=somtp, fldname='somtp') if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 927bcfaa9..16ed8de71 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -23,8 +23,7 @@ module cdeps_docn_comp use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize use NUOPC_Model , only : NUOPC_ModelGet, SetVM - use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs - use shr_kind_mod , only : cx=>shr_kind_cx + use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs, cx=>shr_kind_cx use shr_cal_mod , only : shr_cal_ymd2date use shr_log_mod , only : shr_log_setLogUnit, shr_log_error use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck @@ -32,7 +31,6 @@ module cdeps_docn_comp use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init, dshr_restart_read use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm use dshr_mod , only : dshr_restart_write - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_realize use nuopc_shr_methods, only : shr_get_rpointer_name @@ -93,7 +91,7 @@ module cdeps_docn_comp integer :: flds_scalar_index_ny = 0 integer :: mpicom ! mpi communicator integer :: my_task ! my task in mpi communicator mpicom - logical :: mainproc ! true of my_task == main_task + logical :: mainproc ! true of my_task == main_task character(len=16) :: inst_suffix = "" ! char string associated with instance (ie. "_0001" or "") integer :: logunit ! logging unit number logical :: restart_read ! start from restart @@ -113,17 +111,19 @@ module cdeps_docn_comp integer :: ny_global logical :: skip_restart_read = .false. ! true => skip restart read in continuation run logical :: export_all = .false. ! true => export all fields, do not check connected or not + logical :: first_call = .true. ! linked lists type(fldList_type) , pointer :: fldsImport => null() type(fldList_type) , pointer :: fldsExport => null() - type(dfield_type) , pointer :: dfields => null() ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() integer , pointer :: model_mask(:) => null() logical :: valid_ocn = .true. ! used for single column logic + ! first call in run phse + ! constants logical :: aquaplanet = .false. logical :: diagnose_data = .true. @@ -204,10 +204,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) real(r8) :: rtmp(1) type(ESMF_VM) :: vm character(len=*),parameter :: subname=trim(module_name)//':(InitializeAdvertise) ' - character(*) ,parameter :: F00 = "('(" // trim(module_name) // ") ',8a)" - character(*) ,parameter :: F01 = "('(" // trim(module_name) // ") ',a,2x,i8)" - character(*) ,parameter :: F02 = "('(" // trim(module_name) // ") ',a,l6)" - character(*) ,parameter :: F03 = "('(" // trim(module_name) // ") ',a,f8.5,2x,f8.5)" !------------------------------------------------------------------------------- namelist / docn_nml / datamode, & @@ -229,8 +225,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Determine logical mainproc mainproc = (my_task == main_task) - if (my_task == main_task) then - + if (mainproc) then ! Read docn_nml from nlfilename nlfilename = "docn_in"//trim(inst_suffix) open (newunit=nu,file=trim(nlfilename),status="old",action="read") @@ -238,23 +233,26 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) read (nu,nml=docn_nml,iostat=ierr) close(nu) if (ierr > 0) then - write(logunit,F00) 'ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr + if (mainproc) then + write(logunit,'(2a,i0)') trim(subname), & + 'ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr + end if call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) return end if ! write namelist input to standard out - write(logunit,F00)' case_name = ',trim(case_name) - write(logunit,F00)' datamode = ',trim(datamode) - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - write(logunit,F01)' nx_global = ',nx_global - write(logunit,F01)' ny_global = ',ny_global - write(logunit,F00)' restfilm = ',trim(restfilm) - write(logunit,F02)' skip_restart_read = ',skip_restart_read - write(logunit,F00)' import_data_fields = ',trim(import_data_fields) - write(logunit,*) ' sst_constant_value = ',sst_constant_value - write(logunit,F02)' export_all = ', export_all + write(logunit,'(3a)') trim(subname),' case_name = ',trim(case_name) + write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) + write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global + write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global + write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read + write(logunit,'(3a)') trim(subname),' import_data_fields = ',trim(import_data_fields) + write(logunit,'(2a,es13.6)') trim(subname),' sst_constant_value = ',sst_constant_value + write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all bcasttmp = 0 bcasttmp(1) = nx_global @@ -267,7 +265,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Broadcast namelist input call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMBroadcast(vm, datamode, CL, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadcast(vm, model_meshfile, CX, main_task, rc=rc) @@ -278,10 +275,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadcast(vm, import_data_fields, CL, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMBroadcast(vm, bcasttmp, 4, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMBroadcast(vm, rtmp, 1, main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -303,47 +298,52 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) datamode = "sst_aquap_analytic" end if - ! Validate datamode - if ( trim(datamode) == 'sstdata' .or. & ! read stream, no import data - trim(datamode) == 'sst_aquap_file' .or. & ! read stream, no import data - trim(datamode) == 'som' .or. & ! read stream, needs import data - trim(datamode) == 'som_aquap' .or. & ! read stream, needs import data - trim(datamode) == 'cplhist' .or. & ! read stream, needs import data - trim(datamode) == 'sst_aquap_analytic' .or. & ! analytic, no streams, import or export data - trim(datamode) == 'sst_aquap_constant' .or. & ! analytic, no streams, import or export data - trim(datamode) == 'multilev_cplhist' .or. & ! multilevel ocean input - trim(datamode) == 'multilev' .or. & ! multilevel ocean input - trim(datamode) == 'multilev_dom') then ! multilevel ocean input and sst export - ! success do nothing - else + ! Validate datamode - the following values are currently accepted + ! 'sstdata' read stream, no import data + ! 'sst_aquap_file' read stream, no import data + ! 'som' read stream, needs import data + ! 'som_aquap' read stream, needs import data + ! 'cplhist' read stream, needs import data + ! 'sst_aquap_analytic' analytic, no streams, import or export data + ! 'sst_aquap_constant' analytic, no streams, import or export data + ! 'multilev_cplhist' multilevel ocean input from cplhist data + ! 'multilev' multilevel ocean input + ! 'multilev_dom' multilevel ocean input and sst export + select case (trim(datamode)) + case ( 'sstdata', 'sst_aquap_file', 'som', 'som_aquap', & + 'cplhist', 'sst_aquap_analytic', 'sst_aquap_constant', & + 'multilev_cplhist', 'multilev', 'multilev_dom' ) + if (mainproc) write(logunit,'(3a)') trim(subname),'docn datamode = ',trim(datamode) + case default call shr_log_error(' ERROR illegal docn datamode = '//trim(datamode), rc=rc) return - endif + end select ! Advertise docn fields - if (trim(datamode)=='sst_aquap_analytic' .or. trim(datamode)=='sst_aquap_constant') then + select case (trim(datamode)) + case('sst_aquap_analytic','sst_aquap_constant') aquaplanet = .true. call docn_datamode_aquaplanet_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (trim(datamode(1:3)) == 'som') then + case('som') call docn_datamode_som_advertise(importState, exportState, fldsImport, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (trim(datamode) == 'sstdata' .or. trim(datamode) == 'sst_aquap_file') then + case('sstdata','sst_aquap_file') call docn_datamode_dom_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (trim(datamode) == 'cplhist') then + case('cplhist') call docn_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (trim(datamode) == 'multilev') then + case('multilev') call docn_datamode_multilev_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (trim(datamode) == 'multilev_cplhist') then + case('multilev_cplhist') call docn_datamode_multilev_cplhist_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (trim(datamode) == 'multilev_dom') then + case('multilev_dom') call docn_datamode_multilev_dom_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + end select if (trim(import_data_fields) /= 'none') then call docn_import_data_advertise(importState, fldsImport, flds_scalar_name, import_data_fields, rc) @@ -486,15 +486,13 @@ subroutine ModelAdvance(gcomp, rc) character(len=*),parameter :: subname=trim(module_name)//':(ModelAdvance) ' !------------------------------------------------------------------------------- - rc = ESMF_SUCCESS - call shr_log_setLogUnit(logunit) + call shr_log_setLogUnit(logunit) if (.not. valid_ocn) then RETURN end if - - call memcheck(subname, 5, my_task == main_task) + call memcheck(subname, 5, mainproc) ! query the Component for its clock, importState and exportState call NUOPC_ModelGet(gcomp, modelClock=clock, importState=importState, exportState=exportState, rc=rc) @@ -536,7 +534,6 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar integer , intent(out) :: rc ! local variables - logical :: first_time = .true. character(len=CL) :: rpfile ! restart pointer file name character(*), parameter :: subName = "(docn_comp_run) " !------------------------------------------------------------------------------- @@ -549,7 +546,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar ! First time initialization !-------------------- - if (first_time) then + if (first_call) then ! Initialize datamode module pointers select case (trim(datamode)) @@ -560,27 +557,30 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar call docn_datamode_som_init_pointers(importState, exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('sst_aquap_analytic', 'sst_aquap_constant') - skip_restart_read=.true. call docn_datamode_aquaplanet_init_pointers(exportState, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('cplhist') call docn_datamode_cplhist_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('multilev') - call docn_datamode_multilev_init_pointers(exportState, sdat, model_frac, rc) + call docn_datamode_multilev_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('multilev_dom') - call docn_datamode_multilev_dom_init_pointers(exportState, sdat, model_frac, rc) + call docn_datamode_multilev_dom_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('multilev_cplhist') - ! Note that there is no call to docn_init_dfields since the - ! initialization of dfields is done in the above routine - call docn_datamode_multilev_cplhist_init_pointers(dfields, & - exportState, sdat, model_frac, logunit, mainproc, rc) + call docn_datamode_multilev_cplhist_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select ! Read restart if needed + select case (trim(datamode)) + case('sst_aquap_analytic', 'sst_aquap_constant') + skip_restart_read=.true. + case default + skip_restart_read=.false. + end select + if (restart_read .and. .not. skip_restart_read) then call shr_get_rpointer_name(gcomp, 'ocn', target_ymd, target_tod, rpfile, 'read', rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -590,12 +590,12 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar call dshr_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som', 'som_aquap') - call docn_datamode_som_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat) + call docn_datamode_som_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select end if - ! Reset first_time - first_time = .false. + first_call = .false. end if !-------------------- @@ -648,7 +648,8 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som', 'som_aquap') call docn_datamode_som_restart_write(rpfile, case_name, inst_suffix, target_ymd, target_tod, & - logunit, my_task, sdat) + logunit, my_task, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case('sst_aquap_analytic', 'sst_aquap_constant') ! Do nothing case default @@ -673,7 +674,7 @@ subroutine ModelFinalize(gcomp, rc) integer, intent(out) :: rc !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - if (my_task == main_task) then + if (mainproc) then write(logunit,*) write(logunit,*) 'docn : end of main integration loop' write(logunit,*) diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 2457159aa..033e9e74d 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -7,6 +7,7 @@ module cdeps_drof_comp !---------------------------------------------------------------------------- ! This is the NUOPC cap for DROF !---------------------------------------------------------------------------- + use ESMF , only : ESMF_VM, ESMF_VMBroadcast, ESMF_GridCompGet use ESMF , only : ESMF_Mesh, ESMF_GridComp, ESMF_Time, ESMF_TimeInterval use ESMF , only : ESMF_State, ESMF_Clock, ESMF_SUCCESS, ESMF_LOGMSG_INFO @@ -25,7 +26,7 @@ module cdeps_drof_comp use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs, cx=>shr_kind_cx use shr_cal_mod , only : shr_cal_ymd2date use shr_log_mod , only : shr_log_setLogUnit, shr_log_error - use dshr_methods_mod , only : state_diagnose, chkerr, memcheck + use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config use dshr_mod , only : dshr_model_initphase, dshr_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm @@ -74,8 +75,9 @@ module cdeps_drof_comp integer :: ny_global logical :: skip_restart_read = .false. ! true => skip restart read logical :: export_all = .false. ! true => export all fields, do not check connected or not - logical :: diagnose_data = .true. + logical :: first_call = .true. + integer , parameter :: main_task=0 ! task number of main task #ifdef CESMCOUPLED character(*) , parameter :: modName = "(rof_comp_nuopc)" @@ -86,6 +88,10 @@ module cdeps_drof_comp ! linked lists type(fldList_type) , pointer :: fldsExport => null() + ! grid mask and fraction + real(r8), pointer :: model_frac(:) ! currently not used + integer , pointer :: model_mask(:) ! currently not used + character(*) , parameter :: u_FILE_u = & __FILE__ @@ -153,7 +159,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: inst_index ! number of current instance (ie. 1) integer :: nu ! unit number integer :: ierr ! error code - type(fldlist_type), pointer :: fldList type(ESMF_VM) :: vm integer :: bcasttmp(4) character(len=*),parameter :: subname=trim(modName)//':(InitializeAdvertise) ' @@ -186,7 +191,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) close(nu) if (ierr > 0) then rc = ierr - write(logunit,'(a,i0)') trim(subname),' ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr + write(logunit,'(a,i0)') trim(subname), & + ' ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) return end if @@ -229,14 +235,15 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) export_all = (bcasttmp(4) == 1) ! Validate datamode - if (trim(datamode) == 'copyall') then + select case (trim(datamode)) + case('copyall') if (mainproc) then write(logunit,'(2a)') trim(subname),'drof datamode = ',trim(datamode) end if - else + case default call shr_log_error(' ERROR illegal drof datamode = '//trim(datamode), rc=rc) return - end if + end select ! Advertise export fields call drof_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) @@ -371,13 +378,11 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri integer , intent(out) :: rc ! local variables - logical :: first_time = .true. - integer :: n character(len=CL) :: rpfile character(*), parameter :: subName = "(drof_comp_run) " !-------------------------------- - rc = ESMF_SUCESS + rc = ESMF_SUCCESS call ESMF_TraceRegionEnter('DROF_RUN') @@ -385,7 +390,7 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri ! First time initialization !-------------------- - if (first_time) then + if (first_call) then ! Initialize stream and export state pointers select case (trim(datamode)) case('copyall') @@ -401,7 +406,7 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri if (chkerr(rc,__LINE__,u_FILE_u)) return end if - first_time = .false. + first_call = .false. end if !-------------------- @@ -420,6 +425,7 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri case('copyall') call drof_datamode_copyall_advance() end select + call ESMF_TraceRegionExit('drof_datamode') ! write restarts if needed if (restart_write) then @@ -430,7 +436,7 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri call dshr_restart_write(rpfile, case_name, 'drof', inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - endif + end select end if ! write diagnostics diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index 9a2812755..3a05a6778 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -7,6 +7,7 @@ module cdeps_dwav_comp !---------------------------------------------------------------------------- ! This is the NUOPC cap for DWAV !---------------------------------------------------------------------------- + use ESMF , only : ESMF_VM, ESMF_VMBroadcast, ESMF_GridCompGet use ESMF , only : ESMF_SUCCESS, ESMF_TraceRegionExit, ESMF_TraceRegionEnter use ESMF , only : ESMF_State, ESMF_Clock, ESMF_Alarm, ESMF_LogWrite, ESMF_Time @@ -25,7 +26,7 @@ module cdeps_dwav_comp use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs, cx=>shr_kind_cx use shr_cal_mod , only : shr_cal_ymd2date use shr_log_mod , only : shr_log_setLogUnit, shr_log_error - use dshr_methods_mod , only : state_diagnose, chkerr, memcheck + use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config use dshr_mod , only : dshr_model_initphase, dshr_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm @@ -75,6 +76,14 @@ module cdeps_dwav_comp integer :: ny_global logical :: skip_restart_read = .false. ! true => skip restart read logical :: export_all = .false. ! true => export all fields, do not check connected or not + logical :: first_call = .true. + + ! linked lists + type(fldList_type) , pointer :: fldsExport => null() + + ! model mask and model fraction + real(r8), pointer :: model_frac(:) => null() + integer , pointer :: model_mask(:) => null() ! constants logical :: diagnose_data = .true. @@ -84,14 +93,6 @@ module cdeps_dwav_comp #else character(*) , parameter :: modName = "(cdeps_dwav_comp)" #endif - - ! linked lists - type(fldList_type) , pointer :: fldsExport => null() - - ! model mask and model fraction - real(r8), pointer :: model_frac(:) => null() - integer , pointer :: model_mask(:) => null() - character(*) , parameter :: u_FILE_u = & __FILE__ @@ -235,12 +236,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) export_all = (bcasttmp(4) == 1) ! Validate datamode - if (trim(datamode) == 'copyall') then - if (my_task == main_task) write(logunit,*) 'dwav datamode = ',trim(datamode) - else + select case (trim(datamode)) + case('copyall') + if (mainproc) write(logunit,'(3a)') trim(subname),' dwav datamode = ',trim(datamode) + case default call shr_log_error(' ERROR illegal dwav datamode = '//trim(datamode), rc=rc) return - end if + end select ! Advertise export fields call dwav_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) @@ -250,6 +252,7 @@ end subroutine InitializeAdvertise !=============================================================================== subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) + ! input/output variables type(ESMF_GridComp) :: gcomp type(ESMF_State) :: importState, exportState @@ -305,7 +308,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) end if ! Run dwav to create export state - call dwav_comp_run(logunit, current_ymd, current_tod, sdat, rc=rc) + call dwav_comp_run(gcomp, exportstate, current_ymd, current_tod, restart_write=.false., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Add scalars to export state @@ -339,8 +342,8 @@ subroutine ModelAdvance(gcomp, rc) rc = ESMF_SUCCESS - call memcheck(subname, 5, my_task == main_task) call shr_log_setLogUnit(logunit) + call memcheck(subname, 5, mainproc) ! query the Component for its clock, importState and exportState call NUOPC_ModelGet(gcomp, modelClock=clock, importState=importState, exportState=exportState, rc=rc) @@ -361,7 +364,7 @@ subroutine ModelAdvance(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! run dwav - call dwav_comp_run(logunit, next_ymd, next_tod, sdat, restart_write,rc=rc) + call dwav_comp_run(gcomp, exportState, next_ymd, next_tod, restart_write, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine ModelAdvance @@ -382,17 +385,15 @@ subroutine dwav_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri integer , intent(out) :: rc ! local variables - logical :: first_time = .true. - integer :: n character(len=CL) :: rpfile character(*), parameter :: subName = "(dwav_comp_run) " !------------------------------------------------------------------------------- - rc = ESMF_SUCESS + rc = ESMF_SUCCESS call ESMF_TraceRegionEnter('DWAV_RUN') - if (first_time) then + if (first_call) then ! Initialize stream and export state pointers select case (trim(datamode)) case('copyall') @@ -408,7 +409,7 @@ subroutine dwav_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri if (chkerr(rc,__LINE__,u_FILE_u)) return end if - first_time = .false. + first_call = .false. end if !-------------------- @@ -439,7 +440,7 @@ subroutine dwav_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri call dshr_restart_write(rpfile, case_name, 'dwav', inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - endif + end select end if ! write diagnostics From 467cfc0ab31dfaee93006c42d5c3eaa92e12d0a1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 26 Dec 2025 17:44:29 +0100 Subject: [PATCH 17/61] changed _dom_ to _sstdata_ for datm files --- docn/CMakeLists.txt | 4 +- ...=> docn_datamode_multilev_sstdata_mod.F90} | 30 +++++++------- ..._mod.F90 => docn_datamode_sstdata_mod.F90} | 26 ++++++------- docn/ocn_comp_nuopc.F90 | 39 ++++++++++--------- 4 files changed, 50 insertions(+), 49 deletions(-) rename docn/{docn_datamode_multilev_dom_mod.F90 => docn_datamode_multilev_sstdata_mod.F90} (91%) rename docn/{docn_datamode_dom_mod.F90 => docn_datamode_sstdata_mod.F90} (87%) diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index 1484c7844..86172c525 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -1,11 +1,11 @@ project(docn Fortran) set(SRCFILES ocn_comp_nuopc.F90 - docn_datamode_dom_mod.F90 + docn_datamode_sstdata_mod.F90 docn_datamode_som_mod.F90 docn_datamode_aquaplanet_mod.F90 docn_datamode_cplhist_mod.F90 docn_datamode_multilev_mod.F90 - docn_datamode_multilev_dom_mod.F90 + docn_datamode_multilev_sstdata_mod.F90 docn_datamode_multilev_cplhist_mod.F90 docn_import_data_mod.F90) diff --git a/docn/docn_datamode_multilev_dom_mod.F90 b/docn/docn_datamode_multilev_sstdata_mod.F90 similarity index 91% rename from docn/docn_datamode_multilev_dom_mod.F90 rename to docn/docn_datamode_multilev_sstdata_mod.F90 index 9e297c6af..ae0896f5a 100644 --- a/docn/docn_datamode_multilev_dom_mod.F90 +++ b/docn/docn_datamode_multilev_sstdata_mod.F90 @@ -1,4 +1,4 @@ -module docn_datamode_multilev_dom_mod +module docn_datamode_multilev_sstdata_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use NUOPC , only : NUOPC_Advertise @@ -12,9 +12,9 @@ module docn_datamode_multilev_dom_mod implicit none private ! except - public :: docn_datamode_multilev_dom_advertise - public :: docn_datamode_multilev_dom_init_pointers - public :: docn_datamode_multilev_dom_advance + public :: docn_datamode_multilev_sstdata_advertise + public :: docn_datamode_multilev_sstdata_init_pointers + public :: docn_datamode_multilev_sstdata_advance ! pointers to export fields real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator @@ -46,7 +46,7 @@ module docn_datamode_multilev_dom_mod contains !=============================================================================== - subroutine docn_datamode_multilev_dom_advertise(exportState, fldsexport, flds_scalar_name, rc) + subroutine docn_datamode_multilev_sstdata_advertise(exportState, fldsexport, flds_scalar_name, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState @@ -78,10 +78,10 @@ subroutine docn_datamode_multilev_dom_advertise(exportState, fldsexport, flds_sc fldList => fldList%next enddo - end subroutine docn_datamode_multilev_dom_advertise + end subroutine docn_datamode_multilev_sstdata_advertise !=============================================================================== - subroutine docn_datamode_multilev_dom_init_pointers(exportState, sdat, ocn_fraction, rc) + subroutine docn_datamode_multilev_sstdata_init_pointers(exportState, sdat, ocn_fraction, rc) ! input/output variables type(ESMF_State) , intent(inout) :: exportState @@ -114,13 +114,13 @@ subroutine docn_datamode_multilev_dom_init_pointers(exportState, sdat, ocn_fract ! initialize pointers to stream fields ! this has the full set of leveles in the stream data call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, & - errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn multilev_dom datamode', rc=rc) + errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn multilev_sstdata datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, & - errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_dom datamode', rc=rc) + errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_sstdata datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, & - errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_dom datamode', rc=rc) + errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_sstdata datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize export state pointers to non-zero @@ -135,10 +135,10 @@ subroutine docn_datamode_multilev_dom_init_pointers(exportState, sdat, ocn_fract ! Set export state ocean fraction (So_omask) So_omask(:) = ocn_fraction(:) - end subroutine docn_datamode_multilev_dom_init_pointers + end subroutine docn_datamode_multilev_sstdata_init_pointers !=============================================================================== - subroutine docn_datamode_multilev_dom_advance(sdat, logunit, mainproc, rc) + subroutine docn_datamode_multilev_sstdata_advance(sdat, logunit, mainproc, rc) ! input/output variables type(shr_strdata_type) , intent(in) :: sdat @@ -155,7 +155,7 @@ subroutine docn_datamode_multilev_dom_advance(sdat, logunit, mainproc, rc) real(r8) :: factor real(r8), allocatable :: stream_vlevs(:) logical :: first_time = .true. - character(len=*), parameter :: subname='(docn_datamode_multilev_dom): ' + character(len=*), parameter :: subname='(docn_datamode_multilev_sstdata): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -221,6 +221,6 @@ subroutine docn_datamode_multilev_dom_advance(sdat, logunit, mainproc, rc) first_time = .false. - end subroutine docn_datamode_multilev_dom_advance + end subroutine docn_datamode_multilev_sstdata_advance -end module docn_datamode_multilev_dom_mod +end module docn_datamode_multilev_sstdata_mod diff --git a/docn/docn_datamode_dom_mod.F90 b/docn/docn_datamode_sstdata_mod.F90 similarity index 87% rename from docn/docn_datamode_dom_mod.F90 rename to docn/docn_datamode_sstdata_mod.F90 index 0e0777ef6..11ea27d71 100644 --- a/docn/docn_datamode_dom_mod.F90 +++ b/docn/docn_datamode_sstdata_mod.F90 @@ -1,4 +1,4 @@ -module docn_datamode_dom_mod +module docn_datamode_sstdata_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use NUOPC , only : NUOPC_Advertise @@ -12,9 +12,9 @@ module docn_datamode_dom_mod implicit none private ! except - public :: docn_datamode_dom_advertise - public :: docn_datamode_dom_init_pointers - public :: docn_datamode_dom_advance + public :: docn_datamode_sstdata_advertise + public :: docn_datamode_sstdata_init_pointers + public :: docn_datamode_sstdata_advance ! export fields real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator @@ -37,7 +37,7 @@ module docn_datamode_dom_mod contains !=============================================================================== - subroutine docn_datamode_dom_advertise(exportState, fldsexport, flds_scalar_name, rc) + subroutine docn_datamode_sstdata_advertise(exportState, fldsexport, flds_scalar_name, rc) ! input/output variables type(esmf_State) , intent(inout) :: exportState @@ -67,10 +67,10 @@ subroutine docn_datamode_dom_advertise(exportState, fldsexport, flds_scalar_name fldList => fldList%next enddo - end subroutine docn_datamode_dom_advertise + end subroutine docn_datamode_sstdata_advertise !=============================================================================== - subroutine docn_datamode_dom_init_pointers(exportState, sdat, ocn_fraction, rc) + subroutine docn_datamode_sstdata_init_pointers(exportState, sdat, ocn_fraction, rc) ! input/output variables type(ESMF_State) , intent(inout) :: exportState @@ -98,7 +98,7 @@ subroutine docn_datamode_dom_init_pointers(exportState, sdat, ocn_fraction, rc) ! initialize pointer to stream field call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, & - errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn dom datamode', rc=rc) + errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn sstdata datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize value of export state @@ -108,16 +108,16 @@ subroutine docn_datamode_dom_init_pointers(exportState, sdat, ocn_fraction, rc) if (associated(So_v)) So_v(:) = 0.0_r8 if (associated(So_s)) So_s(:) = ocnsalt - end subroutine docn_datamode_dom_init_pointers + end subroutine docn_datamode_sstdata_init_pointers !=============================================================================== - subroutine docn_datamode_dom_advance(rc) + subroutine docn_datamode_sstdata_advance(rc) ! input/output variables integer, intent(out) :: rc ! local variables - character(len=*), parameter :: subname='(docn_datamode_dom_advance): ' + character(len=*), parameter :: subname='(docn_datamode_sstdata_advance): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -125,6 +125,6 @@ subroutine docn_datamode_dom_advance(rc) ! Assume stream sst data is in degrees C So_t(:) = strm_So_t(:) + TkFrz - end subroutine docn_datamode_dom_advance + end subroutine docn_datamode_sstdata_advance -end module docn_datamode_dom_mod +end module docn_datamode_sstdata_mod diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 16ed8de71..513b3d2b0 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -35,9 +35,9 @@ module cdeps_docn_comp use nuopc_shr_methods, only : shr_get_rpointer_name ! Datamode specialized modules - use docn_datamode_dom_mod , only : docn_datamode_dom_advertise - use docn_datamode_dom_mod , only : docn_datamode_dom_init_pointers - use docn_datamode_dom_mod , only : docn_datamode_dom_advance + use docn_datamode_sstdata_mod , only : docn_datamode_sstdata_advertise + use docn_datamode_sstdata_mod , only : docn_datamode_sstdata_init_pointers + use docn_datamode_sstdata_mod , only : docn_datamode_sstdata_advance use docn_datamode_som_mod , only : docn_datamode_som_advertise use docn_datamode_som_mod , only : docn_datamode_som_init_pointers @@ -57,9 +57,9 @@ module cdeps_docn_comp use docn_datamode_multilev_cplhist_mod , only : docn_datamode_multilev_cplhist_init_pointers use docn_datamode_multilev_cplhist_mod , only : docn_datamode_multilev_cplhist_advance - use docn_datamode_multilev_dom_mod , only : docn_datamode_multilev_dom_advertise - use docn_datamode_multilev_dom_mod , only : docn_datamode_multilev_dom_init_pointers - use docn_datamode_multilev_dom_mod , only : docn_datamode_multilev_dom_advance + use docn_datamode_multilev_sstdata_mod , only : docn_datamode_multilev_sstdata_advertise + use docn_datamode_multilev_sstdata_mod , only : docn_datamode_multilev_sstdata_init_pointers + use docn_datamode_multilev_sstdata_mod , only : docn_datamode_multilev_sstdata_advance use docn_datamode_multilev_mod , only : docn_datamode_multilev_advertise use docn_datamode_multilev_mod , only : docn_datamode_multilev_init_pointers @@ -308,11 +308,12 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! 'sst_aquap_constant' analytic, no streams, import or export data ! 'multilev_cplhist' multilevel ocean input from cplhist data ! 'multilev' multilevel ocean input - ! 'multilev_dom' multilevel ocean input and sst export + ! 'multilev_sstdata' multilevel ocean input and sst export + select case (trim(datamode)) case ( 'sstdata', 'sst_aquap_file', 'som', 'som_aquap', & 'cplhist', 'sst_aquap_analytic', 'sst_aquap_constant', & - 'multilev_cplhist', 'multilev', 'multilev_dom' ) + 'multilev_cplhist', 'multilev', 'multilev_sstdata' ) if (mainproc) write(logunit,'(3a)') trim(subname),'docn datamode = ',trim(datamode) case default call shr_log_error(' ERROR illegal docn datamode = '//trim(datamode), rc=rc) @@ -329,7 +330,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call docn_datamode_som_advertise(importState, exportState, fldsImport, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('sstdata','sst_aquap_file') - call docn_datamode_dom_advertise(exportState, fldsExport, flds_scalar_name, rc) + call docn_datamode_sstdata_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('cplhist') call docn_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, rc) @@ -340,8 +341,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) case('multilev_cplhist') call docn_datamode_multilev_cplhist_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('multilev_dom') - call docn_datamode_multilev_dom_advertise(exportState, fldsExport, flds_scalar_name, rc) + case('multilev_sstdata') + call docn_datamode_multilev_sstdata_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select @@ -551,7 +552,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar ! Initialize datamode module pointers select case (trim(datamode)) case('sstdata', 'sst_aquap_file') - call docn_datamode_dom_init_pointers(exportState, sdat, model_frac, rc) + call docn_datamode_sstdata_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som', 'som_aquap') call docn_datamode_som_init_pointers(importState, exportState, sdat, model_frac, rc) @@ -565,8 +566,8 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar case('multilev') call docn_datamode_multilev_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('multilev_dom') - call docn_datamode_multilev_dom_init_pointers(exportState, sdat, model_frac, rc) + case('multilev_sstdata') + call docn_datamode_multilev_sstdata_init_pointers(exportState, sdat, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('multilev_cplhist') call docn_datamode_multilev_cplhist_init_pointers(exportState, sdat, model_frac, rc) @@ -586,7 +587,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar if (ChkErr(rc,__LINE__,u_FILE_u)) return select case (trim(datamode)) - case('sstdata', 'sst_aquap_file', 'cplhist', 'multilev', 'mulitilev_dom', 'multilev_cplhist') + case('sstdata', 'sst_aquap_file', 'cplhist', 'multilev', 'mulitilev_sstdata', 'multilev_cplhist') call dshr_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som', 'som_aquap') @@ -611,7 +612,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar ! Perform data mode specific calculations select case (trim(datamode)) case('sstdata','sst_aquap_file') - call docn_datamode_dom_advance(rc=rc) + call docn_datamode_sstdata_advance(rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('som','som_aquap') call docn_datamode_som_advance(importState, exportState, clock, restart_read, datamode, rc) @@ -628,8 +629,8 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar case('multilev') call docn_datamode_multilev_advance(sdat, logunit, mainproc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('multilev_dom') - call docn_datamode_multilev_dom_advance(sdat, logunit, mainproc, rc=rc) + case('multilev_sstdata') + call docn_datamode_multilev_sstdata_advance(sdat, logunit, mainproc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('multilev_cplhist') call docn_datamode_multilev_cplhist_advance(exportState, rc=rc) @@ -642,7 +643,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar if (ChkErr(rc,__LINE__,u_FILE_u)) return select case (trim(datamode)) - case('sstdata', 'sst_aquap_file', 'cplhist', 'multilev', 'mulitilev_dom', 'multilev_cplhist') + case('sstdata', 'sst_aquap_file', 'cplhist', 'multilev', 'mulitilev_sstdata', 'multilev_cplhist') call dshr_restart_write(rpfile, case_name, 'docn', inst_suffix, target_ymd, target_tod, logunit, & my_task, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 9d7df538fd59f0910fe0ec53794c2c39190ad473 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 26 Dec 2025 17:47:45 +0100 Subject: [PATCH 18/61] fixed compilation problems --- drof/CMakeLists.txt | 3 ++- drof/drof_datamode_copyall.F90 | 14 ++++++++------ drof/rof_comp_nuopc.F90 | 7 ++++++- dwav/CMakeLists.txt | 3 ++- dwav/dwav_datamode_copyall.F90 | 10 +++++----- dwav/wav_comp_nuopc.F90 | 7 ++++++- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/drof/CMakeLists.txt b/drof/CMakeLists.txt index 444c855e6..847a23670 100644 --- a/drof/CMakeLists.txt +++ b/drof/CMakeLists.txt @@ -1,5 +1,6 @@ project(drof Fortran) -set(SRCFILES rof_comp_nuopc.F90) +set(SRCFILES rof_comp_nuopc.F90 + drof_datamode_copyall.F90) foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.drof/${FILE}") diff --git a/drof/drof_datamode_copyall.F90 b/drof/drof_datamode_copyall.F90 index 7d2236540..95382c1f1 100644 --- a/drof/drof_datamode_copyall.F90 +++ b/drof/drof_datamode_copyall.F90 @@ -3,8 +3,8 @@ module drof_datamode_copyall_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8 - use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer use shr_const_mod , only : SHR_CONST_SPVAL @@ -60,11 +60,12 @@ subroutine drof_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_ end subroutine drof_datamode_copyall_advertise !=============================================================================== - subroutine drof_datamode_copyall_init_pointers(exportState, rc) + subroutine drof_datamode_copyall_init_pointers(exportState, sdat, rc) ! input/output variables - type(ESMF_State) , intent(inout) :: exportState - integer , intent(out) :: rc + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc ! local variables character(len=*), parameter :: subname='(drof_init_pointers): ' @@ -82,6 +83,7 @@ subroutine drof_datamode_copyall_init_pointers(exportState, rc) call shr_strdata_get_stream_pointer( sdat, 'Forr_rofl', strm_Forr_rofl, requirePointer=.true., & errmsg=trim(subname)//'ERROR: strm_Forr_rofl must be associated for drof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Forr_rofi', strm_Forr_rofi, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (.not. associated(strm_Forr_rofi)) then @@ -107,10 +109,10 @@ subroutine drof_datamode_copyall_advance() enddo if (associated(strm_Forr_rofi)) then - if (abs(strm_Forr_rofi(n)) < SHR_CONST_SPVAL) then + if (abs(strm_Forr_rofi(ni)) < SHR_CONST_SPVAL) then Forr_rofi(:) = strm_Forr_rofi(:) else - Forr_rofi(n) = 0.0_r8 + Forr_rofi(ni) = 0.0_r8 end if end if diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 033e9e74d..1f5eec9d9 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -34,6 +34,11 @@ module cdeps_drof_comp use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_realize use nuopc_shr_methods, only : shr_get_rpointer_name + ! Datamode specialized modules + use drof_datamode_copyall_mod, only : drof_datamode_copyall_advertise + use drof_datamode_copyall_mod, only : drof_datamode_copyall_init_pointers + use drof_datamode_copyall_mod, only : drof_datamode_copyall_advance + implicit none private ! except @@ -394,7 +399,7 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri ! Initialize stream and export state pointers select case (trim(datamode)) case('copyall') - call drof_datamode_copyall_init_pointers(exportState, rc) + call drof_datamode_copyall_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select diff --git a/dwav/CMakeLists.txt b/dwav/CMakeLists.txt index 2d96bf3a6..236654f67 100644 --- a/dwav/CMakeLists.txt +++ b/dwav/CMakeLists.txt @@ -1,5 +1,6 @@ project(dwav Fortran) -set(SRCFILES wav_comp_nuopc.F90) +set(SRCFILES wav_comp_nuopc.F90 + dwav_datamode_copyall.F90) foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.dwav/${FILE}") diff --git a/dwav/dwav_datamode_copyall.F90 b/dwav/dwav_datamode_copyall.F90 index b38fde83e..cc6f2698b 100644 --- a/dwav/dwav_datamode_copyall.F90 +++ b/dwav/dwav_datamode_copyall.F90 @@ -3,10 +3,9 @@ module dwav_datamode_copyall_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8 - use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer - use shr_const_mod , only : SHR_CONST_SPVAL implicit none private ! except @@ -63,11 +62,12 @@ subroutine dwav_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_ end subroutine dwav_datamode_copyall_advertise !=============================================================================== - subroutine dwav_datamode_copyall_init_pointers(exportState, rc) + subroutine dwav_datamode_copyall_init_pointers(exportState, sdat, rc) ! input/output variables - type(ESMF_State) , intent(inout) :: exportState - integer , intent(out) :: rc + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc ! local variables character(len=*), parameter :: subname='(dwav_init_pointers): ' diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index 3a05a6778..948ceec3c 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -34,6 +34,11 @@ module cdeps_dwav_comp use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize use nuopc_shr_methods, only : shr_get_rpointer_name + ! Datamode specialized modules + use dwav_datamode_copyall_mod, only : dwav_datamode_copyall_advertise + use dwav_datamode_copyall_mod, only : dwav_datamode_copyall_init_pointers + use dwav_datamode_copyall_mod, only : dwav_datamode_copyall_advance + implicit none private ! except @@ -397,7 +402,7 @@ subroutine dwav_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri ! Initialize stream and export state pointers select case (trim(datamode)) case('copyall') - call dwav_datamode_copyall_init_pointers(exportState, rc) + call dwav_datamode_copyall_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select From 8ce7070f828ad2c69b785d4ceb00db14c0dbcc5d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 26 Dec 2025 20:18:33 +0100 Subject: [PATCH 19/61] some fixes for runtime errors --- datm/cime_config/namelist_definition_datm.xml | 16 ---------------- datm/datm_datamode_jra_mod.F90 | 18 +++++++++++++----- drof/drof_datamode_copyall.F90 | 12 +++++++----- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 8ca888bb3..353ae26af 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -16,9 +16,6 @@ CLM_QIAN.Solar,CLM_QIAN.Precip,CLM_QIAN.TPQW - - CLM_QIAN_WISO.Solar,CLM_QIAN_WISO.Precip,CLM_QIAN_WISO.TPQW - CLMCRUJRA2024.Solar,CLMCRUJRA2024.Precip,CLMCRUJRA2024.TPQW @@ -331,19 +328,6 @@ - - logical - datm - datm_nml - - If true, prescribed water isotopes are sent from datm (must be true for running with CLM). - - - .false. - - - - integer datm diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index c8577bf80..0eeab1209 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -38,6 +38,8 @@ 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_swdn(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() ! stream data pointers real(r8), pointer :: strm_Sa_tbot(:) => null() @@ -185,6 +187,10 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swdn' , fldptr1=Faxa_swdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! initialize stream pointers call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & @@ -245,11 +251,13 @@ subroutine datm_datamode_jra_advance(exportstate, target_ymd, target_tod, model_ Sa_z(n) = 10.0_R8 ! Set export fields as copies directly from streams - Sa_pslv(n) = strm_Sa_pslv(n) - Sa_tbot(n) = strm_Sa_tbot(n) - Sa_u(n) = strm_Sa_u(n) - Sa_v(n) = strm_Sa_v(n) - Sa_shum(n) = strm_Sa_shum(n) + Sa_pslv(n) = strm_Sa_pslv(n) + Sa_tbot(n) = strm_Sa_tbot(n) + Sa_u(n) = strm_Sa_u(n) + Sa_v(n) = strm_Sa_v(n) + Sa_shum(n) = strm_Sa_shum(n) + Faxa_swdn(n) = strm_Faxa_swdn(n) + Faxa_lwdn(n) = strm_Faxa_lwdn(n) ! Set Sa_pbot from Sa_pslv Sa_pbot(n) = Sa_pslv(n) diff --git a/drof/drof_datamode_copyall.F90 b/drof/drof_datamode_copyall.F90 index 95382c1f1..eb2f1391e 100644 --- a/drof/drof_datamode_copyall.F90 +++ b/drof/drof_datamode_copyall.F90 @@ -109,11 +109,13 @@ subroutine drof_datamode_copyall_advance() enddo if (associated(strm_Forr_rofi)) then - if (abs(strm_Forr_rofi(ni)) < SHR_CONST_SPVAL) then - Forr_rofi(:) = strm_Forr_rofi(:) - else - Forr_rofi(ni) = 0.0_r8 - end if + do ni = 1, size(Forr_rofl) + if (abs(strm_Forr_rofi(ni)) < SHR_CONST_SPVAL) then + Forr_rofi(:) = strm_Forr_rofi(:) + else + Forr_rofi(ni) = 0.0_r8 + end if + end do end if end subroutine drof_datamode_copyall_advance From 7006dc2053d8256575681e44b2e8e3bd56b39aa1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 26 Dec 2025 21:22:39 +0100 Subject: [PATCH 20/61] run time fixes for datm_datamode_clmncep_mod.F90 --- datm/datm_datamode_clmncep_mod.F90 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 388ce8cd0..df8e3a2cc 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -32,7 +32,6 @@ module datm_datamode_clmncep_mod real(r8), pointer :: Sa_dens(:) => null() real(r8), pointer :: Sa_pbot(:) => null() real(r8), pointer :: Sa_pslv(:) => null() - real(r8), pointer :: Faxa_lwdn(:) => null() real(r8), pointer :: Faxa_rainc(:) => null() real(r8), pointer :: Faxa_rainl(:) => null() real(r8), pointer :: Faxa_snowc(:) => null() @@ -42,6 +41,8 @@ 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_swdn(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() ! import state data pointers real(r8), pointer :: Sx_avsdr(:) => null() @@ -158,6 +159,8 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r rc = ESMF_SUCCESS ! initialize export state pointers + call dshr_state_getfldptr(exportState, 'Sa_topo' , fldptr1=Sa_topo , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) @@ -166,16 +169,16 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_pslv' , fldptr1=Sa_pslv , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_ptem' , fldptr1=Sa_ptem , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_shum' , fldptr1=Sa_shum , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_dens' , fldptr1=Sa_dens , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_pslv' , fldptr1=Sa_pslv , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rainc' , fldptr1=Faxa_rainc , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rainl' , fldptr1=Faxa_rainl , rc=rc) @@ -194,6 +197,8 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swdn' , fldptr1=Faxa_swdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -317,6 +322,9 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, rc) lsize = size(Sa_u) + Sa_tbot(:) = strm_Sa_tbot(:) + Faxa_swdn(:) = strm_Faxa_swdn(:) + if (first_time) then call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -368,7 +376,6 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, rc) end if !--- temperature --- - Sa_tbot(n) = strm_Sa_tbot(n) if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz ! Limit very cold forcing to 180K Sa_tbot(n) = max(180._r8, Sa_tbot(n)) From 98013816c61546acabefdf155608ec0773783091 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 26 Dec 2025 23:08:35 +0100 Subject: [PATCH 21/61] more fixes for runtime problems --- datm/datm_datamode_clmncep_mod.F90 | 15 +++-- datm/datm_datamode_core2_mod.F90 | 100 ++++++++++++++--------------- datm/datm_datamode_jra_mod.F90 | 12 ++-- 3 files changed, 61 insertions(+), 66 deletions(-) diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index df8e3a2cc..09b784c46 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -12,6 +12,7 @@ module datm_datamode_clmncep_mod use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + use shr_const_mod , only : SHR_CONST_SPVAL implicit none private ! except @@ -221,9 +222,6 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r call shr_strdata_get_stream_pointer( sdat, 'Sa_wind' , strm_Sa_wind, requirePointer=.true., & errmsg=trim(subname)//'ERROR: strm_Sa_wind must be associated for datm clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_topo' , strm_Sa_topo, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_topo must be associated for datm clmncep datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot, requirePointer=.true., & errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for datm clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -232,6 +230,8 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return ! optional stream data pointers + call shr_strdata_get_stream_pointer( sdat, 'Sa_topo' , strm_Sa_topo , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_pbot' , strm_Sa_pbot , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_z' , strm_Sa_z , rc) @@ -322,8 +322,14 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, rc) lsize = size(Sa_u) + ! Direct copies of stream fields Sa_tbot(:) = strm_Sa_tbot(:) Faxa_swdn(:) = strm_Faxa_swdn(:) + if (associated(strm_Sa_topo)) then + Sa_topo(:) = strm_Sa_topo(:) + else + Sa_topo(:) = SHR_CONST_SPVAL + end if if (first_time) then call ESMF_VMGetCurrent(vm, rc=rc) @@ -363,10 +369,7 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, rc) first_time = .false. end if - do n = 1,lsize - !--- topography --- - Sa_topo(n) = strm_Sa_topo(n) !--- bottom layer height --- if (.not. associated(strm_Sa_z)) then diff --git a/datm/datm_datamode_core2_mod.F90 b/datm/datm_datamode_core2_mod.F90 index 2b0e9dcf1..d00d1f385 100644 --- a/datm/datm_datamode_core2_mod.F90 +++ b/datm/datm_datamode_core2_mod.F90 @@ -45,7 +45,7 @@ module datm_datamode_core2_mod real(r8), pointer :: Sa_shum(:) => null() real(r8), pointer :: Sa_pbot(:) => null() real(r8), pointer :: Sa_pslv(:) => null() - real(r8), pointer :: Faxa_lwdn(:) => null() + real(r8), pointer :: Sa_dens(:) => null() real(r8), pointer :: Faxa_rainc(:) => null() real(r8), pointer :: Faxa_rainl(:) => null() real(r8), pointer :: Faxa_snowc(:) => null() @@ -55,20 +55,22 @@ 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_swdn(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() - ! stream data points + ! required stream data points real(r8), pointer :: strm_Faxa_prec(:) => null() real(r8), pointer :: strm_Faxa_swdn(:) => null() - real(r8), pointer :: strm_Faxa_swnet(:) => null() real(r8), pointer :: strm_Faxa_lwdn(:) => null() real(r8), pointer :: strm_Sa_pslv(:) => null() real(r8), pointer :: strm_Sa_tbot(:) => null() real(r8), pointer :: strm_Sa_shum(:) => null() + real(r8), pointer :: strm_Sa_dens(:) => null() real(r8), pointer :: strm_Sa_u(:) => null() real(r8), pointer :: strm_Sa_v(:) => null() real(r8), pointer :: strm_tarcf(:) => null() - ! othe module arrays + ! other module arrays real(R8), pointer :: windFactor(:) real(R8), pointer :: winddFactor(:) real(R8), pointer :: qsatFactor(:) @@ -166,44 +168,6 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor rc = ESMF_SUCCESS - ! get stream pointers - call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_prec must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swdn must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_swnet' , strm_Faxa_swnet , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swnet must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for core2 datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call shr_strdata_get_stream_pointer( sdat, 'tarcf', strm_tarcf, rc) ! required for CORE2_IAF - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (trim(datamode) == 'CORE2_IAF' ) then - if (.not. associated(strm_tarcf)) then - call shr_log_error(trim(subname)//'tarcf must be associated for CORE2_IAF', rc=rc) - return - endif - endif - ! get export state pointers call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -225,6 +189,8 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_shum' , fldptr1=Sa_shum , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_dens' , fldptr1=Sa_dens , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rainc' , fldptr1=Faxa_rainc , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rainl' , fldptr1=Faxa_rainl , rc=rc) @@ -243,22 +209,46 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swdn' , fldptr1=Faxa_swdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (.not. associated(strm_Faxa_prec) .or. .not. associated(strm_Faxa_swdn)) then - call shr_log_error(trim(subname)//'ERROR: either strm_Faxa_prec or strm_Faxa_swd '//& - ' must be in streams for CORE2', rc=rc) + ! get required stream pointers + call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_prec must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_swdn must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_dens' , strm_Sa_dens , requirePointer=.true., & + errmsg=trim(subname)//'ERROR: strm_Sa_dens must be associated for core2 datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'tarcf', strm_tarcf, rc) ! required for CORE2_IAF + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (trim(datamode) == 'CORE2_IAF' .and. .not. associated(strm_tarcf)) then + call shr_log_error(trim(subname)//'tarcf must be associated for CORE2_IAF', rc=rc) return endif - if (trim(datamode) == 'CORE2_IAF' ) then - if (.not. associated(strm_tarcf)) then - call shr_log_error(trim(subname)//'strm_tarcf must be in an input stream for CORE2_IAF', rc=rc) - return - endif - endif - ! create yc call ESMF_MeshGet(sdat%model_mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -271,7 +261,6 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor end do deallocate(ownedElemCoords) - ! create adjustment factor arrays lsize = sdat%model_lsize allocate(windFactor(lsize)) @@ -316,6 +305,8 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ cosfactor = cos((2.0_R8*SHR_CONST_PI*rday)/365 - phs_c0) do n = 1,lsize + + !--- set Sa_z to a constant --- Sa_z(n) = 10.0_R8 !--- correction to NCEP winds based on QSCAT --- @@ -330,6 +321,7 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ !--- density and pslv taken directly from input stream, set pbot --- Sa_pslv(n) = strm_Sa_pslv(n) + Sa_dens(n) = strm_Sa_dens(n) Sa_pbot(n) = Sa_pslv(n) !--- correction to NCEP Arctic & Antarctic air T & potential T --- @@ -376,6 +368,7 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ ! RADIATION DATA !--- fabricate required swdn components from net swdn --- + Faxa_swdn(n) = strm_Faxa_swdn(n) Faxa_swvdr(n) = strm_Faxa_swdn(n)*(0.28_R8) Faxa_swndr(n) = strm_Faxa_swdn(n)*(0.31_R8) Faxa_swvdf(n) = strm_Faxa_swdn(n)*(0.24_R8) @@ -401,6 +394,7 @@ subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_ Faxa_swndf(n) = Faxa_swndf(n)*factor !--- correction to GISS lwdn in Arctic --- + Faxa_lwdn(n) = strm_Faxa_lwdn(n) if ( yc(n) > 60._R8 ) then factor = MIN(1.0_R8, 0.1_R8*(yc(n)-60.0_R8) ) Faxa_lwdn(n) = strm_Faxa_lwdn(n) + factor * dLWarc diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 0eeab1209..e75f5c885 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -51,7 +51,7 @@ module datm_datamode_jra_mod real(r8), pointer :: strm_Faxa_lwdn(:) => null() real(r8), pointer :: strm_Faxa_swdn(:) => null() - ! othe module arrays + ! other module arrays real(R8), pointer :: yc(:) ! array of model latitudes ! constants @@ -248,22 +248,20 @@ subroutine datm_datamode_jra_advance(exportstate, target_ymd, target_tod, model_ cosfactor = cos((2.0_R8*SHR_CONST_PI*rday)/365 - phs_c0) do n = 1,lsize - Sa_z(n) = 10.0_R8 ! Set export fields as copies directly from streams Sa_pslv(n) = strm_Sa_pslv(n) + Sa_pbot(n) = strm_Sa_pslv(n) Sa_tbot(n) = strm_Sa_tbot(n) + Sa_ptem(n) = strm_Sa_tbot(n) Sa_u(n) = strm_Sa_u(n) Sa_v(n) = strm_Sa_v(n) Sa_shum(n) = strm_Sa_shum(n) Faxa_swdn(n) = strm_Faxa_swdn(n) Faxa_lwdn(n) = strm_Faxa_lwdn(n) - ! Set Sa_pbot from Sa_pslv - Sa_pbot(n) = Sa_pslv(n) - - ! Set Sa_ptem from Sa_tbot - Sa_ptem(n) = Sa_tbot(n) + ! Set Sa_z to a constant + Sa_z(n) = 10.0_R8 ! Set Sa_u10m and Sa_v10m to Sa_u and Sa_v Sa_u10m(n) = Sa_u(n) From 3b4633ddf80497e293c2b36b027baa6928e8f0ab Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 27 Dec 2025 11:10:08 +0100 Subject: [PATCH 22/61] update to documentation --- doc/source/docn.rst | 51 +++++++++++++------ docn/cime_config/namelist_definition_docn.xml | 37 +++++++------- docn/ocn_comp_nuopc.F90 | 6 +-- 3 files changed, 56 insertions(+), 38 deletions(-) diff --git a/doc/source/docn.rst b/doc/source/docn.rst index d10852a6d..e16fffc38 100644 --- a/doc/source/docn.rst +++ b/doc/source/docn.rst @@ -21,10 +21,11 @@ operations need to be done by DOCN on *ALL* of the streams in the with a DOCN source file that carries out these operations and these are listed in parentheses next to the mode name. -sstdata and sst_aquap_file (``docn_datamode_copyall_mod.F90``) +sstdata and sst_aquap_file (``docn_datamode_sstdata_mod.F90``) - `sstdata` and `sst_aquap_file` modes assume that the only field in the input stream is SST. It also assumes the SST is in Celsius and must be converted to Kelvin. All other fields are set to zero. + `ssdata` mode includes both climatological and interannyal varying data. .. note:: Normally the ice fraction data is found in the same data files that @@ -32,30 +33,50 @@ sstdata and sst_aquap_file (``docn_datamode_copyall_mod.F90``) the same file because the SST and ice fraction data are derived from the same observational data sets and are consistent with each other. -iaf (``docn_datamode_iaf_mod.F90``) - - iaf is the interannually varying version of `sstdata`. - The ocean salinity is set to a constant reference salinity value. - All other fields other than SST and ocean salinity are set to zero. - sst_aquap_analytic, sst_aquap_constant and sst_aquap[1-10] (``docn_datamode_aquaplanet_mod.F90``) - This mode creates analytic sea surface temperature. In case of using `sst_aquap[1-10]` data mode, an additional information (`sst_option`) is extracted from the data mode to change the behaviour of the data mode such as the method of calculation of sea surface temperature. +multilev (``docn_multilev_mod.F90``) + - This mode reads in multi-level ocean forcing data for temperature + and salinity. The input data can be on any set of vertical levels, + but the output data is then remapped to a fixed set of 30 vertical + levels. This mode is used to force the prognostic land-ice + component (in this case CISM) with ocean forcing. + +multilev_cplhist (``docn_multilev_cplhist_mod.F90``) + - This mode reads in multi-level ocean forcing data for temperature + and salinity. The input data is assumed to be on 30 vertical + levels and it is the responsibility of the prognostic ocean + component to map the data to these levels before sending the data + to the mediator. This mode is used to force the prognostic + land-ice component (in this case CISM) with ocean forcing. + +multilev (``docn_multilev_sstdata_mod.F90``) + - This mode reads in multi-level ocean forcing data for temperature + and salinity (to be sent to a land-ice component, e.g. CISM) as + well as sst data (to be sent to a atmosphere component, + e.g. CAM). The ocean input data can be on any set of vertical + levels, but the output data is then remapped to a fixed set of 30 + vertical levels. The sst data is handled the same way as in + sstdata mode. + som and som_aquap (``docn_datamode_som_mod.F90``) - som ("slab ocean model") mode is a prognostic mode. This mode computes a prognostic sea surface temperature and a freeze/melt potential (surface Q-flux) used by the sea ice model. This - calculation requires an external SOM forcing data file that includes - ocean mixed layer depths and bottom-of-the-slab Q-fluxes. - Scientifically appropriate bottom-of-the-slab Q-fluxes are normally - ocean resolution dependent and are derived from the ocean model output - of a fully coupled CESM run. Note that while this mode runs out of - the box, the default SOM forcing file is not scientifically - appropriate and is provided for testing and development purposes only. - Users must create scientifically appropriate data for their particular - application. A tool is available to derive valid SOM forcing. + calculation requires an external SOM forcing data file that + includes ocean mixed layer depths and bottom-of-the-slab Q-fluxes. + Scientifically appropriate bottom-of-the-slab Q-fluxes are + normally ocean resolution dependent and are derived from the ocean + model output of a fully coupled (e.g. CESM or NorESM) run. Note + that while this mode runs out of the box, the default SOM forcing + file is not scientifically appropriate and is provided for testing + and development purposes only. Users must create scientifically + appropriate data for their particular application. A tool is + available to derive valid SOM forcing. The only difference between `som` and `som_aquap` is that `som_aquap` limits sea surface temperature based on calculated value of freezing diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index b132643f7..46eab8b29 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -53,9 +53,6 @@ provide SST data to the data ocean model. They are normally found in the same file because the SST and ice fraction data are derived from the same observational data sets and are consistent with each other. - to the data ocean model. They are normally found in the same file - because the SST and ice fraction data are derived from the same - observational data sets and are consistent with each other. The ocean salinity is set to a constant reference salinity value. All other fields other than SST and ocean salinity are set to zero. ==> dataMode = "som" @@ -66,29 +63,29 @@ ocean mixed layer depths and bottom-of-the-slab Q-fluxes. Scientifically appropriate bottom-of-the-slab Q-fluxes are normally ocean resolution dependent and are derived from the ocean model output - of a fully coupled CCSM run. Note that while this mode runs out of + of a fully coupled run. Note that while this mode runs out of the box, the default SOM forcing file is not scientifically appropriate and is provided for testing and development purposes only. Users must create scientifically appropriate data for their particular application. A tool is available to derive valid SOM forcing. (1) map the xml variable DOCN_MODE => config variable docn_mode => namelist variable datamode - compset="_DOCN%DOM_" => docn_mode=prescribed => datamode=sstdata - compset="_DOCN%IAF_" => docn_mode=interannual => datamode=sstdata - compset="_DOCN%SOM_" => docn_mode=som => datamode=som - compset="_DOCN%SOMAQP_" => docn_mode=som_aquap => datamode=som_aquap - compset="_DOCN%AQP1_" => docn_mode=sst_aquap1 => datamode=sst_aquap1 - compset="_DOCN%AQP2_" => docn_mode=sst_aquap2 => datamode=sst_aquap2 - compset="_DOCN%AQP3_" => docn_mode=sst_aquap3 => datamode=sst_aquap3 - compset="_DOCN%AQP4_" => docn_mode=sst_aquap4 => datamode=sst_aquap4 - compset="_DOCN%AQP5_" => docn_mode=sst_aquap5 => datamode=sst_aquap5 - compset="_DOCN%AQP6_" => docn_mode=sst_aquap6 => datamode=sst_aquap6 - compset="_DOCN%AQP7_" => docn_mode=sst_aquap7 => datamode=sst_aquap7 - compset="_DOCN%AQP8_" => docn_mode=sst_aquap8 => datamode=sst_aquap8 - compset="_DOCN%AQP9_" => docn_mode=sst_aquap9 => datamode=sst_aquap9 - compset="_DOCN%AQP10_" => docn_mode=sst_aquap10 => datamode=sst_aquap10 - compset="_DOCN%AQPFILE_" => docn_mode=sst_aquapfile => datamode=sst_aquap_file - compset="_DOCN%AQPCONST_" => docn_mode=sst_aquap_constant => datamode=sst_aquap_constant + compset="_DOCN%DOM_" : docn_mode=prescribed , datamode=sstdata + compset="_DOCN%IAF_" : docn_mode=interannual , datamode=sstdata + compset="_DOCN%SOM_" : docn_mode=som , datamode=som + compset="_DOCN%SOMAQP_" : docn_mode=som_aquap , datamode=som_aquap + compset="_DOCN%AQP1_" : docn_mode=sst_aquap1 , datamode=sst_aquap1 + compset="_DOCN%AQP2_" : docn_mode=sst_aquap2 , datamode=sst_aquap2 + compset="_DOCN%AQP3_" : docn_mode=sst_aquap3 , datamode=sst_aquap3 + compset="_DOCN%AQP4_" : docn_mode=sst_aquap4 , datamode=sst_aquap4 + compset="_DOCN%AQP5_" : docn_mode=sst_aquap5 , datamode=sst_aquap5 + compset="_DOCN%AQP6_" : docn_mode=sst_aquap6 , datamode=sst_aquap6 + compset="_DOCN%AQP7_" : docn_mode=sst_aquap7 , datamode=sst_aquap7 + compset="_DOCN%AQP8_" : docn_mode=sst_aquap8 , datamode=sst_aquap8 + compset="_DOCN%AQP9_" : docn_mode=sst_aquap9 , datamode=sst_aquap9 + compset="_DOCN%AQP10_" : docn_mode=sst_aquap10 , datamode=sst_aquap10 + compset="_DOCN%AQPFILE_" : docn_mode=sst_aquapfile , datamode=sst_aquap_file + compset="_DOCN%AQPCONST_" : docn_mode=sst_aquap_constant , datamode=sst_aquap_constant sstdata diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 513b3d2b0..05c646084 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -326,12 +326,12 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) aquaplanet = .true. call docn_datamode_aquaplanet_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('som') - call docn_datamode_som_advertise(importState, exportState, fldsImport, fldsExport, flds_scalar_name, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('sstdata','sst_aquap_file') call docn_datamode_sstdata_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('som') + call docn_datamode_som_advertise(importState, exportState, fldsImport, fldsExport, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case('cplhist') call docn_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 9a366c70925772ac7985cc586370e612fece89a0 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 5 Jan 2026 08:16:20 +0100 Subject: [PATCH 23/61] replaced trim(subname) with subname and character(*) with character(len=*) --- datm/atm_comp_nuopc.F90 | 49 ++++---- datm/datm_datamode_clmncep_mod.F90 | 18 +-- datm/datm_datamode_core2_mod.F90 | 32 +++--- datm/datm_datamode_cplhist_mod.F90 | 44 ++++---- datm/datm_datamode_era5_mod.F90 | 56 +++++----- datm/datm_datamode_gefs_mod.F90 | 12 +- datm/datm_datamode_jra_mod.F90 | 22 ++-- datm/datm_datamode_simple_mod.F90 | 6 +- datm/datm_pres_aero_mod.F90 | 32 +++--- datm/datm_pres_co2_mod.F90 | 8 +- datm/datm_pres_ndep_mod.F90 | 4 +- datm/datm_pres_o3_mod.F90 | 6 +- dglc/dglc_datamode_noevolve_mod.F90 | 18 +-- dglc/glc_comp_nuopc.F90 | 24 ++-- dice/dice_datamode_cplhist_mod.F90 | 8 +- dice/dice_datamode_ssmi_mod.F90 | 8 +- dice/dice_flux_atmice_mod.F90 | 4 +- dice/ice_comp_nuopc.F90 | 36 +++--- dlnd/dlnd_datamode_glc_forcing_mod.F90 | 12 +- dlnd/dlnd_datamode_rof_forcing_mod.F90 | 18 +-- dlnd/lnd_comp_nuopc.F90 | 32 +++--- docn/docn_datamode_aquaplanet_mod.F90 | 4 +- docn/docn_datamode_cplhist_mod.F90 | 14 +-- docn/docn_datamode_multilev_cplhist_mod.F90 | 8 +- docn/docn_datamode_multilev_mod.F90 | 10 +- docn/docn_datamode_multilev_sstdata_mod.F90 | 14 +-- docn/docn_datamode_som_mod.F90 | 20 ++-- docn/docn_datamode_sstdata_mod.F90 | 8 +- docn/docn_import_data_mod.F90 | 4 +- docn/ocn_comp_nuopc.F90 | 46 ++++---- drof/drof_datamode_copyall.F90 | 6 +- drof/rof_comp_nuopc.F90 | 32 +++--- dshr/dshr_dfield_mod.F90 | 16 +-- dshr/dshr_fldlist_mod.F90 | 6 +- dshr/dshr_mod.F90 | 118 ++++++++++---------- dwav/dwav_datamode_copyall.F90 | 10 +- dwav/wav_comp_nuopc.F90 | 38 +++---- streams/dshr_methods_mod.F90 | 50 ++++----- streams/dshr_tinterp_mod.F90 | 37 +++--- 39 files changed, 446 insertions(+), 444 deletions(-) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index a155a4bd8..739ce2892 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -84,10 +84,11 @@ module cdeps_datm_comp use datm_pres_co2_mod , only : datm_pres_co2_advance implicit none - private ! except + private public :: SetServices public :: SetVM + private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -154,12 +155,12 @@ module cdeps_datm_comp logical :: diagnose_data = .true. integer , parameter :: main_task = 0 ! task number of main task #ifdef CESMCOUPLED - character(*) , parameter :: modName = "(atm_comp_nuopc)" + character(len=*) , parameter :: modName = "(atm_comp_nuopc)" #else - character(*) , parameter :: modName = "(cdeps_datm_comp)" + character(len=*) , parameter :: modName = "(cdeps_datm_comp)" #endif - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -287,23 +288,23 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if ! write namelist input to standard out - write(logunit,'(3a)') trim(subname),' case_name = ',trim(case_name) - write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) - write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) - write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) - write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global - write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global - write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) - write(logunit,'(2a,i0)') trim(subname),' iradsw = ',iradsw - write(logunit,'(3a)') trim(subname),' nextsw_cday_calc = ', trim(nextsw_cday_calc) - write(logunit,'(3a)') trim(subname),' factorFn_data = ',trim(factorFn_data) - write(logunit,'(3a)') trim(subname),' factorFn_mesh = ',trim(factorFn_mesh) - write(logunit,'(2a,l6)') trim(subname),' flds_presaero = ',flds_presaero - write(logunit,'(2a,l6)') trim(subname),' flds_presndep = ',flds_presndep - write(logunit,'(2a,l6)') trim(subname),' flds_preso3 = ',flds_preso3 - write(logunit,'(2a,l6)') trim(subname),' flds_co2 = ',flds_co2 - write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read - write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + write(logunit,'(3a)') subname,' case_name = ',trim(case_name) + write(logunit,'(3a)') subname,' datamode = ',trim(datamode) + write(logunit,'(3a)') subname,' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') subname,' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') subname,' nx_global = ',nx_global + write(logunit,'(2a,i0)') subname,' ny_global = ',ny_global + write(logunit,'(3a)') subname,' restfilm = ',trim(restfilm) + write(logunit,'(2a,i0)') subname,' iradsw = ',iradsw + write(logunit,'(3a)') subname,' nextsw_cday_calc = ', trim(nextsw_cday_calc) + write(logunit,'(3a)') subname,' factorFn_data = ',trim(factorFn_data) + write(logunit,'(3a)') subname,' factorFn_mesh = ',trim(factorFn_mesh) + write(logunit,'(2a,l6)') subname,' flds_presaero = ',flds_presaero + write(logunit,'(2a,l6)') subname,' flds_presndep = ',flds_presndep + write(logunit,'(2a,l6)') subname,' flds_preso3 = ',flds_preso3 + write(logunit,'(2a,l6)') subname,' flds_co2 = ',flds_co2 + write(logunit,'(2a,l6)') subname,' skip_restart_read = ',skip_restart_read + write(logunit,'(2a,l6)') subname,' export_all = ',export_all bcasttmp = 0 bcasttmp(1) = nx_global @@ -366,7 +367,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) case ('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA', & 'CORE_RYF6162_JRA','CORE_RYF8485_JRA','CORE_RYF9091_JRA','CORE_RYF0304_JRA', & 'CLMNCEP','CPLHIST','GEFS','ERA5','SIMPLE') - if (mainproc) write(logunit,'(3a)') trim(subname),'datm datamode = ',trim(datamode) + if (mainproc) write(logunit,'(3a)') subname,'datm datamode = ',trim(datamode) case default call shr_log_error(' ERROR illegal datm datamode = '//trim(datamode), rc=rc) return @@ -617,7 +618,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod ! local variables character(len=CL) :: rpfile - character(*), parameter :: subName = '(datm_comp_run) ' + character(len=*), parameter :: subName = '(datm_comp_run) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -812,7 +813,7 @@ real(R8) function getNextRadCDay( julday, tod, stepno, dtime, iradsw ) real(R8) :: nextsw_cday integer :: liradsw integer :: delta_radsw - character(*),parameter :: subName = '(getNextRadCDay) ' + character(len=*),parameter :: subName = '(getNextRadCDay) ' !------------------------------------------------------------------------------- ! Note that stepno is obtained via the advancecount argument to diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 09b784c46..3200b558d 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -15,7 +15,7 @@ module datm_datamode_clmncep_mod use shr_const_mod , only : SHR_CONST_SPVAL implicit none - private ! except + private public :: datm_datamode_clmncep_advertise public :: datm_datamode_clmncep_init_pointers @@ -88,8 +88,8 @@ module datm_datamode_clmncep_mod real(r8) , parameter :: stebol = SHR_CONST_STEBOL ! Stefan-Boltzmann constant ~ W/m^2/K^4 real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg - character(*), parameter :: nullstr = 'null' - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: nullstr = 'null' + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -220,13 +220,13 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r ! required stream data pointers call shr_strdata_get_stream_pointer( sdat, 'Sa_wind' , strm_Sa_wind, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_wind must be associated for datm clmncep datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_wind must be associated for datm clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for datm clmncep datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_tbot must be associated for datm clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Faxa_precn' , strm_Faxa_precn, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_precn must be associated for datm clmncep datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_precn must be associated for datm clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! optional stream data pointers @@ -339,7 +339,7 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, rc) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return tbotmax = rtmp(2) - if (mainproc) write(logunit,*) trim(subname),' tbotmax = ',tbotmax + if (mainproc) write(logunit,*) subname,' tbotmax = ',tbotmax if(tbotmax <= 0) then call shr_log_error(subname//'ERROR: bad value in tbotmax', rc=rc) return @@ -354,7 +354,7 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, rc) else anidrmax = SHR_CONST_SPVAL end if - if (mainproc) write(logunit,*) trim(subname),' anidrmax = ',anidrmax + if (mainproc) write(logunit,*) subname,' anidrmax = ',anidrmax ! determine tdewmax (see below for use) if (associated(strm_Sa_tdew)) then @@ -362,7 +362,7 @@ subroutine datm_datamode_clmncep_advance(mainproc, logunit, rc) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return tdewmax = rtmp(2) - if (mainproc) write(logunit,*) trim(subname),' tdewmax = ',tdewmax + if (mainproc) write(logunit,*) subname,' tdewmax = ',tdewmax endif ! reset first_time diff --git a/datm/datm_datamode_core2_mod.F90 b/datm/datm_datamode_core2_mod.F90 index d00d1f385..36a72fe5c 100644 --- a/datm/datm_datamode_core2_mod.F90 +++ b/datm/datm_datamode_core2_mod.F90 @@ -26,7 +26,7 @@ module datm_datamode_core2_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: datm_datamode_core2_advertise public :: datm_datamode_core2_init_pointers @@ -90,8 +90,8 @@ module datm_datamode_core2_mod data dTarc / 0.49_R8, 0.06_R8,-0.73_R8, -0.89_R8,-0.77_R8,-1.02_R8, & -1.99_R8,-0.91_R8, 1.72_R8, 2.30_R8, 1.81_R8, 1.06_R8/ - character(*), parameter :: nullstr = 'null' - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: nullstr = 'null' + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -216,36 +216,36 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor ! get required stream pointers call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_prec must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_prec must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swdn must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_swdn must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_lwdn must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_pslv must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_tbot must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_u must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_v must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_shum must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_dens' , strm_Sa_dens , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_dens must be associated for core2 datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_dens must be associated for core2 datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'tarcf', strm_tarcf, rc) ! required for CORE2_IAF if (ChkErr(rc,__LINE__,u_FILE_u)) return if (trim(datamode) == 'CORE2_IAF' .and. .not. associated(strm_tarcf)) then - call shr_log_error(trim(subname)//'tarcf must be associated for CORE2_IAF', rc=rc) + call shr_log_error(subname//'tarcf must be associated for CORE2_IAF', rc=rc) return endif @@ -409,8 +409,8 @@ subroutine datm_get_adjustment_factors(sdat, fileName_mesh, fileName_data, windF ! input/output variables type(shr_strdata_type) , intent(in) :: sdat - character(*) , intent(in) :: fileName_mesh ! file name string - character(*) , intent(in) :: fileName_data ! file name string + character(len=*) , intent(in) :: fileName_mesh ! file name string + character(len=*) , intent(in) :: fileName_data ! file name string real(R8) , pointer :: windF(:) ! wind adjustment factor real(R8) , pointer :: winddF(:) ! wind adjustment factor real(r8) , pointer :: qsatF(:) ! rel humidty adjustment factor @@ -435,7 +435,7 @@ subroutine datm_get_adjustment_factors(sdat, fileName_mesh, fileName_data, windF integer :: nxg, nyg real(r8), pointer :: data(:) integer :: srcTermProcessing_Value = 0 - character(*) ,parameter :: subName = '(datm_get_adjustment_factors) ' + character(len=*) ,parameter :: subName = '(datm_get_adjustment_factors) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index 83fbb41f0..90f11e15c 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -12,7 +12,7 @@ module datm_datamode_cplhist_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: datm_datamode_cplhist_advertise public :: datm_datamode_cplhist_init_pointers @@ -61,7 +61,7 @@ module datm_datamode_cplhist_mod real(r8), pointer :: strm_Faxa_snowl(:) => null() real(r8), pointer :: strm_Faxa_lwdn (:) => null() - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -172,64 +172,64 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r ! Set pointers into stream data call shr_strdata_get_stream_pointer(sdat, 'Sa_z', strm_Sa_z, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_z must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_z must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_tbot', strm_Sa_tbot, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_tbot must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_ptem', strm_Sa_ptem, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_ptem must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_ptem must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_shum', strm_Sa_shum, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_shum must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_pbot', strm_Sa_pbot, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_pbot must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_pbot must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_wind must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_wind must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_pslv', strm_Sa_pslv, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_pslv must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_dens must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_dens must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_u', strm_Sa_u, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_u must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_v', strm_Sa_v, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_v must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_rainc', strm_Faxa_rainc, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_rainc must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_rainc must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_rainl', strm_Faxa_rainl, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_rainl must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_rainl must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_snowc', strm_Faxa_snowc, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_snowc must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_snowc must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_snowl', strm_Faxa_snowl, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_snowl must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_snowl must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_lwdn must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndr', strm_Faxa_swndr, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swndr must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_swndr must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdr', strm_Faxa_swvdr, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_swvdr must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_swndf', strm_Faxa_swndf, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swndf must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_swndf must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_swvdf', strm_Faxa_swvdf, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_swvdf must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_lwdn', strm_Faxa_lwdn, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for clmncep datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_lwdn must be associated for clmncep datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine datm_datamode_cplhist_init_pointers diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index b8032308d..714b01237 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -10,7 +10,7 @@ module datm_datamode_era5_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: datm_datamode_era5_advertise public :: datm_datamode_era5_init_pointers @@ -75,8 +75,8 @@ module datm_datamode_era5_mod real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg real(r8) , parameter :: rhofw = SHR_CONST_RHOFW ! density of fresh water ~ kg/m^3 - character(*), parameter :: nullstr = 'undefined' - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: nullstr = 'undefined' + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -238,100 +238,100 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) ! Error checks if (.not. associated(strm_Sa_tdew)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for era5 datamode') + call shr_log_error(subname//'ERROR: strm_Sa_pslv must be associated for era5 datamode') return end if if (associated(Sa_wspd10m) .and. .not. associated(strm_Sa_u10m)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_u10m must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Sa_u10m must be associated for era5 datamode', rc=rc) return end if if (associated(Sa_wspd10m) .and. .not. associated(strm_Sa_v10m)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_v10m must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Sa_v10m must be associated for era5 datamode', rc=rc) return end if if (associated(Sa_t2m) .and. .not. associated(strm_Sa_t2m)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_t2m must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Sa_t2m must be associated for era5 datamode', rc=rc) return end if if (associated(Sa_t2m) .and. associated(Sa_pslv) .and. associated(Sa_q2m) .and. .not. associated(strm_Sa_pslv)) then - call shr_log_error(trim(subname)//'ERROR: strm_Sa_pslv must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Sa_pslv must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_swdn)) then if (.not. associated(strm_Faxa_swdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_swdn must be associated for era5 datamode', rc=rc) return end if end if if ( associated(Faxa_swvdr) .or. associated(Faxa_swndr) .or. associated(Faxa_swvdf) .or. associated(Faxa_swndf)) then if (.not. associated(strm_Faxa_swdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swdn must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_swdn must be associated for era5 datamode', rc=rc) return end if end if if (associated(Faxa_swvdr) .and. .not. associated(strm_Faxa_swvdr)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdr must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_swvdr must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_swndr) .and. .not. associated(strm_Faxa_swndr)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndr must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_swndr must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_swvdf) .and. .not. associated(strm_Faxa_swvdf)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swvdf must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_swvdf must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_swndf) .and. .not. associated(strm_Faxa_swndf)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swndf must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_swndf must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_lwdn) .and. .not. associated(strm_Faxa_lwdn)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_lwdn must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_lwnet) .and. .not. associated(strm_Faxa_lwnet)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lwnet must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_lwnet must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_swnet) .and. .not. associated(strm_Faxa_swnet)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_swnet must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_swnet must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_sen) .and. .not. associated(strm_Faxa_sen)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_sen must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_sen must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_lat) .and. .not. associated(strm_Faxa_lat)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_lat must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_lat must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_rain) .and. .not. associated(strm_Faxa_rain)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rain must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_rain must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_rainc) .and. .not. associated(strm_Faxa_rainc)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainc must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_rainc must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_rainl) .and. .not. associated(strm_Faxa_rainl)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_rainl must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_rainl must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_snowc) .and. .not. associated(strm_Faxa_snowc)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowc must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_snowc must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_snowl) .and. .not. associated(strm_Faxa_snowl)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_snowl must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_snowl must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_taux) .and. .not. associated(strm_Faxa_taux)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_taux must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_taux must be associated for era5 datamode', rc=rc) return end if if (associated(Faxa_tauy) .and. .not. associated(strm_Faxa_tauy)) then - call shr_log_error(trim(subname)//'ERROR: strm_Faxa_tauy must be associated for era5 datamode', rc=rc) + call shr_log_error(subname//'ERROR: strm_Faxa_tauy must be associated for era5 datamode', rc=rc) return end if @@ -371,7 +371,7 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, rc) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) t2max = rtmp(2) - if (mainproc) write(logunit,*) trim(subname),' t2max = ',t2max + if (mainproc) write(logunit,*) subname,' t2max = ',t2max end if ! determine tdewmax (see below for use) @@ -379,7 +379,7 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, rc) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) td2max = rtmp(2) - if (mainproc) write(logunit,*) trim(subname),' td2max = ',td2max + if (mainproc) write(logunit,*) subname,' td2max = ',td2max ! reset first_time first_time = .false. diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index b6d367146..6cefe6613 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -14,7 +14,7 @@ module datm_datamode_gefs_mod use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy implicit none - private ! except + private public :: datm_datamode_gefs_advertise public :: datm_datamode_gefs_init_pointers @@ -52,8 +52,8 @@ module datm_datamode_gefs_mod type(dfield_type) , pointer :: dfields => null() - character(*), parameter :: nullstr = 'undefined' - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: nullstr = 'undefined' + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -132,7 +132,7 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc call ESMF_StateGet(exportState, itemNameList=lfieldnames, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return do n = 1, fieldCount - call ESMF_LogWrite(trim(subname)//': field name = '//trim(lfieldnames(n)), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//': field name = '//trim(lfieldnames(n)), ESMF_LOGMSG_INFO) call ESMF_StateGet(exportState, itemName=trim(lfieldnames(n)), field=lfield, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_dfield_add( dfields, sdat, trim(lfieldnames(n)), trim(lfieldnames(n)), & @@ -219,14 +219,14 @@ subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return tbotmax = rtmp(2) - if (mainproc) write(logunit,*) trim(subname),' tbotmax = ',tbotmax + if (mainproc) write(logunit,*) subname,' tbotmax = ',tbotmax ! determine maskmax (see below for use) rtmp(1) = maxval(strm_mask(:)) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return maskmax = rtmp(2) - if (mainproc) write(logunit,*) trim(subname),' maskmax = ',maskmax + if (mainproc) write(logunit,*) subname,' maskmax = ',maskmax ! reset first_time first_time = .false. diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index e75f5c885..a32973791 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -11,7 +11,7 @@ module datm_datamode_jra_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: datm_datamode_jra_advertise public :: datm_datamode_jra_init_pointers @@ -61,8 +61,8 @@ module datm_datamode_jra_mod real(R8) , parameter :: phs_c0 = 0.298_R8 real(R8) , parameter :: dLWarc = -5.000_R8 - character(*), parameter :: nullstr = 'null' - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: nullstr = 'null' + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -194,28 +194,28 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) ! initialize stream pointers call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_prec must be associated for jra datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_prec must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_swdn must be associated for jra datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_swdn must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Faxa_lwdn must be associated for jra datamode', rc=rc) + errmsg=subname//'ERROR: strm_Faxa_lwdn must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_pslv must be associated for jra datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_pslv must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_tbot must be associated for jra datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_tbot must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_u must be associated for jra datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_u must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_v must be associated for jra datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_v must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_shum must be associated for jra datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_shum must be associated for jra datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine datm_datamode_jra_init_pointers diff --git a/datm/datm_datamode_simple_mod.F90 b/datm/datm_datamode_simple_mod.F90 index dab4800e4..4937f7505 100644 --- a/datm/datm_datamode_simple_mod.F90 +++ b/datm/datm_datamode_simple_mod.F90 @@ -27,7 +27,7 @@ module datm_datamode_simple_mod use shr_log_mod , only : shr_log_error implicit none - private ! except + private public :: datm_datamode_simple_advertise public :: datm_datamode_simple_init_pointers @@ -74,8 +74,8 @@ module datm_datamode_simple_mod real(R8) , parameter :: phs_c0 = 0.298_R8 real(R8) , parameter :: dLWarc = -5.000_R8 - character(*), parameter :: nullstr = 'null' - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: nullstr = 'null' + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== diff --git a/datm/datm_pres_aero_mod.F90 b/datm/datm_pres_aero_mod.F90 index 151052e39..dc3401c2d 100644 --- a/datm/datm_pres_aero_mod.F90 +++ b/datm/datm_pres_aero_mod.F90 @@ -7,7 +7,7 @@ module datm_pres_aero_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: datm_pres_aero_advertise public :: datm_pres_aero_init_pointers @@ -38,7 +38,7 @@ module datm_pres_aero_mod real(r8), pointer :: strm_Faxa_dstdry3(:) => null() real(r8), pointer :: strm_Faxa_dstdry4(:) => null() - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -86,59 +86,59 @@ subroutine datm_pres_aero_init_pointers(exportState, sdat, rc) ! Set module pointers into streams and check that they are associated call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphidry' , strm_Faxa_bcphidry, requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_bcphidry must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_bcphidry must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphodry' , strm_Faxa_bcphodry, requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_bcphodry must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_bcphodry must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_bcphiwet' , strm_Faxa_bcphiwet, requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_bcphiwet must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_bcphiwet must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphidry' , strm_Faxa_ocphidry, requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_ocphidry must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_ocphidry must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphodry' , strm_Faxa_ocphodry, requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_ocphodry must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_ocphodry must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_ocphiwet' , strm_Faxa_ocphiwet, requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_ocphiwet must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_ocphiwet must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry1' , strm_Faxa_dstdry1 , requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_dstdry1 must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_dstdry1 must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry2' , strm_Faxa_dstdry2 , requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_dstdry2 must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_dstdry2 must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry3' , strm_Faxa_dstdry3 , requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_dstdry3 must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_dstdry3 must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstdry4' , strm_Faxa_dstdry4 , requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_dstdry4 must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_dstdry4 must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet1' , strm_Faxa_dstwet1 , requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_dstwet1 must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_dstwet1 must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet2' , strm_Faxa_dstwet2 , requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_dstwet2 must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_dstwet2 must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet3' , strm_Faxa_dstwet3 , requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_dstwet3 must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_dstwet3 must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Faxa_dstwet4' , strm_Faxa_dstwet4 , requirePointer=.true., & - errmsg=trim(subname)//'strm_Faxa_dstwet4 must be associated if flds_presaero is .true.', rc=rc) + errmsg=subname//'strm_Faxa_dstwet4 must be associated if flds_presaero is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine datm_pres_aero_init_pointers diff --git a/datm/datm_pres_co2_mod.F90 b/datm/datm_pres_co2_mod.F90 index 1234512c1..1b1b34f0b 100644 --- a/datm/datm_pres_co2_mod.F90 +++ b/datm/datm_pres_co2_mod.F90 @@ -7,7 +7,7 @@ module datm_pres_co2_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: datm_pres_co2_advertise public :: datm_pres_co2_init_pointers @@ -23,7 +23,7 @@ module datm_pres_co2_mod character(len=CL) :: datamode - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -69,12 +69,12 @@ subroutine datm_pres_co2_init_pointers(exportState, sdat, rc) ! Get pointer to stream data that will be used below - if the ! following stream fields are not in any sdat streams, then a null value is returned call shr_strdata_get_stream_pointer(sdat, 'Sa_co2diag', strm_Sa_co2diag, requirePointer=.true., & - errmsg=trim(subname)//'strm_Sa_co2diag must be associated if flds_co2 is .true.', rc=rc) + errmsg=subname//'strm_Sa_co2diag must be associated if flds_co2 is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (datamode == 'CPLHIST') then call shr_strdata_get_stream_pointer(sdat, 'Sa_co2prog', strm_Sa_co2prog, requirePointer=.true., & - errmsg=trim(subname)//'strm_Sa_co2prog must be associated if flds_co2 is .true. '// & + errmsg=subname//'strm_Sa_co2prog must be associated if flds_co2 is .true. '// & ' and datamode is CPLHIST', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/datm/datm_pres_ndep_mod.F90 b/datm/datm_pres_ndep_mod.F90 index 1ac262d65..484f4ffbd 100644 --- a/datm/datm_pres_ndep_mod.F90 +++ b/datm/datm_pres_ndep_mod.F90 @@ -8,7 +8,7 @@ module datm_pres_ndep_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: datm_pres_ndep_advertise public :: datm_pres_ndep_init_pointers @@ -28,7 +28,7 @@ module datm_pres_ndep_mod logical :: use_cmip7_ndep - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== diff --git a/datm/datm_pres_o3_mod.F90 b/datm/datm_pres_o3_mod.F90 index c05962777..d6cfa3c00 100644 --- a/datm/datm_pres_o3_mod.F90 +++ b/datm/datm_pres_o3_mod.F90 @@ -7,7 +7,7 @@ module datm_pres_o3_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: datm_pres_o3_advertise public :: datm_pres_o3_init_pointers @@ -19,7 +19,7 @@ module datm_pres_o3_mod ! stream pointer real(r8), pointer :: strm_Sa_o3(:) => null() - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -55,7 +55,7 @@ subroutine datm_pres_o3_init_pointers(exportState, sdat, rc) ! Get pointer to stream data that will be used below call shr_strdata_get_stream_pointer(sdat, 'Sa_o3', strm_Sa_o3, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sa_o3 must be associated if flds_pres_o3 is .true.', rc=rc) + errmsg=subname//'ERROR: strm_Sa_o3 must be associated if flds_pres_o3 is .true.', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine datm_pres_o3_init_pointers diff --git a/dglc/dglc_datamode_noevolve_mod.F90 b/dglc/dglc_datamode_noevolve_mod.F90 index dc7bf4539..c33daa49f 100644 --- a/dglc/dglc_datamode_noevolve_mod.F90 +++ b/dglc/dglc_datamode_noevolve_mod.F90 @@ -25,7 +25,7 @@ module dglc_datamode_noevolve_mod use pio , only : pio_seterrorhandling implicit none - private ! except + private public :: dglc_datamode_noevolve_advertise public :: dglc_datamode_noevolve_init_pointers @@ -72,8 +72,8 @@ module dglc_datamode_noevolve_mod character(len=*), parameter :: field_in_so_t_depth = 'So_t_depth' character(len=*), parameter :: field_in_so_s_depth = 'So_s_depth' - character(*) , parameter :: nullstr = 'null' - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -204,7 +204,7 @@ subroutine dglc_datamode_noevolve_init_pointers(NStateExp, NstateImp, rc) if (.not. NUOPC_IsConnected(NStateImp(ns), fieldName=field_in_tsrf)) then ! NOTE: the field is connected ONLY if the MED->GLC entry is in the nuopc.runconfig file ! This restriction occurs even if the field was advertised - call shr_log_error(trim(subname)//": MED->GLC must appear in run sequence", rc=rc) + call shr_log_error(subname//": MED->GLC must appear in run sequence", rc=rc) return end if call dshr_state_getfldptr(NStateImp(ns), field_in_tsrf, fldptr1=Sl_tsrf(ns)%ptr, rc=rc) @@ -626,7 +626,7 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, type(io_desc_t) :: pio_iodesc integer :: rcode integer :: tmp(1) - character(*), parameter :: subName = "(dglc_datamode_noevolve_restart_read) " + character(len=*), parameter :: subName = "(dglc_datamode_noevolve_restart_read) " !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -638,7 +638,7 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (my_task == main_task) then - write(logunit,'(a)') trim(subname)//' restart filename from rpointer '//trim(rpfile) + write(logunit,'(a)') subname//' restart filename from rpointer '//trim(rpfile) open(newunit=nu, file=trim(rpfile), form='formatted') read(nu,'(a)') restfilem close(nu) @@ -649,7 +649,7 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, else ! use namelist already read if (my_task == main_task) then - write(logunit, '(a)') trim(subname)//' restart filenames from namelist ' + write(logunit, '(a)') subname//' restart filenames from namelist ' inquire(file=trim(restfilem), exist=exists) endif endif @@ -657,13 +657,13 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, if(exists) tmp=1 exists = (tmp(1) == 1) if (.not. exists .and. my_task == main_task) then - write(logunit, '(a)') trim(subname)//' file not found, skipping '//trim(restfilem) + write(logunit, '(a)') subname//' file not found, skipping '//trim(restfilem) return end if ! Read restart file if (my_task == main_task) then - write(logunit, '(a)') trim(subname)//' reading data model restart '//trim(restfilem) + write(logunit, '(a)') subname//' reading data model restart '//trim(restfilem) end if rcode = pio_openfile(pio_subsystem, pioid, io_type, trim(restfilem), pio_nowrite) diff --git a/dglc/glc_comp_nuopc.F90 b/dglc/glc_comp_nuopc.F90 index 1d9f6a5b4..de2f1f001 100644 --- a/dglc/glc_comp_nuopc.F90 +++ b/dglc/glc_comp_nuopc.F90 @@ -50,7 +50,7 @@ module cdeps_dglc_comp use dglc_datamode_noevolve_mod, only : dglc_datamode_noevolve_restart_write implicit none - private ! except + private public :: SetServices public :: SetVM @@ -65,7 +65,7 @@ module cdeps_dglc_comp ! Private module data !-------------------------------------------------------------------------- - character(*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: nullstr = 'null' integer , parameter :: max_icesheets = 10 ! maximum number of ice sheets for namelist input integer :: num_icesheets ! actual number of ice sheets @@ -113,12 +113,12 @@ module cdeps_dglc_comp logical :: diagnose_data = .true. integer , parameter :: main_task = 0 ! task number of main task #ifdef CESMCOUPLED - character(*) , parameter :: module_name = "(glc_comp_nuopc)" + character(len=*) , parameter :: module_name = "(glc_comp_nuopc)" #else - character(*) , parameter :: module_name = "(cdeps_dglc_comp)" + character(len=*) , parameter :: module_name = "(cdeps_dglc_comp)" #endif - character(*) , parameter :: modelname = 'dglc' - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: modelname = 'dglc' + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -337,7 +337,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) rc = ESMF_SUCCESS ! Initialize model mesh, restart flag, logunit, model_mask and model_frac - call ESMF_VMLogMemInfo("Entering "//trim(subname)) + call ESMF_VMLogMemInfo("Entering "//subname) call ESMF_TraceRegionEnter('dglc_strdata_init') ! Determine stream filename @@ -389,7 +389,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (my_task == main_task) then inquire(file=trim(model_meshfiles(ns)), exist=exists) if (.not.exists) then - call shr_log_error(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfiles(ns))//' does not exist', rc=rc) + call shr_log_error(subname//' ERROR: model_meshfile '//trim(model_meshfiles(ns))//' does not exist', rc=rc) return end if endif @@ -433,7 +433,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dglc_strdata_init') - call ESMF_VMLogMemInfo("Leaving "//trim(subname)) + call ESMF_VMLogMemInfo("Leaving "//subname) end subroutine InitializeRealize @@ -529,7 +529,7 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va character(len=CS) :: cnum integer :: ns ! ice sheet index character(len=CS) :: rpfile - character(*), parameter :: subName = "(dglc_comp_run) " + character(len=*), parameter :: subName = "(dglc_comp_run) " !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -606,7 +606,7 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va if (diagnose_data) then do ns = 1,num_icesheets write(cnum,'(i0)') ns - call dshr_state_diagnose(NStateExp(ns), flds_scalar_name, trim(subname)//':ES_'//trim(cnum), rc=rc) + call dshr_state_diagnose(NStateExp(ns), flds_scalar_name, subname//':ES_'//trim(cnum), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do end if @@ -687,7 +687,7 @@ subroutine ModelSetRunClock(gcomp, rc) call alarmInit(mclock, valid_alarm, 'nseconds', opt_n=dtime, alarmname='alarm_valid_inputs', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call ESMF_LogWrite(trim(subname)// ": ERROR glc_avg_period = "//trim(glc_avg_period)//" not supported", & + call ESMF_LogWrite(subname// ": ERROR glc_avg_period = "//trim(glc_avg_period)//" not supported", & ESMF_LOGMSG_INFO, rc=rc) rc = ESMF_FAILURE RETURN diff --git a/dice/dice_datamode_cplhist_mod.F90 b/dice/dice_datamode_cplhist_mod.F90 index 1dcf83b4f..ab7921c88 100644 --- a/dice/dice_datamode_cplhist_mod.F90 +++ b/dice/dice_datamode_cplhist_mod.F90 @@ -17,7 +17,7 @@ module dice_datamode_cplhist_mod use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy implicit none - private ! except + private public :: dice_datamode_cplhist_advertise public :: dice_datamode_cplhist_init_pointers @@ -45,7 +45,7 @@ module dice_datamode_cplhist_mod type(dfield_type) , pointer :: dfields => null() - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -101,7 +101,7 @@ subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & ! input/output variables type(ESMF_State) , intent(inout) :: importState type(ESMF_State) , intent(inout) :: exportState - character(len=*) , intent(in) :: flds_scalar_name + character(len=*) , intent(in) :: flds_scalar_name integer , intent(in) :: logunit logical , intent(in) :: mainproc type(shr_strdata_type) , intent(in) :: sdat @@ -134,7 +134,7 @@ subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & if (chkerr(rc,__LINE__,u_FILE_u)) return end if end do - + ! initialize pointers to export fields call dshr_state_getfldptr(exportState,'Si_ifrac',fldptr1=Si_ifrac, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return diff --git a/dice/dice_datamode_ssmi_mod.F90 b/dice/dice_datamode_ssmi_mod.F90 index 755c2bbf4..970db3863 100644 --- a/dice/dice_datamode_ssmi_mod.F90 +++ b/dice/dice_datamode_ssmi_mod.F90 @@ -14,7 +14,7 @@ module dice_datamode_ssmi_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: dice_datamode_ssmi_advertise public :: dice_datamode_ssmi_init_pointers @@ -102,8 +102,8 @@ module dice_datamode_ssmi_mod real(r8) , parameter :: latice = shr_const_latice ! latent heat of fusion real(r8) , parameter :: waterMax = 1000.0_r8 ! wrt iFrac comp & frazil ice (kg/m^2) - character(*) , parameter :: nullstr = 'null' - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -227,7 +227,7 @@ subroutine dice_datamode_ssmi_init_pointers(importState, exportState, sdat, flds ! Set pointer to stream data (required) call shr_strdata_get_stream_pointer( sdat, 'Si_ifrac', strm_Si_ifrac, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Si_ifrac must be associated for ssmi datamode', rc=rc) + errmsg=subname//'ERROR: strm_Si_ifrac must be associated for ssmi datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Set Si_imask (this corresponds to the ocean mask) diff --git a/dice/dice_flux_atmice_mod.F90 b/dice/dice_flux_atmice_mod.F90 index 4d660765b..7ecdb5a1c 100644 --- a/dice/dice_flux_atmice_mod.F90 +++ b/dice/dice_flux_atmice_mod.F90 @@ -113,8 +113,8 @@ subroutine dice_flux_atmice( & psixhu(xd) = 2.0_R8 * log((1.0_R8 + xd*xd)/2.0_R8) !--- formats ---------------------------------------- - character(*),parameter :: F01 = "('(dice_flux_atmIce) ',a, i7,2x,d21.14)" - character(*),parameter :: subName = "(dice_flux_atmIce) " + character(len=*),parameter :: F01 = "('(dice_flux_atmIce) ',a, i7,2x,d21.14)" + character(len=*),parameter :: subName = "(dice_flux_atmIce) " !------------------------------------------------------------------------------- lsize = size(tbot) diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 534abbd77..2b0afedb0 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -48,7 +48,7 @@ module cdeps_dice_comp use dice_datamode_cplhist_mod , only : dice_datamode_cplhist_restart_write implicit none - private ! except + private public :: SetServices public :: SetVM @@ -75,7 +75,7 @@ module cdeps_dice_comp integer :: logunit ! logging unit number logical :: restart_read ! start from restart character(CL) :: case_name ! case name - character(*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: nullstr = 'null' ! dice_in namelist input character(CX) :: streamfilename = nullstr ! filename to obtain stream info from @@ -110,11 +110,11 @@ module cdeps_dice_comp logical :: diagnose_data = .true. integer , parameter :: main_task=0 ! task number of main task #ifdef CESMCOUPLED - character(*) , parameter :: modName = "(ice_comp_nuopc)" + character(len=*) , parameter :: modName = "(ice_comp_nuopc)" #else - character(*) , parameter :: modName = "(cdeps_dice_comp)" + character(len=*) , parameter :: modName = "(cdeps_dice_comp)" #endif - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -220,17 +220,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if ! write namelist input to standard out - write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) - write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) - write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) - write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global - write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global - write(logunit,'(2a,d13.5)') trim(subname),' flux_swpf = ',flux_swpf - write(logunit,'(2a,d13.5)') trim(subname),' flux_Qmin = ',flux_Qmin - write(logunit,'(2a,l6)') trim(subname),' flux_Qacc = ',flux_Qacc - write(logunit,'(2a,d13.5)') trim(subname),' flux_Qacc0 = ',flux_Qacc0 - write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) - write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + write(logunit,'(3a)') subname,' datamode = ',trim(datamode) + write(logunit,'(3a)') subname,' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') subname,' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') subname,' nx_global = ',nx_global + write(logunit,'(2a,i0)') subname,' ny_global = ',ny_global + write(logunit,'(2a,d13.5)') subname,' flux_swpf = ',flux_swpf + write(logunit,'(2a,d13.5)') subname,' flux_Qmin = ',flux_Qmin + write(logunit,'(2a,l6)') subname,' flux_Qacc = ',flux_Qacc + write(logunit,'(2a,d13.5)') subname,' flux_Qacc0 = ',flux_Qacc0 + write(logunit,'(3a)') subname,' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') subname,' export_all = ',export_all bcasttmp = 0 bcasttmp(1) = nx_global @@ -271,7 +271,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Validate datamode select case (trim(datamode)) case('ssmi','ssmi_iaf','cplhist') - if (mainproc) write(logunit,'(3a)') trim(subname),' dice datamode = ',trim(datamode) + if (mainproc) write(logunit,'(3a)') subname,' dice datamode = ',trim(datamode) case default call shr_log_error(' ERROR illegal dice datamode = '//trim(datamode), rc=rc) return @@ -485,7 +485,7 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod ! local variables character(len=CL) :: rpfile - character(*), parameter :: subName = "(dice_comp_run) " + character(len=*), parameter :: subName = "(dice_comp_run) " !------------------------------------------------------------------------------- rc = ESMF_SUCCESS diff --git a/dlnd/dlnd_datamode_glc_forcing_mod.F90 b/dlnd/dlnd_datamode_glc_forcing_mod.F90 index b330af8c7..b1396d4c4 100644 --- a/dlnd/dlnd_datamode_glc_forcing_mod.F90 +++ b/dlnd/dlnd_datamode_glc_forcing_mod.F90 @@ -12,7 +12,7 @@ module dlnd_datamode_glc_forcing_mod use glc_elevclass_mod, only : glc_elevclass_as_string, glc_elevclass_init implicit none - private ! except + private public :: dlnd_datamode_glc_forcing_advertise public :: dlnd_datamode_glc_forcing_init_pointers @@ -34,8 +34,8 @@ module dlnd_datamode_glc_forcing_mod integer :: glc_nec - character(*), parameter :: nullstr = 'null' - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: nullstr = 'null' + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -148,17 +148,17 @@ subroutine dlnd_datamode_glc_forcing_init_pointers(exportState, sdat, model_frac end if strm_fld = 'Sl_tsrf_elev'//trim(nec_str) call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Sl_tsrf_elev(ng)%ptr, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) + errmsg=subname//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return strm_fld = 'Sl_topo_elev'//trim(nec_str) call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Sl_topo_elev(ng)%ptr, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) + errmsg=subname//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return strm_fld = 'Flgl_qice_elev'//trim(nec_str) call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Flgl_qice_elev(ng)%ptr, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) + errmsg=subname//'ERROR: '//trim(strm_fld)//' must be associated for dlnd glc_forcing datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do diff --git a/dlnd/dlnd_datamode_rof_forcing_mod.F90 b/dlnd/dlnd_datamode_rof_forcing_mod.F90 index 51310ac1d..379549898 100644 --- a/dlnd/dlnd_datamode_rof_forcing_mod.F90 +++ b/dlnd/dlnd_datamode_rof_forcing_mod.F90 @@ -12,7 +12,7 @@ module dlnd_datamode_rof_forcing_mod use shr_lnd2rof_tracers_mod , only : shr_lnd2rof_tracers_readnl implicit none - private ! except + private public :: dlnd_datamode_rof_forcing_advertise public :: dlnd_datamode_rof_forcing_init_pointers @@ -43,8 +43,8 @@ module dlnd_datamode_rof_forcing_mod integer :: ntracers_nonh2o - character(*), parameter :: nullstr = 'null' - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: nullstr = 'null' + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -177,29 +177,29 @@ subroutine dlnd_datamode_rof_forcing_init_pointers(exportState, sdat, model_frac strm_fld = trim('Flrl_rofsur_nonh2o') // trim(nchar) call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_Flrl_rofsur_nonh2o_2d(nf)%ptr, & requirePointer=.true., & - errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//& + errmsg=subname//'ERROR: '//trim(strm_fld)//& ' must be associated for dlnd rof_forcing datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do else if (ntracers_nonh2o == 1) then call shr_strdata_get_stream_pointer(sdat, 'Flrl_rofsur_nonh2o' , strm_Flrl_rofsur_nonh2o_1d, & requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Flrl_rofsur_1d '// & + errmsg=subname//'ERROR: strm_Flrl_rofsur_1d '// & ' must be associated for dlnd rof_forcing mode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if call shr_strdata_get_stream_pointer(sdat, 'Flrl_rofsur' , strm_Flrl_rofsur, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Flrl_rofsur be associated for dlnd rof_forcing mode', rc=rc) + errmsg=subname//'ERROR: strm_Flrl_rofsur be associated for dlnd rof_forcing mode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Flrl_rofsub' , strm_Flrl_rofsub, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Flrl_rofsub be associated for dlnd rof_forcing mode', rc=rc) + errmsg=subname//'ERROR: strm_Flrl_rofsub be associated for dlnd rof_forcing mode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Flrl_rofgwl' , strm_Flrl_rofgwl, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Flrl_rofgwl be associated for dlnd rof_forcing mode', rc=rc) + errmsg=subname//'ERROR: strm_Flrl_rofgwl be associated for dlnd rof_forcing mode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Flrl_rofi' , strm_Flrl_rofi, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Flrl_rofi be associated for dlnd rof_forcing mode', rc=rc) + errmsg=subname//'ERROR: strm_Flrl_rofi be associated for dlnd rof_forcing mode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! optional stream field pointer diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index 93079e111..56bcecd96 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -46,7 +46,7 @@ module cdeps_dlnd_comp use nuopc_shr_methods , only : shr_get_rpointer_name implicit none - private ! except + private public :: SetServices public :: SetVM @@ -74,7 +74,7 @@ module cdeps_dlnd_comp integer :: logunit ! logging unit number logical :: restart_read ! start from restart character(CL) :: case_name ! case name - character(*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: nullstr = 'null' ! dlnd_in namelist input character(CL) :: dataMode = nullstr ! flags physics options wrt input data @@ -100,12 +100,12 @@ module cdeps_dlnd_comp logical :: diagnose_data = .true. integer , parameter :: main_task=0 ! task number of main task #ifdef CESMCOUPLED - character(*) , parameter :: modName = "(lnd_comp_nuopc)" + character(len=*) , parameter :: modName = "(lnd_comp_nuopc)" #else - character(*) , parameter :: modName = "(cdeps_dlnd_comp)" + character(len=*) , parameter :: modName = "(cdeps_dlnd_comp)" #endif - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -233,20 +233,20 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out if (my_task == main_task) then - write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) - write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) - write(logunit,'(3a)') trim(subname),' datamode = ',datamode - write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global - write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global - write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) - write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read - write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + write(logunit,'(3a)') subname,' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') subname,' model_maskfile = ',trim(model_maskfile) + write(logunit,'(3a)') subname,' datamode = ',datamode + write(logunit,'(2a,i0)') subname,' nx_global = ',nx_global + write(logunit,'(2a,i0)') subname,' ny_global = ',ny_global + write(logunit,'(3a)') subname,' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') subname,' skip_restart_read = ',skip_restart_read + write(logunit,'(2a,l6)') subname,' export_all = ',export_all endif ! Validate sdat datamode select case (trim(datamode)) case('glc_forcing_mct','glc_forcing','rof_forcing') - if (my_task == main_task) write(logunit,'(3a)') trim(subname),' dlnd datamode = ',trim(datamode) + if (my_task == main_task) write(logunit,'(3a)') subname,' dlnd datamode = ',trim(datamode) case default call shr_log_error(' ERROR illegal dlnd datamode = '//trim(datamode), rc=rc) return @@ -413,8 +413,8 @@ subroutine ModelFinalize(gcomp, rc) integer, intent(out) :: rc ! local variables - character(*), parameter :: F00 = "('(dlnd_comp_final) ',8a)" - character(*), parameter :: F91 = "('(dlnd_comp_final) ',73('-'))" + character(len=*), parameter :: F00 = "('(dlnd_comp_final) ',8a)" + character(len=*), parameter :: F91 = "('(dlnd_comp_final) ',73('-'))" character(len=*),parameter :: subname=trim(modName)//':(ModelFinalize) ' !------------------------------------------------------------------------------- diff --git a/docn/docn_datamode_aquaplanet_mod.F90 b/docn/docn_datamode_aquaplanet_mod.F90 index e988b6dc2..62d5cc937 100644 --- a/docn/docn_datamode_aquaplanet_mod.F90 +++ b/docn/docn_datamode_aquaplanet_mod.F90 @@ -9,7 +9,7 @@ module docn_datamode_aquaplanet_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: docn_datamode_aquaplanet_advertise public :: docn_datamode_aquaplanet_init_pointers @@ -46,7 +46,7 @@ module docn_datamode_aquaplanet_mod real(r8) , parameter :: latrad8 = 30._r8*pio180 real(r8) , parameter :: lonrad = 30._r8*pio180 - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== diff --git a/docn/docn_datamode_cplhist_mod.F90 b/docn/docn_datamode_cplhist_mod.F90 index 898a8d421..141c20f64 100644 --- a/docn/docn_datamode_cplhist_mod.F90 +++ b/docn/docn_datamode_cplhist_mod.F90 @@ -10,7 +10,7 @@ module docn_datamode_cplhist_mod use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer implicit none - private ! except + private public :: docn_datamode_cplhist_advertise public :: docn_datamode_cplhist_init_pointers @@ -32,8 +32,8 @@ module docn_datamode_cplhist_mod real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity - character(*) , parameter :: nullstr = 'null' - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -103,7 +103,7 @@ subroutine docn_datamode_cplhist_init_pointers(exportState, sdat, ocn_fraction, ! initialize pointers to required stream fields call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_t must be associated for docn cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! initialize pointers to optional stream fields @@ -115,17 +115,17 @@ subroutine docn_datamode_cplhist_init_pointers(exportState, sdat, ocn_fraction, if (ChkErr(rc,__LINE__,u_FILE_u)) return if (associated(So_u) .and. .not. associated(strm_So_u)) then - call shr_log_error(trim(subname)//& + call shr_log_error(subname//& 'ERROR: strm_So_u must be associated if So_u is associated for docn cplhist mode', rc=rc) return end if if (associated(So_v) .and. .not. associated(strm_So_v)) then - call shr_log_error(trim(subname)//& + call shr_log_error(subname//& 'ERROR: strm_So_v must be associated if So_v is associated for docn cplhist mode', rc=rc) return end if if (associated(So_bldepth) .and. .not. associated(strm_So_bldepth)) then - call shr_log_error(trim(subname)//& + call shr_log_error(subname//& 'ERROR: strm_So_bldepth must be associated if So_bldepth is associated for docn cplhist mode', rc=rc) return end if diff --git a/docn/docn_datamode_multilev_cplhist_mod.F90 b/docn/docn_datamode_multilev_cplhist_mod.F90 index 1655ccf8e..a314dfa25 100644 --- a/docn/docn_datamode_multilev_cplhist_mod.F90 +++ b/docn/docn_datamode_multilev_cplhist_mod.F90 @@ -11,7 +11,7 @@ module docn_datamode_multilev_cplhist_mod use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type implicit none - private ! except + private public :: docn_datamode_multilev_cplhist_advertise public :: docn_datamode_multilev_cplhist_init_pointers @@ -32,7 +32,7 @@ module docn_datamode_multilev_cplhist_mod ! number of multi-level ocean fields integer, parameter :: nlev_export = 30 - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -106,14 +106,14 @@ subroutine docn_datamode_multilev_cplhist_init_pointers(exportState, sdat, ocn_f strm_fld = 'So_t_depth' // trim(num_str) call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_So_t_depth(ilev)%ptr, & requirePointer=.true., & - errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//& + errmsg=subname//'ERROR: '//trim(strm_fld)//& ' must be associated for docn multiplev_cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return strm_fld = 'So_s_depth' // trim(num_str) call shr_strdata_get_stream_pointer( sdat, trim(strm_fld), strm_So_s_depth(ilev)%ptr, & requirePointer=.true., & - errmsg=trim(subname)//'ERROR: '//trim(strm_fld)//& + errmsg=subname//'ERROR: '//trim(strm_fld)//& ' must be associated for docn multiplev_cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do diff --git a/docn/docn_datamode_multilev_mod.F90 b/docn/docn_datamode_multilev_mod.F90 index b60fe4a34..5a6299fcd 100644 --- a/docn/docn_datamode_multilev_mod.F90 +++ b/docn/docn_datamode_multilev_mod.F90 @@ -9,7 +9,7 @@ module docn_datamode_multilev_mod use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type implicit none - private ! except + private public :: docn_datamode_multilev_advertise public :: docn_datamode_multilev_init_pointers @@ -31,8 +31,8 @@ module docn_datamode_multilev_mod 1230., 1290., 1350., 1410., 1470., 1530., 1590., 1650., 1710., 1770. /) ! constants - character(*) , parameter :: nullstr = 'null' - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -94,10 +94,10 @@ subroutine docn_datamode_multilev_init_pointers(exportState, sdat, ocn_fraction, ! Set stream pointers (this has the full set of leveles in the stream data) call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, & - errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_t_depth must be associated for docn multilev datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, & - errmsg=trim(subname)//'ERROR: strm_So_s_depth must be associated for docn multilev datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_s_depth must be associated for docn multilev datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize export state pointers to non-zero diff --git a/docn/docn_datamode_multilev_sstdata_mod.F90 b/docn/docn_datamode_multilev_sstdata_mod.F90 index ae0896f5a..cdb886503 100644 --- a/docn/docn_datamode_multilev_sstdata_mod.F90 +++ b/docn/docn_datamode_multilev_sstdata_mod.F90 @@ -10,7 +10,7 @@ module docn_datamode_multilev_sstdata_mod use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type, shr_strdata_get_stream_count implicit none - private ! except + private public :: docn_datamode_multilev_sstdata_advertise public :: docn_datamode_multilev_sstdata_init_pointers @@ -39,7 +39,7 @@ module docn_datamode_multilev_sstdata_mod real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -114,13 +114,13 @@ subroutine docn_datamode_multilev_sstdata_init_pointers(exportState, sdat, ocn_f ! initialize pointers to stream fields ! this has the full set of leveles in the stream data call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, & - errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn multilev_sstdata datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_t must be associated for docn multilev_sstdata datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_t_depth', strm_So_t_depth, & - errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_sstdata datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_t_depth must be associated for docn multilev_sstdata datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_s_depth', strm_So_s_depth, & - errmsg=trim(subname)//'ERROR: strm_So_t_depth must be associated for docn multilev_sstdata datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_t_depth must be associated for docn multilev_sstdata datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize export state pointers to non-zero @@ -171,7 +171,7 @@ subroutine docn_datamode_multilev_sstdata_advance(sdat, logunit, mainproc, rc) if (nlev_stream > 1) exit end do if (nlev_stream == 0) then - call shr_log_error(trim(subname)//" could not find vertical levels greater than 0", rc=rc) + call shr_log_error(subname//" could not find vertical levels greater than 0", rc=rc) return end if allocate(stream_vlevs(nlev_stream)) @@ -214,7 +214,7 @@ subroutine docn_datamode_multilev_sstdata_advance(sdat, logunit, mainproc, rc) end if end do if (.not. level_found) then - call shr_log_error(trim(subname)//" could not find level bounds for vertical interpolation", rc=rc) + call shr_log_error(subname//" could not find level bounds for vertical interpolation", rc=rc) return end if end do diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index a93410350..c0d67cbe7 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -18,7 +18,7 @@ module docn_datamode_som_mod use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add implicit none - private ! except + private public :: docn_datamode_som_advertise public :: docn_datamode_som_init_pointers @@ -71,7 +71,7 @@ module docn_datamode_som_mod real(r8) , parameter :: latice = shr_const_latice ! latent heat of fusion real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -206,28 +206,28 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f ! Initialize pointers to stream fields call shr_strdata_get_stream_pointer( sdat, 'So_t' , strm_So_t, & - errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn som datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_t must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_s' , strm_So_s, & - errmsg=trim(subname)//'ERROR: strm_So_s must be associated for docn som datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_s must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_u' , strm_So_u, & - errmsg=trim(subname)//'ERROR: strm_So_u must be associated for docn som datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_u must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_v' , strm_So_v, & - errmsg=trim(subname)//'ERROR: strm_So_v must be associated for docn som datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_v must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_dhdx' , strm_So_dhdx, & - errmsg=trim(subname)//'ERROR: strm_So_dhdx must be associated for docn som datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_dhdx must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_dhdy' , strm_So_dhdy, & - errmsg=trim(subname)//'ERROR: strm_So_dhdy must be associated for docn som datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_dhdy must be associated for docn som datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_h' , strm_So_h, & - errmsg=trim(subname)//'ERROR: strm_So_h must be associated for docn som datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_h must be associated for docn som datamode', rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'So_qbot' , strm_So_qbot, & - errmsg=trim(subname)//'ERROR: strm_So_qbot must be associated for docn som datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_qbot must be associated for docn som datamode', rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return ! Set export state ocean fraction (So_omask) diff --git a/docn/docn_datamode_sstdata_mod.F90 b/docn/docn_datamode_sstdata_mod.F90 index 11ea27d71..2c4821526 100644 --- a/docn/docn_datamode_sstdata_mod.F90 +++ b/docn/docn_datamode_sstdata_mod.F90 @@ -10,7 +10,7 @@ module docn_datamode_sstdata_mod use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer implicit none - private ! except + private public :: docn_datamode_sstdata_advertise public :: docn_datamode_sstdata_init_pointers @@ -29,8 +29,8 @@ module docn_datamode_sstdata_mod real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity - character(*) , parameter :: nullstr = 'null' - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -98,7 +98,7 @@ subroutine docn_datamode_sstdata_init_pointers(exportState, sdat, ocn_fraction, ! initialize pointer to stream field call shr_strdata_get_stream_pointer( sdat, 'So_t', strm_So_t, & - errmsg=trim(subname)//'ERROR: strm_So_t must be associated for docn sstdata datamode', rc=rc) + errmsg=subname//'ERROR: strm_So_t must be associated for docn sstdata datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize value of export state diff --git a/docn/docn_import_data_mod.F90 b/docn/docn_import_data_mod.F90 index ea4b423c7..6a74b2dc0 100644 --- a/docn/docn_import_data_mod.F90 +++ b/docn/docn_import_data_mod.F90 @@ -7,13 +7,13 @@ module docn_import_data_mod use dshr_methods_mod , only : chkerr implicit none - private ! except + private public :: docn_import_data_advertise private :: docn_get_import_fields - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 05c646084..54abfd371 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -68,7 +68,7 @@ module cdeps_docn_comp use docn_import_data_mod , only : docn_import_data_advertise implicit none - private ! except + private public :: SetServices public :: SetVM @@ -96,7 +96,7 @@ module cdeps_docn_comp integer :: logunit ! logging unit number logical :: restart_read ! start from restart character(CL) :: case_name - character(*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: nullstr = 'null' ! docn_in namelist input character(CX) :: streamfilename = nullstr ! filename to obtain stream info from @@ -129,12 +129,12 @@ module cdeps_docn_comp logical :: diagnose_data = .true. integer , parameter :: main_task = 0 ! task number of main task #ifdef CESMCOUPLED - character(*) , parameter :: module_name = "(ocn_comp_nuopc)" + character(len=*) , parameter :: module_name = "(ocn_comp_nuopc)" #else - character(*) , parameter :: module_name = "(cdeps_docn_comp)" + character(len=*) , parameter :: module_name = "(cdeps_docn_comp)" #endif - character(*) , parameter :: modelname = 'docn' - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: modelname = 'docn' + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -234,7 +234,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) close(nu) if (ierr > 0) then if (mainproc) then - write(logunit,'(2a,i0)') trim(subname), & + write(logunit,'(2a,i0)') subname, & 'ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr end if call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) @@ -242,17 +242,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if ! write namelist input to standard out - write(logunit,'(3a)') trim(subname),' case_name = ',trim(case_name) - write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) - write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) - write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) - write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global - write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global - write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) - write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read - write(logunit,'(3a)') trim(subname),' import_data_fields = ',trim(import_data_fields) - write(logunit,'(2a,es13.6)') trim(subname),' sst_constant_value = ',sst_constant_value - write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + write(logunit,'(3a)') subname,' case_name = ',trim(case_name) + write(logunit,'(3a)') subname,' datamode = ',trim(datamode) + write(logunit,'(3a)') subname,' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') subname,' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') subname,' nx_global = ',nx_global + write(logunit,'(2a,i0)') subname,' ny_global = ',ny_global + write(logunit,'(3a)') subname,' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') subname,' skip_restart_read = ',skip_restart_read + write(logunit,'(3a)') subname,' import_data_fields = ',trim(import_data_fields) + write(logunit,'(2a,es13.6)') subname,' sst_constant_value = ',sst_constant_value + write(logunit,'(2a,l6)') subname,' export_all = ',export_all bcasttmp = 0 bcasttmp(1) = nx_global @@ -314,7 +314,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) case ( 'sstdata', 'sst_aquap_file', 'som', 'som_aquap', & 'cplhist', 'sst_aquap_analytic', 'sst_aquap_constant', & 'multilev_cplhist', 'multilev', 'multilev_sstdata' ) - if (mainproc) write(logunit,'(3a)') trim(subname),'docn datamode = ',trim(datamode) + if (mainproc) write(logunit,'(3a)') subname,'docn datamode = ',trim(datamode) case default call shr_log_error(' ERROR illegal docn datamode = '//trim(datamode), rc=rc) return @@ -381,7 +381,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - call ESMF_VMLogMemInfo("Entering "//trim(subname)) + call ESMF_VMLogMemInfo("Entering "//subname) ! Initialize model mesh, restart flag, logunit, model_mask and model_frac call ESMF_TraceRegionEnter('docn_strdata_init') @@ -443,7 +443,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! ******************* ! *** RETURN HERE *** ! ******************* - call ESMF_VMLogMemInfo("Leaving "//trim(subname)) + call ESMF_VMLogMemInfo("Leaving "//subname) RETURN end if @@ -463,7 +463,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_SetScalar(dble(ny_global),flds_scalar_index_ny, exportState, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMLogMemInfo("Leaving "//trim(subname)) + call ESMF_VMLogMemInfo("Leaving "//subname) end subroutine InitializeRealize !=============================================================================== @@ -536,7 +536,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar ! local variables character(len=CL) :: rpfile ! restart pointer file name - character(*), parameter :: subName = "(docn_comp_run) " + character(len=*), parameter :: subName = "(docn_comp_run) " !------------------------------------------------------------------------------- rc = ESMF_SUCCESS diff --git a/drof/drof_datamode_copyall.F90 b/drof/drof_datamode_copyall.F90 index eb2f1391e..5d584c4f6 100644 --- a/drof/drof_datamode_copyall.F90 +++ b/drof/drof_datamode_copyall.F90 @@ -9,7 +9,7 @@ module drof_datamode_copyall_mod use shr_const_mod , only : SHR_CONST_SPVAL implicit none - private ! except + private public :: drof_datamode_copyall_advertise public :: drof_datamode_copyall_init_pointers @@ -23,7 +23,7 @@ module drof_datamode_copyall_mod real(r8), pointer :: strm_Forr_rofl(:) => null() ! always required real(r8), pointer :: strm_Forr_rofi(:) => null() ! sometimes present in stream - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -81,7 +81,7 @@ subroutine drof_datamode_copyall_init_pointers(exportState, sdat, rc) ! Initialize module pointers call shr_strdata_get_stream_pointer( sdat, 'Forr_rofl', strm_Forr_rofl, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Forr_rofl must be associated for drof', rc=rc) + errmsg=subname//'ERROR: strm_Forr_rofl must be associated for drof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Forr_rofi', strm_Forr_rofi, rc=rc) diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 1f5eec9d9..ac4886871 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -40,7 +40,7 @@ module cdeps_drof_comp use drof_datamode_copyall_mod, only : drof_datamode_copyall_advance implicit none - private ! except + private public :: SetServices public :: SetVM @@ -68,7 +68,7 @@ module cdeps_drof_comp integer :: logunit ! logging unit number logical :: restart_read character(CL) :: case_name ! case name - character(*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: nullstr = 'null' ! drof_in namelist input character(CX) :: streamfilename = nullstr ! filename to obtain stream info from character(CX) :: nlfilename = nullstr ! filename to obtain namelist info from @@ -85,9 +85,9 @@ module cdeps_drof_comp integer , parameter :: main_task=0 ! task number of main task #ifdef CESMCOUPLED - character(*) , parameter :: modName = "(rof_comp_nuopc)" + character(len=*) , parameter :: modName = "(rof_comp_nuopc)" #else - character(*) , parameter :: modName = "(cdeps_drof_comp)" + character(len=*) , parameter :: modName = "(cdeps_drof_comp)" #endif ! linked lists @@ -97,7 +97,7 @@ module cdeps_drof_comp real(r8), pointer :: model_frac(:) ! currently not used integer , pointer :: model_mask(:) ! currently not used - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -196,21 +196,21 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) close(nu) if (ierr > 0) then rc = ierr - write(logunit,'(a,i0)') trim(subname), & + write(logunit,'(a,i0)') subname, & ' ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) return end if ! write namelist input to standard out - write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) - write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) - write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) - write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global - write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global - write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) - write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read - write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + write(logunit,'(3a)') subname,' datamode = ',trim(datamode) + write(logunit,'(3a)') subname,' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') subname,' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') subname,' nx_global = ',nx_global + write(logunit,'(2a,i0)') subname,' ny_global = ',ny_global + write(logunit,'(3a)') subname,' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') subname,' skip_restart_read = ',skip_restart_read + write(logunit,'(2a,l6)') subname,' export_all = ',export_all bcasttmp = 0 bcasttmp(1) = nx_global @@ -243,7 +243,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) select case (trim(datamode)) case('copyall') if (mainproc) then - write(logunit,'(2a)') trim(subname),'drof datamode = ',trim(datamode) + write(logunit,'(2a)') subname,'drof datamode = ',trim(datamode) end if case default call shr_log_error(' ERROR illegal drof datamode = '//trim(datamode), rc=rc) @@ -384,7 +384,7 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri ! local variables character(len=CL) :: rpfile - character(*), parameter :: subName = "(drof_comp_run) " + character(len=*), parameter :: subName = "(drof_comp_run) " !-------------------------------- rc = ESMF_SUCCESS diff --git a/dshr/dshr_dfield_mod.F90 b/dshr/dshr_dfield_mod.F90 index b10ca3160..9420dc185 100644 --- a/dshr/dshr_dfield_mod.F90 +++ b/dshr/dshr_dfield_mod.F90 @@ -40,7 +40,7 @@ module dshr_dfield_mod end type dfield_type integer , parameter :: iunset = -999 - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -117,7 +117,7 @@ subroutine dshr_dfield_add_1d(dfields, sdat, state_fld, strm_fld, state, logunit if (chkerr(rc,__LINE__,u_FILE_u)) return dfield_new%state_data1d = 0.0_r8 if (mainproc) then - write(logunit,'(3a)') trim(subname),' setting pointer for export state ',trim(state_fld) + write(logunit,'(3a)') subname,' setting pointer for export state ',trim(state_fld) end if end subroutine dshr_dfield_add_1d @@ -194,7 +194,7 @@ subroutine dshr_dfield_add_1d_stateptr(dfields, sdat, state_fld, strm_fld, state if (chkerr(rc,__LINE__,u_FILE_u)) return dfield_new%state_data1d = 0.0_r8 if (mainproc) then - write(logunit,'(3a)') trim(subname),' setting pointer for export state ',trim(state_fld) + write(logunit,'(3a)') subname,' setting pointer for export state ',trim(state_fld) end if ! Return array pointer if argument is present @@ -203,7 +203,7 @@ subroutine dshr_dfield_add_1d_stateptr(dfields, sdat, state_fld, strm_fld, state ! write output if (mainproc) then if (found) then - write(logunit,'(4a,i0,a,i0)') trim(subname),& + write(logunit,'(4a,i0,a,i0)') subname,& ' setting pointer to stream field strm_',trim(strm_fld), & ' stream index = ',ns,' field bundle index= ',nf end if @@ -297,7 +297,7 @@ subroutine dshr_dfield_add_2d(dfields, sdat, state_fld, strm_flds, state, & if (trim(strm_flds(nf)) == trim(lfieldnamelist(n))) then dfield_new%fldbun_indices(nf) = n if (mainproc) then - write(logunit,'(5a)') trim(subname), & + write(logunit,'(5a)') subname, & ' using stream field strm_',trim(strm_flds(nf)),' for 2d ',trim(state_fld) end if end if @@ -314,7 +314,7 @@ subroutine dshr_dfield_add_2d(dfields, sdat, state_fld, strm_flds, state, & if (chkerr(rc,__LINE__,u_FILE_u)) return dfield_new%state_data2d(:,:) = 0._r8 if (mainproc) then - write(logunit,'(3a)') trim(subname),' setting pointer for export state ',trim(state_fld) + write(logunit,'(3a)') subname,' setting pointer for export state ',trim(state_fld) end if end subroutine dshr_dfield_add_2d @@ -404,7 +404,7 @@ subroutine dshr_dfield_add_2d_stateptr(dfields, sdat, state_fld, strm_flds, stat if (trim(strm_flds(nf)) == trim(lfieldnamelist(n))) then dfield_new%fldbun_indices(nf) = n if (mainproc) then - write(logunit,'(5a)') trim(subname), & + write(logunit,'(5a)') subname, & ' using stream field strm_',trim(strm_flds(nf)),' for 2d ',trim(state_fld) end if end if @@ -421,7 +421,7 @@ subroutine dshr_dfield_add_2d_stateptr(dfields, sdat, state_fld, strm_flds, stat if (chkerr(rc,__LINE__,u_FILE_u)) return dfield_new%state_data2d(:,:) = 0._r8 if (mainproc) then - write(logunit,'(3a)') trim(subname),' setting pointer for export state ',trim(state_fld) + write(logunit,'(3a)') subname,' setting pointer for export state ',trim(state_fld) end if state_ptr => dfield_new%state_data2d diff --git a/dshr/dshr_fldlist_mod.F90 b/dshr/dshr_fldlist_mod.F90 index a06912fc1..fd15c3919 100644 --- a/dshr/dshr_fldlist_mod.F90 +++ b/dshr/dshr_fldlist_mod.F90 @@ -22,7 +22,7 @@ module dshr_fldlist_mod type(fldlist_type), pointer :: next => null() end type fldlist_type - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -87,7 +87,7 @@ subroutine dshr_fldlist_realize(state, fldLists, flds_scalar_name, flds_scalar_n end if if (stdname == trim(flds_scalar_name)) then - call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected on root pe", & + call ESMF_LogWrite(subname//trim(tag)//" Field = "//trim(stdname)//" is connected on root pe", & ESMF_LOGMSG_INFO) ! Create the scalar field call SetScalarField(field, flds_scalar_name, flds_scalar_num, rc=rc) @@ -103,7 +103,7 @@ subroutine dshr_fldlist_realize(state, fldLists, flds_scalar_name, flds_scalar_n field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return end if - call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected using mesh", & + call ESMF_LogWrite(subname//trim(tag)//" Field = "//trim(stdname)//" is connected using mesh", & ESMF_LOGMSG_INFO) endif diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index 214f5ba3d..c0f6afff3 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -78,7 +78,7 @@ module dshr_mod logical :: write_restart_at_endofrun integer , parameter :: main_task = 0 - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -99,7 +99,7 @@ subroutine dshr_model_initphase(gcomp, importState, exportState, clock, rc) rc = ESMF_SUCCESS ! To prevent an unused variable warning if(.not. (ESMF_StateIsCreated(importState) .or. ESMF_StateIsCreated(exportState) .or. ESMF_ClockIsCreated(clock))) then - call shr_log_error(trim(subname)//' state or clock not created', rc=rc) + call shr_log_error(subname//' state or clock not created', rc=rc) return endif @@ -154,7 +154,7 @@ subroutine dshr_init(gcomp, compname, mpicom, my_task, inst_index, inst_suffix, if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent .and. isSet) then flds_scalar_name = trim(cvalue) - call ESMF_LogWrite(trim(subname)//' flds_scalar_name = '//trim(flds_scalar_name), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//' flds_scalar_name = '//trim(flds_scalar_name), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif @@ -163,7 +163,7 @@ subroutine dshr_init(gcomp, compname, mpicom, my_task, inst_index, inst_suffix, if (isPresent .and. isSet) then read(cvalue, *) flds_scalar_num write(logmsg,*) flds_scalar_num - call ESMF_LogWrite(trim(subname)//' flds_scalar_num = '//trim(logmsg), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//' flds_scalar_num = '//trim(logmsg), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif @@ -172,7 +172,7 @@ subroutine dshr_init(gcomp, compname, mpicom, my_task, inst_index, inst_suffix, if (isPresent .and. isSet) then read(cvalue,*) flds_scalar_index_nx write(logmsg,*) flds_scalar_index_nx - call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_nx = '//trim(logmsg), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//' : flds_scalar_index_nx = '//trim(logmsg), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif @@ -181,7 +181,7 @@ subroutine dshr_init(gcomp, compname, mpicom, my_task, inst_index, inst_suffix, if (isPresent .and. isSet) then read(cvalue,*) flds_scalar_index_ny write(logmsg,*) flds_scalar_index_ny - call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_ny = '//trim(logmsg), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//' : flds_scalar_index_ny = '//trim(logmsg), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif @@ -203,7 +203,7 @@ subroutine dshr_init(gcomp, compname, mpicom, my_task, inst_index, inst_suffix, call set_component_logging(gcomp, my_task == main_task, logunit, slogunit, rc=rc) #else if (my_task == main_task) then - call ESMF_LogWrite(trim(subname)//' : output logging is written to '//trim(diro)//"/"//trim(logfile), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//' : output logging is written to '//trim(diro)//"/"//trim(logfile), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return open(newunit=logunit, file=trim(diro)//"/"//trim(logfile)) @@ -271,7 +271,7 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo logical :: isPresent, isSet logical :: exists ! check for file existence real(r8) :: scol_spval = -999._r8 - character(*) , parameter :: F00 ="('(dshr_mesh_init) ',a)" + character(len=*) , parameter :: F00 ="('(dshr_mesh_init) ',a)" character(len=*), parameter :: subname='(dshr_mod:dshr_mesh_init)' ! ---------------------------------------------- @@ -332,13 +332,13 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo inquire(file=trim(model_meshfile), exist=exists) if (.not.exists) then write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_log_error(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist', rc=rc) + call shr_log_error(subname//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist', rc=rc) return end if inquire(file=trim(model_maskfile), exist=exists) if (.not.exists) then write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_log_error(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist', rc=rc) + call shr_log_error(subname//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist', rc=rc) return end if endif @@ -356,9 +356,9 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo if (ChkErr(rc,__LINE__,u_FILE_u)) return if (mainproc) then - write(logunit,F00) trim(subname)// " obtained "//trim(compname)//" mesh from "// & + write(logunit,F00) subname// " obtained "//trim(compname)//" mesh from "// & trim(model_meshfile) - write(logunit,F00) trim(subname)// " obtained "//trim(compname)//" mask from "// & + write(logunit,F00) subname// " obtained "//trim(compname)//" mask from "// & trim(model_maskfile) end if @@ -384,7 +384,7 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo if (ChkErr(rc,__LINE__,u_FILE_u)) return if (mainproc) then - write(logunit,F00) trim(subname)// " obtained "//trim(compname)//" mesh and mask from "// & + write(logunit,F00) subname// " obtained "//trim(compname)//" mesh and mask from "// & trim(model_meshfile) end if end if @@ -601,8 +601,8 @@ subroutine dshr_restart_read(rest_filem, rpfile, & type(io_desc_t) :: pio_iodesc integer :: rcode integer :: tmp(1) - character(*), parameter :: F00 = "('(dshr_restart_read) ',8a)" - character(*), parameter :: subName = "(dshr_restart_read) " + character(len=*), parameter :: F00 = "('(dshr_restart_read) ',8a)" + character(len=*), parameter :: subName = "(dshr_restart_read) " !------------------------------------------------------------------------------- rc = ESMF_SUCCESS ! no streams means no restart file is read. @@ -682,7 +682,7 @@ subroutine dshr_restart_write(rpfile, case_name, model_name, inst_suffix, ymd, t type(io_desc_t) :: pio_iodesc integer :: oldmode integer :: rcode - character(*), parameter :: F00 = "('(dshr_restart_write) ',2a,2(i0,2x))" + character(len=*), parameter :: F00 = "('(dshr_restart_write) ',2a,2(i0,2x))" !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -788,7 +788,7 @@ subroutine dshr_state_getscalar(state, scalar_id, scalar_value, flds_scalar_name call ESMF_FieldGet(field, farrayPtr = farrayptr, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then - call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO, line=__LINE__, file=u_FILE_u) + call ESMF_LogWrite(subname//": ERROR in scalar_id", ESMF_LOGMSG_INFO, line=__LINE__, file=u_FILE_u) rc = ESMF_FAILURE if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return endif @@ -837,7 +837,7 @@ subroutine dshr_state_setscalar(scalar_value, scalar_id, State, flds_scalar_name call ESMF_FieldGet(lfield, farrayPtr = farrayptr, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then - call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//": ERROR in scalar_id", ESMF_LOGMSG_INFO) rc = ESMF_FAILURE return endif @@ -891,8 +891,8 @@ subroutine dshr_orbital_init(gcomp, logunit, maintask, rc) if (trim(orb_mode) == trim(orb_fixed_year)) then if (orb_iyear == SHR_ORB_UNDEF_INT) then if (maintask) then - write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) - write(logunit,*) trim(subname),' ERROR: fixed_year settings = ',orb_iyear + write(logunit,*) subname,' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) subname,' ERROR: fixed_year settings = ',orb_iyear write (msgstr, *) ' ERROR: invalid settings for orb_mode '//trim(orb_mode) end if call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) @@ -905,8 +905,8 @@ subroutine dshr_orbital_init(gcomp, logunit, maintask, rc) elseif (trim(orb_mode) == trim(orb_variable_year)) then if (orb_iyear == SHR_ORB_UNDEF_INT .or. orb_iyear_align == SHR_ORB_UNDEF_INT) then if (maintask) then - write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) - write(logunit,*) trim(subname),' ERROR: variable_year settings = ',orb_iyear, orb_iyear_align + write(logunit,*) subname,' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) subname,' ERROR: variable_year settings = ',orb_iyear, orb_iyear_align write (msgstr, *) subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode) end if call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) @@ -920,10 +920,10 @@ subroutine dshr_orbital_init(gcomp, logunit, maintask, rc) !-- force orb_iyear to undef to make sure shr_orb_params works properly if (orb_eccen == SHR_ORB_UNDEF_REAL .or. orb_obliq == SHR_ORB_UNDEF_REAL .or. orb_mvelp == SHR_ORB_UNDEF_REAL) then if (maintask) then - write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) - write(logunit,*) trim(subname),' ERROR: orb_eccen = ',orb_eccen - write(logunit,*) trim(subname),' ERROR: orb_obliq = ',orb_obliq - write(logunit,*) trim(subname),' ERROR: orb_mvelp = ',orb_mvelp + write(logunit,*) subname,' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) subname,' ERROR: orb_eccen = ',orb_eccen + write(logunit,*) subname,' ERROR: orb_obliq = ',orb_obliq + write(logunit,*) subname,' ERROR: orb_mvelp = ',orb_mvelp write (msgstr, *) subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode) end if call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) @@ -1182,7 +1182,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else if (trim(cvalue) .eq. '64BIT_DATA') then sdat%io_format = PIO_64BIT_DATA else - call ESMF_LogWrite(trim(subname)//'-'//trim(cname)// & + call ESMF_LogWrite(subname//'-'//trim(cname)// & ' : need to provide valid option for pio_ioformat'// & ' (CLASSIC|64BIT_OFFSET|64BIT_DATA)', ESMF_LOGMSG_INFO) rc = ESMF_FAILURE @@ -1192,7 +1192,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) cvalue = '64BIT_OFFSET' sdat%io_format = PIO_64BIT_OFFSET end if - if (my_task == main_task) write(logunit,*) trim(subname)//' : pio_netcdf_format = ', & + if (my_task == main_task) write(logunit,*) subname//' : pio_netcdf_format = ', & trim(cvalue), sdat%io_format ! pio_typename @@ -1211,7 +1211,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else if (trim(cvalue) .eq. 'NETCDF4P') then sdat%io_type = PIO_IOTYPE_NETCDF4P else - call ESMF_LogWrite(trim(subname)//'-'//trim(cname)// & + call ESMF_LogWrite(subname//'-'//trim(cname)// & ' : need to provide valid option for pio_typename'// & ' (NETCDF|PNETCDF|NETCDF4C|NETCDF4P)', ESMF_LOGMSG_INFO) rc = ESMF_FAILURE @@ -1221,7 +1221,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) cvalue = 'NETCDF' sdat%io_type = PIO_IOTYPE_NETCDF end if - if (my_task == main_task) write(logunit,*) trim(subname)//' : pio_typename = ', & + if (my_task == main_task) write(logunit,*) subname//' : pio_typename = ', & trim(cvalue), sdat%io_type ! pio_root @@ -1238,7 +1238,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else pio_root = 1 end if - if (my_task == main_task) write(logunit,*) trim(subname)//' : pio_root = ', & + if (my_task == main_task) write(logunit,*) subname//' : pio_root = ', & pio_root ! pio_stride @@ -1251,7 +1251,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else pio_stride = -99 end if - if (my_task == main_task) write(logunit,*) trim(subname)//' : pio_stride = ', & + if (my_task == main_task) write(logunit,*) subname//' : pio_stride = ', & pio_stride ! pio_numiotasks @@ -1264,7 +1264,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else pio_numiotasks = -99 end if - if (my_task == main_task) write(logunit,*) trim(subname)//' : pio_numiotasks = ', & + if (my_task == main_task) write(logunit,*) subname//' : pio_numiotasks = ', & pio_numiotasks ! check for parallel IO, it requires at least two io pes @@ -1275,23 +1275,23 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) pio_stride = min(pio_stride, petCount/2) if (my_task == main_task) then write(logunit,*) ' parallel io requires at least two io pes - following parameters are updated:' - write(logunit,*) trim(subname)//' : pio_stride = ', pio_stride - write(logunit,*) trim(subname)//' : pio_numiotasks = ', pio_numiotasks + write(logunit,*) subname//' : pio_stride = ', pio_stride + write(logunit,*) subname//' : pio_numiotasks = ', pio_numiotasks end if endif ! check/set/correct io pio parameters if (pio_stride > 0 .and. pio_numiotasks < 0) then pio_numiotasks = max(1, petCount/pio_stride) - if (my_task == main_task) write(logunit,*) trim(subname)//' : update pio_numiotasks = ', pio_numiotasks + if (my_task == main_task) write(logunit,*) subname//' : update pio_numiotasks = ', pio_numiotasks else if(pio_numiotasks > 0 .and. pio_stride < 0) then pio_stride = max(1, petCount/pio_numiotasks) - if (my_task == main_task) write(logunit,*) trim(subname)//' : update pio_stride = ', pio_stride + if (my_task == main_task) write(logunit,*) subname//' : update pio_stride = ', pio_stride else if(pio_numiotasks < 0 .and. pio_stride < 0) then pio_stride = max(1,petCount/4) pio_numiotasks = max(1,petCount/pio_stride) - if (my_task == main_task) write(logunit,*) trim(subname)//' : update pio_numiotasks = ', pio_numiotasks - if (my_task == main_task) write(logunit,*) trim(subname)//' : update pio_stride = ', pio_stride + if (my_task == main_task) write(logunit,*) subname//' : update pio_numiotasks = ', pio_numiotasks + if (my_task == main_task) write(logunit,*) subname//' : update pio_stride = ', pio_stride end if if (pio_stride == 1) then pio_root = 0 @@ -1316,15 +1316,15 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) end if if (my_task == main_task) then write(logunit,*) 'pio_stride, iotasks or root out of bounds - resetting to defaults:' - write(logunit,*) trim(subname)//' : pio_root = ', pio_root - write(logunit,*) trim(subname)//' : pio_stride = ', pio_stride - write(logunit,*) trim(subname)//' : pio_numiotasks = ', pio_numiotasks + write(logunit,*) subname//' : pio_root = ', pio_root + write(logunit,*) subname//' : pio_stride = ', pio_stride + write(logunit,*) subname//' : pio_numiotasks = ', pio_numiotasks end if end if ! init PIO allocate(sdat%pio_subsystem) - if (my_task == main_task) write(logunit,*) trim(subname)//' : calling pio init' + if (my_task == main_task) write(logunit,*) subname//' : calling pio init' call pio_init(my_task, mpicom, pio_numiotasks, 0, pio_stride, & pio_rearranger, sdat%pio_subsystem, base=pio_root) @@ -1337,7 +1337,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) if (isPresent .and. isSet) then read(cvalue,*) pio_debug_level if (pio_debug_level < 0 .or. pio_debug_level > 6) then - call ESMF_LogWrite(trim(subname)//': need to provide valid option for'// & + call ESMF_LogWrite(subname//': need to provide valid option for'// & ' pio_debug_level (0-6)', ESMF_LOGMSG_INFO) rc = ESMF_FAILURE return @@ -1345,7 +1345,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else pio_debug_level = 0 end if - if (my_task == main_task) write(logunit,*) trim(subname), & + if (my_task == main_task) write(logunit,*) subname, & ' : pio_debug_level = ',pio_debug_level ! set PIO debug level @@ -1362,7 +1362,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else if (trim(cvalue) .eq. 'SUBSET') then pio_rearranger = PIO_REARR_SUBSET else - call ESMF_LogWrite(trim(subname)//'-'//trim(cname)// & + call ESMF_LogWrite(subname//'-'//trim(cname)// & ' : need to provide valid option for pio_rearranger'// & ' (BOX|SUBSET)', ESMF_LOGMSG_INFO) rc = ESMF_FAILURE @@ -1372,12 +1372,12 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) cvalue = 'BOX' pio_rearranger = PIO_REARR_BOX end if - if (my_task == main_task) write(logunit,*) trim(subname)//' : pio_rearranger = ', & + if (my_task == main_task) write(logunit,*) subname//' : pio_rearranger = ', & trim(cvalue), pio_rearranger ! init PIO allocate(sdat%pio_subsystem) - if (my_task == main_task) write(logunit,*) trim(subname)//' : calling pio init' + if (my_task == main_task) write(logunit,*) subname//' : calling pio init' call pio_init(my_task, mpicom, pio_numiotasks, 0, pio_stride, & pio_rearranger, sdat%pio_subsystem, base=pio_root) @@ -1394,7 +1394,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else if (trim(cvalue) .eq. 'COLL') then pio_rearr_comm_type = PIO_REARR_COMM_COLL else - call ESMF_LogWrite(trim(subname)//' : need to provide valid option for'// & + call ESMF_LogWrite(subname//' : need to provide valid option for'// & ' pio_rearr_comm_type (P2P|COLL)', ESMF_LOGMSG_INFO) rc = ESMF_FAILURE return @@ -1403,7 +1403,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) cvalue = 'P2P' pio_rearr_comm_type = PIO_REARR_COMM_P2P end if - if (my_task == main_task) write(logunit,*) trim(subname)// & + if (my_task == main_task) write(logunit,*) subname// & ' : pio_rearr_comm_type = ', trim(cvalue), pio_rearr_comm_type ! pio_rearr_comm_fcd @@ -1422,7 +1422,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else if (trim(cvalue) .eq. '2DDISABLE') then pio_rearr_comm_fcd = PIO_REARR_COMM_FC_2D_DISABLE else - call ESMF_LogWrite(trim(subname)//' : need to provide valid option for'// & + call ESMF_LogWrite(subname//' : need to provide valid option for'// & ' pio_rearr_comm_fcd (2DENABLE|IO2COMP|COMP2IO|2DDISABLE)', ESMF_LOGMSG_INFO) rc = ESMF_FAILURE return @@ -1431,7 +1431,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) cvalue = '2DENABLE' pio_rearr_comm_fcd = PIO_REARR_COMM_FC_2D_ENABLE end if - if (my_task == main_task) write(logunit,*) trim(subname)// & + if (my_task == main_task) write(logunit,*) subname// & ' : pio_rearr_comm_fcd = ', trim(cvalue), pio_rearr_comm_fcd ! pio_rearr_comm_enable_hs_comp2io @@ -1502,22 +1502,22 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) ! print out PIO rearranger parameters if (my_task == main_task) then - write(logunit,*) trim(subname)//' : pio_rearr_comm_enable_hs_comp2io = ', & + write(logunit,*) subname//' : pio_rearr_comm_enable_hs_comp2io = ', & pio_rearr_comm_enable_hs_comp2io - write(logunit,*) trim(subname)//' : pio_rearr_comm_enable_isend_comp2io = ', & + write(logunit,*) subname//' : pio_rearr_comm_enable_isend_comp2io = ', & pio_rearr_comm_enable_isend_comp2io - write(logunit,*) trim(subname)//' : pio_rearr_comm_max_pend_req_comp2io = ', & + write(logunit,*) subname//' : pio_rearr_comm_max_pend_req_comp2io = ', & pio_rearr_comm_max_pend_req_comp2io - write(logunit,*) trim(subname)//' : pio_rearr_comm_enable_hs_io2comp = ', & + write(logunit,*) subname//' : pio_rearr_comm_enable_hs_io2comp = ', & pio_rearr_comm_enable_hs_io2comp - write(logunit,*) trim(subname)//' : pio_rearr_comm_enable_isend_io2comp = ', & + write(logunit,*) subname//' : pio_rearr_comm_enable_isend_io2comp = ', & pio_rearr_comm_enable_isend_io2comp - write(logunit,*) trim(subname)//' : pio_rearr_comm_max_pend_req_io2comp = ', & + write(logunit,*) subname//' : pio_rearr_comm_max_pend_req_io2comp = ', & pio_rearr_comm_max_pend_req_io2comp end if ! set PIO rearranger options - if (my_task == main_task) write(logunit,*) trim(subname)// & + if (my_task == main_task) write(logunit,*) subname// & ' calling pio_set_rearr_opts' ret = pio_set_rearr_opts(sdat%pio_subsystem, pio_rearr_comm_type, & pio_rearr_comm_fcd, & diff --git a/dwav/dwav_datamode_copyall.F90 b/dwav/dwav_datamode_copyall.F90 index cc6f2698b..def12cc4e 100644 --- a/dwav/dwav_datamode_copyall.F90 +++ b/dwav/dwav_datamode_copyall.F90 @@ -8,7 +8,7 @@ module dwav_datamode_copyall_mod use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer implicit none - private ! except + private public :: dwav_datamode_copyall_advertise public :: dwav_datamode_copyall_init_pointers @@ -24,7 +24,7 @@ module dwav_datamode_copyall_mod real(r8), pointer :: strm_Sw_ustokes(:) => null() real(r8), pointer :: strm_Sw_vstokes(:) => null() - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -85,13 +85,13 @@ subroutine dwav_datamode_copyall_init_pointers(exportState, sdat, rc) ! Initialize module pointers call shr_strdata_get_stream_pointer( sdat, 'Sw_lamult', strm_Sw_lamult, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sw_lamult must be associated for dwav', rc=rc) + errmsg=subname//'ERROR: strm_Sw_lamult must be associated for dwav', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sw_ustokes', strm_Sw_ustokes, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sw_ustokes must be associated for dwav', rc=rc) + errmsg=subname//'ERROR: strm_Sw_ustokes must be associated for dwav', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Sw_vstokes', strm_Sw_vstokes, requirePointer=.true., & - errmsg=trim(subname)//'ERROR: strm_Sw_vstokes must be associated for dwav', rc=rc) + errmsg=subname//'ERROR: strm_Sw_vstokes must be associated for dwav', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine dwav_datamode_copyall_init_pointers diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index 948ceec3c..dd0e92c69 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -40,7 +40,7 @@ module cdeps_dwav_comp use dwav_datamode_copyall_mod, only : dwav_datamode_copyall_advance implicit none - private ! except + private public :: SetServices public :: SetVM @@ -68,7 +68,7 @@ module cdeps_dwav_comp integer :: logunit ! logging unit number logical :: restart_read character(CL) :: case_name ! case name - character(*) , parameter :: nullstr = 'null' + character(len=*) , parameter :: nullstr = 'null' ! dwav_in namelist input character(CX) :: streamfilename = nullstr ! filename to obtain stream info from @@ -94,11 +94,11 @@ module cdeps_dwav_comp logical :: diagnose_data = .true. integer , parameter :: main_task=0 ! task number of main task #ifdef CESMCOUPLED - character(*) , parameter :: modName = "(wav_comp_nuopc)" + character(len=*) , parameter :: modName = "(wav_comp_nuopc)" #else - character(*) , parameter :: modName = "(cdeps_dwav_comp)" + character(len=*) , parameter :: modName = "(cdeps_dwav_comp)" #endif - character(*) , parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -167,9 +167,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) type(ESMF_VM) :: vm integer :: bcasttmp(4) character(len=*),parameter :: subname=trim(modName)//':(InitializeAdvertise) ' - character(*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)" - character(*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)" - character(*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)" + character(len=*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)" + character(len=*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)" + character(len=*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)" !------------------------------------------------------------------------------- namelist / dwav_nml / datamode, model_meshfile, model_maskfile, & @@ -198,20 +198,20 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) read (nu,nml=dwav_nml,iostat=ierr) close(nu) if (ierr > 0) then - write(logunit,'(a,i0)') trim(subname),' ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr + write(logunit,'(a,i0)') subname,' ERROR: reading input namelist, '//trim(nlfilename)//' iostat=',ierr call shr_log_error(subName//': namelist read error '//trim(nlfilename), rc=rc) return end if ! write namelist input to standard out - write(logunit,'(3a)') trim(subname),' datamode = ',trim(datamode) - write(logunit,'(3a)') trim(subname),' model_meshfile = ',trim(model_meshfile) - write(logunit,'(3a)') trim(subname),' model_maskfile = ',trim(model_maskfile) - write(logunit,'(2a,i0)') trim(subname),' nx_global = ',nx_global - write(logunit,'(2a,i0)') trim(subname),' ny_global = ',ny_global - write(logunit,'(3a)') trim(subname),' restfilm = ',trim(restfilm) - write(logunit,'(2a,l6)') trim(subname),' skip_restart_read = ',skip_restart_read - write(logunit,'(2a,l6)') trim(subname),' export_all = ',export_all + write(logunit,'(3a)') subname,' datamode = ',trim(datamode) + write(logunit,'(3a)') subname,' model_meshfile = ',trim(model_meshfile) + write(logunit,'(3a)') subname,' model_maskfile = ',trim(model_maskfile) + write(logunit,'(2a,i0)') subname,' nx_global = ',nx_global + write(logunit,'(2a,i0)') subname,' ny_global = ',ny_global + write(logunit,'(3a)') subname,' restfilm = ',trim(restfilm) + write(logunit,'(2a,l6)') subname,' skip_restart_read = ',skip_restart_read + write(logunit,'(2a,l6)') subname,' export_all = ',export_all bcasttmp = 0 bcasttmp(1) = nx_global @@ -243,7 +243,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Validate datamode select case (trim(datamode)) case('copyall') - if (mainproc) write(logunit,'(3a)') trim(subname),' dwav datamode = ',trim(datamode) + if (mainproc) write(logunit,'(3a)') subname,' dwav datamode = ',trim(datamode) case default call shr_log_error(' ERROR illegal dwav datamode = '//trim(datamode), rc=rc) return @@ -391,7 +391,7 @@ subroutine dwav_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri ! local variables character(len=CL) :: rpfile - character(*), parameter :: subName = "(dwav_comp_run) " + character(len=*), parameter :: subName = "(dwav_comp_run) " !------------------------------------------------------------------------------- rc = ESMF_SUCCESS diff --git a/streams/dshr_methods_mod.F90 b/streams/dshr_methods_mod.F90 index 0da81255c..733cb2548 100644 --- a/streams/dshr_methods_mod.F90 +++ b/streams/dshr_methods_mod.F90 @@ -32,7 +32,7 @@ module dshr_methods_mod character(len=1024) :: msgString integer, parameter :: memdebug_level=1 - character(*), parameter :: u_FILE_u = & + character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -66,7 +66,7 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur ! only one of fldptr1 or fldptr2 can be present if (present(fldptr1) .and. present(fldptr2)) then - call shr_log_error(trim(subname)//": both fldptr1 and fldptr2 cannot be present ",rc=rc) + call shr_log_error(subname//": both fldptr1 and fldptr2 cannot be present ",rc=rc) return end if @@ -83,7 +83,7 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur if (chkerr(rc,__LINE__,u_FILE_u)) return else ! the call to just returns if it cannot find the field - call ESMF_LogWrite(trim(subname)//" Could not find the field: "//trim(fldname)//& + call ESMF_LogWrite(subname//" Could not find the field: "//trim(fldname)//& " just returning", ESMF_LOGMSG_INFO) return end if @@ -165,7 +165,7 @@ subroutine dshr_state_diagnose(State, flds_scalar_name, string, rc) write(msgString,'(A,a)') trim(string)//': '//trim(lfieldnamelist(n))," no data" endif else - call shr_log_error(trim(subname)//": ERROR rank not supported ", rc=rc) + call shr_log_error(subname//": ERROR rank not supported ", rc=rc) return endif call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) @@ -202,7 +202,7 @@ subroutine dshr_fldbun_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) rc = ESMF_SUCCESS if (.not. dshr_fldbun_FldChk(FB, trim(fldname), rc=rc)) then - call shr_log_error(trim(subname)//": ERROR field "//trim(fldname)//" not in FB ", rc=rc) + call shr_log_error(subname//": ERROR field "//trim(fldname)//" not in FB ", rc=rc) return endif call ESMF_FieldBundleGet(FB, fieldName=trim(fldname), field=lfield, rc=rc) @@ -211,7 +211,7 @@ subroutine dshr_fldbun_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (ungriddedUBound(1) > 0) then if (.not.present(fldptr2)) then - call shr_log_error(trim(subname)//": ERROR missing rank=2 array ", & + call shr_log_error(subname//": ERROR missing rank=2 array ", & line=__LINE__, file=u_FILE_u, rc=rc) return endif @@ -220,7 +220,7 @@ subroutine dshr_fldbun_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) lrank = 2 else if (.not.present(fldptr1)) then - call shr_log_error(trim(subname)//": ERROR missing rank=1 array ", & + call shr_log_error(subname//": ERROR missing rank=1 array ", & line=__LINE__, file=u_FILE_u, rc=rc) return endif @@ -282,7 +282,7 @@ subroutine dshr_fldbun_regrid(FBsrc, FBdst, RH, zeroregion, rc) ! check that input and output field bundles have identical number of fields if (fieldcount_src /= fieldcount_dst) then - call ESMF_LogWrite(trim(subname)//": ERROR fieldcount_src and field_count_dst are not the same") + call ESMF_LogWrite(subname//": ERROR fieldcount_src and field_count_dst are not the same") rc = ESMF_FAILURE if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) then call ESMF_Finalize(endflag=ESMF_END_ABORT) @@ -361,7 +361,7 @@ subroutine dshr_fldbun_getNameN(FB, fieldnum, fieldname, rc) call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (fieldnum > fieldCount) then - call shr_log_error(trim(subname)//": ERROR fieldnum > fieldCount ", rc=rc) + call shr_log_error(subname//": ERROR fieldnum > fieldCount ", rc=rc) return endif @@ -398,7 +398,7 @@ logical function dshr_fldbun_FldChk(FB, fldname, rc) call ESMF_FieldBundleGet(FB, fieldName=trim(fldname), isPresent=isPresent, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) then - call shr_log_error(trim(subname)//" Error checking field: "//trim(fldname), rc=rc) + call shr_log_error(subname//" Error checking field: "//trim(fldname), rc=rc) return endif @@ -441,20 +441,20 @@ subroutine dshr_fldbun_Field_diagnose(FB, fieldname, string, rc) ! no local data elseif (lrank == 1) then if (size(dataPtr1d) > 0) then - write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname), & + write(msgString,'(A,3g14.7,i8)') subname//' '//trim(lstring)//': '//trim(fieldname), & minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) else - write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname)," no data" + write(msgString,'(A,a)') subname//' '//trim(lstring)//': '//trim(fieldname)," no data" endif elseif (lrank == 2) then if (size(dataPtr2d) > 0) then - write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname), & + write(msgString,'(A,3g14.7,i8)') subname//' '//trim(lstring)//': '//trim(fieldname), & minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) else - write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname)," no data" + write(msgString,'(A,a)') subname//' '//trim(lstring)//': '//trim(fieldname)," no data" endif else - call shr_log_error(trim(subname)//": ERROR rank not supported ", rc=rc) + call shr_log_error(subname//": ERROR rank not supported ", rc=rc) return endif call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) @@ -508,23 +508,23 @@ subroutine dshr_fldbun_diagnose(FB, string, rc) elseif (lrank == 1) then if (size(dataPtr1d) > 0) then - write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & + write(msgString,'(A,3g14.7,i8)') subname//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) else - write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), " no data" + write(msgString,'(A,a)') subname//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), " no data" endif elseif (lrank == 2) then if (size(dataPtr2d) > 0) then - write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & + write(msgString,'(A,3g14.7,i8)') subname//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) else - write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & + write(msgString,'(A,a)') subname//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & " no data" endif else - call shr_log_error(trim(subname)//": ERROR rank not supported ", rc=rc) + call shr_log_error(subname//": ERROR rank not supported ", rc=rc) return endif call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) @@ -533,7 +533,7 @@ subroutine dshr_fldbun_diagnose(FB, string, rc) ! Deallocate memory deallocate(lfieldnamelist) - call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//": done", ESMF_LOGMSG_INFO) end subroutine dshr_fldbun_diagnose @@ -575,17 +575,17 @@ subroutine dshr_field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) if (labort) then call ESMF_FieldGet(field, name=name, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_log_error(trim(subname)//": field "//trim(name)//" has no data not allocated ", rc=rc) + call shr_log_error(subname//": field "//trim(name)//" has no data not allocated ", rc=rc) return else - call ESMF_LogWrite(trim(subname)//": WARNING data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + call ESMF_LogWrite(subname//": WARNING data not allocated ", ESMF_LOGMSG_INFO, rc=rc) endif else call ESMF_FieldGet(field, ungriddedUBound=ungriddedUBound, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (ungriddedUBound(1) > 0) then if (.not.present(fldptr2)) then - call shr_log_error(trim(subname)//": ERROR missing rank=2 array for "//trim(name), & + call shr_log_error(subname//": ERROR missing rank=2 array for "//trim(name), & line=__LINE__, file=u_FILE_u, rc=rc) return endif @@ -594,7 +594,7 @@ subroutine dshr_field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) lrank = 2 else if (.not.present(fldptr1)) then - call shr_log_error(trim(subname)//": ERROR missing rank=1 array for "//trim(name), & + call shr_log_error(subname//": ERROR missing rank=1 array for "//trim(name), & line=__LINE__, file=u_FILE_u, rc=rc) return endif diff --git a/streams/dshr_tinterp_mod.F90 b/streams/dshr_tinterp_mod.F90 index 104bea65e..3aa42f1ce 100644 --- a/streams/dshr_tinterp_mod.F90 +++ b/streams/dshr_tinterp_mod.F90 @@ -13,8 +13,9 @@ module dshr_tInterp_mod use shr_const_mod , only : SHR_CONST_PI use dshr_methods_mod , only : chkerr use shr_sys_mod , only : shr_sys_abort + implicit none - private ! except + private public :: shr_tInterp_getFactors ! get time-interp factors public :: shr_tInterp_getAvgCosz ! get cosz, time avg of @@ -26,7 +27,7 @@ module dshr_tInterp_mod real(r8) ,parameter :: c0 = 0.0_r8 real(r8) ,parameter :: c1 = 1.0_r8 real(r8) ,parameter :: eps = 1.0E-12_r8 - character(*) ,parameter :: u_FILE_u = & + character(len=*) ,parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -51,9 +52,9 @@ subroutine shr_tInterp_getFactors(D1,S1,D2,S2,Din,Sin,f1,f2,calendar,logunit,alg integer ,intent(in) :: Din,Sin ! desired/model date & sec real(r8) ,intent(out) :: f1 ! wgt for 1 real(r8) ,intent(out) :: f2 ! wgt for 2 - character(*) ,intent(in) :: calendar!calendar type + character(len=*) ,intent(in) :: calendar!calendar type integer ,intent(in) :: logunit - character(*) ,intent(in) ,optional :: algo ! algorithm + character(len=*) ,intent(in) ,optional :: algo ! algorithm integer ,intent(out) :: rc ! return code ! local variables @@ -64,11 +65,11 @@ subroutine shr_tInterp_getFactors(D1,S1,D2,S2,Din,Sin,f1,f2,calendar,logunit,alg integer(i8) :: snum, sden ! delta times in seconds integer(i8) :: sint1,sint2 ! delta times in seconds character(cs) :: lalgo ! local algo variable - character(*),parameter :: subName = "(shr_tInterp_getFactors) " - character(*),parameter :: F00 = "('(shr_tInterp_getFactors) ',8a)" - character(*),parameter :: F01 = "('(shr_tInterp_getFactors) ',a,2f17.8)" - character(*),parameter :: F02 = "('(shr_tInterp_getFactors) ',a,3i9)" - character(*),parameter :: F03 = "('(shr_tInterp_getFactors) ',2a,3(i9.8,i6))" + character(len=*),parameter :: subName = "(shr_tInterp_getFactors) " + character(len=*),parameter :: F00 = "('(shr_tInterp_getFactors) ',8a)" + character(len=*),parameter :: F01 = "('(shr_tInterp_getFactors) ',a,2f17.8)" + character(len=*),parameter :: F02 = "('(shr_tInterp_getFactors) ',a,3i9)" + character(len=*),parameter :: F03 = "('(shr_tInterp_getFactors) ',2a,3(i9.8,i6))" !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -182,7 +183,7 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & real(r8) ,intent(in) :: lambm0 ! orb param real(r8) ,intent(in) :: obliqr ! orb param integer ,intent(in) :: modeldt ! model time step in secs - character(*) ,intent(in) :: calendar ! calendar type + character(len=*) ,intent(in) :: calendar ! calendar type logical , intent(in) :: isroot integer , intent(in) :: logunit integer ,intent(out) :: rc ! error status @@ -198,8 +199,8 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & integer :: ldt ! local dt as needed integer(i8) :: ldt8 ! local dt as needed in i8 integer(i8) :: dtsec ! delta time from timeint - character(*),parameter :: subName = "(shr_tInterp_getAvgCosz) " - character(*),parameter :: F00 = "('(shr_tInterp_getAvgCosz) ',8a)" + character(len=*),parameter :: subName = "(shr_tInterp_getAvgCosz) " + character(len=*),parameter :: F00 = "('(shr_tInterp_getAvgCosz) ',8a)" !--------------------------------------------------------------- rc = ESMF_SUCCESS @@ -247,7 +248,7 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & allocate(cosz(lsize)) if (debug>0 .and. isroot) then - write(logunit,'(a,4(i8,2x))') trim(subname)//' calculating time average over interval ymd1,tod1,ymd2,tod2 = ', & + write(logunit,'(a,4(i8,2x))') subname//' calculating time average over interval ymd1,tod1,ymd2,tod2 = ', & ymd1,tod1,ymd2,tod2 end if @@ -289,7 +290,7 @@ subroutine shr_tInterp_getCosz(cosz, lon, lat, ymd, tod, & real(r8) , intent(in) :: mvelpp ! orb param real(r8) , intent(in) :: lambm0 ! orb param real(r8) , intent(in) :: obliqr ! orb param - character(*) , intent(in) :: calendar ! calendar type + character(len=*) , intent(in) :: calendar ! calendar type logical , intent(in) :: isroot integer , intent(in) :: logunit @@ -300,7 +301,7 @@ subroutine shr_tInterp_getCosz(cosz, lon, lat, ymd, tod, & real(r8) :: calday ! julian days real(r8) :: declin,eccf ! orb params real(r8) ,parameter :: solZenMin = 0.001_r8 ! min solar zenith angle - character(*) ,parameter :: subName = "(shr_tInterp_getCosz) " + character(len=*) ,parameter :: subName = "(shr_tInterp_getCosz) " !--------------------------------------------------------------- lsize = size(lon) @@ -312,9 +313,9 @@ subroutine shr_tInterp_getCosz(cosz, lon, lat, ymd, tod, & call shr_cal_date2julian(ymd, tod, calday, calendar) call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr, declin, eccf ) if (debug > 0 .and. isroot) then - write(logunit,'(a,2(i8,2x),d20.10,2x,a)') trim(subname)//' ymd, tod, calday, calendar = ',ymd,tod,calday,calendar - write(logunit,'(a,4(d20.10,2x))') trim(subname)//' eccen, mvelpp, lambm0, obliqr = ',eccen, mvelpp, lambm0, obliqr - write(logunit,'(a,2(d20.10,2x))') trim(subname)//' declin,eccf= ',declin,eccf + write(logunit,'(a,2(i8,2x),d20.10,2x,a)') subname//' ymd, tod, calday, calendar = ',ymd,tod,calday,calendar + write(logunit,'(a,4(d20.10,2x))') subname//' eccen, mvelpp, lambm0, obliqr = ',eccen, mvelpp, lambm0, obliqr + write(logunit,'(a,2(d20.10,2x))') subname//' declin,eccf= ',declin,eccf end if do n = 1,lsize lonr = lon(n) * deg2rad From 6eac9d19033d18b1f6d460f21f91b59aa7697c43 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 5 Jan 2026 08:19:42 +0100 Subject: [PATCH 24/61] backed out change to .github/workflows/extbuild.yml --- .github/workflows/extbuild.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index 44a0a2972..185f6d85d 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -19,8 +19,8 @@ jobs: CPPFLAGS: "-I/usr/include -I/usr/local/include " LDFLAGS: "-L/usr/lib/x86_64-linux-gnu " # Versions of all dependencies can be updated here - these match tag names in the github repo - ESMF_VERSION: v8.9.0 - ParallelIO_VERSION: pio2_6_6 + ESMF_VERSION: v8.6.1 + ParallelIO_VERSION: pio2_6_2 steps: - id: checkout-CDEPS uses: actions/checkout@v4 @@ -39,8 +39,8 @@ jobs: id: cache-PARALLELIO uses: actions/cache@v4 with: - path: /home/runner/work/CDEPS/CDEPS/pio - key: ${{ runner.os }}-${{ env.ParallelIO_VERSION }}-parallelio + path: ${GITHUB_WORKSPACE}/pio + key: ${{ runner.os }}-${{ env.ParallelIO_VERSION }}-parallelio2 - name: Build ParallelIO if: steps.cache-PARALLELIO.outputs.cache-hit != 'true' uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@9390e30e29d4ebbfbef0fc72162cacd9e8f25e4e @@ -49,7 +49,7 @@ jobs: enable_fortran: True install_prefix: ${GITHUB_WORKSPACE}/pio - name: Install ESMF - uses: esmf-org/install-esmf-action@v1.0.2 + uses: esmf-org/install-esmf-action@v1 env: ESMF_COMPILER: gfortran ESMF_BOPT: g From 29690efda0115bdd8de3a9e59111aec1437c8f35 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 6 Jan 2026 20:03:20 +0100 Subject: [PATCH 25/61] removed unnecessary commented section and cleaned up typo --- dlnd/cime_config/config_component.xml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/dlnd/cime_config/config_component.xml b/dlnd/cime_config/config_component.xml index 8fd2e27b1..c9ce2ec78 100644 --- a/dlnd/cime_config/config_component.xml +++ b/dlnd/cime_config/config_component.xml @@ -52,19 +52,9 @@ none run_component_dlnd env_run.xml - colon delimited string of non water tracers to be sent from dlnd to the mediator - only used for DLND%%RCPL + colon delimited string of non water tracers to be sent from dlnd to the mediator - only used for DLND%RCPL - - - - - - - - - - char UNSET From 7bcb202d5bf497085d47c1245879d67d09445c9c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 6 Jan 2026 20:08:18 +0100 Subject: [PATCH 26/61] minor editing changes --- dlnd/cime_config/config_component.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlnd/cime_config/config_component.xml b/dlnd/cime_config/config_component.xml index c9ce2ec78..bf8716e08 100644 --- a/dlnd/cime_config/config_component.xml +++ b/dlnd/cime_config/config_component.xml @@ -108,7 +108,7 @@ run_component_dlnd env_run.xml - starting year to loop data over (only used when DLND_MODE is CPLHIST or GLC_CPLHIST or ROF_CPLHIST) + starting year to loop data over (only used when DLND_MODE is SCPL or GCPL or RCPL) @@ -119,7 +119,7 @@ run_component_dlnd env_run.xml - ending year to loop data over (only used when DLND_MODE is CPLHIST or GLC_CPLHIST) + starting year to loop data over (only used when DLND_MODE is SCPL or GCPL or RCPL) From 06bdf5f9e32d2e972f99e10ad90a1e11c1e18bd8 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 6 Jan 2026 20:16:41 +0100 Subject: [PATCH 27/61] minor changes to get PR aligned with corresponding ESCOMP CDEPS PR --- dlnd/dlnd_datamode_rof_forcing_mod.F90 | 3 +++ drof/cime_config/config_component.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dlnd/dlnd_datamode_rof_forcing_mod.F90 b/dlnd/dlnd_datamode_rof_forcing_mod.F90 index 955276c7e..e6c4873fe 100644 --- a/dlnd/dlnd_datamode_rof_forcing_mod.F90 +++ b/dlnd/dlnd_datamode_rof_forcing_mod.F90 @@ -44,6 +44,9 @@ module dlnd_datamode_rof_forcing_mod real(r8), pointer :: strm_Flrl_irrig(:) => null() integer :: ntracers_nonh2o + + ! Note that setting the maximum value to 99 is due to the i2.2 format below + ! for generating the strm_fld field names integer, parameter :: ntracers_nonh2o_max = 99 character(*), parameter :: nullstr = 'null' diff --git a/drof/cime_config/config_component.xml b/drof/cime_config/config_component.xml index 9ad49e455..562655539 100644 --- a/drof/cime_config/config_component.xml +++ b/drof/cime_config/config_component.xml @@ -94,7 +94,7 @@ UNSET run_component_drof env_run.xml - case name for coupler history data mode when DROF_MODE is CPLHIST mode + case name for coupler history data mode (only used when DROF_MODE is CPLHIST mode) From b783bf7c78369e1d56ee8bc64c56f177d9e05bcc Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 8 Jan 2026 14:06:43 +0100 Subject: [PATCH 28/61] more cleanup changes --- datm/atm_comp_nuopc.F90 | 6 +++--- dglc/cime_config/testdefs/testlist_dglc.xml | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 225b2ae47..0b4dd1061 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -155,12 +155,12 @@ module cdeps_datm_comp logical :: diagnose_data = .true. integer , parameter :: main_task = 0 ! task number of main task #ifdef CESMCOUPLED - character(*) , parameter :: modName = "(atm_comp_nuopc)" + character(len=*) , parameter :: modName = "(atm_comp_nuopc)" #else - character(*) , parameter :: modName = "(cdeps_datm_comp)" + character(len=*) , parameter :: modName = "(cdeps_datm_comp)" #endif - character(*), parameter :: u_FILE_u = & + character(len=*) , parameter :: u_FILE_u = & __FILE__ !=============================================================================== diff --git a/dglc/cime_config/testdefs/testlist_dglc.xml b/dglc/cime_config/testdefs/testlist_dglc.xml index 9eb1b6dba..a7dca5dfb 100644 --- a/dglc/cime_config/testdefs/testlist_dglc.xml +++ b/dglc/cime_config/testdefs/testlist_dglc.xml @@ -27,6 +27,14 @@ + + + + + + + + From 1d6b3a7d34564b92e70dfc656549e593778d235a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 8 Jan 2026 14:16:27 +0100 Subject: [PATCH 29/61] removed DEBUG print statement --- streams/dshr_stream_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index 70f94f8e1..f8976fe7d 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -244,7 +244,6 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu p => item(getElementsByTagname(streamnode, "mapalgo"), 0) if (associated(p)) then call extractDataContent(p, streamdat(i)%mapalgo) - write(6,*)'DEBUG: shr_stream_mapalgo = '//trim(streamdat(i)%mapalgo) if (streamdat(i)%mapalgo /= shr_stream_mapalgo_bilinear .and. & streamdat(i)%mapalgo /= shr_stream_mapalgo_redist .and. & streamdat(i)%mapalgo /= shr_stream_mapalgo_nn .and. & @@ -252,7 +251,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu streamdat(i)%mapalgo /= shr_stream_mapalgo_consd .and. & streamdat(i)%mapalgo(1:8) /= shr_stream_mapalgo_mapfile .and. & streamdat(i)%mapalgo /= shr_stream_mapalgo_none) then - call shr_log_error("mapaglo must have a value of either bilinear, redist, nn, consf or consd", rc=rc) + call shr_log_error("mapaglo must have a value of either bilinear, redist, nn, consf, consd or "//& + " mapalgo(1:8) must equal mapfile: ", rc=rc) return end if endif From 620d15cce6d37b8e3a1ad7d26f08e482141c8691 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 9 Jan 2026 09:59:18 +0100 Subject: [PATCH 30/61] updated share to escomp/main since this is only used by UFS and will make it easier to be in sync with escomp --- share/CMakeLists.txt | 1 + share/shr_lnd2rof_tracers_mod.F90 | 94 +++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 share/shr_lnd2rof_tracers_mod.F90 diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index cee2936d4..c771621b3 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -16,6 +16,7 @@ add_library(cdeps_share ${GenF90_SRCS} shr_const_mod.F90 shr_orb_mod.F90 shr_log_mod.F90 + shr_lnd2rof_tracers_mod.F90 shr_strconvert_mod.F90 shr_precip_mod.F90 shr_string_mod.F90 diff --git a/share/shr_lnd2rof_tracers_mod.F90 b/share/shr_lnd2rof_tracers_mod.F90 new file mode 100644 index 000000000..e673983b7 --- /dev/null +++ b/share/shr_lnd2rof_tracers_mod.F90 @@ -0,0 +1,94 @@ +module shr_lnd2rof_tracers_mod + + !======================================================================== + ! read lnd2rof_tracers_inparm namelist and sets up driver list of fields for + ! lnd -> river communications + !======================================================================== + + use ESMF , only : ESMF_VMGetCurrent, ESMF_VM, ESMF_VMGet, ESMF_VMBroadcast + use ESMF , only : ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU, ESMF_SUCCESS + use shr_sys_mod , only : shr_sys_abort + use shr_log_mod , only : shr_log_getLogUnit + use shr_kind_mod , only : r8 => shr_kind_r8, cs => shr_kind_cs + use shr_nl_mod , only : shr_nl_find_group_name + + implicit none + private + + ! !PUBLIC MEMBER FUNCTIONS + public :: shr_lnd2rof_tracers_readnl ! Read namelist + + character(len=*), parameter :: & + u_FILE_u=__FILE__ + +!==================================================================================== +CONTAINS +!==================================================================================== + + subroutine shr_lnd2rof_tracers_readnl(NLFilename, lnd2rof_tracer_list) + + ! input/output variables + character(len=*), intent(in) :: NLFilename ! Namelist filename + character(len=*), intent(out) :: lnd2rof_tracer_list ! Colon delimited string of liquid lnd2rof tracers + + !----- local ----- + type(ESMF_VM) :: vm + integer :: unitn ! namelist unit number + integer :: ierr ! error code + logical :: exists ! if file exists or not + integer :: rc + integer :: localpet + integer :: mpicom + integer :: logunit + character(len=CS) :: lnd2rof_tracers + character(*),parameter :: subName = '(shr_lnd2rof_tracers_readnl) ' + ! ------------------------------------------------------------------ + + namelist /lnd2rof_tracers_inparm/ lnd2rof_tracers + + !----------------------------------------------------------------------------- + ! Read namelist and figure out the lnd2rof_tracers field list to pass + ! First check if file exists and if not, n_lnd2rof_tracers will be zero + !----------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + !--- Open and read namelist --- + if ( len_trim(NLFilename) == 0 ) then + call shr_sys_abort( subName//'ERROR: nlfilename not set' ) + end if + call shr_log_getLogUnit(logunit) + + lnd2rof_tracers = ' ' + lnd2rof_tracer_list = ' ' + + call ESMF_VMGetCurrent(vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_VMGet(vm, localPet=localPet, mpiCommunicator=mpicom, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + if (localpet==0) then + inquire(file=trim(NLFileName), exist=exists) + if ( exists ) then + open(newunit=unitn, file=trim(NLFilename), status='old' ) + call shr_nl_find_group_name(unitn, 'lnd2rof_tracers_inparm', ierr) + if (ierr == 0) then + ! Note that if ierr /= 0, no namelist is present. + read(unitn, lnd2rof_tracers_inparm, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort(trim(subName) //'problem of read of lnd2rof_tracers_inparm ') + endif + endif + close( unitn ) + end if + end if + call ESMF_VMBroadcast(vm, lnd2rof_tracers, CS, 0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + if (lnd2rof_tracers /= ' ') then + lnd2rof_tracer_list = trim(lnd2rof_tracers) + end if + + end subroutine shr_lnd2rof_tracers_readnl + +end module shr_lnd2rof_tracers_mod From 2b5fca7c350d1eecb8581f26ab9066b666d78db8 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 9 Jan 2026 10:04:42 +0100 Subject: [PATCH 31/61] fixed typo --- dlnd/cime_config/config_component.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlnd/cime_config/config_component.xml b/dlnd/cime_config/config_component.xml index bf8716e08..126afbc0f 100644 --- a/dlnd/cime_config/config_component.xml +++ b/dlnd/cime_config/config_component.xml @@ -119,7 +119,7 @@ run_component_dlnd env_run.xml - starting year to loop data over (only used when DLND_MODE is SCPL or GCPL or RCPL) + ending year to loop data over (only used when DLND_MODE is SCPL or GCPL or RCPL) From 2e60aedf97bb3cf5169c895f88f4970863e94cc4 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 9 Jan 2026 10:06:02 +0100 Subject: [PATCH 32/61] updated testlist_dglc.xml to be consistent with escomp/main --- dglc/cime_config/testdefs/testlist_dglc.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/dglc/cime_config/testdefs/testlist_dglc.xml b/dglc/cime_config/testdefs/testlist_dglc.xml index a7dca5dfb..9eb1b6dba 100644 --- a/dglc/cime_config/testdefs/testlist_dglc.xml +++ b/dglc/cime_config/testdefs/testlist_dglc.xml @@ -27,14 +27,6 @@ - - - - - - - - From 7d6db2737d760906545bafcf395ce429aaa70eb8 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 9 Jan 2026 10:10:25 +0100 Subject: [PATCH 33/61] updated datm/buildnml to be up to date with escomp/main --- datm/cime_config/buildnml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index 3653c81c9..14dc18e38 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -59,7 +59,7 @@ def _get_neon_data_availability(case, neonsite): neonatm = None dataversion = case.get_value("NEONVERSION") if dataversion == "latest": - dataversions = ["v3", "v2", "v1"] + dataversions = ["v4", "v3", "v2", "v1"] else: dataversions = [dataversion] From e5915ac11dbabe901ac9de49bf8d2b9ea1cf3571 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 9 Jan 2026 10:11:44 +0100 Subject: [PATCH 34/61] updated workflows to be up to date with escomp/main --- .github/workflows/extbuild.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index 185f6d85d..44a0a2972 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -19,8 +19,8 @@ jobs: CPPFLAGS: "-I/usr/include -I/usr/local/include " LDFLAGS: "-L/usr/lib/x86_64-linux-gnu " # Versions of all dependencies can be updated here - these match tag names in the github repo - ESMF_VERSION: v8.6.1 - ParallelIO_VERSION: pio2_6_2 + ESMF_VERSION: v8.9.0 + ParallelIO_VERSION: pio2_6_6 steps: - id: checkout-CDEPS uses: actions/checkout@v4 @@ -39,8 +39,8 @@ jobs: id: cache-PARALLELIO uses: actions/cache@v4 with: - path: ${GITHUB_WORKSPACE}/pio - key: ${{ runner.os }}-${{ env.ParallelIO_VERSION }}-parallelio2 + path: /home/runner/work/CDEPS/CDEPS/pio + key: ${{ runner.os }}-${{ env.ParallelIO_VERSION }}-parallelio - name: Build ParallelIO if: steps.cache-PARALLELIO.outputs.cache-hit != 'true' uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@9390e30e29d4ebbfbef0fc72162cacd9e8f25e4e @@ -49,7 +49,7 @@ jobs: enable_fortran: True install_prefix: ${GITHUB_WORKSPACE}/pio - name: Install ESMF - uses: esmf-org/install-esmf-action@v1 + uses: esmf-org/install-esmf-action@v1.0.2 env: ESMF_COMPILER: gfortran ESMF_BOPT: g From 061a433324ad271fb8ed1988a89b775a33d22f3b Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 9 Jan 2026 19:18:37 +0100 Subject: [PATCH 35/61] updated to noresm --- streams/dshr_methods_mod.F90 | 50 ++++++++++++++++++------------------ streams/dshr_tinterp_mod.F90 | 37 +++++++++++++------------- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/streams/dshr_methods_mod.F90 b/streams/dshr_methods_mod.F90 index 733cb2548..0da81255c 100644 --- a/streams/dshr_methods_mod.F90 +++ b/streams/dshr_methods_mod.F90 @@ -32,7 +32,7 @@ module dshr_methods_mod character(len=1024) :: msgString integer, parameter :: memdebug_level=1 - character(len=*), parameter :: u_FILE_u = & + character(*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -66,7 +66,7 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur ! only one of fldptr1 or fldptr2 can be present if (present(fldptr1) .and. present(fldptr2)) then - call shr_log_error(subname//": both fldptr1 and fldptr2 cannot be present ",rc=rc) + call shr_log_error(trim(subname)//": both fldptr1 and fldptr2 cannot be present ",rc=rc) return end if @@ -83,7 +83,7 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullRetur if (chkerr(rc,__LINE__,u_FILE_u)) return else ! the call to just returns if it cannot find the field - call ESMF_LogWrite(subname//" Could not find the field: "//trim(fldname)//& + call ESMF_LogWrite(trim(subname)//" Could not find the field: "//trim(fldname)//& " just returning", ESMF_LOGMSG_INFO) return end if @@ -165,7 +165,7 @@ subroutine dshr_state_diagnose(State, flds_scalar_name, string, rc) write(msgString,'(A,a)') trim(string)//': '//trim(lfieldnamelist(n))," no data" endif else - call shr_log_error(subname//": ERROR rank not supported ", rc=rc) + call shr_log_error(trim(subname)//": ERROR rank not supported ", rc=rc) return endif call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) @@ -202,7 +202,7 @@ subroutine dshr_fldbun_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) rc = ESMF_SUCCESS if (.not. dshr_fldbun_FldChk(FB, trim(fldname), rc=rc)) then - call shr_log_error(subname//": ERROR field "//trim(fldname)//" not in FB ", rc=rc) + call shr_log_error(trim(subname)//": ERROR field "//trim(fldname)//" not in FB ", rc=rc) return endif call ESMF_FieldBundleGet(FB, fieldName=trim(fldname), field=lfield, rc=rc) @@ -211,7 +211,7 @@ subroutine dshr_fldbun_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (ungriddedUBound(1) > 0) then if (.not.present(fldptr2)) then - call shr_log_error(subname//": ERROR missing rank=2 array ", & + call shr_log_error(trim(subname)//": ERROR missing rank=2 array ", & line=__LINE__, file=u_FILE_u, rc=rc) return endif @@ -220,7 +220,7 @@ subroutine dshr_fldbun_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) lrank = 2 else if (.not.present(fldptr1)) then - call shr_log_error(subname//": ERROR missing rank=1 array ", & + call shr_log_error(trim(subname)//": ERROR missing rank=1 array ", & line=__LINE__, file=u_FILE_u, rc=rc) return endif @@ -282,7 +282,7 @@ subroutine dshr_fldbun_regrid(FBsrc, FBdst, RH, zeroregion, rc) ! check that input and output field bundles have identical number of fields if (fieldcount_src /= fieldcount_dst) then - call ESMF_LogWrite(subname//": ERROR fieldcount_src and field_count_dst are not the same") + call ESMF_LogWrite(trim(subname)//": ERROR fieldcount_src and field_count_dst are not the same") rc = ESMF_FAILURE if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) then call ESMF_Finalize(endflag=ESMF_END_ABORT) @@ -361,7 +361,7 @@ subroutine dshr_fldbun_getNameN(FB, fieldnum, fieldname, rc) call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (fieldnum > fieldCount) then - call shr_log_error(subname//": ERROR fieldnum > fieldCount ", rc=rc) + call shr_log_error(trim(subname)//": ERROR fieldnum > fieldCount ", rc=rc) return endif @@ -398,7 +398,7 @@ logical function dshr_fldbun_FldChk(FB, fldname, rc) call ESMF_FieldBundleGet(FB, fieldName=trim(fldname), isPresent=isPresent, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) then - call shr_log_error(subname//" Error checking field: "//trim(fldname), rc=rc) + call shr_log_error(trim(subname)//" Error checking field: "//trim(fldname), rc=rc) return endif @@ -441,20 +441,20 @@ subroutine dshr_fldbun_Field_diagnose(FB, fieldname, string, rc) ! no local data elseif (lrank == 1) then if (size(dataPtr1d) > 0) then - write(msgString,'(A,3g14.7,i8)') subname//' '//trim(lstring)//': '//trim(fieldname), & + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname), & minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) else - write(msgString,'(A,a)') subname//' '//trim(lstring)//': '//trim(fieldname)," no data" + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname)," no data" endif elseif (lrank == 2) then if (size(dataPtr2d) > 0) then - write(msgString,'(A,3g14.7,i8)') subname//' '//trim(lstring)//': '//trim(fieldname), & + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname), & minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) else - write(msgString,'(A,a)') subname//' '//trim(lstring)//': '//trim(fieldname)," no data" + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname)," no data" endif else - call shr_log_error(subname//": ERROR rank not supported ", rc=rc) + call shr_log_error(trim(subname)//": ERROR rank not supported ", rc=rc) return endif call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) @@ -508,23 +508,23 @@ subroutine dshr_fldbun_diagnose(FB, string, rc) elseif (lrank == 1) then if (size(dataPtr1d) > 0) then - write(msgString,'(A,3g14.7,i8)') subname//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) else - write(msgString,'(A,a)') subname//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), " no data" + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), " no data" endif elseif (lrank == 2) then if (size(dataPtr2d) > 0) then - write(msgString,'(A,3g14.7,i8)') subname//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) else - write(msgString,'(A,a)') subname//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & " no data" endif else - call shr_log_error(subname//": ERROR rank not supported ", rc=rc) + call shr_log_error(trim(subname)//": ERROR rank not supported ", rc=rc) return endif call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) @@ -533,7 +533,7 @@ subroutine dshr_fldbun_diagnose(FB, string, rc) ! Deallocate memory deallocate(lfieldnamelist) - call ESMF_LogWrite(subname//": done", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) end subroutine dshr_fldbun_diagnose @@ -575,17 +575,17 @@ subroutine dshr_field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) if (labort) then call ESMF_FieldGet(field, name=name, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_log_error(subname//": field "//trim(name)//" has no data not allocated ", rc=rc) + call shr_log_error(trim(subname)//": field "//trim(name)//" has no data not allocated ", rc=rc) return else - call ESMF_LogWrite(subname//": WARNING data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + call ESMF_LogWrite(trim(subname)//": WARNING data not allocated ", ESMF_LOGMSG_INFO, rc=rc) endif else call ESMF_FieldGet(field, ungriddedUBound=ungriddedUBound, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (ungriddedUBound(1) > 0) then if (.not.present(fldptr2)) then - call shr_log_error(subname//": ERROR missing rank=2 array for "//trim(name), & + call shr_log_error(trim(subname)//": ERROR missing rank=2 array for "//trim(name), & line=__LINE__, file=u_FILE_u, rc=rc) return endif @@ -594,7 +594,7 @@ subroutine dshr_field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) lrank = 2 else if (.not.present(fldptr1)) then - call shr_log_error(subname//": ERROR missing rank=1 array for "//trim(name), & + call shr_log_error(trim(subname)//": ERROR missing rank=1 array for "//trim(name), & line=__LINE__, file=u_FILE_u, rc=rc) return endif diff --git a/streams/dshr_tinterp_mod.F90 b/streams/dshr_tinterp_mod.F90 index 3aa42f1ce..104bea65e 100644 --- a/streams/dshr_tinterp_mod.F90 +++ b/streams/dshr_tinterp_mod.F90 @@ -13,9 +13,8 @@ module dshr_tInterp_mod use shr_const_mod , only : SHR_CONST_PI use dshr_methods_mod , only : chkerr use shr_sys_mod , only : shr_sys_abort - implicit none - private + private ! except public :: shr_tInterp_getFactors ! get time-interp factors public :: shr_tInterp_getAvgCosz ! get cosz, time avg of @@ -27,7 +26,7 @@ module dshr_tInterp_mod real(r8) ,parameter :: c0 = 0.0_r8 real(r8) ,parameter :: c1 = 1.0_r8 real(r8) ,parameter :: eps = 1.0E-12_r8 - character(len=*) ,parameter :: u_FILE_u = & + character(*) ,parameter :: u_FILE_u = & __FILE__ !=============================================================================== @@ -52,9 +51,9 @@ subroutine shr_tInterp_getFactors(D1,S1,D2,S2,Din,Sin,f1,f2,calendar,logunit,alg integer ,intent(in) :: Din,Sin ! desired/model date & sec real(r8) ,intent(out) :: f1 ! wgt for 1 real(r8) ,intent(out) :: f2 ! wgt for 2 - character(len=*) ,intent(in) :: calendar!calendar type + character(*) ,intent(in) :: calendar!calendar type integer ,intent(in) :: logunit - character(len=*) ,intent(in) ,optional :: algo ! algorithm + character(*) ,intent(in) ,optional :: algo ! algorithm integer ,intent(out) :: rc ! return code ! local variables @@ -65,11 +64,11 @@ subroutine shr_tInterp_getFactors(D1,S1,D2,S2,Din,Sin,f1,f2,calendar,logunit,alg integer(i8) :: snum, sden ! delta times in seconds integer(i8) :: sint1,sint2 ! delta times in seconds character(cs) :: lalgo ! local algo variable - character(len=*),parameter :: subName = "(shr_tInterp_getFactors) " - character(len=*),parameter :: F00 = "('(shr_tInterp_getFactors) ',8a)" - character(len=*),parameter :: F01 = "('(shr_tInterp_getFactors) ',a,2f17.8)" - character(len=*),parameter :: F02 = "('(shr_tInterp_getFactors) ',a,3i9)" - character(len=*),parameter :: F03 = "('(shr_tInterp_getFactors) ',2a,3(i9.8,i6))" + character(*),parameter :: subName = "(shr_tInterp_getFactors) " + character(*),parameter :: F00 = "('(shr_tInterp_getFactors) ',8a)" + character(*),parameter :: F01 = "('(shr_tInterp_getFactors) ',a,2f17.8)" + character(*),parameter :: F02 = "('(shr_tInterp_getFactors) ',a,3i9)" + character(*),parameter :: F03 = "('(shr_tInterp_getFactors) ',2a,3(i9.8,i6))" !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -183,7 +182,7 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & real(r8) ,intent(in) :: lambm0 ! orb param real(r8) ,intent(in) :: obliqr ! orb param integer ,intent(in) :: modeldt ! model time step in secs - character(len=*) ,intent(in) :: calendar ! calendar type + character(*) ,intent(in) :: calendar ! calendar type logical , intent(in) :: isroot integer , intent(in) :: logunit integer ,intent(out) :: rc ! error status @@ -199,8 +198,8 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & integer :: ldt ! local dt as needed integer(i8) :: ldt8 ! local dt as needed in i8 integer(i8) :: dtsec ! delta time from timeint - character(len=*),parameter :: subName = "(shr_tInterp_getAvgCosz) " - character(len=*),parameter :: F00 = "('(shr_tInterp_getAvgCosz) ',8a)" + character(*),parameter :: subName = "(shr_tInterp_getAvgCosz) " + character(*),parameter :: F00 = "('(shr_tInterp_getAvgCosz) ',8a)" !--------------------------------------------------------------- rc = ESMF_SUCCESS @@ -248,7 +247,7 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & allocate(cosz(lsize)) if (debug>0 .and. isroot) then - write(logunit,'(a,4(i8,2x))') subname//' calculating time average over interval ymd1,tod1,ymd2,tod2 = ', & + write(logunit,'(a,4(i8,2x))') trim(subname)//' calculating time average over interval ymd1,tod1,ymd2,tod2 = ', & ymd1,tod1,ymd2,tod2 end if @@ -290,7 +289,7 @@ subroutine shr_tInterp_getCosz(cosz, lon, lat, ymd, tod, & real(r8) , intent(in) :: mvelpp ! orb param real(r8) , intent(in) :: lambm0 ! orb param real(r8) , intent(in) :: obliqr ! orb param - character(len=*) , intent(in) :: calendar ! calendar type + character(*) , intent(in) :: calendar ! calendar type logical , intent(in) :: isroot integer , intent(in) :: logunit @@ -301,7 +300,7 @@ subroutine shr_tInterp_getCosz(cosz, lon, lat, ymd, tod, & real(r8) :: calday ! julian days real(r8) :: declin,eccf ! orb params real(r8) ,parameter :: solZenMin = 0.001_r8 ! min solar zenith angle - character(len=*) ,parameter :: subName = "(shr_tInterp_getCosz) " + character(*) ,parameter :: subName = "(shr_tInterp_getCosz) " !--------------------------------------------------------------- lsize = size(lon) @@ -313,9 +312,9 @@ subroutine shr_tInterp_getCosz(cosz, lon, lat, ymd, tod, & call shr_cal_date2julian(ymd, tod, calday, calendar) call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr, declin, eccf ) if (debug > 0 .and. isroot) then - write(logunit,'(a,2(i8,2x),d20.10,2x,a)') subname//' ymd, tod, calday, calendar = ',ymd,tod,calday,calendar - write(logunit,'(a,4(d20.10,2x))') subname//' eccen, mvelpp, lambm0, obliqr = ',eccen, mvelpp, lambm0, obliqr - write(logunit,'(a,2(d20.10,2x))') subname//' declin,eccf= ',declin,eccf + write(logunit,'(a,2(i8,2x),d20.10,2x,a)') trim(subname)//' ymd, tod, calday, calendar = ',ymd,tod,calday,calendar + write(logunit,'(a,4(d20.10,2x))') trim(subname)//' eccen, mvelpp, lambm0, obliqr = ',eccen, mvelpp, lambm0, obliqr + write(logunit,'(a,2(d20.10,2x))') trim(subname)//' declin,eccf= ',declin,eccf end if do n = 1,lsize lonr = lon(n) * deg2rad From 652ba5bed7d88f97cbc8eefb90e639a1a299bc47 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 9 Jan 2026 19:57:38 +0100 Subject: [PATCH 36/61] updated stream_cdeps.py to noresm --- cime_config/stream_cdeps.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cime_config/stream_cdeps.py b/cime_config/stream_cdeps.py index 17fbf6c1d..f80586e80 100644 --- a/cime_config/stream_cdeps.py +++ b/cime_config/stream_cdeps.py @@ -716,11 +716,11 @@ def _sub_paths( date_string = (year_format + "-{:02d}-{:02d}").format( adjusted_year, adjusted_month, adjusted_day ) - new_file = line.replace(match.group(0), date_string) - if os.path.exists(new_file): - new_lines.append(new_file) + new_line = line.replace(match.group(0), date_string) + if os.path.exists(new_line): + new_lines.append(new_line) else: - print(f" WARNING:not adding missing file {new_file}") + print(f" WARNING:not adding missing file {new_line}") elif match.group("month"): for month in range(1, 13): date_string = (year_format + "-{:02d}").format(year, month) From eacb1c85e42622eade8b4c910add31a3be9972e9 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 10 Jan 2026 17:57:41 +0100 Subject: [PATCH 37/61] fixed bug in dwav that was introduced as part of refactor --- dwav/dwav_datamode_copyall.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dwav/dwav_datamode_copyall.F90 b/dwav/dwav_datamode_copyall.F90 index def12cc4e..811418a84 100644 --- a/dwav/dwav_datamode_copyall.F90 +++ b/dwav/dwav_datamode_copyall.F90 @@ -80,7 +80,7 @@ subroutine dwav_datamode_copyall_init_pointers(exportState, sdat, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sw_ustokes', fldptr1=Sw_ustokes , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sw_ustokes', fldptr1=Sw_vstokes , rc=rc) + call dshr_state_getfldptr(exportState, 'Sw_vstokes', fldptr1=Sw_vstokes , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return ! Initialize module pointers @@ -99,7 +99,7 @@ end subroutine dwav_datamode_copyall_init_pointers !=============================================================================== subroutine dwav_datamode_copyall_advance() - Sw_lamult(:) = strm_Sw_lamult(:) + Sw_lamult(:) = strm_Sw_lamult(:) Sw_ustokes(:) = strm_Sw_ustokes(:) Sw_vstokes(:) = strm_Sw_vstokes(:) From b69a93b52dd829a9472a835673cd82dedf955ae3 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 10 Jan 2026 18:49:47 +0100 Subject: [PATCH 38/61] fixed syntax for (C[SLX]) to (len=C[SLX]) --- streams/dshr_strdata_mod.F90 | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index efe639bd6..50d5a6703 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -91,13 +91,13 @@ module dshr_strdata_mod ! note that the fields in fldbun_stream_lb and fldbun_stream_ub contain the the names fldlist_model type shr_strdata_perstream - character(CL) :: stream_meshfile ! stream mesh file from stream txt file + character(len=CL) :: stream_meshfile ! stream mesh file from stream txt file type(ESMF_Mesh) :: stream_mesh ! stream mesh created from stream mesh file type(io_desc_t) :: stream_pio_iodesc ! stream pio descriptor logical :: stream_pio_iodesc_set =.false. ! true=>pio iodesc has been set type(ESMF_RouteHandle) :: routehandle ! stream n -> model mesh mapping - character(CL), allocatable :: fldlist_stream(:) ! names of stream file fields - character(CL), allocatable :: fldlist_model(:) ! names of stream model fields + character(len=CL), allocatable :: fldlist_stream(:) ! names of stream file fields + character(len=CL), allocatable :: fldlist_model(:) ! names of stream model fields integer :: stream_nlev ! number of vertical levels in stream real(r8), allocatable :: stream_vlevs(:) ! values of vertical levels in stream integer :: stream_lb ! index of the Lowerbound (LB) in fldlist_stream @@ -134,7 +134,7 @@ module dshr_strdata_mod integer, pointer :: model_gindex(:) ! model global index spzce integer :: model_gsize ! model global domain size type(ESMF_CLock) :: model_clock ! model clock - character(CL) :: model_calendar = shr_cal_noleap ! model calendar for ymd,tod + character(len=CL) :: model_calendar = shr_cal_noleap ! model calendar for ymd,tod integer :: ymd, tod ! model time type(iosystem_desc_t), pointer :: pio_subsystem => null() ! pio info real(r8) :: eccen = SHR_ORB_UNDEF_REAL ! cosz t-interp info @@ -457,9 +457,9 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) ! local variables type(ESMF_Mesh), pointer :: stream_mesh type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type - character(CS) :: calendar ! calendar name + character(len=CS) :: calendar ! calendar name integer :: ns ! stream index - character(CX) :: fileName ! generic file name + character(len=CX) :: fileName ! generic file name integer :: nfld ! loop stream field index type(ESMF_Field) :: lfield ! temporary type(ESMF_Field) :: lfield_dst ! temporary @@ -468,8 +468,8 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) type(ESMF_VM) :: vm integer :: nvars integer :: i, stream_nlev, index, istat - character(CL) :: stream_vector_names - character(CL) :: mapfile + character(len=CL) :: stream_vector_names + character(len=CL) :: mapfile character(len=*), parameter :: subname='(shr_sdat_init)' ! ---------------------------------------------- @@ -769,12 +769,12 @@ subroutine shr_strdata_get_stream_nlev(sdat, stream_index, rc) type(ESMF_VM) :: vm type(file_desc_t) :: pioid integer :: rcode - character(CX) :: filename + character(len=CX) :: filename integer :: dimid type(var_desc_t) :: varid integer :: stream_nlev integer :: old_handle ! previous setting of pio error handling - character(CS) :: units + character(len=CS) :: units integer :: istat character(len=*), parameter :: subname = '(shr_strdata_get_stream_nlev) ' ! ---------------------------------------------- @@ -851,7 +851,7 @@ subroutine shr_strdata_get_stream_domain(sdat, stream_index, fldname, flddata, r type(var_desc_t) :: varid type(file_desc_t) :: pioid integer :: rcode - character(CX) :: filename + character(len=CX) :: filename type(io_desc_t) :: pio_iodesc real(r4), allocatable :: data_real(:) real(r8), allocatable :: data_double(:) @@ -999,7 +999,7 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) real(r8), pointer :: data_v_dst(:) ! pointer into field bundle type(ESMF_Time) :: timeLB, timeUB ! lb and ub times type(ESMF_TimeInterval) :: timeint ! delta time - character(CL) :: calendar + character(len=CL) :: calendar integer :: dday ! delta days real(r8) :: dtime ! delta time integer :: year,month,day ! date year month day @@ -1457,12 +1457,12 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) real(r8) :: rDateM,rDateLB,rDateUB ! model,LB,UB dates with fractional days integer :: n_lb, n_ub integer :: i - character(CX) :: filename_lb - character(CX) :: filename_ub - character(CX) :: filename_next - character(CX) :: filename_prev + character(len=CX) :: filename_lb + character(len=CX) :: filename_ub + character(len=CX) :: filename_next + character(len=CX) :: filename_prev logical :: find_bounds - character(len=*), parameter :: subname = '(shr_strdata_readLBUB) ' + character(len=*), parameter :: subname = '(shr_strdata_readLBUB) ' !------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -1596,7 +1596,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & ! local variables integer :: stream_nlev type(ESMF_Field) :: field_dst - character(CX) :: currfile + character(len=CX) :: currfile logical :: fileexists logical :: fileopen type(file_desc_t) :: pioid @@ -1628,10 +1628,10 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & real(r8) :: coslat, coslon real(r8) :: scale_factor, add_offset integer(i2) :: fillvalue_i2 - character(CS) :: uname, vname + character(len=CS) :: uname, vname integer :: i, lev logical :: checkflag = .false. - character(CL) :: errmsg + character(len=CL) :: errmsg integer :: istat character(len=*), parameter :: subname = '(shr_strdata_readstrm) ' !------------------------------------------------------------------------------- @@ -2158,7 +2158,7 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) integer :: n, m, cnt type(var_desc_t) :: varid integer :: ndims - character(CS) :: dimname + character(len=CS) :: dimname integer, allocatable :: dimids(:) integer, allocatable :: dimlens(:) type(ESMF_DistGrid) :: distGrid From 8dc92ef612f0f347ba27955bbde56b7531e2cfe0 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 10 Jan 2026 19:22:13 +0100 Subject: [PATCH 39/61] additional fixed syntax for (C[SLX]) to (len=C[SLX]) --- streams/dshr_stream_mod.F90 | 70 ++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index f8976fe7d..e46e33caf 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -63,32 +63,32 @@ module dshr_stream_mod public :: shr_stream_dataDump ! internal stream data for debugging public :: shr_stream_restIO ! read or write to netcdf restart file - character(CS),parameter,public :: shr_stream_file_null = 'not_set' + character(len=CS),parameter,public :: shr_stream_file_null = 'not_set' ! valid values for time extrapoloation - character(CS),parameter,public :: shr_stream_taxis_cycle = 'cycle' - character(CS),parameter,public :: shr_stream_taxis_extend = 'extend' - character(CS),parameter,public :: shr_stream_taxis_limit = 'limit' + character(len=CS),parameter,public :: shr_stream_taxis_cycle = 'cycle' + character(len=CS),parameter,public :: shr_stream_taxis_extend = 'extend' + character(len=CS),parameter,public :: shr_stream_taxis_limit = 'limit' ! valid values for time interpolation - character(CS),parameter,public :: shr_stream_tinterp_lower = 'lower' - character(CS),parameter,public :: shr_stream_tinterp_upper = 'upper' - character(CS),parameter,public :: shr_stream_tinterp_nearest = 'nearest' - character(CS),parameter,public :: shr_stream_tinterp_linear = 'linear' - character(CS),parameter,public :: shr_stream_tinterp_coszen = 'coszen' + character(len=CS),parameter,public :: shr_stream_tinterp_lower = 'lower' + character(len=CS),parameter,public :: shr_stream_tinterp_upper = 'upper' + character(len=CS),parameter,public :: shr_stream_tinterp_nearest = 'nearest' + character(len=CS),parameter,public :: shr_stream_tinterp_linear = 'linear' + character(len=CS),parameter,public :: shr_stream_tinterp_coszen = 'coszen' ! valid values for mapping interpolation - character(CS),parameter,public :: shr_stream_mapalgo_bilinear = 'bilinear' - character(CS),parameter,public :: shr_stream_mapalgo_redist = 'redist' - character(CS),parameter,public :: shr_stream_mapalgo_nn = 'nn' - character(CS),parameter,public :: shr_stream_mapalgo_consf = 'consf' - character(CS),parameter,public :: shr_stream_mapalgo_consd = 'consd' - character(CL),parameter,public :: shr_stream_mapalgo_mapfile = 'mapfile:' - character(CS),parameter,public :: shr_stream_mapalgo_none = 'none' + character(len=CS),parameter,public :: shr_stream_mapalgo_bilinear = 'bilinear' + character(len=CS),parameter,public :: shr_stream_mapalgo_redist = 'redist' + character(len=CS),parameter,public :: shr_stream_mapalgo_nn = 'nn' + character(len=CS),parameter,public :: shr_stream_mapalgo_consf = 'consf' + character(len=CS),parameter,public :: shr_stream_mapalgo_consd = 'consd' + character(len=CL),parameter,public :: shr_stream_mapalgo_mapfile = 'mapfile:' + character(len=CS),parameter,public :: shr_stream_mapalgo_none = 'none' ! a useful derived type to use inside shr_streamType --- type shr_stream_file_type - character(CX) :: name = shr_stream_file_null ! the file name (full pathname) + character(len=CX) :: name = shr_stream_file_null ! the file name (full pathname) logical :: haveData = .false. ! has t-coord data been read in? integer :: nt = 0 ! size of time dimension integer ,allocatable :: date(:) ! t-coord date: yyyymmdd @@ -97,8 +97,8 @@ module dshr_stream_mod end type shr_stream_file_type type shr_stream_data_variable - character(CS) :: nameinfile - character(CS) :: nameinmodel + character(len=CS) :: nameinfile + character(len=CS) :: nameinmodel end type shr_stream_data_variable type shr_stream_streamType @@ -113,15 +113,15 @@ module dshr_stream_mod integer :: yearFirst = -1 ! first year to use in t-axis (yyyymmdd) integer :: yearLast = -1 ! last year to use in t-axis (yyyymmdd) integer :: yearAlign = -1 ! align yearFirst with this model year - character(CS) :: lev_dimname = 'null' ! name of vertical dimension if any - character(CS) :: taxMode = shr_stream_taxis_cycle ! cycling option for time axis - character(CS) :: tInterpAlgo = 'linear' ! algorithm to use for time interpolation - character(CL) :: mapalgo = 'bilinear' ! type of mapping - default is 'bilinear' - character(CS) :: readMode = 'single' ! stream read model - 'single' or 'full_file' + character(len=CS) :: lev_dimname = 'null' ! name of vertical dimension if any + character(len=CS) :: taxMode = shr_stream_taxis_cycle ! cycling option for time axis + character(len=CS) :: tInterpAlgo = 'linear' ! algorithm to use for time interpolation + character(len=CL) :: mapalgo = 'bilinear' ! type of mapping - default is 'bilinear' + character(len=CS) :: readMode = 'single' ! stream read model - 'single' or 'full_file' real(r8) :: dtlimit = 1.5_r8 ! delta time ratio limits for time interpolation integer :: offset = 0 ! offset in seconds of stream data - character(CS) :: calendar = shr_cal_noleap ! stream calendar (obtained from first stream data file) - character(CL) :: meshFile = ' ' ! filename for mesh for all fields on stream (full pathname) + character(len=CS) :: calendar = shr_cal_noleap ! stream calendar (obtained from first stream data file) + character(len=CL) :: meshFile = ' ' ! filename for mesh for all fields on stream (full pathname) integer :: k_lvd = -1 ! file/sample of least valid date integer :: n_lvd = -1 ! file/sample of least valid date logical :: found_lvd = .false. ! T <=> k_lvd,n_lvd have been set @@ -129,9 +129,9 @@ module dshr_stream_mod integer :: n_gvd = -1 ! file/sample of greatest valid date logical :: found_gvd = .false. ! T <=> k_gvd,n_gvd have been set logical :: fileopen = .false. ! is current file open - character(CX) :: currfile = ' ' ! current filename + character(len=CX) :: currfile = ' ' ! current filename integer :: nvars ! number of stream variables - character(CL) :: stream_vectors = 'null' ! stream vectors names + character(len=CL) :: stream_vectors = 'null' ! stream vectors names type(file_desc_t) :: currpioid ! current pio file desc type(shr_stream_file_type) , allocatable :: file(:) ! filenames of stream data files (full pathname) type(shr_stream_data_variable), allocatable :: varlist(:) ! stream variable names (on file and in model) @@ -515,7 +515,7 @@ subroutine shr_stream_init_from_inline(streamdat, & integer :: nfiles integer :: nvars integer :: istat - character(CS) :: calendar ! stream calendar + character(len=CS) :: calendar ! stream calendar character(len=*),parameter :: subName = '(shr_stream_init_from_inline) ' ! -------------------------------------------------------- @@ -1315,7 +1315,7 @@ subroutine shr_stream_readTCoord(strm, k, rc) integer,optional ,intent(out) :: rc ! return code ! local variables - character(CX) :: fileName ! filename to read + character(len=CX) :: fileName ! filename to read integer :: nt integer :: num,n integer :: din,dout @@ -1323,15 +1323,15 @@ subroutine shr_stream_readTCoord(strm, k, rc) integer :: lrc integer :: vid,ndims,rcode integer,allocatable :: dids(:) - character(CS) :: units,calendar - character(CS) :: bunits ! time units (days,secs,...) + character(len=CS) :: units,calendar + character(len=CS) :: bunits ! time units (days,secs,...) integer :: bdate ! base date: calendar date real(R8) :: bsec ! base date: elapsed secs integer :: ndate ! calendar date of time value integer :: old_handle ! previous setting of pio error handling real(R8) :: nsec ! elapsed secs on calendar date real(R8),allocatable :: tvar(:) - character(CX) :: msg + character(len=CX) :: msg integer :: istat character(len=*),parameter :: subname = '(shr_stream_readTCoord) ' !------------------------------------------------------------------------------- @@ -1645,8 +1645,8 @@ subroutine shr_stream_getCalendar(strm, k, calendar) ! local integer :: vid, n - character(CX) :: fileName - character(CL) :: lcal + character(len=CX) :: fileName + character(len=CL) :: lcal integer(PIO_OFFSET_KIND) :: attlen integer :: old_handle integer :: rCode From de4a200f7365481d92a9c892d7d63668bd1e3dad Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 10 Jan 2026 19:24:56 +0100 Subject: [PATCH 40/61] addressed issue raised in PR review --- streams/dshr_strdata_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 50d5a6703..4c726a669 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -677,7 +677,7 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) srcTermProcessing=srcTermProcessing_Value, ignoreDegenerate=.true., & unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) else if (trim(sdat%stream(ns)%mapalgo(1:8)) == 'mapfile:') then - mapfile = trim(sdat%stream(ns)%mapalgo(9:len_trim(sdat%stream(ns)%mapalgo))) + mapfile = trim(sdat%stream(ns)%mapalgo(9:)) call ESMF_FieldSMMStore(sdat%pstrm(ns)%field_stream, lfield_dst, mapfile, & routehandle=sdat%pstrm(ns)%routehandle, & ignoreUnmatchedIndices=.true., & From 71299526a8fccf314537536a59a972ef6116b864 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 13 Jan 2026 11:02:48 +0100 Subject: [PATCH 41/61] refactored datm gefs mode --- datm/datm_datamode_gefs_mod.F90 | 175 ++++++++++++++++++++++---------- 1 file changed, 120 insertions(+), 55 deletions(-) diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index 6cefe6613..d64e3683c 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -9,9 +9,7 @@ module datm_datamode_gefs_mod use shr_const_mod , only : shr_const_tkfrz, shr_const_rhofw, shr_const_rdair use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer - use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy implicit none private @@ -21,27 +19,45 @@ module datm_datamode_gefs_mod public :: datm_datamode_gefs_advance ! export state data - real(r8), pointer :: Sa_z(:) => null() - real(r8), pointer :: Sa_u(:) => null() - real(r8), pointer :: Sa_v(:) => null() - real(r8), pointer :: Sa_tbot(:) => null() - real(r8), pointer :: Sa_shum(:) => null() - real(r8), pointer :: Sa_pbot(:) => null() - real(r8), pointer :: Sa_u10m(:) => null() - real(r8), pointer :: Sa_v10m(:) => null() - real(r8), pointer :: Sa_t2m(:) => null() - real(r8), pointer :: Sa_q2m(:) => null() - real(r8), pointer :: Sa_pslv(:) => null() - real(r8), pointer :: Faxa_lwdn(:) => null() - real(r8), pointer :: Faxa_rain(:) => null() - real(r8), pointer :: Faxa_snow(:) => null() - real(r8), pointer :: Faxa_swndr(:) => null() - real(r8), pointer :: Faxa_swndf(:) => null() - real(r8), pointer :: Faxa_swvdr(:) => null() - real(r8), pointer :: Faxa_swvdf(:) => null() + real(r8), pointer :: Sa_z(:) => null() + real(r8), pointer :: Sa_u(:) => null() + real(r8), pointer :: Sa_v(:) => null() + real(r8), pointer :: Sa_tbot(:) => null() + real(r8), pointer :: Sa_shum(:) => null() + real(r8), pointer :: Sa_pbot(:) => null() + real(r8), pointer :: Sa_u10m(:) => null() + real(r8), pointer :: Sa_v10m(:) => null() + real(r8), pointer :: Sa_t2m(:) => null() + real(r8), pointer :: Sa_q2m(:) => null() + real(r8), pointer :: Sa_pslv(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() + real(r8), pointer :: Faxa_rain(:) => null() + real(r8), pointer :: Faxa_snow(:) => null() + real(r8), pointer :: Faxa_swndr(:) => null() + real(r8), pointer :: Faxa_swndf(:) => null() + real(r8), pointer :: Faxa_swvdr(:) => null() + real(r8), pointer :: Faxa_swvdf(:) => null() ! stream data - real(r8), pointer :: strm_mask(:) => null() + real(r8), pointer :: strm_Sa_mask(:) => null() + real(r8), pointer :: strm_Sa_z(:) => null() + real(r8), pointer :: strm_Sa_u(:) => null() + real(r8), pointer :: strm_Sa_v(:) => null() + real(r8), pointer :: strm_Sa_tbot(:) => null() + real(r8), pointer :: strm_Sa_shum(:) => null() + real(r8), pointer :: strm_Sa_pbot(:) => null() + real(r8), pointer :: strm_Sa_u10m(:) => null() + real(r8), pointer :: strm_Sa_v10m(:) => null() + real(r8), pointer :: strm_Sa_t2m(:) => null() + real(r8), pointer :: strm_Sa_q2m(:) => null() + real(r8), pointer :: strm_Sa_pslv(:) => null() + real(r8), pointer :: strm_Faxa_lwdn(:) => null() + real(r8), pointer :: strm_Faxa_rain(:) => null() + real(r8), pointer :: strm_Faxa_snow(:) => null() + real(r8), pointer :: strm_Faxa_swndr(:) => null() + real(r8), pointer :: strm_Faxa_swndf(:) => null() + real(r8), pointer :: strm_Faxa_swvdr(:) => null() + real(r8), pointer :: strm_Faxa_swvdf(:) => null() real(r8) :: tbotmax ! units detector real(r8) :: maskmax ! units detector @@ -50,8 +66,6 @@ module datm_datamode_gefs_mod real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg real(r8) , parameter :: rhofw = SHR_CONST_RHOFW ! density of fresh water ~ kg/m^3 - type(dfield_type) , pointer :: dfields => null() - character(len=*), parameter :: nullstr = 'undefined' character(len=*), parameter :: u_FILE_u = & __FILE__ @@ -124,24 +138,63 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc rc = ESMF_SUCCESS - ! Initialize dfields arrays for export fields with no ungridded dimension - ! and that have a corresponding stream field - call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lfieldnames(fieldCount)) - call ESMF_StateGet(exportState, itemNameList=lfieldnames, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1, fieldCount - call ESMF_LogWrite(subname//': field name = '//trim(lfieldnames(n)), ESMF_LOGMSG_INFO) - call ESMF_StateGet(exportState, itemName=trim(lfieldnames(n)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_dfield_add( dfields, sdat, trim(lfieldnames(n)), trim(lfieldnames(n)), & - exportState, logunit, mainproc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - ! initialize pointers for module level stream arrays - call shr_strdata_get_stream_pointer( sdat, 'Sa_mask' , strm_mask , rc) + call shr_strdata_get_stream_pointer( sdat, 'Sa_mask', strm_Sa_mask , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_mask must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_z', strm_Sa_z , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_z must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_u', strm_Sa_u , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_u must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_v', strm_Sa_v , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_v must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot', strm_Sa_tbot , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_tbot must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_pbot', strm_Sa_pbot , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_pbot must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_shum', strm_Sa_shum , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_shum must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_u10m', strm_Sa_u10m , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_u10m must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_v10m', strm_Sa_v10m , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_v10m must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_t2m', strm_Sa_t2m , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_t2m must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_q2m', strm_Sa_q2m , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_q2m must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv', strm_Sa_pslv , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_pslv must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_rain', strm_Faxa_rain , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Faxa_rain must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_snow', strm_Faxa_snow , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Faxa_snow must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swvdr', strm_Faxa_swvdr , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Faxa_swvdr must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swvdf', strm_Faxa_swvdf , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Faxa_swvdf must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swndr', strm_Faxa_swndr , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Faxa_swndr must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_swndf', strm_Faxa_swndf , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Faxa_swndf must be associated for gefs datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn', strm_Faxa_lwdn , requirePointer=.true., & + errmsg=subname//'ERROR: strm_Faxa_lwdn must be associated for gefs datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! get export state pointers @@ -161,15 +214,15 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_v10m' , fldptr1=Sa_v10m , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_t2m' , fldptr1=Sa_t2m , rc=rc) + call dshr_state_getfldptr(exportState, 'Sa_t2m' , fldptr1=Sa_t2m , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_q2m' , fldptr1=Sa_q2m , rc=rc) + call dshr_state_getfldptr(exportState, 'Sa_q2m' , fldptr1=Sa_q2m , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_pslv' , fldptr1=Sa_pslv , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rain' , fldptr1=Faxa_rain , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_snow' , fldptr1=Faxa_snow, rc=rc) + call dshr_state_getfldptr(exportState, 'Faxa_snow' , fldptr1=Faxa_snow , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swvdr' , fldptr1=Faxa_swvdr , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -187,7 +240,6 @@ end subroutine datm_datamode_gefs_init_pointers !=============================================================================== subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, rc) - use ESMF, only: ESMF_VMGetCurrent, ESMF_VMAllReduce, ESMF_REDUCE_MAX, ESMF_VM ! input/output variables @@ -208,13 +260,14 @@ subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, rc) rc = ESMF_SUCCESS - lsize = size(strm_mask) + lsize = size(strm_Sa_mask) if (first_time) then call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! determine tbotmax (see below for use) - rtmp(1) = maxval(Sa_tbot(:)) + rtmp(1) = maxval(strm_Sa_tbot(:)) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return tbotmax = rtmp(2) @@ -222,7 +275,7 @@ subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, rc) if (mainproc) write(logunit,*) subname,' tbotmax = ',tbotmax ! determine maskmax (see below for use) - rtmp(1) = maxval(strm_mask(:)) + rtmp(1) = maxval(strm_Sa_mask(:)) call ESMF_VMAllReduce(vm, rtmp, rtmp(2:), 1, ESMF_REDUCE_MAX, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return maskmax = rtmp(2) @@ -232,15 +285,27 @@ subroutine datm_datamode_gefs_advance(exportstate, sdat, mainproc, logunit, rc) first_time = .false. end if - ! copy all fields from streams to export state as default - ! This automatically will update the fields in the export state - call ESMF_TraceRegionEnter('datm_gefs_dfield_copy') - call dshr_dfield_copy(dfields, sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('datm_gefs_dfield_copy') - + Sa_z(:) = strm_Sa_z(:) + Sa_u(:) = strm_Sa_u(:) + Sa_v(:) = strm_Sa_v(:) + Sa_shum(:) = strm_Sa_shum(:) + Sa_pbot(:) = strm_Sa_pbot(:) + Sa_u10m(:) = strm_Sa_u10m(:) + Sa_v10m(:) = strm_Sa_v10m(:) + Sa_t2m(:) = strm_Sa_t2m(:) + Sa_q2m(:) = strm_Sa_q2m(:) + Sa_pslv(:) = strm_Sa_pslv(:) + Faxa_lwdn(:) = strm_Faxa_lwdn(:) + Faxa_rain(:) = strm_Faxa_rain(:) + Faxa_snow(:) = strm_Faxa_snow(:) + Faxa_swndr(:) = strm_Faxa_swndr(:) + Faxa_swndf(:) = strm_Faxa_swndf(:) + Faxa_swvdr(:) = strm_Faxa_swvdr(:) + Faxa_swvdf(:) = strm_Faxa_swvdf(:) + + !--- temperature --- do n = 1, lsize - !--- temperature --- + Sa_tbot(n) = strm_Sa_tbot(n) if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz ! Limit very cold forcing to 180K Sa_tbot(n) = max(180._r8, Sa_tbot(n)) From 88562ab8e170bc6e783f64fc8b1d60f03437b0e1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 13 Jan 2026 21:01:27 +0100 Subject: [PATCH 42/61] fix problem encountered in ufs for docn cplhist mode --- docn/docn_datamode_cplhist_mod.F90 | 36 +++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/docn/docn_datamode_cplhist_mod.F90 b/docn/docn_datamode_cplhist_mod.F90 index 141c20f64..8710c3c66 100644 --- a/docn/docn_datamode_cplhist_mod.F90 +++ b/docn/docn_datamode_cplhist_mod.F90 @@ -4,7 +4,7 @@ module docn_datamode_cplhist_mod use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8 use shr_log_mod , only : shr_log_error - use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal + use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal, shr_const_spval use dshr_methods_mod , only : dshr_state_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer @@ -114,22 +114,6 @@ subroutine docn_datamode_cplhist_init_pointers(exportState, sdat, ocn_fraction, call shr_strdata_get_stream_pointer( sdat, 'So_bldepth', strm_So_bldepth, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (associated(So_u) .and. .not. associated(strm_So_u)) then - call shr_log_error(subname//& - 'ERROR: strm_So_u must be associated if So_u is associated for docn cplhist mode', rc=rc) - return - end if - if (associated(So_v) .and. .not. associated(strm_So_v)) then - call shr_log_error(subname//& - 'ERROR: strm_So_v must be associated if So_v is associated for docn cplhist mode', rc=rc) - return - end if - if (associated(So_bldepth) .and. .not. associated(strm_So_bldepth)) then - call shr_log_error(subname//& - 'ERROR: strm_So_bldepth must be associated if So_bldepth is associated for docn cplhist mode', rc=rc) - return - end if - ! Allocation depends on exchanged fields, so check before filling arrays with values here So_t(:) = TkFrz if (associated(So_u)) So_u(:) = 0.0_r8 @@ -156,13 +140,25 @@ subroutine docn_datamode_cplhist_advance(sst_constant_value, rc) rc = ESMF_SUCCESS if (associated(So_u)) then - So_u(:) = strm_So_u(:) + if (associated(strm_So_u)) then + So_u(:) = strm_So_u(:) + else + So_u(:) = shr_const_spval + end if end if if (associated(So_v)) then - So_v(:) = strm_So_v(:) + if (associated(strm_So_v)) then + So_v(:) = strm_So_v(:) + else + So_v(:) = shr_const_spval + end if end if if (associated(So_bldepth)) then - So_bldepth(:) = strm_So_bldepth(:) + if (associated(strm_So_bldepth)) then + So_bldepth(:) = strm_So_bldepth(:) + else + So_bldepth(:) = shr_const_spval + end if end if ! If need unit conversion for So_t (C-->K), From b3c10ab7ad4181208f5d3ff67c6a649c051d5526 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 14 Jan 2026 21:48:30 +0100 Subject: [PATCH 43/61] removed unused local variables --- datm/datm_datamode_gefs_mod.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index d64e3683c..157cb5c94 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -129,10 +129,6 @@ subroutine datm_datamode_gefs_init_pointers(exportState, sdat, logunit, mainproc integer , intent(out) :: rc ! local variables - integer :: n - integer :: fieldcount - type(ESMF_Field) :: lfield - character(ESMF_MAXSTR) ,pointer :: lfieldnames(:) character(len=*), parameter :: subname='(datm_init_pointers): ' !------------------------------------------------------------------------------- From ee77d0d23c0d8c9e1d6450efbcf6942cd2789e17 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 16 Jan 2026 16:12:02 +0100 Subject: [PATCH 44/61] addressed issues raised in PR review by Bill Sacks --- datm/datm_datamode_cplhist_mod.F90 | 6 +++--- datm/datm_datamode_era5_mod.F90 | 2 +- docn/docn_datamode_multilev_cplhist_mod.F90 | 10 +++++----- docn/docn_datamode_som_mod.F90 | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index 90f11e15c..a93fb94c5 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -187,7 +187,7 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r errmsg=subname//'ERROR: strm_Sa_pbot must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, requirePointer=.true., & - errmsg=subname//'ERROR: strm_Sa_wind must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_ndens must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_pslv', strm_Sa_pslv, requirePointer=.true., & errmsg=subname//'ERROR: strm_Sa_pslv must be associated for cplhist datamode', rc=rc) @@ -262,8 +262,8 @@ subroutine datm_datamode_cplhist_advance(rc) Faxa_snowl(:) = strm_Faxa_snowl(:) Faxa_lwdn(:) = strm_Faxa_lwdn (:) Faxa_swndr(:) = strm_Faxa_swndr(:) - Faxa_swndf(:) = strm_Faxa_swvdr(:) - Faxa_swvdr(:) = strm_Faxa_swndf(:) + Faxa_swndf(:) = strm_Faxa_swndf(:) + Faxa_swvdr(:) = strm_Faxa_swvdr(:) Faxa_swvdf(:) = strm_Faxa_swvdf(:) end subroutine datm_datamode_cplhist_advance diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index 63cd34cb3..07046caeb 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -239,7 +239,7 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) ! Error checks if (.not. associated(strm_Sa_tdew)) then - call shr_log_error(subname//'ERROR: strm_Sa_pslv must be associated for era5 datamode') + call shr_log_error(subname//'ERROR: strm_Sa_tdew must be associated for era5 datamode') return end if diff --git a/docn/docn_datamode_multilev_cplhist_mod.F90 b/docn/docn_datamode_multilev_cplhist_mod.F90 index a314dfa25..b1be864f8 100644 --- a/docn/docn_datamode_multilev_cplhist_mod.F90 +++ b/docn/docn_datamode_multilev_cplhist_mod.F90 @@ -147,12 +147,12 @@ subroutine docn_datamode_multilev_cplhist_advance(exportState, rc) end do end do - do ilev = 1,size(So_t_depth,dim=1) - do ig = 1,size(So_t_depth,dim=2) - if (strm_So_t_depth(ilev)%ptr(ig) == 0._r8) then - So_t_depth(ilev,ig) = 1.e30_r8 + do ilev = 1,size(So_s_depth,dim=1) + do ig = 1,size(So_s_depth,dim=2) + if (strm_So_s_depth(ilev)%ptr(ig) == 0._r8) then + So_s_depth(ilev,ig) = 1.e30_r8 else - So_t_depth(ilev,ig) = strm_So_t_depth(ilev)%ptr(ig) + So_s_depth(ilev,ig) = strm_So_s_depth(ilev)%ptr(ig) end if end do end do diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index c0d67cbe7..8801faa2f 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -267,7 +267,7 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re rc = ESMF_SUCCESS So_u(:) = strm_So_u(:) - So_u(:) = strm_So_v(:) + So_v(:) = strm_So_v(:) So_s(:) = strm_So_s(:) So_dhdx(:) = strm_So_dhdx(:) So_dhdy(:) = strm_So_dhdy(:) From 95ab312828c564e3ee9fa9881bb246304083960a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 16 Jan 2026 16:28:28 +0100 Subject: [PATCH 45/61] addressed more issues raised by Bill Sacks in the PR review --- docn/ocn_comp_nuopc.F90 | 14 ++++++-------- drof/drof_datamode_copyall.F90 | 6 +++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 54abfd371..4d0ec19a7 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -329,7 +329,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) case('sstdata','sst_aquap_file') call docn_datamode_sstdata_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - case('som') + case('som','som_aquap') call docn_datamode_som_advertise(importState, exportState, fldsImport, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('cplhist') @@ -575,14 +575,12 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar end select ! Read restart if needed - select case (trim(datamode)) - case('sst_aquap_analytic', 'sst_aquap_constant') - skip_restart_read=.true. - case default - skip_restart_read=.false. - end select + do_restart_read = restart_read .and. .not. skip_restart_read + if (datamode == 'sst_aquap_analytic' .or. datamode == 'sst_aquap_constant') then + do_restart_read = .false. + end if - if (restart_read .and. .not. skip_restart_read) then + if (restart_read) then call shr_get_rpointer_name(gcomp, 'ocn', target_ymd, target_tod, rpfile, 'read', rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/drof/drof_datamode_copyall.F90 b/drof/drof_datamode_copyall.F90 index 5d584c4f6..615e6e4f5 100644 --- a/drof/drof_datamode_copyall.F90 +++ b/drof/drof_datamode_copyall.F90 @@ -101,7 +101,7 @@ subroutine drof_datamode_copyall_advance() ! zero out "special values" of export fields do ni = 1, size(Forr_rofl) - if (abs(strm_Forr_rofl(ni)) < SHR_CONST_SPVAL) then + if (abs(strm_Forr_rofl(ni)) < 1.e28_r8) then Forr_rofl(ni) = strm_Forr_rofl(ni) else Forr_rofl(ni) = 0.0_r8 @@ -109,8 +109,8 @@ subroutine drof_datamode_copyall_advance() enddo if (associated(strm_Forr_rofi)) then - do ni = 1, size(Forr_rofl) - if (abs(strm_Forr_rofi(ni)) < SHR_CONST_SPVAL) then + do ni = 1, size(Forr_rofi) + if (abs(strm_Forr_rofl(ni)) < 1.e28_r8) then Forr_rofi(:) = strm_Forr_rofi(:) else Forr_rofi(ni) = 0.0_r8 From 19c1e3f37c39555338477f99aa85ad7e2dc36fca Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 16 Jan 2026 16:33:36 +0100 Subject: [PATCH 46/61] fixed compile problem --- docn/ocn_comp_nuopc.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 4d0ec19a7..67a29dd2c 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -535,6 +535,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar integer , intent(out) :: rc ! local variables + logical :: do_restart_read character(len=CL) :: rpfile ! restart pointer file name character(len=*), parameter :: subName = "(docn_comp_run) " !------------------------------------------------------------------------------- From 414ba6a3534c0f44cb87cbb70dc35902f0d536d1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 16 Jan 2026 18:36:47 +0100 Subject: [PATCH 47/61] fixed problematic fix --- docn/ocn_comp_nuopc.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 67a29dd2c..10aeec7b4 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -581,7 +581,7 @@ subroutine docn_comp_run(gcomp, importState, exportState, clock, target_ymd, tar do_restart_read = .false. end if - if (restart_read) then + if (do_restart_read) then call shr_get_rpointer_name(gcomp, 'ocn', target_ymd, target_tod, rpfile, 'read', rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 1670e2b759c8b7f8e2b5fa16c2d735e4f7270a59 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 16 Jan 2026 20:14:15 +0100 Subject: [PATCH 48/61] fixed typo in correcting errors --- drof/drof_datamode_copyall.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drof/drof_datamode_copyall.F90 b/drof/drof_datamode_copyall.F90 index 615e6e4f5..9c89155fb 100644 --- a/drof/drof_datamode_copyall.F90 +++ b/drof/drof_datamode_copyall.F90 @@ -110,7 +110,7 @@ subroutine drof_datamode_copyall_advance() if (associated(strm_Forr_rofi)) then do ni = 1, size(Forr_rofi) - if (abs(strm_Forr_rofl(ni)) < 1.e28_r8) then + if (abs(strm_Forr_rofi(ni)) < 1.e28_r8) then Forr_rofi(:) = strm_Forr_rofi(:) else Forr_rofi(ni) = 0.0_r8 From 73008245fe15ff0dc12c6c56a62368e42360d593 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 16 Jan 2026 23:25:03 +0100 Subject: [PATCH 49/61] fixed problem found in testing aux_cdeps --- docn/cime_config/namelist_definition_docn.xml | 4 ++-- docn/ocn_comp_nuopc.F90 | 21 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index 321530056..1cc404bc6 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -40,7 +40,7 @@ char docn docn_nml - sstdata,sst_aquap1,sst_aquap2,sst_aquap3,sst_aquap4,sst_aquap5,sst_aquap6,sst_aquap7,sst_aquap8,sst_aquap9,sst_aquap10,sst_aquapfile,sst_aquap_constant,som,som_aquap,iaf,cplhist,multilev,multilev_dom,multilev_cplhist + sstdata,sst_aquap1,sst_aquap2,sst_aquap3,sst_aquap4,sst_aquap5,sst_aquap6,sst_aquap7,sst_aquap8,sst_aquap9,sst_aquap10,sst_aquapfile,sst_aquap_constant,som,som_aquap,iaf,cplhist,multilev,multilev_sstdata,multilev_cplhist General method that operates on the data for a given docn_mode. ==> dataMode = "sstdata" @@ -102,7 +102,7 @@ sst_aquap_file sst_aquap_constant multilev_cplhist - multilev_dom + multilev_sstdata multilev cplhist diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 10aeec7b4..e9d275060 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -299,16 +299,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if ! Validate datamode - the following values are currently accepted - ! 'sstdata' read stream, no import data - ! 'sst_aquap_file' read stream, no import data - ! 'som' read stream, needs import data - ! 'som_aquap' read stream, needs import data - ! 'cplhist' read stream, needs import data - ! 'sst_aquap_analytic' analytic, no streams, import or export data - ! 'sst_aquap_constant' analytic, no streams, import or export data - ! 'multilev_cplhist' multilevel ocean input from cplhist data - ! 'multilev' multilevel ocean input - ! 'multilev_sstdata' multilevel ocean input and sst export + ! Unless specifically noted below, no import data is needed from the mediator + ! 'sstdata' read stream + ! 'sst_aquap_file' read stream + ! 'som' read stream, needs import data from mediator + ! 'som_aquap' read stream, needs import data from mediator + ! 'cplhist' read stream + ! 'sst_aquap_analytic' analytic, no streams + ! 'sst_aquap_constant' analytic, no streams + ! 'multilev_cplhist' read stream, multilevel ocean export of cplhist data + ! 'multilev' read stream, multilevel ocean export + ! 'multilev_sstdata' read stream, multilevel ocean and sst export select case (trim(datamode)) case ( 'sstdata', 'sst_aquap_file', 'som', 'som_aquap', & From a3b28fa5c7fa66da45c04dfa6ee812b260d242e7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 16 Jan 2026 21:27:26 -0700 Subject: [PATCH 50/61] Remove line breaks from valid values for DATM_PRESNDEP The line break after the last valid value (cplhist) led it to be interpreted as "cplhist\n", so "cplhist" was determined to be not a valid value. So apparently we can't have a newline after the last valid value; I'm not sure about having newlines in other places, but it looked funny to have newlines in other places and not after the last one, so I'm just removing all newlines here. This reverts a change that was made as part of https://github.com/ESCOMP/CDEPS/pull/373 --- datm/cime_config/config_component.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/datm/cime_config/config_component.xml b/datm/cime_config/config_component.xml index 35bf01b60..cccc8e3a3 100644 --- a/datm/cime_config/config_component.xml +++ b/datm/cime_config/config_component.xml @@ -102,11 +102,7 @@ char - none, - clim_1850_cmip7,clim_2000_cmip7,clim_2010_cmip7,hist_cmip7, - clim_1850_cmip6,clim_2000_cmip6,clim_2010_cmip6,hist_cmip6, - SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP5-3.4,SSP5-8.5,cplhist - + none,clim_1850_cmip7,clim_2000_cmip7,clim_2010_cmip7,hist_cmip7,clim_1850_cmip6,clim_2000_cmip6,clim_2010_cmip6,hist_cmip6,SSP1-2.6,SSP2-4.5,SSP3-7.0,SSP5-3.4,SSP5-8.5,cplhist clim_2000 clim_1850_cmip6 From 5ac76ce505d80e87b25ad852a08810b9c6701b1a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 17 Jan 2026 13:10:32 +0100 Subject: [PATCH 51/61] refactored dice cplhist mode --- dice/dice_datamode_cplhist_mod.F90 | 187 ++++++++++++++++++++++------- dice/ice_comp_nuopc.F90 | 3 +- 2 files changed, 146 insertions(+), 44 deletions(-) diff --git a/dice/dice_datamode_cplhist_mod.F90 b/dice/dice_datamode_cplhist_mod.F90 index ab7921c88..98c7d84e5 100644 --- a/dice/dice_datamode_cplhist_mod.F90 +++ b/dice/dice_datamode_cplhist_mod.F90 @@ -5,16 +5,14 @@ module dice_datamode_cplhist_mod use ESMF , only : ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit - use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_Field + use ESMF , only : ESMF_State, ESMF_Field 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_const_mod , only : shr_const_TkFrzsw - use shr_sys_mod , only : shr_sys_abort + use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl + use shr_const_mod , only : shr_const_TkFrzsw, shr_const_spval use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add use dshr_mod , only : dshr_restart_read, dshr_restart_write - use dshr_strdata_mod , only : shr_strdata_type - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer implicit none private @@ -25,8 +23,9 @@ module dice_datamode_cplhist_mod public :: dice_datamode_cplhist_restart_read public :: dice_datamode_cplhist_restart_write - ! export fields ! ice to atm in CMEPS/mediator/esmFldsExchange_ufs_mod.F90 + + ! export field pointers real(r8), pointer :: Si_ifrac(:) => null() real(r8), pointer :: Si_imask(:) => null() real(r8), pointer :: Faii_taux(:) => null() @@ -43,7 +42,22 @@ module dice_datamode_cplhist_mod real(r8), pointer :: Si_anidr(:) => null() real(r8), pointer :: Si_anidf(:) => null() - type(dfield_type) , pointer :: dfields => null() + ! stream field pointers + real(r8), pointer :: strm_Si_ifrac(:) => null() + real(r8), pointer :: strm_Si_imask(:) => null() + real(r8), pointer :: strm_Faii_taux(:) => null() + real(r8), pointer :: strm_Faii_tauy(:) => null() + real(r8), pointer :: strm_Faii_lat(:) => null() + real(r8), pointer :: strm_Faii_sen(:) => null() + real(r8), pointer :: strm_Faii_lwup(:) => null() + real(r8), pointer :: strm_Faii_evap(:) => null() + real(r8), pointer :: strm_Si_vice(:) => null() + real(r8), pointer :: strm_Si_vsno(:) => null() + real(r8), pointer :: strm_Si_t(:) => null() + real(r8), pointer :: strm_Si_avsdr(:) => null() + real(r8), pointer :: strm_Si_avsdf(:) => null() + real(r8), pointer :: strm_Si_anidr(:) => null() + real(r8), pointer :: strm_Si_anidf(:) => null() character(len=*) , parameter :: u_FILE_u = & __FILE__ @@ -95,46 +109,19 @@ subroutine dice_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_ end subroutine dice_datamode_cplhist_advertise !=============================================================================== - subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & - flds_scalar_name, logunit, mainproc, rc) + subroutine dice_datamode_cplhist_init_pointers(exportState, sdat, rc) ! input/output variables - type(ESMF_State) , intent(inout) :: importState type(ESMF_State) , intent(inout) :: exportState - character(len=*) , intent(in) :: flds_scalar_name - integer , intent(in) :: logunit - logical , intent(in) :: mainproc type(shr_strdata_type) , intent(in) :: sdat integer , intent(out) :: rc ! local variables - integer :: n - type(ESMF_Field) :: lfield - character(CL) ,pointer :: lfieldnamelist(:) => null() - integer :: fieldcount character(len=*), parameter :: subname='(dice_init_pointers): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! Initialize dfields data type (to map streams to export state - ! fields) Create dfields linked list - used for copying stream - ! fields with ungridded dimensions to export state fields - call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lfieldnamelist(fieldCount)) - call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1, fieldCount - call ESMF_StateGet(exportState, itemName=trim(lfieldNameList(n)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (trim(lfieldnamelist(n)) /= flds_scalar_name) then - call dshr_dfield_add( dfields, sdat, trim(lfieldnamelist(n)), trim(lfieldnamelist(n)), & - exportState, logunit, mainproc, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - end if - end do - ! initialize pointers to export fields call dshr_state_getfldptr(exportState,'Si_ifrac',fldptr1=Si_ifrac, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -167,7 +154,41 @@ subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & call dshr_state_getfldptr(exportState, 'Si_anidf', fldptr1=Si_anidf, allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - !Initialize (e.g., =0)? + ! Set required stream pointer fields + call shr_strdata_get_stream_pointer(sdat,'Si_ifrac', strm_Si_ifrac, & + errmsg=subname//'ERROR: strm_Si_ifrac must be associated for dice cplhist datamode', rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat,'Si_imask', strm_Si_imask, & + errmsg=subname//'ERROR: strm_Si_imask must be associated for dice cplhist datamode', rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Set optional stream pointer fields + call shr_strdata_get_stream_pointer(sdat,'Faii_taux', strm_Faii_taux, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_tauy', strm_Faii_tauy, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_lat', strm_Faii_lat, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_sen', strm_Faii_sen, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_lwup', strm_Faii_lwup, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_evap', strm_Faii_evap, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_vice', strm_Si_vice, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_vsno', strm_Si_vsno, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_avsdr', strm_Si_avsdr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_avsdf', strm_Si_avsdf, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_anidr', strm_Si_anidr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_anidf', strm_Si_anidf, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_t', strm_Si_t, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return end subroutine dice_datamode_cplhist_init_pointers @@ -184,11 +205,93 @@ subroutine dice_datamode_cplhist_advance(sdat, rc) rc = ESMF_SUCCESS - ! Automatically update the fields in the export state - call ESMF_TraceRegionEnter('dice_dfield_copy') - call dshr_dfield_copy(dfields, sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('dice_dfield_copy') + Si_imask(:) = strm_Si_imask(:) + Si_ifrac(:) = strm_Si_ifrac(:) + + if (associated(Faii_taux)) then + if (associated(strm_Faii_taux)) then + Faii_taux(:) = strm_Faii_taux(:) + else + Faii_taux(:) = shr_const_spval + end if + end if + if (associated(Faii_tauy)) then + if (associated(strm_Faii_tauy)) then + Faii_tauy(:) = strm_Faii_tauy(:) + else + Faii_tauy(:) = shr_const_spval + end if + end if + if (associated(Faii_lat)) then + if (associated(strm_Faii_lat)) then + Faii_lat(:) = strm_Faii_lat(:) + else + Faii_lat(:) = shr_const_spval + end if + end if + if (associated(Faii_sen)) then + if (associated(strm_Faii_sen)) then + Faii_sen(:) = strm_Faii_sen(:) + else + Faii_sen(:) = shr_const_spval + end if + end if + if (associated(Faii_lwup)) then + if (associated(strm_Faii_lwup)) then + Faii_lwup(:) = strm_Faii_lwup(:) + else + Faii_lwup(:) = shr_const_spval + end if + end if + if (associated(Si_vice)) then + if (associated(strm_Si_vice)) then + Si_vice(:) = strm_Si_vice(:) + else + Si_vice(:) = shr_const_spval + end if + end if + if (associated(Si_vsno)) then + if (associated(strm_Si_vsno)) then + Si_vsno(:) = strm_Si_vsno(:) + else + Si_vsno(:) = shr_const_spval + end if + end if + if (associated(Si_avsdr)) then + if (associated(strm_Si_avsdr)) then + Si_avsdr(:) = strm_Si_avsdr(:) + else + Si_avsdr(:) = shr_const_spval + end if + end if + if (associated(Si_avsdf)) then + if (associated(strm_Si_avsdf)) then + Si_avsdf(:) = strm_Si_avsdf(:) + else + Si_avsdf(:) = shr_const_spval + end if + end if + if (associated(Si_anidr)) then + if (associated(strm_Si_anidr)) then + Si_anidr(:) = strm_Si_anidr(:) + else + Si_anidr(:) = shr_const_spval + end if + end if + if (associated(Si_anidf)) then + if (associated(strm_Si_anidf)) then + Si_anidf(:) = strm_Si_anidf(:) + else + Si_anidf(:) = shr_const_spval + end if + end if + if (associated(Si_t)) then + if (associated(strm_Si_t)) then + Si_t(:) = strm_Si_t(:) + else + Si_t(:) = shr_const_spval + end if + end if ! Unit conversions, calculations,.... Where aice=0, Si_t=0K (as ! missing value). Interpolation in time between ice that comes or diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 2b0afedb0..b3dd1dbe7 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -504,8 +504,7 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod call dice_datamode_ssmi_init_pointers(importState, exportState, sdat, flds_i2o_per_cat, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return case('cplhist') - call dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & - flds_scalar_name, logunit, mainproc, rc) + call dice_datamode_cplhist_init_pointers(exportState, sdat, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return end select From 0539008b84a1d23eba66fd7afa1228d5055023c0 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 17 Jan 2026 06:37:09 -0700 Subject: [PATCH 52/61] fix test failure for SMS_D_Ld1.ne30pg3_t232.I1850Clm50BgcSpinup.derecho_intel.clm-cplhist --- datm/datm_datamode_cplhist_mod.F90 | 8 ++++++++ streams/dshr_methods_mod.F90 | 2 ++ 2 files changed, 10 insertions(+) diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index a93fb94c5..27788fcc5 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -21,6 +21,7 @@ module datm_datamode_cplhist_mod ! export state data pointers + real(r8), pointer :: Sa_topo(:) => null() real(r8), pointer :: Sa_z(:) => null() real(r8), pointer :: Sa_tbot(:) => null() real(r8), pointer :: Sa_ptem(:) => null() @@ -42,6 +43,7 @@ module datm_datamode_cplhist_mod ! stream data pointers + real(r8), pointer :: strm_Sa_topo(:) => null() real(r8), pointer :: strm_Sa_z (:) => null() real(r8), pointer :: strm_Sa_tbot(:) => null() real(r8), pointer :: strm_Sa_ptem(:) => null() @@ -132,6 +134,8 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r rc = ESMF_SUCCESS ! get export state pointers + call dshr_state_getfldptr(exportState, 'Sa_topo' , fldptr1=Sa_topo , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , rc=rc) @@ -171,6 +175,9 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r ! Set pointers into stream data + call shr_strdata_get_stream_pointer(sdat, 'Sa_topo', strm_Sa_topo, requirePointer=.true., & + errmsg=subname//'ERROR: strm_Sa_z must be associated for cplhist datamode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_z', strm_Sa_z, requirePointer=.true., & errmsg=subname//'ERROR: strm_Sa_z must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -246,6 +253,7 @@ subroutine datm_datamode_cplhist_advance(rc) rc = ESMF_SUCCESS + Sa_topo(:) = strm_Sa_topo(:) Sa_z(:) = strm_Sa_z(:) Sa_tbot(:) = strm_Sa_tbot(:) Sa_ptem(:) = strm_Sa_ptem(:) diff --git a/streams/dshr_methods_mod.F90 b/streams/dshr_methods_mod.F90 index 0da81255c..b3dde7df0 100644 --- a/streams/dshr_methods_mod.F90 +++ b/streams/dshr_methods_mod.F90 @@ -151,6 +151,7 @@ subroutine dshr_state_diagnose(State, flds_scalar_name, string, rc) if (lrank == 0) then ! no local data elseif (lrank == 1) then + write(6,'(2a)')'DEBUG: diagnosing 1d ',trim(lfieldnamelist(n)) if (size(dataPtr1d) > 0) then write(msgString,'(A,3g14.7,i8)') trim(string)//': '//trim(lfieldnamelist(n)), & minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) @@ -158,6 +159,7 @@ subroutine dshr_state_diagnose(State, flds_scalar_name, string, rc) write(msgString,'(A,a)') trim(string)//': '//trim(lfieldnamelist(n))," no data" endif elseif (lrank == 2) then + write(6,'(2a)')'DEBUG: diagnosing 2d ',trim(lfieldnamelist(n)) if (size(dataPtr2d) > 0) then write(msgString,'(A,3g14.7,i8)') trim(string)//': '//trim(lfieldnamelist(n)), & minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) From 91ca9b8d7e3ef186e80553a9749f0d71bc969703 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 17 Jan 2026 06:38:37 -0700 Subject: [PATCH 53/61] removed extraneous debug statements --- streams/dshr_methods_mod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/streams/dshr_methods_mod.F90 b/streams/dshr_methods_mod.F90 index b3dde7df0..0da81255c 100644 --- a/streams/dshr_methods_mod.F90 +++ b/streams/dshr_methods_mod.F90 @@ -151,7 +151,6 @@ subroutine dshr_state_diagnose(State, flds_scalar_name, string, rc) if (lrank == 0) then ! no local data elseif (lrank == 1) then - write(6,'(2a)')'DEBUG: diagnosing 1d ',trim(lfieldnamelist(n)) if (size(dataPtr1d) > 0) then write(msgString,'(A,3g14.7,i8)') trim(string)//': '//trim(lfieldnamelist(n)), & minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) @@ -159,7 +158,6 @@ subroutine dshr_state_diagnose(State, flds_scalar_name, string, rc) write(msgString,'(A,a)') trim(string)//': '//trim(lfieldnamelist(n))," no data" endif elseif (lrank == 2) then - write(6,'(2a)')'DEBUG: diagnosing 2d ',trim(lfieldnamelist(n)) if (size(dataPtr2d) > 0) then write(msgString,'(A,3g14.7,i8)') trim(string)//': '//trim(lfieldnamelist(n)), & minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) From c235eca8179db1580eb89a67dc3dd8a937e8a718 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 17 Jan 2026 08:07:10 -0700 Subject: [PATCH 54/61] Fix error message --- datm/datm_datamode_cplhist_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index 27788fcc5..049c41f36 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -176,7 +176,7 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r ! Set pointers into stream data call shr_strdata_get_stream_pointer(sdat, 'Sa_topo', strm_Sa_topo, requirePointer=.true., & - errmsg=subname//'ERROR: strm_Sa_z must be associated for cplhist datamode', rc=rc) + errmsg=subname//'ERROR: strm_Sa_topo must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_z', strm_Sa_z, requirePointer=.true., & errmsg=subname//'ERROR: strm_Sa_z must be associated for cplhist datamode', rc=rc) From c65bba8e18db8976207c49a331e68b8ff584e86f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 17 Jan 2026 13:10:32 +0100 Subject: [PATCH 55/61] refactored dice cplhist mode --- dice/dice_datamode_cplhist_mod.F90 | 187 ++++++++++++++++++++++------- dice/ice_comp_nuopc.F90 | 3 +- 2 files changed, 146 insertions(+), 44 deletions(-) diff --git a/dice/dice_datamode_cplhist_mod.F90 b/dice/dice_datamode_cplhist_mod.F90 index ab7921c88..98c7d84e5 100644 --- a/dice/dice_datamode_cplhist_mod.F90 +++ b/dice/dice_datamode_cplhist_mod.F90 @@ -5,16 +5,14 @@ module dice_datamode_cplhist_mod use ESMF , only : ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit - use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_Field + use ESMF , only : ESMF_State, ESMF_Field 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_const_mod , only : shr_const_TkFrzsw - use shr_sys_mod , only : shr_sys_abort + use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl + use shr_const_mod , only : shr_const_TkFrzsw, shr_const_spval use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add use dshr_mod , only : dshr_restart_read, dshr_restart_write - use dshr_strdata_mod , only : shr_strdata_type - use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer implicit none private @@ -25,8 +23,9 @@ module dice_datamode_cplhist_mod public :: dice_datamode_cplhist_restart_read public :: dice_datamode_cplhist_restart_write - ! export fields ! ice to atm in CMEPS/mediator/esmFldsExchange_ufs_mod.F90 + + ! export field pointers real(r8), pointer :: Si_ifrac(:) => null() real(r8), pointer :: Si_imask(:) => null() real(r8), pointer :: Faii_taux(:) => null() @@ -43,7 +42,22 @@ module dice_datamode_cplhist_mod real(r8), pointer :: Si_anidr(:) => null() real(r8), pointer :: Si_anidf(:) => null() - type(dfield_type) , pointer :: dfields => null() + ! stream field pointers + real(r8), pointer :: strm_Si_ifrac(:) => null() + real(r8), pointer :: strm_Si_imask(:) => null() + real(r8), pointer :: strm_Faii_taux(:) => null() + real(r8), pointer :: strm_Faii_tauy(:) => null() + real(r8), pointer :: strm_Faii_lat(:) => null() + real(r8), pointer :: strm_Faii_sen(:) => null() + real(r8), pointer :: strm_Faii_lwup(:) => null() + real(r8), pointer :: strm_Faii_evap(:) => null() + real(r8), pointer :: strm_Si_vice(:) => null() + real(r8), pointer :: strm_Si_vsno(:) => null() + real(r8), pointer :: strm_Si_t(:) => null() + real(r8), pointer :: strm_Si_avsdr(:) => null() + real(r8), pointer :: strm_Si_avsdf(:) => null() + real(r8), pointer :: strm_Si_anidr(:) => null() + real(r8), pointer :: strm_Si_anidf(:) => null() character(len=*) , parameter :: u_FILE_u = & __FILE__ @@ -95,46 +109,19 @@ subroutine dice_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_ end subroutine dice_datamode_cplhist_advertise !=============================================================================== - subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & - flds_scalar_name, logunit, mainproc, rc) + subroutine dice_datamode_cplhist_init_pointers(exportState, sdat, rc) ! input/output variables - type(ESMF_State) , intent(inout) :: importState type(ESMF_State) , intent(inout) :: exportState - character(len=*) , intent(in) :: flds_scalar_name - integer , intent(in) :: logunit - logical , intent(in) :: mainproc type(shr_strdata_type) , intent(in) :: sdat integer , intent(out) :: rc ! local variables - integer :: n - type(ESMF_Field) :: lfield - character(CL) ,pointer :: lfieldnamelist(:) => null() - integer :: fieldcount character(len=*), parameter :: subname='(dice_init_pointers): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! Initialize dfields data type (to map streams to export state - ! fields) Create dfields linked list - used for copying stream - ! fields with ungridded dimensions to export state fields - call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lfieldnamelist(fieldCount)) - call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1, fieldCount - call ESMF_StateGet(exportState, itemName=trim(lfieldNameList(n)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (trim(lfieldnamelist(n)) /= flds_scalar_name) then - call dshr_dfield_add( dfields, sdat, trim(lfieldnamelist(n)), trim(lfieldnamelist(n)), & - exportState, logunit, mainproc, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - end if - end do - ! initialize pointers to export fields call dshr_state_getfldptr(exportState,'Si_ifrac',fldptr1=Si_ifrac, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -167,7 +154,41 @@ subroutine dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & call dshr_state_getfldptr(exportState, 'Si_anidf', fldptr1=Si_anidf, allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - !Initialize (e.g., =0)? + ! Set required stream pointer fields + call shr_strdata_get_stream_pointer(sdat,'Si_ifrac', strm_Si_ifrac, & + errmsg=subname//'ERROR: strm_Si_ifrac must be associated for dice cplhist datamode', rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat,'Si_imask', strm_Si_imask, & + errmsg=subname//'ERROR: strm_Si_imask must be associated for dice cplhist datamode', rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Set optional stream pointer fields + call shr_strdata_get_stream_pointer(sdat,'Faii_taux', strm_Faii_taux, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_tauy', strm_Faii_tauy, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_lat', strm_Faii_lat, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_sen', strm_Faii_sen, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_lwup', strm_Faii_lwup, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Faii_evap', strm_Faii_evap, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_vice', strm_Si_vice, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_vsno', strm_Si_vsno, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_avsdr', strm_Si_avsdr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_avsdf', strm_Si_avsdf, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_anidr', strm_Si_anidr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_anidf', strm_Si_anidf, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer(sdat, 'Si_t', strm_Si_t, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return end subroutine dice_datamode_cplhist_init_pointers @@ -184,11 +205,93 @@ subroutine dice_datamode_cplhist_advance(sdat, rc) rc = ESMF_SUCCESS - ! Automatically update the fields in the export state - call ESMF_TraceRegionEnter('dice_dfield_copy') - call dshr_dfield_copy(dfields, sdat, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TraceRegionExit('dice_dfield_copy') + Si_imask(:) = strm_Si_imask(:) + Si_ifrac(:) = strm_Si_ifrac(:) + + if (associated(Faii_taux)) then + if (associated(strm_Faii_taux)) then + Faii_taux(:) = strm_Faii_taux(:) + else + Faii_taux(:) = shr_const_spval + end if + end if + if (associated(Faii_tauy)) then + if (associated(strm_Faii_tauy)) then + Faii_tauy(:) = strm_Faii_tauy(:) + else + Faii_tauy(:) = shr_const_spval + end if + end if + if (associated(Faii_lat)) then + if (associated(strm_Faii_lat)) then + Faii_lat(:) = strm_Faii_lat(:) + else + Faii_lat(:) = shr_const_spval + end if + end if + if (associated(Faii_sen)) then + if (associated(strm_Faii_sen)) then + Faii_sen(:) = strm_Faii_sen(:) + else + Faii_sen(:) = shr_const_spval + end if + end if + if (associated(Faii_lwup)) then + if (associated(strm_Faii_lwup)) then + Faii_lwup(:) = strm_Faii_lwup(:) + else + Faii_lwup(:) = shr_const_spval + end if + end if + if (associated(Si_vice)) then + if (associated(strm_Si_vice)) then + Si_vice(:) = strm_Si_vice(:) + else + Si_vice(:) = shr_const_spval + end if + end if + if (associated(Si_vsno)) then + if (associated(strm_Si_vsno)) then + Si_vsno(:) = strm_Si_vsno(:) + else + Si_vsno(:) = shr_const_spval + end if + end if + if (associated(Si_avsdr)) then + if (associated(strm_Si_avsdr)) then + Si_avsdr(:) = strm_Si_avsdr(:) + else + Si_avsdr(:) = shr_const_spval + end if + end if + if (associated(Si_avsdf)) then + if (associated(strm_Si_avsdf)) then + Si_avsdf(:) = strm_Si_avsdf(:) + else + Si_avsdf(:) = shr_const_spval + end if + end if + if (associated(Si_anidr)) then + if (associated(strm_Si_anidr)) then + Si_anidr(:) = strm_Si_anidr(:) + else + Si_anidr(:) = shr_const_spval + end if + end if + if (associated(Si_anidf)) then + if (associated(strm_Si_anidf)) then + Si_anidf(:) = strm_Si_anidf(:) + else + Si_anidf(:) = shr_const_spval + end if + end if + if (associated(Si_t)) then + if (associated(strm_Si_t)) then + Si_t(:) = strm_Si_t(:) + else + Si_t(:) = shr_const_spval + end if + end if ! Unit conversions, calculations,.... Where aice=0, Si_t=0K (as ! missing value). Interpolation in time between ice that comes or diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 2b0afedb0..b3dd1dbe7 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -504,8 +504,7 @@ subroutine dice_comp_run(gcomp, importstate, exportstate, target_ymd, target_tod call dice_datamode_ssmi_init_pointers(importState, exportState, sdat, flds_i2o_per_cat, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return case('cplhist') - call dice_datamode_cplhist_init_pointers(importState, exportState, sdat, & - flds_scalar_name, logunit, mainproc, rc) + call dice_datamode_cplhist_init_pointers(exportState, sdat, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return end select From 306bee1192189b1557b319a3d36984a2819f1314 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 17 Jan 2026 09:09:57 -0700 Subject: [PATCH 56/61] fixed baseline differences in ocnImp_So_bldepth in ERI.TL319_t232.DTEST.derecho_intel.cice-default test --- docn/docn_datamode_som_mod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index 8801faa2f..ff6026bf0 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -236,9 +236,10 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f ! Allocate memory for somtp allocate(somtp(sdat%model_lsize)) - ! Initialize export state pointers to non-zero + ! Initialize export state pointers So_t(:) = TkFrz So_s(:) = ocnsalt + So_bldepth(:) = 0._r8 end subroutine docn_datamode_som_init_pointers From 8ce3ffeefa2e7e9f3eb84e44672bbfde357dee89 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 18 Jan 2026 19:16:42 +0100 Subject: [PATCH 57/61] added new drof_datamode_cplhist.F90 and expanded list of cplhist stream fields --- drof/CMakeLists.txt | 5 +- drof/cime_config/namelist_definition_drof.xml | 11 +- drof/cime_config/stream_definition_drof.xml | 9 +- drof/cime_config/testdefs/testlist_drof.xml | 8 + .../drof/cplhist_noresm/shell_commands | 6 + drof/drof_datamode_cplhist.F90 | 198 ++++++++++++++++++ drof/rof_comp_nuopc.F90 | 33 ++- 7 files changed, 255 insertions(+), 15 deletions(-) create mode 100644 drof/cime_config/testdefs/testmods_dirs/drof/cplhist_noresm/shell_commands create mode 100644 drof/drof_datamode_cplhist.F90 diff --git a/drof/CMakeLists.txt b/drof/CMakeLists.txt index 847a23670..93fcd4af9 100644 --- a/drof/CMakeLists.txt +++ b/drof/CMakeLists.txt @@ -1,6 +1,7 @@ project(drof Fortran) -set(SRCFILES rof_comp_nuopc.F90 - drof_datamode_copyall.F90) +set(SRCFILES rof_comp_nuopc.F90 + drof_datamode_copyall.F90 + drof_datamode_cplhist.F90) foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.drof/${FILE}") diff --git a/drof/cime_config/namelist_definition_drof.xml b/drof/cime_config/namelist_definition_drof.xml index 56f8646c6..5a09f8309 100644 --- a/drof/cime_config/namelist_definition_drof.xml +++ b/drof/cime_config/namelist_definition_drof.xml @@ -6,7 +6,7 @@ char(100) streams streams_file - List of streams used for the given drof_mode. + List of streams used for the given drof_mode (determined by the xml variable $DROF_MODE) rof.cplhist rof.diatren_ann_rx1 @@ -31,16 +31,19 @@ char drof drof_nml - copyall + copyall,cplhist The runoff data is associated with the river model. Copies all fields directly from the input data streams Any required fields not found on an input stream will be set to zero. - The only datamode is copyall - the streams are determined by the xml variable $DROF_MODE - dataMode = "copyall" + The two modes are copyall and cplhist. In cplhist mode, more fields are advertised + to the mediator than in copyall mode. + The streams are determined by the xml variable $DROF_MODE + dataMode = "copyall,cplhist" copyall + cplhist diff --git a/drof/cime_config/stream_definition_drof.xml b/drof/cime_config/stream_definition_drof.xml index b9f7ddab2..0594b6ce9 100644 --- a/drof/cime_config/stream_definition_drof.xml +++ b/drof/cime_config/stream_definition_drof.xml @@ -641,8 +641,13 @@ $DROF_CPLHIST_DIR/$DROF_CPLHIST_CASE.cpl.hx.rof.24h.avrg.%ymd-00000.nc - rofImp_Forr_rofl Forr_rofl - rofImp_Forr_rofi Forr_rofi + rofImp_Forr_rofl Forr_rofl + rofImp_Forr_rofl_glc Forr_rofl_glc + rofImp_Forr_rofi Forr_rofi + rofImp_Forr_rofi_glc Forr_rofi_glc + rofImp_Flrr_flood Flrr_flood + rofImp_Flrr_volr Flrr_volr + rofImp_Flrr_volrmch Flrr_volrmch null diff --git a/drof/cime_config/testdefs/testlist_drof.xml b/drof/cime_config/testdefs/testlist_drof.xml index 6e423fabe..21252bc61 100644 --- a/drof/cime_config/testdefs/testlist_drof.xml +++ b/drof/cime_config/testdefs/testlist_drof.xml @@ -10,5 +10,13 @@ + + + + + + + + diff --git a/drof/cime_config/testdefs/testmods_dirs/drof/cplhist_noresm/shell_commands b/drof/cime_config/testdefs/testmods_dirs/drof/cplhist_noresm/shell_commands new file mode 100644 index 000000000..54ed06869 --- /dev/null +++ b/drof/cime_config/testdefs/testmods_dirs/drof/cplhist_noresm/shell_commands @@ -0,0 +1,6 @@ +./xmlchange DROF_CPLHIST_DIR=\$DIN_LOC_ROOT/cplhist/noresm3_0/n1850.ne16pg3_tn14.noresm3_0_beta03b.CPLHIST.2025-10-29/cplhist +./xmlchange DROF_CPLHIST_CASE=n1850.ne16pg3_tn14.noresm3_0_beta03b.CPLHIST.2025-10-29 +./xmlchange DROF_CPLHIST_YR_START=350 +./xmlchange DROF_CPLHIST_YR_END=351 +./xmlchange DROF_CPLHIST_YR_ALIGN=1 +./xmlchange ROF_DOMAIN_MESH=\$DIN_LOC_ROOT/share/meshes/r05_nomask_c110308_ESMFmesh.nc \ No newline at end of file diff --git a/drof/drof_datamode_cplhist.F90 b/drof/drof_datamode_cplhist.F90 new file mode 100644 index 000000000..f8ad2b3d0 --- /dev/null +++ b/drof/drof_datamode_cplhist.F90 @@ -0,0 +1,198 @@ +module drof_datamode_cplhist_mod + + use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS + use NUOPC , only : NUOPC_Advertise + use shr_kind_mod , only : r8=>shr_kind_r8 + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer + use shr_const_mod , only : SHR_CONST_SPVAL + + implicit none + private + + public :: drof_datamode_cplhist_advertise + public :: drof_datamode_cplhist_init_pointers + public :: drof_datamode_cplhist_advance + + ! export state pointer arrays + real(r8), pointer :: Forr_rofl(:) => null() ! mediator sends this to ocn + real(r8), pointer :: Forr_rofl_glc(:) => null() ! mediator sends this to ocn + real(r8), pointer :: Forr_rofi(:) => null() ! mediator sends this to ocn + real(r8), pointer :: Forr_rofi_glc(:) => null() ! mediator sends this to ocn + real(r8), pointer :: Flrr_flood(:) => null() ! mediator sends this to lnd + real(r8), pointer :: Flrr_volr(:) => null() ! mediator sends this to lnd + real(r8), pointer :: Flrr_volrmch(:) => null() ! mediator sends this to lnd + + ! stream pointer arrays + real(r8), pointer :: strm_Forr_rofl(:) => null() + real(r8), pointer :: strm_Forr_rofi(:) => null() + real(r8), pointer :: strm_Forr_rofl_glc(:) => null() + real(r8), pointer :: strm_Forr_rofi_glc(:) => null() + real(r8), pointer :: strm_Flrr_flood(:) => null() + real(r8), pointer :: strm_Flrr_volr(:) => null() + real(r8), pointer :: strm_Flrr_volrmch(:) => null() + + character(len=*) , parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine drof_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_name, rc) + + ! input/output variables + type(esmf_State) , intent(inout) :: exportState + type(fldlist_type) , pointer :: fldsexport + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(out) :: rc + + ! local variables + type(fldlist_type), pointer :: fldList + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Advertise export fields + call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) + call dshr_fldlist_add(fldsExport, "Forr_rofl") + call dshr_fldlist_add(fldsExport, "Forr_rofl_glc") + call dshr_fldlist_add(fldsExport, "Forr_rofi") + call dshr_fldlist_add(fldsExport, "Forr_rofi_glc") + call dshr_fldlist_add(fldsExport, "Flrr_flood") + call dshr_fldlist_add(fldsExport, "Flrr_volr") + call dshr_fldlist_add(fldsExport, "Flrr_volrmch") + + fldlist => fldsExport ! the head of the linked list + do while (associated(fldlist)) + call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite('(drof_comp_advertise): Fr_drof'//trim(fldList%stdname), ESMF_LOGMSG_INFO) + fldList => fldList%next + enddo + + end subroutine drof_datamode_cplhist_advertise + + !=============================================================================== + subroutine drof_datamode_cplhist_init_pointers(exportState, sdat, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(drof_datamode_cplhist_init_pointers): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Initialize module export state pointers + call dshr_state_getfldptr(exportState, 'Forr_rofl' , fldptr1=Forr_rofl , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Forr_rofl_glc', fldptr1=Forr_rofl_glc, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Forr_rofi' , fldptr1=Forr_rofi , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Forr_rofi_glc', fldptr1=Forr_rofi_glc, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Flrr_flood' , fldptr1=Flrr_flood , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Flrr_volr' , fldptr1=Flrr_volr , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Flrr_volrmch' , fldptr1=Flrr_volrmch, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Initialize module stream pointers + call shr_strdata_get_stream_pointer( sdat, 'Forr_rofl', strm_Forr_rofl, requirePointer=.true., & + errmsg=subname//'ERROR: strm_Forr_rofl must be associated for drof cplhist mode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Forr_rofl_glc', strm_Forr_rofl_glc, requirePointer=.true., & + errmsg=subname//'ERROR: strm_Forr_rofl_glc must be associated for drof cplhist mode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Forr_rofi', strm_Forr_rofi, requirePointer=.true., & + errmsg=subname//'ERROR: strm_Forr_rofi must be associated for drof cplhist mode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Forr_rofi_glc', strm_Forr_rofi_glc, requirePointer=.true., & + errmsg=subname//'ERROR: strm_Forr_rofi_glc must be associated for drof cplhist mode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Flrr_flood', strm_Flrr_flood, requirePointer=.true., & + errmsg=subname//'ERROR: strm_Flrr_flood must be associated for drof cplhist mode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Flrr_volr', strm_Flrr_volr, requirePointer=.true., & + errmsg=subname//'ERROR: strm_Flrr_volr must be associated for drof cplhist mode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_strdata_get_stream_pointer( sdat, 'Flrr_volrmch', strm_Flrr_volrmch, requirePointer=.true., & + errmsg=subname//'ERROR: strm_Flrr_volrmch must be associated for drof cplhist mode', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine drof_datamode_cplhist_init_pointers + + !=============================================================================== + subroutine drof_datamode_cplhist_advance() + + ! local variables + integer :: ni + !------------------------------------------------------------------------------- + + ! zero out "special values" of export fields + do ni = 1, size(Forr_rofl) + if (abs(strm_Forr_rofl(ni)) < 1.e28_r8) then + Forr_rofl(ni) = strm_Forr_rofl(ni) + else + Forr_rofl(ni) = 0.0_r8 + end if + enddo + + do ni = 1, size(Forr_rofl_glc) + if (abs(strm_Forr_rofl_glc(ni)) < 1.e28_r8) then + Forr_rofl_glc(:) = strm_Forr_rofl_glc(:) + else + Forr_rofl_glc(ni) = 0.0_r8 + end if + end do + + do ni = 1, size(Forr_rofi) + if (abs(strm_Forr_rofi(ni)) < 1.e28_r8) then + Forr_rofi(:) = strm_Forr_rofi(:) + else + Forr_rofi(ni) = 0.0_r8 + end if + end do + + do ni = 1, size(Forr_rofi_glc) + if (abs(strm_Forr_rofi_glc(ni)) < 1.e28_r8) then + Forr_rofi_glc(:) = strm_Forr_rofi_glc(:) + else + Forr_rofi_glc(ni) = 0.0_r8 + end if + end do + + do ni = 1, size(Flrr_flood) + if (abs(strm_Flrr_flood(ni)) < 1.e28_r8) then + Flrr_flood(ni) = strm_Flrr_flood(ni) + else + Flrr_flood(ni) = 0.0_r8 + end if + enddo + + do ni = 1, size(Flrr_volr) + if (abs(strm_Flrr_volr(ni)) < 1.e28_r8) then + Flrr_volr(ni) = strm_Flrr_volr(ni) + else + Flrr_volr(ni) = 0.0_r8 + end if + enddo + + do ni = 1, size(Flrr_volrmch) + if (abs(strm_Flrr_volrmch(ni)) < 1.e28_r8) then + Flrr_volrmch(ni) = strm_Flrr_volrmch(ni) + else + Flrr_volrmch(ni) = 0.0_r8 + end if + enddo + + end subroutine drof_datamode_cplhist_advance + +end module drof_datamode_cplhist_mod diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index ac4886871..06d837069 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -39,6 +39,10 @@ module cdeps_drof_comp use drof_datamode_copyall_mod, only : drof_datamode_copyall_init_pointers use drof_datamode_copyall_mod, only : drof_datamode_copyall_advance + use drof_datamode_cplhist_mod, only : drof_datamode_cplhist_advertise + use drof_datamode_cplhist_mod, only : drof_datamode_cplhist_init_pointers + use drof_datamode_cplhist_mod, only : drof_datamode_cplhist_advance + implicit none private @@ -241,18 +245,22 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Validate datamode select case (trim(datamode)) - case('copyall') - if (mainproc) then - write(logunit,'(2a)') subname,'drof datamode = ',trim(datamode) - end if + case('copyall','cplhist') + if (mainproc) write(logunit,'(2a)') subname,'drof datamode = ',trim(datamode) case default call shr_log_error(' ERROR illegal drof datamode = '//trim(datamode), rc=rc) return end select ! Advertise export fields - call drof_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + select case (trim(datamode)) + case('copyall') + call drof_datamode_copyall_advertise(exportState, fldsexport, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('cplhist') + call drof_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end select end subroutine InitializeAdvertise @@ -401,6 +409,12 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri case('copyall') call drof_datamode_copyall_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('cplhist') + call drof_datamode_cplhist_init_pointers(exportState, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + case default + call shr_log_error(' ERROR illegal drof datamode = '//trim(datamode), rc=rc) + return end select ! Read restart if needed @@ -429,13 +443,18 @@ subroutine drof_comp_run(gcomp, exportState, target_ymd, target_tod, restart_wri select case (trim(datamode)) case('copyall') call drof_datamode_copyall_advance() + case('cplhist') + call drof_datamode_cplhist_advance() + case default + call shr_log_error(' ERROR illegal drof datamode = '//trim(datamode), rc=rc) + return end select call ESMF_TraceRegionExit('drof_datamode') ! write restarts if needed if (restart_write) then select case (trim(datamode)) - case('copyall') + case('copyall','cplhist') call shr_get_rpointer_name(gcomp, 'rof', target_ymd, target_tod, rpfile, 'write', rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_restart_write(rpfile, case_name, 'drof', inst_suffix, target_ymd, target_tod, & From 419ca8669fc66df97b4d2c21bee861f61d3aee4c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 19 Jan 2026 22:39:43 +0100 Subject: [PATCH 58/61] fixed problems in latest PR --- datm/datm_datamode_cplhist_mod.F90 | 3 --- drof/drof_datamode_cplhist.F90 | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 index 049c41f36..a26193c61 100644 --- a/datm/datm_datamode_cplhist_mod.F90 +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -199,9 +199,6 @@ subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, r call shr_strdata_get_stream_pointer(sdat, 'Sa_pslv', strm_Sa_pslv, requirePointer=.true., & errmsg=subname//'ERROR: strm_Sa_pslv must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer(sdat, 'Sa_dens', strm_Sa_dens, requirePointer=.true., & - errmsg=subname//'ERROR: strm_Sa_dens must be associated for cplhist datamode', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer(sdat, 'Sa_u', strm_Sa_u, requirePointer=.true., & errmsg=subname//'ERROR: strm_Sa_u must be associated for cplhist datamode', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/drof/drof_datamode_cplhist.F90 b/drof/drof_datamode_cplhist.F90 index f8ad2b3d0..d794adef3 100644 --- a/drof/drof_datamode_cplhist.F90 +++ b/drof/drof_datamode_cplhist.F90 @@ -147,7 +147,7 @@ subroutine drof_datamode_cplhist_advance() do ni = 1, size(Forr_rofl_glc) if (abs(strm_Forr_rofl_glc(ni)) < 1.e28_r8) then - Forr_rofl_glc(:) = strm_Forr_rofl_glc(:) + Forr_rofl_glc(ni) = strm_Forr_rofl_glc(ni) else Forr_rofl_glc(ni) = 0.0_r8 end if @@ -155,7 +155,7 @@ subroutine drof_datamode_cplhist_advance() do ni = 1, size(Forr_rofi) if (abs(strm_Forr_rofi(ni)) < 1.e28_r8) then - Forr_rofi(:) = strm_Forr_rofi(:) + Forr_rofi(ni) = strm_Forr_rofi(ni) else Forr_rofi(ni) = 0.0_r8 end if @@ -163,7 +163,7 @@ subroutine drof_datamode_cplhist_advance() do ni = 1, size(Forr_rofi_glc) if (abs(strm_Forr_rofi_glc(ni)) < 1.e28_r8) then - Forr_rofi_glc(:) = strm_Forr_rofi_glc(:) + Forr_rofi_glc(ni) = strm_Forr_rofi_glc(ni) else Forr_rofi_glc(ni) = 0.0_r8 end if From 03e9bb749dc9edfc25f80e72378b008025bcddf7 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 21 Jan 2026 19:43:35 +0100 Subject: [PATCH 59/61] fixed another problem found in PR review --- drof/drof_datamode_copyall.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drof/drof_datamode_copyall.F90 b/drof/drof_datamode_copyall.F90 index 9c89155fb..cc1d341b9 100644 --- a/drof/drof_datamode_copyall.F90 +++ b/drof/drof_datamode_copyall.F90 @@ -111,7 +111,7 @@ subroutine drof_datamode_copyall_advance() if (associated(strm_Forr_rofi)) then do ni = 1, size(Forr_rofi) if (abs(strm_Forr_rofi(ni)) < 1.e28_r8) then - Forr_rofi(:) = strm_Forr_rofi(:) + Forr_rofi(ni) = strm_Forr_rofi(:) else Forr_rofi(ni) = 0.0_r8 end if From 829a17555bbc6879fe89ab698f825cb63bd6843b Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 21 Jan 2026 20:00:23 +0100 Subject: [PATCH 60/61] fixed problem mentioned in PR review --- drof/drof_datamode_copyall.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drof/drof_datamode_copyall.F90 b/drof/drof_datamode_copyall.F90 index cc1d341b9..91608e6e9 100644 --- a/drof/drof_datamode_copyall.F90 +++ b/drof/drof_datamode_copyall.F90 @@ -111,7 +111,7 @@ subroutine drof_datamode_copyall_advance() if (associated(strm_Forr_rofi)) then do ni = 1, size(Forr_rofi) if (abs(strm_Forr_rofi(ni)) < 1.e28_r8) then - Forr_rofi(ni) = strm_Forr_rofi(:) + Forr_rofi(ni) = strm_Forr_rofi(ni) else Forr_rofi(ni) = 0.0_r8 end if From 9d88ca521016537988f5bdd74e0a2bb861473b1d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 23 Jan 2026 10:29:35 -0700 Subject: [PATCH 61/61] Restore accidentally-deleted JRA-1p5-2023 DROF mode --- drof/cime_config/config_component.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drof/cime_config/config_component.xml b/drof/cime_config/config_component.xml index 930de36bd..a5772acb3 100644 --- a/drof/cime_config/config_component.xml +++ b/drof/cime_config/config_component.xml @@ -13,7 +13,7 @@ --> - Data runoff model + Data runoff model NULL mode COREv2 normal year forcing: COREv2 interannual year forcing: @@ -24,6 +24,7 @@ JRA55 interannual forcing, v1.4, through 2018, no rofi around AIS JRA55 interannual forcing, v1.4, through 2018, no rofl around AIS JRA55 interannual forcing, v1.4, through 2018, no rofi or rofl around AIS + JRA55 interannual forcing, v1.5, through 2023 JRA55 interannual forcing JRA55 Repeat Year Forcing v1.3 1961-1962 JRA55 Repeat Year Forcing v1.3 1984-1985 @@ -60,6 +61,7 @@ IAF_JRA_1p4_2018_AIS0ICE IAF_JRA_1p4_2018_AIS0LIQ IAF_JRA_1p4_2018_AIS0ROF + IAF_JRA_1p5_2023 RYF6162_JRA RYF8485_JRA RYF9091_JRA