From 7ede0e35227a067eb91c0e8e90ca74f89816d1a1 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 24 Apr 2019 10:43:50 -0600 Subject: [PATCH] Update CIME to ESMCI cime5.8.2 (#2876) Update CIME to ESMCI cime5.8.2 Squash merge of jgfouca/branch-for-to-acme-2019-04-22 Features: * Adds a stub for Integrated Assessment Component (IAC) * Allow specific tests to ignore field list differences Bug fixes: * Minor [BFB] --- driver-mct/cime_config/buildexe | 5 + driver-mct/cime_config/config_component.xml | 125 +++++++- .../cime_config/config_component_e3sm.xml | 9 + driver-mct/cime_config/config_compsets.xml | 3 +- driver-mct/cime_config/config_pes.xml | 9 +- .../cime_config/namelist_definition_drv.xml | 259 ++++++++++++++++ .../namelist_definition_modelio.xml | 6 + driver-mct/main/cime_comp_mod.F90 | 284 ++++++++++++++++-- driver-mct/main/component_mod.F90 | 15 +- driver-mct/main/component_type_mod.F90 | 5 +- driver-mct/main/prep_atm_mod.F90 | 26 +- driver-mct/main/prep_iac_mod.F90 | 168 +++++++++++ driver-mct/main/prep_lnd_mod.F90 | 31 +- driver-mct/main/seq_frac_mct.F90 | 39 ++- driver-mct/main/seq_hist_mod.F90 | 83 ++++- driver-mct/main/seq_rest_mod.F90 | 31 +- driver-mct/shr/seq_comm_mct.F90 | 31 +- driver-mct/shr/seq_flds_mod.F90 | 5 + driver-mct/shr/seq_infodata_mod.F90 | 122 +++++++- driver-mct/shr/seq_timemgr_mod.F90 | 61 +++- driver-mct/unit_test/CMakeLists.txt | 1 + 21 files changed, 1239 insertions(+), 79 deletions(-) create mode 100644 driver-mct/main/prep_iac_mod.F90 diff --git a/driver-mct/cime_config/buildexe b/driver-mct/cime_config/buildexe index 5e13c62166b2..288f93f4d212 100755 --- a/driver-mct/cime_config/buildexe +++ b/driver-mct/cime_config/buildexe @@ -31,8 +31,13 @@ def _main_func(): gmake = case.get_value("GMAKE") gmake_j = case.get_value("GMAKE_J") num_esp = case.get_value("NUM_COMP_INST_ESP") + ocn_model = case.get_value("COMP_OCN") + atm_model = case.get_value("COMP_ATM") gmake_opts = get_standard_makefile_args(case) + if ocn_model == 'mom' or atm_model == "fv3gfs": + gmake_opts += "USE_FMS=TRUE" + expect((num_esp is None) or (int(num_esp) == 1), "ESP component restricted to one instance") diff --git a/driver-mct/cime_config/config_component.xml b/driver-mct/cime_config/config_component.xml index d916bcdbfcca..d3fb65a3e2e1 100644 --- a/driver-mct/cime_config/config_component.xml +++ b/driver-mct/cime_config/config_component.xml @@ -11,7 +11,7 @@ char - CPL,ATM,LND,ICE,OCN,ROF,GLC,WAV,ESP + CPL,ATM,LND,ICE,OCN,ROF,GLC,WAV,IAC,ESP env_case.xml case_comp List of component classes supported by this driver @@ -408,6 +408,7 @@ FALSE FALSE FALSE + FALSE @@ -1109,6 +1110,30 @@ number of wav cells in j direction - DO NOT EDIT (for experts only) + + char + UNSET + build_grid + env_build.xml + iac model (iac) grid + + + + integer + 0 + build_grid + env_build.xml + number of iac cells in i direction - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of iac cells in j direction - DO NOT EDIT (for experts only) + + char UNSET @@ -1210,6 +1235,22 @@ path of wav domain file + + char + UNSET + run_domain + env_run.xml + iac domain file + + + + char + $DIN_LOC_ROOT/share/domains + run_domain + env_run.xml + path of iac domain file + + char UNSET @@ -1690,6 +1731,74 @@ wav2ocn state mapping file decomp type + + char + idmap + run_domain + env_run.xml + iac2atm flux mapping file + + + + char + X,Y + X + run_domain + env_run.xml + iac2atm flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + iac2atm state mapping file + + + + char + X,Y + X + run_domain + env_run.xml + iac2atm state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + iac2lnd flux mapping file + + + + char + X,Y + X + run_domain + env_run.xml + iac2lnd flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + iac2lnd state mapping file + + + + char + X,Y + X + run_domain + env_run.xml + iac2lnd state mapping file decomp type + + char none,npfix,cart3d,cart3d_diag,cart3d_uvw,cart3d_uvw_diag @@ -1924,6 +2033,7 @@ $MAX_MPITASKS_PER_NODE $MAX_MPITASKS_PER_NODE $MAX_MPITASKS_PER_NODE + $MAX_MPITASKS_PER_NODE mach_pes env_mach_pes.xml @@ -1941,6 +2051,7 @@ 0 0 0 + 0 mach_pes env_mach_pes.xml @@ -1959,6 +2070,7 @@ 1 1 1 + 1 mach_pes env_mach_pes.xml @@ -1977,6 +2089,7 @@ 0 0 0 + 0 mach_pes env_mach_pes.xml @@ -2006,6 +2119,7 @@ 1 1 1 + 1 mach_pes env_mach_pes.xml @@ -2026,6 +2140,7 @@ concurrent concurrent concurrent + concurrent mach_pes env_mach_pes.xml @@ -2044,6 +2159,7 @@ 1 1 1 + 1 mach_pes env_mach_pes.xml @@ -2228,6 +2344,7 @@ default default default + default @@ -2249,6 +2366,7 @@ 64bit_offset 64bit_offset 64bit_offset + 64bit_offset @@ -2270,6 +2388,7 @@ + @@ -2290,6 +2409,7 @@ + @@ -2308,6 +2428,7 @@ 1 1 1 + 1 @@ -2329,6 +2450,7 @@ -99 -99 -99 + -99 @@ -2596,6 +2718,7 @@ FALSE FALSE FALSE + FALSE diff --git a/driver-mct/cime_config/config_component_e3sm.xml b/driver-mct/cime_config/config_component_e3sm.xml index aafd3b4a0ff3..7da2b682fc0d 100644 --- a/driver-mct/cime_config/config_component_e3sm.xml +++ b/driver-mct/cime_config/config_component_e3sm.xml @@ -496,6 +496,15 @@ where basedt is equal to NCPL_BASE_PERIOD in seconds. + + integer + $ATM_NCPL + run_coupling + env_run.xml + Number of iac coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist iac_cpl_dt, equal to basedt/IAC_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + diff --git a/driver-mct/cime_config/config_compsets.xml b/driver-mct/cime_config/config_compsets.xml index 612c44949f05..0386fbfa0723 100644 --- a/driver-mct/cime_config/config_compsets.xml +++ b/driver-mct/cime_config/config_compsets.xml @@ -24,6 +24,7 @@ ROF = [DROF, SROF, XROF] GLC = [ SGLC ] WAV = [DWAV, SWAV ] + IAC = [ SIAC ] ESP = [DESP, SESP ] The OPTIONAL %phys attributes specify submodes of the given system @@ -40,7 +41,7 @@ A - 2000_DATM%NYF_SLND_DICE%SSMI_DOCN%DOM_DROF%NYF_SGLC_SWAV + 2000_DATM%NYF_SLND_DICE%SSMI_DOCN%DOM_DROF%NYF_SGLC_SWAV_SIAC diff --git a/driver-mct/cime_config/config_pes.xml b/driver-mct/cime_config/config_pes.xml index ad332b3ff030..db4bebb81a72 100644 --- a/driver-mct/cime_config/config_pes.xml +++ b/driver-mct/cime_config/config_pes.xml @@ -14,7 +14,8 @@ -1 -1 -1 - -1 + -1 + -1 -1 @@ -24,7 +25,8 @@ 1 1 1 - 1 + 1 + 1 1 1 @@ -36,7 +38,8 @@ 0 0 0 - 0 + 0 + 0 0 diff --git a/driver-mct/cime_config/namelist_definition_drv.xml b/driver-mct/cime_config/namelist_definition_drv.xml index 0f0e779377a9..f63c78459eee 100644 --- a/driver-mct/cime_config/namelist_definition_drv.xml +++ b/driver-mct/cime_config/namelist_definition_drv.xml @@ -812,6 +812,18 @@ + + char + mapping + seq_infodata_inparm + + IAC_GRID values passed into driver. + + + $IAC_GRID + + + logical mapping @@ -1286,6 +1298,19 @@ + + logical + history + seq_infodata_inparm + + writes iac fields in coupler average history files. + default: true + + + .true. + + + logical history @@ -1622,6 +1647,19 @@ + + integer + time + seq_timemgr_inparm + + iac coupling interval in seconds + set via IAC_NCPL in env_run.xml. + IAC_NCPL is the number of times the iac is coupled per NCPL_BASE_PERIOD + NCPL_BASE_PERIOD is also set in env_run.xml and is the base period + associated with NCPL coupling frequency, nad has valid values: hour,day,year,decade + + + integer time @@ -1711,6 +1749,18 @@ + + integer + time + seq_timemgr_inparm + + iac coupling interval offset in seconds default: 0 + + + 0 + + + integer time @@ -2192,6 +2242,18 @@ + + logical + time + seq_timemgr_inparm + + Whether Pause signals are active for component iac + + + $PAUSE_ACTIVE_IAC + + + logical time @@ -2691,6 +2753,71 @@ + + integer + cime_pes + cime_pes + + the number of mpi tasks assigned to the iac components. + set by NTASKS_IAC in env_configure.xml. + + + $NTASKS_IAC + + + + + integer + cime_pes + cime_pes + + the number of threads per mpi task for the iac component. + set by NTHRDS_IAC in env_configure.xml. + + + $NTHRDS_IAC + + + + + integer + cime_pes + cime_pes + + the global mpi task rank of the root processor assigned to the iac component. + set by ROOTPE_IAC in env_configure.xml. + + + $ROOTPE_IAC + + + + + integer + cime_pes + cime_pes + + the mpi global processors stride associated with the mpi tasks for the iac component. + set by PSTRID_IAC in env_configure.xml. + + + $PSTRID_IAC + + + + + char + cime_pes + cime_pes + concurrent,sequential + + Layout of multi-instance iacs (if there are more than 1) + + + $NINST_IAC_LAYOUT + + + integer cime_pes @@ -4174,6 +4301,126 @@ + + char + mapping + abs + seq_maps + + iac to atm mapping file for fluxes + + + $IAC2ATM_FMAPNAME + + + + + char + mapping + seq_maps + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $IAC2ATM_FMAPTYPE + X + + + + + char + mapping + abs + seq_maps + + iac to atm mapping file for states + + + $IAC2ATM_SMAPNAME + + + + + char + mapping + seq_maps + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $IAC2ATM_SMAPTYPE + X + + + + + char + mapping + abs + seq_maps + + iac to lnd mapping file for fluxes + + + $IAC2LND_FMAPNAME + + + + + char + mapping + seq_maps + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $IAC2LND_FMAPTYPE + X + + + + + char + mapping + abs + seq_maps + + iac to lnd mapping file for states + + + $IAC2LND_SMAPNAME + + + + + char + mapping + seq_maps + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $IAC2LND_SMAPTYPE + X + + + logical data_assimilation @@ -4222,6 +4469,18 @@ + + logical + data_assimilation + seq_timemgr_inparm + + Whether Data Assimilation is on for component iac + + + $DATA_ASSIMILATION_IAC + + + logical data_assimilation diff --git a/driver-mct/cime_config/namelist_definition_modelio.xml b/driver-mct/cime_config/namelist_definition_modelio.xml index ea5d47f0a4ae..660bc93dee3e 100644 --- a/driver-mct/cime_config/namelist_definition_modelio.xml +++ b/driver-mct/cime_config/namelist_definition_modelio.xml @@ -60,6 +60,7 @@ $ROF_PIO_STRIDE $GLC_PIO_STRIDE $WAV_PIO_STRIDE + $IAC_PIO_STRIDE -99 @@ -80,6 +81,7 @@ $ROF_PIO_ROOT $GLC_PIO_ROOT $WAV_PIO_ROOT + $IAC_PIO_ROOT -99 @@ -101,6 +103,7 @@ $ROF_PIO_REARRANGER $GLC_PIO_REARRANGER $WAV_PIO_REARRANGER + $IAC_PIO_REARRANGER -99 @@ -121,6 +124,7 @@ $ROF_PIO_NUMTASKS $GLC_PIO_NUMTASKS $WAV_PIO_NUMTASKS + $IAC_PIO_NUMTASKS -99 @@ -143,6 +147,7 @@ $ROF_PIO_TYPENAME $GLC_PIO_TYPENAME $WAV_PIO_TYPENAME + $IAC_PIO_TYPENAME nothing @@ -166,6 +171,7 @@ $ROF_PIO_NETCDF_FORMAT $GLC_PIO_NETCDF_FORMAT $WAV_PIO_NETCDF_FORMAT + $IAC_PIO_NETCDF_FORMAT diff --git a/driver-mct/main/cime_comp_mod.F90 b/driver-mct/main/cime_comp_mod.F90 index 6a59ca1fc5d7..a0831467fe3d 100644 --- a/driver-mct/main/cime_comp_mod.F90 +++ b/driver-mct/main/cime_comp_mod.F90 @@ -54,6 +54,7 @@ module cime_comp_mod use wav_comp_mct , only: wav_init=>wav_init_mct, wav_run=>wav_run_mct, wav_final=>wav_final_mct use rof_comp_mct , only: rof_init=>rof_init_mct, rof_run=>rof_run_mct, rof_final=>rof_final_mct use esp_comp_mct , only: esp_init=>esp_init_mct, esp_run=>esp_run_mct, esp_final=>esp_final_mct + use iac_comp_mct , only: iac_init=>iac_init_mct, iac_run=>iac_run_mct, iac_final=>iac_final_mct !---------------------------------------------------------------------------- ! cpl7 modules @@ -66,9 +67,11 @@ module cime_comp_mod use seq_comm_mct, only: CPLALLATMID,CPLALLLNDID,CPLALLOCNID,CPLALLICEID use seq_comm_mct, only: CPLALLGLCID,CPLALLROFID,CPLALLWAVID,CPLALLESPID use seq_comm_mct, only: CPLATMID,CPLLNDID,CPLOCNID,CPLICEID,CPLGLCID,CPLROFID,CPLWAVID,CPLESPID + use seq_comm_mct, only: IACID, ALLIACID, CPLALLIACID, CPLIACID use seq_comm_mct, only: num_inst_atm, num_inst_lnd, num_inst_rof use seq_comm_mct, only: num_inst_ocn, num_inst_ice, num_inst_glc use seq_comm_mct, only: num_inst_wav, num_inst_esp + use seq_comm_mct, only: num_inst_iac use seq_comm_mct, only: num_inst_xao, num_inst_frc, num_inst_phys use seq_comm_mct, only: num_inst_total, num_inst_max use seq_comm_mct, only: seq_comm_iamin, seq_comm_name, seq_comm_namelen @@ -101,6 +104,7 @@ module cime_comp_mod use seq_timemgr_mod, only: seq_timemgr_alarm_rofrun use seq_timemgr_mod, only: seq_timemgr_alarm_wavrun use seq_timemgr_mod, only: seq_timemgr_alarm_esprun + use seq_timemgr_mod, only: seq_timemgr_alarm_iacrun use seq_timemgr_mod, only: seq_timemgr_alarm_barrier use seq_timemgr_mod, only: seq_timemgr_alarm_pause use seq_timemgr_mod, only: seq_timemgr_pause_active @@ -149,12 +153,13 @@ module cime_comp_mod use seq_flds_mod, only : seq_flds_w2x_fluxes, seq_flds_x2w_fluxes use seq_flds_mod, only : seq_flds_r2x_fluxes, seq_flds_x2r_fluxes use seq_flds_mod, only : seq_flds_set + use seq_flds_mod, only : seq_flds_z2x_fluxes, seq_flds_x2z_fluxes ! component type and accessor functions use component_type_mod, only: component_get_iamin_compid, component_get_suffix use component_type_mod, only: component_get_iamroot_compid use component_type_mod, only: component_get_name, component_get_c2x_cx - use component_type_mod, only: atm, lnd, ice, ocn, rof, glc, wav, esp + use component_type_mod, only: atm, lnd, ice, ocn, rof, glc, wav, esp, iac use component_mod, only: component_init_pre use component_mod, only: component_init_cc, component_init_cx use component_mod, only: component_run, component_final @@ -170,6 +175,7 @@ module cime_comp_mod use prep_ocn_mod use prep_atm_mod use prep_aoflux_mod + use prep_iac_mod !--- mapping routines --- use seq_map_type_mod @@ -214,6 +220,8 @@ module cime_comp_mod private :: cime_run_ice_recv_post private :: cime_run_wav_setup_send private :: cime_run_wav_recv_post + private :: cime_run_iac_setup_send + private :: cime_run_iac_recv_post private :: cime_run_update_fractions private :: cime_run_calc_budgets1 private :: cime_run_calc_budgets2 @@ -253,6 +261,7 @@ module cime_comp_mod type(mct_aVect) , pointer :: fractions_gx(:) ! Fractions on glc grid, cpl processes type(mct_aVect) , pointer :: fractions_rx(:) ! Fractions on rof grid, cpl processes type(mct_aVect) , pointer :: fractions_wx(:) ! Fractions on wav grid, cpl processes + type(mct_aVect) , pointer :: fractions_zx(:) ! Fractions on iac grid, cpl processes !--- domain equivalent 2d grid size --- integer :: atm_nx, atm_ny ! nx, ny of 2d grid, if known @@ -262,6 +271,7 @@ module cime_comp_mod integer :: rof_nx, rof_ny integer :: glc_nx, glc_ny integer :: wav_nx, wav_ny + integer :: iac_nx, iac_ny !---------------------------------------------------------------------------- ! Infodata: inter-model control flags, domain info @@ -283,6 +293,7 @@ module cime_comp_mod type (ESMF_Clock), target :: EClock_r ! rof clock type (ESMF_Clock), target :: EClock_w ! wav clock type (ESMF_Clock), target :: EClock_e ! esp clock + type (ESMF_Clock), target :: EClock_z ! iac clock logical :: restart_alarm ! restart alarm logical :: history_alarm ! history alarm @@ -298,6 +309,7 @@ module cime_comp_mod logical :: rofrun_alarm ! rof run alarm logical :: wavrun_alarm ! wav run alarm logical :: esprun_alarm ! esp run alarm + logical :: iacrun_alarm ! iac run alarm logical :: tprof_alarm ! timing profile alarm logical :: barrier_alarm ! barrier alarm logical :: t1hr_alarm ! alarm every hour @@ -379,6 +391,7 @@ module cime_comp_mod logical :: flood_present ! .true. => rof is computing flood logical :: wav_present ! .true. => wav is present logical :: esp_present ! .true. => esp is present + logical :: iac_present ! .true. => iac is present logical :: atm_prognostic ! .true. => atm comp expects input logical :: lnd_prognostic ! .true. => lnd comp expects input @@ -390,6 +403,7 @@ module cime_comp_mod logical :: rof_prognostic ! .true. => rof comp expects input logical :: wav_prognostic ! .true. => wav comp expects input logical :: esp_prognostic ! .true. => esp comp expects input + logical :: iac_prognostic ! .true. => iac comp expects input logical :: atm_c2_lnd ! .true. => atm to lnd coupling on logical :: atm_c2_ocn ! .true. => atm to ocn coupling on @@ -412,6 +426,10 @@ module cime_comp_mod logical :: glc_c2_ice ! .true. => glc to ice coupling on logical :: wav_c2_ocn ! .true. => wav to ocn coupling on + logical :: iac_c2_lnd ! .true. => iac to lnd coupling on + logical :: iac_c2_atm ! .true. => iac to atm coupling on + logical :: lnd_c2_iac ! .true. => lnd to iac coupling on + logical :: dead_comps ! .true. => dead components logical :: esmf_map_flag ! .true. => use esmf for mapping @@ -438,6 +456,7 @@ module cime_comp_mod character(CL) :: rof_gnam ! rof grid character(CL) :: glc_gnam ! glc grid character(CL) :: wav_gnam ! wav grid + character(CL) :: iac_gnam ! iac grid logical :: samegrid_ao ! samegrid atm and ocean logical :: samegrid_al ! samegrid atm and land @@ -450,6 +469,7 @@ module cime_comp_mod logical :: samegrid_og ! samegrid glc and ocean logical :: samegrid_ig ! samegrid glc and ice logical :: samegrid_alo ! samegrid atm, lnd, ocean + logical :: samegrid_zl ! samegrid iac and land logical :: read_restart ! local read restart flag character(CL) :: rest_file ! restart file path + filename @@ -537,6 +557,7 @@ module cime_comp_mod integer :: nthreads_ROFID ! OMP glc number of threads integer :: nthreads_WAVID ! OMP wav number of threads integer :: nthreads_ESPID ! OMP esp number of threads + integer :: nthreads_IACID ! OMP iac number of threads integer :: pethreads_GLOID ! OMP number of threads per task @@ -557,6 +578,7 @@ module cime_comp_mod integer :: mpicom_CPLALLGLCID ! MPI comm for CPLALLGLCID integer :: mpicom_CPLALLROFID ! MPI comm for CPLALLROFID integer :: mpicom_CPLALLWAVID ! MPI comm for CPLALLWAVID + integer :: mpicom_CPLALLIACID ! MPI comm for CPLALLIACID integer :: iam_GLOID ! pe number in global id logical :: iamin_CPLID ! pe associated with CPLID @@ -570,6 +592,7 @@ module cime_comp_mod logical :: iamin_CPLALLGLCID ! pe associated with CPLALLGLCID logical :: iamin_CPLALLROFID ! pe associated with CPLALLROFID logical :: iamin_CPLALLWAVID ! pe associated with CPLALLWAVID + logical :: iamin_CPLALLIACID ! pe associated with CPLALLIACID !---------------------------------------------------------------------------- @@ -592,6 +615,7 @@ module cime_comp_mod integer, parameter :: comp_num_rof = 6 integer, parameter :: comp_num_wav = 7 integer, parameter :: comp_num_esp = 8 + integer, parameter :: comp_num_iac = 9 !---------------------------------------------------------------------------- ! misc @@ -599,7 +623,7 @@ module cime_comp_mod integer, parameter :: ens1=1 ! use first instance of ensemble only integer, parameter :: fix1=1 ! temporary hard-coding to first ensemble, needs to be fixed - integer :: eai, eli, eoi, eii, egi, eri, ewi, eei, exi, efi ! component instance counters + integer :: eai, eli, eoi, eii, egi, eri, ewi, eei, exi, efi, ezi ! component instance counters !---------------------------------------------------------------------------- ! formats @@ -770,7 +794,23 @@ subroutine cime_pre_init1(esmf_log_option) call seq_comm_getinfo(CPLALLWAVID, mpicom=mpicom_CPLALLWAVID) iamin_CPLALLWAVID = seq_comm_iamin(CPLALLWAVID) - do eei = 1,num_inst_esp + ! IAC mods + do ezi = 1,num_inst_iac + it=it+1 + comp_id(it) = IACID(ezi) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(IACID(ezi), mpicom=comp_comm(it), & + nthreads=nthreads_IACID, iam=comp_comm_iam(it)) + if (seq_comm_iamin(IACID(ezi))) then + complist = trim(complist)//' '//trim(seq_comm_name(IACID(ezi))) + endif + if (seq_comm_iamroot(IACID(ezi))) output_perf = .true. + enddo + call seq_comm_getinfo(CPLALLIACID, mpicom=mpicom_CPLALLIACID) + iamin_CPLALLIACID = seq_comm_iamin(CPLALLIACID) + + do eei = 1,num_inst_esp it=it+1 comp_id(it) = ESPID(eei) comp_iamin(it) = seq_comm_iamin(comp_id(it)) @@ -931,10 +971,11 @@ subroutine cime_pre_init2() !---------------------------------------------------------- !| Timer initialization (has to be after mpi init) !---------------------------------------------------------- + maxthreads = max(nthreads_GLOID,nthreads_CPLID,nthreads_ATMID, & nthreads_LNDID,nthreads_ICEID,nthreads_OCNID,nthreads_GLCID, & - nthreads_ROFID, nthreads_WAVID, nthreads_ESPID, pethreads_GLOID ) - + nthreads_ROFID, nthreads_WAVID, nthreads_ESPID, nthreads_IACID, & + pethreads_GLOID ) call t_initf(NLFileName, LogPrint=.true., mpicom=mpicom_GLOID, & MasterTask=iamroot_GLOID,MaxThreads=maxthreads) @@ -1000,6 +1041,7 @@ subroutine cime_pre_init2() rof_present=rof_present , & wav_present=wav_present , & esp_present=esp_present , & + iac_present=iac_present , & single_column=single_column , & aqua_planet=aqua_planet , & cpl_seq_option=cpl_seq_option , & @@ -1033,6 +1075,7 @@ subroutine cime_pre_init2() rof_gnam=rof_gnam , & glc_gnam=glc_gnam , & wav_gnam=wav_gnam , & + iac_gnam=iac_gnam , & tfreeze_option = tfreeze_option , & cpl_decomp=seq_mctext_decomp , & shr_map_dopole=shr_map_dopole , & @@ -1104,6 +1147,9 @@ subroutine cime_pre_init2() call seq_comm_setnthreads(nthreads_ESPID) if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_ESPID = ',& nthreads_ESPID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_IACID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_IACID = ',& + nthreads_IACID,seq_comm_getnthreads() if (iamroot_GLOID) write(logunit,*) ' ' call seq_comm_setnthreads(nthreads_GLOID) @@ -1116,7 +1162,8 @@ subroutine cime_pre_init2() call seq_timemgr_clockInit(seq_SyncClock, nlfilename, & read_restart, rest_file, pioid, mpicom_gloid, & EClock_d, EClock_a, EClock_l, EClock_o, & - EClock_i, Eclock_g, Eclock_r, Eclock_w, Eclock_e) + EClock_i, Eclock_g, Eclock_r, Eclock_w, Eclock_e, & + EClock_z) if (iamroot_CPLID) then call seq_timemgr_clockPrint(seq_SyncClock) @@ -1194,6 +1241,7 @@ subroutine cime_pre_init2() ice_phase=1, & glc_phase=1, & wav_phase=1, & + iac_phase=1, & esp_phase=1) !---------------------------------------------------------- @@ -1257,7 +1305,7 @@ subroutine cime_init() call t_startf('CPL:init_comps') if (iamroot_CPLID )then write(logunit,*) ' ' - write(logunit,F00) 'Initialize each component: atm, lnd, rof, ocn, ice, glc, wav, esp' + write(logunit,F00) 'Initialize each component: atm, lnd, rof, ocn, ice, glc, wav, esp, iac' call shr_sys_flush(logunit) endif @@ -1270,6 +1318,8 @@ subroutine cime_init() call component_init_pre(glc, GLCID, CPLGLCID, CPLALLGLCID, infodata, ntype='glc') call component_init_pre(wav, WAVID, CPLWAVID, CPLALLWAVID, infodata, ntype='wav') call component_init_pre(esp, ESPID, CPLESPID, CPLALLESPID, infodata, ntype='esp') + call component_init_pre(iac, IACID, CPLIACID, CPLALLIACID, infodata, ntype='iac') + call t_stopf('CPL:comp_init_pre_all') call t_startf('CPL:comp_init_cc_atm') @@ -1321,6 +1371,12 @@ subroutine cime_init() call t_adj_detailf(-2) call t_stopf('CPL:comp_init_cc_esp') + call t_startf('comp_init_cc_iac') + call t_adj_detailf(+2) + call component_init_cc(Eclock_z, iac, iac_init, infodata, NLFilename) + call t_adj_detailf(-2) + call t_stopf('comp_init_cc_iac') + call t_startf('CPL:comp_init_cx_all') call t_adj_detailf(+2) call component_init_cx(atm, infodata) @@ -1330,6 +1386,7 @@ subroutine cime_init() call component_init_cx(ice, infodata) call component_init_cx(glc, infodata) call component_init_cx(wav, infodata) + call component_init_cx(iac, infodata) call t_adj_detailf(-2) call t_stopf('CPL:comp_init_cx_all') @@ -1383,6 +1440,14 @@ subroutine cime_init() endif enddo + do ezi = 1,num_inst_iac + iamin_ID = component_get_iamin_compid(iac(ezi)) + if (iamin_ID) then + compname = component_get_name(iac(ezi)) + complist = trim(complist)//' '//trim(compname) + endif + enddo + do eei = 1,num_inst_esp iamin_ID = component_get_iamin_compid(esp(eei)) if (iamin_ID) then @@ -1406,6 +1471,7 @@ subroutine cime_init() if (iamin_CPLALLGLCID) call seq_infodata_exchange(infodata,CPLALLGLCID,'cpl2glc_init') if (iamin_CPLALLROFID) call seq_infodata_exchange(infodata,CPLALLROFID,'cpl2rof_init') if (iamin_CPLALLWAVID) call seq_infodata_exchange(infodata,CPLALLWAVID,'cpl2wav_init') + if (iamin_CPLALLIACID) call seq_infodata_exchange(infodata,CPLALLIACID,'cpl2iac_init') if (iamroot_CPLID) then write(logunit,F00) 'Determine final settings for presence of surface components' @@ -1424,6 +1490,7 @@ subroutine cime_init() rof_present=rof_present, & rofice_present=rofice_present, & wav_present=wav_present, & + iac_present=iac_present, & esp_present=esp_present, & flood_present=flood_present, & atm_prognostic=atm_prognostic, & @@ -1435,6 +1502,7 @@ subroutine cime_init() glc_prognostic=glc_prognostic, & rof_prognostic=rof_prognostic, & wav_prognostic=wav_prognostic, & + iac_prognostic=iac_prognostic, & esp_prognostic=esp_prognostic, & dead_comps=dead_comps, & esmf_map_flag=esmf_map_flag, & @@ -1445,6 +1513,7 @@ subroutine cime_init() glc_nx=glc_nx, glc_ny=glc_ny, & ocn_nx=ocn_nx, ocn_ny=ocn_ny, & wav_nx=wav_nx, wav_ny=wav_ny, & + iac_nx=iac_nx, iac_ny=iac_ny, & atm_aero=atm_aero ) ! derive samegrid flags @@ -1498,6 +1567,9 @@ subroutine cime_init() glc_c2_ocn = .false. glc_c2_ice = .false. wav_c2_ocn = .false. + iac_c2_atm = .false. + iac_c2_lnd = .false. + lnd_c2_iac = .false. if (atm_present) then if (lnd_prognostic) atm_c2_lnd = .true. @@ -1510,6 +1582,7 @@ subroutine cime_init() if (atm_prognostic) lnd_c2_atm = .true. if (rof_prognostic) lnd_c2_rof = .true. if (glc_prognostic) lnd_c2_glc = .true. + if (iac_prognostic) lnd_c2_iac = .true. endif if (ocn_present) then if (atm_prognostic) ocn_c2_atm = .true. @@ -1535,6 +1608,10 @@ subroutine cime_init() if (wav_present) then if (ocn_prognostic) wav_c2_ocn = .true. endif + if (iac_present) then + if (lnd_prognostic) iac_c2_lnd = .true. + if (atm_prognostic) iac_c2_atm = .true. + endif !---------------------------------------------------------- ! Set domain check and other flag @@ -1580,6 +1657,7 @@ subroutine cime_init() write(logunit,F0L)'rof/ice present = ',rofice_present write(logunit,F0L)'rof/flood present = ',flood_present write(logunit,F0L)'wav model present = ',wav_present + write(logunit,F0L)'iac model present = ',iac_present write(logunit,F0L)'esp model present = ',esp_present write(logunit,F0L)'atm model prognostic = ',atm_prognostic @@ -1591,6 +1669,7 @@ subroutine cime_init() write(logunit,F0L)'rof model prognostic = ',rof_prognostic write(logunit,F0L)'ocn rof prognostic = ',ocnrof_prognostic write(logunit,F0L)'wav model prognostic = ',wav_prognostic + write(logunit,F0L)'iac model prognostic = ',iac_prognostic write(logunit,F0L)'esp model prognostic = ',esp_prognostic write(logunit,F0L)'atm_c2_lnd = ',atm_c2_lnd @@ -1613,6 +1692,8 @@ subroutine cime_init() write(logunit,F0L)'glc_c2_ocn = ',glc_c2_ocn write(logunit,F0L)'glc_c2_ice = ',glc_c2_ice write(logunit,F0L)'wav_c2_ocn = ',wav_c2_ocn + write(logunit,F0L)'iac_c2_lnd = ',iac_c2_lnd + write(logunit,F0L)'iac_c2_atm = ',iac_c2_atm write(logunit,F0L)'dead components = ',dead_comps write(logunit,F0L)'domain_check = ',domain_check @@ -1623,6 +1704,7 @@ subroutine cime_init() write(logunit,F01)'ocn_nx,ocn_ny = ',ocn_nx,ocn_ny,trim(ocn_gnam) write(logunit,F01)'glc_nx,glc_ny = ',glc_nx,glc_ny,trim(glc_gnam) write(logunit,F01)'wav_nx,wav_ny = ',wav_nx,wav_ny,trim(wav_gnam) + write(logunit,F01)'iac_nx,iac_ny = ',iac_nx,iac_ny,trim(iac_gnam) write(logunit,F0L)'samegrid_ao = ',samegrid_ao write(logunit,F0L)'samegrid_al = ',samegrid_al write(logunit,F0L)'samegrid_ro = ',samegrid_ro @@ -1667,6 +1749,9 @@ subroutine cime_init() if (esp_prognostic .and. .not.esp_present) then call shr_sys_abort(subname//' ERROR: if prognostic esp must also have esp present') endif + if (iac_prognostic .and. .not.iac_present) then + call shr_sys_abort(subname//' ERROR: if prognostic iac must also have iac present') + endif #ifndef CPL_BYPASS if ((ice_prognostic .or. ocn_prognostic .or. lnd_prognostic) .and. .not. atm_present) then call shr_sys_abort(subname//' ERROR: if prognostic surface model must also have atm present') @@ -1711,6 +1796,8 @@ subroutine cime_init() call shr_sys_abort(subname//' ERROR: rof_prognostic but num_inst_rof not num_inst_max') if (wav_prognostic .and. num_inst_wav /= num_inst_max) & call shr_sys_abort(subname//' ERROR: wav_prognostic but num_inst_wav not num_inst_max') + if (iac_prognostic .and. num_inst_iac /= num_inst_max) & + call shr_sys_abort(subname//' ERROR: iac_prognostic but num_inst_iac not num_inst_max') !---------------------------------------------------------- !| Initialize attribute vectors for prep_c2C_init_avs routines and fractions @@ -1723,9 +1810,9 @@ subroutine cime_init() call t_adj_detailf(+2) if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID) - call prep_atm_init(infodata, ocn_c2_atm, ice_c2_atm, lnd_c2_atm) + call prep_atm_init(infodata, ocn_c2_atm, ice_c2_atm, lnd_c2_atm, iac_c2_lnd) - call prep_lnd_init(infodata, atm_c2_lnd, rof_c2_lnd, glc_c2_lnd) + call prep_lnd_init(infodata, atm_c2_lnd, rof_c2_lnd, glc_c2_lnd, iac_c2_lnd) call prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_ocn, wav_c2_ocn, glc_c2_ocn) @@ -1737,6 +1824,8 @@ subroutine cime_init() call prep_wav_init(infodata, atm_c2_wav, ocn_c2_wav, ice_c2_wav) + call prep_iac_init(infodata, lnd_c2_iac) + if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID) call t_adj_detailf(-2) call t_stopf('CPL:init_maps') @@ -1835,6 +1924,9 @@ subroutine cime_init() call mpi_barrier(mpicom_GLOID,ierr) if (wav_present) call component_init_areacor(wav, areafact_samegrid, seq_flds_w2x_fluxes) + call mpi_barrier(mpicom_GLOID,ierr) + if (iac_present) call component_init_areacor(iac, areafact_samegrid, seq_flds_z2x_fluxes) + call t_adj_detailf(-2) call t_stopf ('CPL:init_areacor') @@ -1875,6 +1967,10 @@ subroutine cime_init() call component_diag(infodata, wav, flow='c2x', comment='recv IC wav', & info_debug=info_debug) endif + if (iac_present) then + call component_diag(infodata, iac, flow='c2x', comment='recv IC iac', & + info_debug=info_debug) + endif if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID) call t_adj_detailf(-2) @@ -1896,6 +1992,7 @@ subroutine cime_init() allocate(fractions_gx(num_inst_frc)) allocate(fractions_rx(num_inst_frc)) allocate(fractions_wx(num_inst_frc)) + allocate(fractions_zx(num_inst_frc)) if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID) do efi = 1,num_inst_frc @@ -1909,10 +2006,10 @@ subroutine cime_init() call seq_frac_init(infodata, & atm(ens1), ice(ens1), lnd(ens1), & ocn(ens1), glc(ens1), rof(ens1), & - wav(ens1), & + wav(ens1), iac(ens1), & fractions_ax(efi), fractions_ix(efi), fractions_lx(efi), & fractions_ox(efi), fractions_gx(efi), fractions_rx(efi), & - fractions_wx(efi)) + fractions_wx(efi), fractions_zx(efi)) if (iamroot_CPLID) then write(logunit,*) ' ' @@ -2103,9 +2200,9 @@ subroutine cime_init() call seq_diag_zero_mct(mode='all') if (read_restart .and. iamin_CPLID) then call seq_rest_read(rest_file, infodata, & - atm, lnd, ice, ocn, rof, glc, wav, esp, & + atm, lnd, ice, ocn, rof, glc, wav, esp, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, & - fractions_rx, fractions_gx, fractions_wx) + fractions_rx, fractions_gx, fractions_wx, fractions_zx) endif call t_adj_detailf(-2) @@ -2152,9 +2249,9 @@ subroutine cime_init() call shr_sys_flush(logunit) endif call seq_hist_write(infodata, EClock_d, & - atm, lnd, ice, ocn, rof, glc, wav, & + atm, lnd, ice, ocn, rof, glc, wav, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, & - fractions_rx, fractions_gx, fractions_wx, trim(cpl_inst_tag)) + fractions_rx, fractions_gx, fractions_wx, fractions_zx, trim(cpl_inst_tag)) if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID) call t_adj_detailf(-2) @@ -2182,7 +2279,7 @@ subroutine cime_run() use shr_string_mod, only: shr_string_listGetIndexF use seq_comm_mct, only: atm_layout, lnd_layout, ice_layout use seq_comm_mct, only: glc_layout, rof_layout, ocn_layout - use seq_comm_mct, only: wav_layout, esp_layout, num_inst_driver + use seq_comm_mct, only: wav_layout, esp_layout, iac_layout, num_inst_driver use seq_comm_mct, only: seq_comm_inst use seq_pauseresume_mod, only: seq_resume_store_comp, seq_resume_get_files use seq_pauseresume_mod, only: seq_resume_free @@ -2262,6 +2359,7 @@ subroutine cime_run() esprun_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_esprun) ocnrun_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_ocnrun) ocnnext_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_ocnnext) + iacrun_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_iacrun) restart_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_restart) history_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_history) histavg_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_histavg) @@ -2350,7 +2448,7 @@ subroutine cime_run() write(logunit,102) ' Alarm_state: model date = ',ymd,tod, & ' aliogrw run alarms = ', atmrun_alarm, lndrun_alarm, & icerun_alarm, ocnrun_alarm, glcrun_alarm, & - rofrun_alarm, wavrun_alarm, esprun_alarm + rofrun_alarm, wavrun_alarm, esprun_alarm, iacrun_alarm write(logunit,102) ' Alarm_state: model date = ',ymd,tod, & ' 1.2.3.6.12.24 run alarms = ', t1hr_alarm, t2hr_alarm, & t3hr_alarm, t6hr_alarm, t12hr_alarm, t24hr_alarm @@ -2360,6 +2458,13 @@ subroutine cime_run() call t_stopf ('CPL:CLOCK_ADVANCE') + !---------------------------------------------------------- + !| IAC SETUP-SEND + !---------------------------------------------------------- + if (iac_present .and. iacrun_alarm) then + call cime_run_iac_setup_send() + endif + !---------------------------------------------------------- !| MAP ATM to OCN ! Set a2x_ox as a module variable in prep_ocn_mod @@ -2428,6 +2533,18 @@ subroutine cime_run() call cime_run_rof_setup_send() endif + !---------------------------------------------------------- + !| RUN IAC MODEL + !---------------------------------------------------------- + if (iac_present .and. iacrun_alarm) then + call component_run(Eclock_z, iac, iac_run, infodata, & + seq_flds_x2c_fluxes=seq_flds_x2z_fluxes, & + seq_flds_c2x_fluxes=seq_flds_z2x_fluxes, & + comp_prognostic=iac_prognostic, comp_num=comp_num_iac, & + timer_barrier= 'CPL:IAC_RUN_BARRIER', timer_comp_run='CPL:IAC_RUN', & + run_barriers=run_barriers, ymd=ymd, tod=tod,comp_layout=iac_layout) + endif + !---------------------------------------------------------- !| RUN ICE MODEL !---------------------------------------------------------- @@ -2490,6 +2607,13 @@ subroutine cime_run() endif end if + !---------------------------------------------------------- + !| IAC RECV-POST + !---------------------------------------------------------- + if (iac_present .and. iacrun_alarm) then + call cime_run_iac_recv_post() + endif + !---------------------------------------------------------- !| OCN RECV-POST (cesm1_mod_tight, nuopc_tight) !---------------------------------------------------------- @@ -2703,16 +2827,16 @@ subroutine cime_run() endif call seq_hist_write(infodata, EClock_d, & - atm, lnd, ice, ocn, rof, glc, wav, & + atm, lnd, ice, ocn, rof, glc, wav, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, & - fractions_rx, fractions_gx, fractions_wx, trim(cpl_inst_tag)) + fractions_rx, fractions_gx, fractions_wx, fractions_zx, trim(cpl_inst_tag)) if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID) endif if (do_histavg) then call seq_hist_writeavg(infodata, EClock_d, & - atm, lnd, ice, ocn, rof, glc, wav, histavg_alarm, & + atm, lnd, ice, ocn, rof, glc, wav, iac, histavg_alarm, & trim(cpl_inst_tag)) endif @@ -2986,9 +3110,9 @@ subroutine cime_run() end if if (iamin_CPLID) then call seq_rest_read(drv_resume, infodata, & - atm, lnd, ice, ocn, rof, glc, wav, esp, & + atm, lnd, ice, ocn, rof, glc, wav, esp, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, & - fractions_rx, fractions_gx, fractions_wx) + fractions_rx, fractions_gx, fractions_wx, fractions_zx) end if ! Clear the resume file so we don't try to read it again drv_resume = ' ' @@ -3063,7 +3187,8 @@ subroutine cime_run() lnd(ens1)%iamroot_compid .or. & ice(ens1)%iamroot_compid .or. & glc(ens1)%iamroot_compid .or. & - wav(ens1)%iamroot_compid) then + wav(ens1)%iamroot_compid .or. & + iac(ens1)%iamroot_compid) then call shr_mem_getusage(msize,mrss,.true.) write(logunit,105) ' memory_write: model date = ',ymd,tod, & @@ -3169,6 +3294,7 @@ subroutine cime_final() call component_final(EClock_o, ocn, ocn_final) call component_final(EClock_g, glc, glc_final) call component_final(EClock_w, wav, wav_final) + call component_final(EClock_w, iac, iac_final) !------------------------------------------------------------------------ ! End the run cleanly @@ -3455,6 +3581,9 @@ subroutine cime_run_atm_setup_send() if (lnd_c2_atm) then call prep_atm_calc_l2x_ax(fractions_lx, timer='CPL:atmprep_lnd2atm') endif + if (iac_c2_atm) then + call prep_atm_calc_z2x_ax(fractions_zx, timer='CPL:atmprep_iac2atm') + endif if (associated(xao_ax)) then call prep_atm_mrg(infodata, fractions_ax, xao_ax=xao_ax, timer_mrg='CPL:atmprep_mrgx2a') endif @@ -3563,7 +3692,7 @@ subroutine cime_run_ocn_setup_send() end subroutine cime_run_ocn_setup_send -!---------------------------------------------------------------------------------- + !---------------------------------------------------------------------------------- subroutine cime_run_ocn_recv_post() @@ -3595,7 +3724,94 @@ subroutine cime_run_ocn_recv_post() end subroutine cime_run_ocn_recv_post -!---------------------------------------------------------------------------------- + !---------------------------------------------------------------------------------- + subroutine cime_run_iac_setup_send() + + !------------------------------------------------------- + ! | iac prep-merge + !------------------------------------------------------- + + if (iamin_CPLID .and. iac_prognostic) then + call cime_comp_barriers(mpicom=mpicom_CPLID, timer='CPL:IACPREP_BARRIER') + + call t_drvstartf ('CPL:IACPREP', cplrun=.true., barrier=mpicom_CPLID) + if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID) + + ! Average our accumulators + call prep_iac_accum_avg(timer='CPL:iacprep_l2xavg') + + ! Setup lnd inputs on iac grid. Right now I think they will be the same + ! thing, but I'm trying to code for the general case + if (lnd_c2_iac) then + call prep_iac_calc_l2x_zx(timer='CPL:iacprep_lnd2iac') + endif + + + call prep_iac_mrg(infodata, fractions_zx, timer_mrg='CPL:iacprep_mrgx2z') + + call component_diag(infodata, iac, flow='x2c', comment= 'send iac', & + info_debug=info_debug, timer_diag='CPL:iacprep_diagav') + + if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID) + call t_drvstopf ('CPL:IACPREP',cplrun=.true.) + endif + + !---------------------------------------------------- + !| cpl -> iac + !---------------------------------------------------- + + if (iamin_CPLALLIACID .and. iac_prognostic) then + call component_exch(iac, flow='x2c', & + infodata=infodata, infodata_string='cpl2iac_run', & + mpicom_barrier=mpicom_CPLALLLNDID, run_barriers=run_barriers, & + timer_barrier='CPL:C2Z_BARRIER', timer_comp_exch='CPL:C2Z', & + timer_map_exch='CPL:c2z_iacx2iacr', timer_infodata_exch='CPL:c2z_infoexch') + endif + + end subroutine cime_run_iac_setup_send + + !---------------------------------------------------------------------------------- + subroutine cime_run_iac_recv_post() + + !---------------------------------------------------------- + !| iac -> cpl + !---------------------------------------------------------- + + if (iamin_CPLALLIACID) then + call component_exch(rof, flow='c2x', & + infodata=infodata, infodata_string='iac2cpl_run', & + mpicom_barrier=mpicom_CPLALLIACID, run_barriers=run_barriers, & + timer_barrier='CPL:Z2C_BARRIER', timer_comp_exch='CPL:Z2C', & + timer_map_exch='CPL:z2c_iacr2iacx', timer_infodata_exch='CPL:z2c_infoexch') + endif + + !---------------------------------------------------------- + !| iac post + !---------------------------------------------------------- + + if (iamin_CPLID) then + call cime_comp_barriers(mpicom=mpicom_CPLID, timer='CPL:IACPOST_BARRIER') + call t_drvstartf ('CPL:IACPOST',cplrun=.true.,barrier=mpicom_CPLID) + if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID) + + call component_diag(infodata, iac, flow='c2x', comment= 'recv iac', & + info_debug=info_debug, timer_diag='CPL:iacpost_diagav') + + ! TRS I think this is wrong - review these prep functions. I think it's more likely + if (iac_c2_lnd) then + call prep_lnd_calc_z2x_lx(timer='CPL:iacpost_iac2lnd') + endif + + if (iac_c2_atm) then + call prep_atm_calc_z2x_ax(fractions_zx, timer='CPL:iacpost_iac2atm') + endif + + call t_drvstopf ('CPL:IACPOST', cplrun=.true.) + endif + + end subroutine cime_run_iac_recv_post + + !---------------------------------------------------------------------------------- subroutine cime_run_atmocn_setup(hashint) integer, intent(inout) :: hashint(:) @@ -3668,6 +3884,11 @@ subroutine cime_run_lnd_setup_send() if (glc_c2_lnd) call prep_lnd_calc_g2x_lx(timer='CPL:glcpost_glc2lnd') end if + ! IAC export onto lnd grid + if (iac_c2_lnd) then + call prep_lnd_calc_z2x_lx(timer='CPL:lndprep_iac2lnd') + endif + if (lnd_prognostic) then call prep_lnd_mrg(infodata, timer_mrg='CPL:lndprep_mrgx2l') @@ -3719,7 +3940,8 @@ subroutine cime_run_lnd_recv_post() ! Accumulate rof and glc inputs (module variables in prep_rof_mod and prep_glc_mod) if (lnd_c2_rof) call prep_rof_accum(timer='CPL:lndpost_accl2r') - if (lnd_c2_glc) call prep_glc_accum(timer='CPL:lndpost_accl2g' ) + if (lnd_c2_glc) call prep_glc_accum(timer='CPL:lndpost_accl2g') + if (lnd_c2_iac) call prep_iac_accum(timer='CPL:lndpost_accl2z') if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID) call t_drvstopf ('CPL:LNDPOST',cplrun=.true.) @@ -4180,16 +4402,16 @@ subroutine cime_run_write_history() endif call seq_hist_write(infodata, EClock_d, & - atm, lnd, ice, ocn, rof, glc, wav, & + atm, lnd, ice, ocn, rof, glc, wav, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, & - fractions_rx, fractions_gx, fractions_wx, trim(cpl_inst_tag)) + fractions_rx, fractions_gx, fractions_wx, fractions_zx, trim(cpl_inst_tag)) if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID) endif if (do_histavg) then call seq_hist_writeavg(infodata, EClock_d, & - atm, lnd, ice, ocn, rof, glc, wav, histavg_alarm, & + atm, lnd, ice, ocn, rof, glc, wav, iac, histavg_alarm, & trim(cpl_inst_tag)) endif @@ -4226,9 +4448,9 @@ subroutine cime_run_write_restart(drv_pause, write_restart, drv_resume) endif call seq_rest_write(EClock_d, seq_SyncClock, infodata, & - atm, lnd, ice, ocn, rof, glc, wav, esp, & + atm, lnd, ice, ocn, rof, glc, wav, esp, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, & - fractions_rx, fractions_gx, fractions_wx, & + fractions_rx, fractions_gx, fractions_wx, fractions_zx, & trim(cpl_inst_tag), drv_resume) if (iamroot_CPLID) then diff --git a/driver-mct/main/component_mod.F90 b/driver-mct/main/component_mod.F90 index 983b7af698db..3c9e6da2c33e 100644 --- a/driver-mct/main/component_mod.F90 +++ b/driver-mct/main/component_mod.F90 @@ -123,7 +123,15 @@ subroutine component_init_pre(comp, compid, cplcompid, cplallcompid, & comp(eci)%suffix = seq_comm_suffix(comp(eci)%compid) comp(eci)%name = seq_comm_name (comp(eci)%compid) comp(eci)%ntype = ntype(1:3) - comp(eci)%oneletterid = ntype(1:1) + + select case(ntype) + case ('atm','cpl','ocn','wav','glc','ice','rof','lnd','esp') + comp(eci)%oneletterid = ntype(1:1) + case ('iac') + comp(eci)%oneletterid = 'z' + case default + call shr_sys_abort(subname//': ntype, "'//ntype//'" not recognized"') + end select if (eci == 1) then allocate(comp(1)%dom_cx) @@ -167,6 +175,9 @@ subroutine component_init_pre(comp, compid, cplcompid, cplallcompid, & if (comp(1)%oneletterid == 'e') then call seq_infodata_getData(infodata, esp_present=comp(eci)%present) end if + if (comp(1)%oneletterid == 'z') then + call seq_infodata_getData(infodata, iac_present=comp(eci)%present) + end if #else call seq_infodata_getData(comp(1)%oneletterid, infodata, comp_present=comp(eci)%present) #endif @@ -277,6 +288,7 @@ end subroutine comp_init if (comp(1)%oneletterid == 'g') call seq_infodata_getData(infodata, glc_present=comp(eci)%present) if (comp(1)%oneletterid == 'w') call seq_infodata_getData(infodata, wav_present=comp(eci)%present) if (comp(1)%oneletterid == 'e') call seq_infodata_getData(infodata, esp_present=comp(eci)%present) + if (comp(1)%oneletterid == 'z') call seq_infodata_getData(infodata, iac_present=comp(eci)%present) #else call seq_infodata_getData(comp(1)%oneletterid, infodata, comp_present=comp(eci)%present) #endif @@ -693,6 +705,7 @@ end subroutine comp_run if (comp(1)%oneletterid == 'g') call seq_infodata_putData(infodata, glc_phase=phase) if (comp(1)%oneletterid == 'w') call seq_infodata_putData(infodata, wav_phase=phase) if (comp(1)%oneletterid == 'e') call seq_infodata_putData(infodata, esp_phase=phase) + if (comp(1)%oneletterid == 'z') call seq_infodata_putData(infodata, iac_phase=phase) #else call seq_infodata_putData(comp(1)%oneletterid, infodata, comp_phase=phase) #endif diff --git a/driver-mct/main/component_type_mod.F90 b/driver-mct/main/component_type_mod.F90 index d1cd710946a3..6d222c8a1d54 100644 --- a/driver-mct/main/component_type_mod.F90 +++ b/driver-mct/main/component_type_mod.F90 @@ -12,7 +12,7 @@ module component_type_mod use seq_comm_mct , only: seq_comm_namelen use seq_comm_mct , only: num_inst_atm, num_inst_lnd, num_inst_rof use seq_comm_mct , only: num_inst_ocn, num_inst_ice, num_inst_glc - use seq_comm_mct , only: num_inst_wav, num_inst_esp + use seq_comm_mct , only: num_inst_wav, num_inst_esp, num_inst_iac use mct_mod implicit none @@ -112,8 +112,9 @@ module component_type_mod type(component_type), target :: glc(num_inst_glc) type(component_type), target :: wav(num_inst_wav) type(component_type), target :: esp(num_inst_esp) + type(component_type), target :: iac(num_inst_iac) - public :: atm, lnd, rof, ocn, ice, glc, wav, esp + public :: atm, lnd, rof, ocn, ice, glc, wav, esp, iac !=============================================================================== diff --git a/driver-mct/main/prep_atm_mod.F90 b/driver-mct/main/prep_atm_mod.F90 index fdd2a713180f..4fcf079b785f 100644 --- a/driver-mct/main/prep_atm_mod.F90 +++ b/driver-mct/main/prep_atm_mod.F90 @@ -31,10 +31,12 @@ module prep_atm_mod public :: prep_atm_get_l2x_ax public :: prep_atm_get_i2x_ax public :: prep_atm_get_o2x_ax + public :: prep_atm_get_z2x_ax public :: prep_atm_calc_l2x_ax public :: prep_atm_calc_i2x_ax public :: prep_atm_calc_o2x_ax + public :: prep_atm_calc_z2x_ax public :: prep_atm_get_mapper_So2a public :: prep_atm_get_mapper_Fo2a @@ -65,6 +67,7 @@ module prep_atm_mod type(mct_aVect), pointer :: l2x_ax(:) ! Lnd export, atm grid, cpl pes - allocated in driver type(mct_aVect), pointer :: i2x_ax(:) ! Ice export, atm grid, cpl pes - allocated in driver type(mct_aVect), pointer :: o2x_ax(:) ! Ocn export, atm grid, cpl pes - allocated in driver + type(mct_aVect), pointer :: z2x_ax(:) ! Iac export, atm grid, cpl pes - allocated in driver ! other module variables integer :: mpicom_CPLID ! MPI cpl communicator @@ -75,7 +78,7 @@ module prep_atm_mod !================================================================================================ - subroutine prep_atm_init(infodata, ocn_c2_atm, ice_c2_atm, lnd_c2_atm) + subroutine prep_atm_init(infodata, ocn_c2_atm, ice_c2_atm, lnd_c2_atm, iac_c2_atm) !--------------------------------------------------------------- ! Description @@ -86,6 +89,7 @@ subroutine prep_atm_init(infodata, ocn_c2_atm, ice_c2_atm, lnd_c2_atm) logical , intent(in) :: ocn_c2_atm ! .true. => ocn to atm coupling on logical , intent(in) :: ice_c2_atm ! .true. => ice to atm coupling on logical , intent(in) :: lnd_c2_atm ! .true. => lnd to atm coupling on + logical , intent(in) :: iac_c2_atm ! .true. => iac to atm coupling on ! ! Local Variables integer :: lsize_a @@ -739,6 +743,21 @@ end subroutine prep_atm_calc_l2x_ax !================================================================================================ + subroutine prep_atm_calc_z2x_ax(fractions_zx, timer) + !--------------------------------------------------------------- + ! Description + ! Create z2x_ax (note that z2x_ax is a local module variable) + ! + ! Arguments + type(mct_aVect) , intent(in) :: fractions_zx(:) + character(len=*), intent(in) :: timer + ! + ! Local Variables + + end subroutine prep_atm_calc_z2x_ax + + !================================================================================================ + function prep_atm_get_l2x_ax() type(mct_aVect), pointer :: prep_atm_get_l2x_ax(:) prep_atm_get_l2x_ax => l2x_ax(:) @@ -754,6 +773,11 @@ function prep_atm_get_o2x_ax() prep_atm_get_o2x_ax => o2x_ax(:) end function prep_atm_get_o2x_ax + function prep_atm_get_z2x_ax() + type(mct_aVect), pointer :: prep_atm_get_z2x_ax(:) + prep_atm_get_z2x_ax => z2x_ax(:) + end function prep_atm_get_z2x_ax + function prep_atm_get_mapper_So2a() type(seq_map), pointer :: prep_atm_get_mapper_So2a prep_atm_get_mapper_So2a => mapper_So2a diff --git a/driver-mct/main/prep_iac_mod.F90 b/driver-mct/main/prep_iac_mod.F90 new file mode 100644 index 000000000000..1ab5f6d02848 --- /dev/null +++ b/driver-mct/main/prep_iac_mod.F90 @@ -0,0 +1,168 @@ +module prep_iac_mod + +#include "shr_assert.h" + use shr_kind_mod, only: r8 => SHR_KIND_R8 + use shr_kind_mod, only: cs => SHR_KIND_CS + use shr_kind_mod, only: cl => SHR_KIND_CL + use shr_kind_mod, only: cxx => SHR_KIND_CXX + use shr_sys_mod, only: shr_sys_abort, shr_sys_flush + use seq_comm_mct, only: num_inst_lnd, num_inst_iac, num_inst_frc + use seq_comm_mct, only: CPLID, ROFID, logunit + use seq_comm_mct, only: seq_comm_getData=>seq_comm_setptrs + use seq_infodata_mod, only: seq_infodata_type, seq_infodata_getdata + use shr_log_mod , only: errMsg => shr_log_errMsg + use seq_map_type_mod + use seq_map_mod + use seq_flds_mod + use t_drv_timers_mod + use mct_mod + use perf_mod + use component_type_mod, only: component_get_x2c_cx, component_get_c2x_cx + use component_type_mod, only: iac, lnd + use prep_lnd_mod, only: prep_lnd_get_mapper_Fr2l + + implicit none + save + private + + !-------------------------------------------------------------------------- + ! Public interfaces + !-------------------------------------------------------------------------- + + public :: prep_iac_init + public :: prep_iac_mrg + + public :: prep_iac_accum + public :: prep_iac_accum_avg + + public :: prep_iac_calc_l2x_zx + + public :: prep_iac_get_l2zacc_lx + public :: prep_iac_get_l2zacc_lx_cnt + public :: prep_iac_get_mapper_Fl2z + + !-------------------------------------------------------------------------- + ! Private interfaces + !-------------------------------------------------------------------------- + + !-------------------------------------------------------------------------- + ! Private data + !-------------------------------------------------------------------------- + + ! mappers + type(seq_map), pointer :: mapper_Fl2z + + ! attribute vectors + type(mct_aVect), pointer :: l2x_zx(:) + + ! accumulation variables + type(mct_aVect), pointer :: l2zacc_lx(:) ! lnd export, lnd grid, cpl pes + integer , target :: l2zacc_lx_cnt ! l2racc_lx: number of time samples accumulated + + ! other module variables + integer :: mpicom_CPLID ! MPI cpl communicator + + !================================================================================================ + +contains + + !================================================================================================ + + subroutine prep_iac_init(infodata, lnd_c2_iac) + + !--------------------------------------------------------------- + ! Description + ! Initialize module attribute vectors and all other non-mapping + ! module variables + ! + ! Arguments + type(seq_infodata_type) , intent(in) :: infodata + logical , intent(in) :: lnd_c2_iac ! .true. => lnd to iac coupling on + ! + ! Local Variables + + end subroutine prep_iac_init + + !================================================================================================ + + subroutine prep_iac_accum(timer) + + !--------------------------------------------------------------- + ! Description + ! Accumulate land input to iac + ! + ! Arguments + character(len=*), intent(in) :: timer + ! + ! Local Variables + + end subroutine prep_iac_accum + + !================================================================================================ + + subroutine prep_iac_accum_avg(timer) + + !--------------------------------------------------------------- + ! Description + ! Finalize accumulation of land input to river component + ! + ! Arguments + character(len=*), intent(in) :: timer + ! + ! Local Variables + + end subroutine prep_iac_accum_avg + + !================================================================================================ + + subroutine prep_iac_mrg(infodata, fractions_zx, timer_mrg) + + !--------------------------------------------------------------- + ! Description + ! Merge iac inputs + ! + ! Arguments + type(seq_infodata_type) , intent(in) :: infodata + type(mct_aVect) , intent(in) :: fractions_zx(:) + character(len=*) , intent(in) :: timer_mrg + ! + ! Local Variables + + end subroutine prep_iac_mrg + + !================================================================================================ + + !================================================================================================ + + subroutine prep_iac_calc_l2x_zx(timer) + !--------------------------------------------------------------- + ! Description + ! Create l2x_zx (note that l2x_zx is a local module variable) + ! + ! Arguments + ! Don't know if we need these fractions just yet + ! type(mct_aVect) , intent(in) :: fractions_lx(:) + character(len=*), intent(in) :: timer + ! + ! Local Variables + + end subroutine prep_iac_calc_l2x_zx + + !================================================================================================ + + function prep_iac_get_l2zacc_lx() + type(mct_aVect), pointer :: prep_iac_get_l2zacc_lx(:) + prep_iac_get_l2zacc_lx => l2zacc_lx(:) + end function prep_iac_get_l2zacc_lx + + function prep_iac_get_l2zacc_lx_cnt() + integer, pointer :: prep_iac_get_l2zacc_lx_cnt + prep_iac_get_l2zacc_lx_cnt => l2zacc_lx_cnt + end function prep_iac_get_l2zacc_lx_cnt + + function prep_iac_get_mapper_Fl2z() + type(seq_map), pointer :: prep_iac_get_mapper_Fl2z + prep_iac_get_mapper_Fl2z => mapper_Fl2z + end function prep_iac_get_mapper_Fl2z + +end module prep_iac_mod diff --git a/driver-mct/main/prep_lnd_mod.F90 b/driver-mct/main/prep_lnd_mod.F90 index b65df6a4211c..344637f3fdcf 100644 --- a/driver-mct/main/prep_lnd_mod.F90 +++ b/driver-mct/main/prep_lnd_mod.F90 @@ -34,10 +34,12 @@ module prep_lnd_mod public :: prep_lnd_calc_a2x_lx public :: prep_lnd_calc_r2x_lx public :: prep_lnd_calc_g2x_lx + public :: prep_lnd_calc_z2x_lx public :: prep_lnd_get_a2x_lx public :: prep_lnd_get_r2x_lx public :: prep_lnd_get_g2x_lx + public :: prep_lnd_get_z2x_lx public :: prep_lnd_get_mapper_Sa2l public :: prep_lnd_get_mapper_Fa2l @@ -67,6 +69,7 @@ module prep_lnd_mod type(mct_aVect), pointer :: a2x_lx(:) ! Atm export, lnd grid, cpl pes - allocated in driver type(mct_aVect), pointer :: r2x_lx(:) ! Rof export, lnd grid, lnd pes - allocated in lnd gc type(mct_aVect), pointer :: g2x_lx(:) ! Glc export, lnd grid, cpl pes - allocated in driver + type(mct_aVect), pointer :: z2x_lx(:) ! Iac export, lnd grid, cpl pes - allocated in driver ! seq_comm_getData variables integer :: mpicom_CPLID ! MPI cpl communicator @@ -86,7 +89,7 @@ module prep_lnd_mod !================================================================================================ - subroutine prep_lnd_init(infodata, atm_c2_lnd, rof_c2_lnd, glc_c2_lnd) + subroutine prep_lnd_init(infodata, atm_c2_lnd, rof_c2_lnd, glc_c2_lnd, iac_c2_lnd) !--------------------------------------------------------------- ! Description @@ -98,6 +101,7 @@ subroutine prep_lnd_init(infodata, atm_c2_lnd, rof_c2_lnd, glc_c2_lnd) logical , intent(in) :: atm_c2_lnd ! .true. => atm to lnd coupling on logical , intent(in) :: rof_c2_lnd ! .true. => rof to lnd coupling on logical , intent(in) :: glc_c2_lnd ! .true. => glc to lnd coupling on + logical , intent(in) :: iac_c2_lnd ! .true. => iac to lnd coupling on ! ! Local Variables integer :: lsize_l @@ -477,6 +481,26 @@ end subroutine prep_lnd_calc_g2x_lx !================================================================================================ + subroutine prep_lnd_calc_z2x_lx(timer) + !--------------------------------------------------------------- + ! Description + ! Create z2x_lx (note that z2x_lx is a local module variable) + ! + ! Arguments + character(len=*) , intent(in) :: timer + ! + ! Local Variables + integer :: egi + type(mct_aVect), pointer :: z2x_gx + character(*), parameter :: subname = '(prep_lnd_calc_z2x_lx)' + !--------------------------------------------------------------- + + ! Stub + + end subroutine prep_lnd_calc_z2x_lx + + !================================================================================================ + function prep_lnd_get_a2x_lx() type(mct_aVect), pointer :: prep_lnd_get_a2x_lx(:) prep_lnd_get_a2x_lx => a2x_lx(:) @@ -492,6 +516,11 @@ function prep_lnd_get_g2x_lx() prep_lnd_get_g2x_lx => g2x_lx(:) end function prep_lnd_get_g2x_lx + function prep_lnd_get_z2x_lx() + type(mct_aVect), pointer :: prep_lnd_get_z2x_lx(:) + prep_lnd_get_z2x_lx => z2x_lx(:) + end function prep_lnd_get_z2x_lx + function prep_lnd_get_mapper_Sa2l() type(seq_map), pointer :: prep_lnd_get_mapper_Sa2l prep_lnd_get_mapper_Sa2l => mapper_Sa2l diff --git a/driver-mct/main/seq_frac_mct.F90 b/driver-mct/main/seq_frac_mct.F90 index 3793ca31e35c..11985ab9a58a 100644 --- a/driver-mct/main/seq_frac_mct.F90 +++ b/driver-mct/main/seq_frac_mct.F90 @@ -217,9 +217,10 @@ module seq_frac_mct ! !INTERFACE: ------------------------------------------------------------------ subroutine seq_frac_init( infodata, & - atm, ice, lnd, ocn, glc, rof, wav, & + atm, ice, lnd, ocn, glc, rof, wav, iac,& fractions_a, fractions_i, fractions_l, & - fractions_o, fractions_g, fractions_r, fractions_w) + fractions_o, fractions_g, fractions_r, & + fractions_w, fractions_z) ! !INPUT/OUTPUT PARAMETERS: type(seq_infodata_type) , intent(in) :: infodata @@ -230,6 +231,7 @@ subroutine seq_frac_init( infodata, & type(component_type) , intent(in) :: glc type(component_type) , intent(in) :: rof type(component_type) , intent(in) :: wav + type(component_type) , intent(in) :: iac type(mct_aVect) , intent(inout) :: fractions_a ! Fractions on atm grid/decomp type(mct_aVect) , intent(inout) :: fractions_i ! Fractions on ice grid/decomp type(mct_aVect) , intent(inout) :: fractions_l ! Fractions on lnd grid/decomp @@ -237,6 +239,7 @@ subroutine seq_frac_init( infodata, & type(mct_aVect) , intent(inout) :: fractions_g ! Fractions on glc grid/decomp type(mct_aVect) , intent(inout) :: fractions_r ! Fractions on rof grid/decomp type(mct_aVect) , intent(inout) :: fractions_w ! Fractions on wav grid/decomp + type(mct_aVect) , intent(inout) :: fractions_z ! Fractions on iac grid/decomp !EOP !----- local ----- @@ -247,6 +250,7 @@ subroutine seq_frac_init( infodata, & type(mct_ggrid), pointer :: dom_g type(mct_ggrid), pointer :: dom_r type(mct_ggrid), pointer :: dom_w + type(mct_ggrid), pointer :: dom_z logical :: atm_present ! .true. => atm is present logical :: ice_present ! .true. => ice is present @@ -255,6 +259,7 @@ subroutine seq_frac_init( infodata, & logical :: glc_present ! .true. => glc is present logical :: rof_present ! .true. => rof is present logical :: wav_present ! .true. => wav is present + logical :: iac_present ! .true. => iac is present logical :: dead_comps ! .true. => dead models present integer :: n ! indices @@ -270,6 +275,7 @@ subroutine seq_frac_init( infodata, & character(*),parameter :: fraclist_g = 'gfrac:lfrac' character(*),parameter :: fraclist_r = 'lfrac:rfrac' character(*),parameter :: fraclist_w = 'wfrac' + character(*),parameter :: fraclist_z = 'afrac:lfrac' !----- formats ----- character(*),parameter :: subName = '(seq_frac_init) ' @@ -286,6 +292,7 @@ subroutine seq_frac_init( infodata, & ocn_present=ocn_present, & glc_present=glc_present, & wav_present=wav_present, & + iac_present=iac_present, & dead_comps=dead_comps) dom_a => component_get_dom_cx(atm) @@ -295,6 +302,7 @@ subroutine seq_frac_init( infodata, & dom_r => component_get_dom_cx(rof) dom_g => component_get_dom_cx(glc) dom_w => component_get_dom_cx(wav) + dom_z => component_get_dom_cx(iac) debug_old = seq_frac_debug seq_frac_debug = 2 @@ -363,6 +371,15 @@ subroutine seq_frac_init( infodata, & fractions_w%rAttr(:,:) = 1.0_r8 end if + ! Initialize fractions on iac grid decomp, just an initial "guess", updated later + + if (iac_present) then + lSize = mct_aVect_lSize(dom_z%data) + call mct_aVect_init(fractions_z,rList=fraclist_z,lsize=lsize) + call mct_aVect_zero(fractions_z) + fractions_z%rAttr(:,:) = 1.0_r8 + end if + ! Initialize fractions on ice grid/decomp (initialize ice fraction to zero) if (ice_present) then @@ -471,6 +488,7 @@ subroutine seq_frac_init( infodata, & if (glc_present) call seq_frac_check(fractions_g,'glc init') if (rof_present) call seq_frac_check(fractions_r,'rof init') if (wav_present) call seq_frac_check(fractions_w,'wav init') + if (iac_present) call seq_frac_check(fractions_z,'iac init') if (ice_present) call seq_frac_check(fractions_i,'ice init') if (ocn_present) call seq_frac_check(fractions_o,'ocn init') if (atm_present .and. (lnd_present.or.ice_present.or.ocn_present)) & @@ -621,11 +639,12 @@ subroutine seq_frac_check(fractions,string) real(r8) :: gminval,gmaxval ! used for glc real(r8) :: rminval,rmaxval ! used for rof real(r8) :: wminval,wmaxval ! used for wav + real(r8) :: zminval,zmaxval ! used for iac real(r8) :: kminval,kmaxval ! used for lnd, lfrin real(r8) :: sminval,smaxval ! used for sum real(r8) :: tmpmin, tmpmax ! global tmps integer :: tmpsum ! global tmp - integer :: ka,kl,ki,ko,kg,kk,kr,kw + integer :: ka,kl,ki,ko,kg,kk,kr,kw,kz character(len=128) :: lstring logical :: error @@ -655,6 +674,7 @@ subroutine seq_frac_check(fractions,string) kg = -1 kr = -1 kw = -1 + kz = -1 aminval = 999.0_r8 amaxval = -999.0_r8 lminval = 999.0_r8 @@ -673,6 +693,8 @@ subroutine seq_frac_check(fractions,string) rmaxval = -999.0_r8 wminval = 999.0_r8 wmaxval = -999.0_r8 + zminval = 999.0_r8 + zmaxval = -999.0_r8 lsize = mct_avect_lsize(fractions) ka = mct_aVect_indexRA(fractions,"afrac",perrWith='quiet') @@ -682,6 +704,7 @@ subroutine seq_frac_check(fractions,string) kg = mct_aVect_indexRA(fractions,"gfrac",perrWith='quiet') kr = mct_aVect_indexRA(fractions,"rfrac",perrWith='quiet') kw = mct_aVect_indexRA(fractions,"wfrac",perrWith='quiet') + kz = mct_aVect_indexRA(fractions,"zfrac",perrWith='quiet') kk = mct_aVect_indexRA(fractions,"lfrin",perrWith='quiet') if (ka > 0) then @@ -712,6 +735,10 @@ subroutine seq_frac_check(fractions,string) wminval = minval(fractions%rAttr(kw,:)) wmaxval = maxval(fractions%rAttr(kw,:)) endif + if (kz > 0) then + zminval = minval(fractions%rAttr(kz,:)) + zmaxval = maxval(fractions%rAttr(kz,:)) + endif if (kk > 0) then kminval = minval(fractions%rAttr(kk,:)) kmaxval = maxval(fractions%rAttr(kk,:)) @@ -743,6 +770,7 @@ subroutine seq_frac_check(fractions,string) if (gminval < 0.0_r8-eps_fracval .or. gmaxval > 1.0_r8+eps_fracval) error = .true. if (rminval < 0.0_r8-eps_fracval .or. rmaxval > 1.0_r8+eps_fracval) error = .true. if (wminval < 0.0_r8-eps_fracval .or. wmaxval > 1.0_r8+eps_fracval) error = .true. + if (zminval < 0.0_r8-eps_fracval .or. zmaxval > 1.0_r8+eps_fracval) error = .true. if (kminval < 0.0_r8-eps_fracval .or. kmaxval > 1.0_r8+eps_fracval) error = .true. if (error .or. seq_frac_debug > 1) then @@ -781,6 +809,11 @@ subroutine seq_frac_check(fractions,string) call shr_mpi_max(wmaxval,tmpmax,mpicom,subname//':wfrac',all=.false.) if (iamroot) write(logunit,F02) trim(lstring),' wfrac min/max = ',tmpmin,tmpmax endif + if (kz > 0) then + call shr_mpi_min(kminval,tmpmin,mpicom,subname//':zfrac',all=.false.) + call shr_mpi_max(kmaxval,tmpmax,mpicom,subname//':zfrac',all=.false.) + if (iamroot) write(logunit,F02) trim(lstring),' zfrac min/max = ',tmpmin,tmpmax + endif if (kk > 0) then call shr_mpi_min(kminval,tmpmin,mpicom,subname//':lfrin',all=.false.) call shr_mpi_max(kmaxval,tmpmax,mpicom,subname//':lfrin',all=.false.) diff --git a/driver-mct/main/seq_hist_mod.F90 b/driver-mct/main/seq_hist_mod.F90 index 076d41819b2e..433854932003 100644 --- a/driver-mct/main/seq_hist_mod.F90 +++ b/driver-mct/main/seq_hist_mod.F90 @@ -30,7 +30,7 @@ module seq_hist_mod use seq_comm_mct, only: CPLID, GLOID, logunit, loglevel use seq_comm_mct, only: num_inst_atm, num_inst_lnd, num_inst_ocn use seq_comm_mct, only: num_inst_ice, num_inst_glc, num_inst_wav - use seq_comm_mct, only: num_inst_rof, num_inst_xao + use seq_comm_mct, only: num_inst_rof, num_inst_xao, num_inst_iac use prep_ocn_mod, only: prep_ocn_get_r2x_ox use prep_ocn_mod, only: prep_ocn_get_x2oacc_ox @@ -81,6 +81,7 @@ module seq_hist_mod logical :: rof_present ! .true. => land runoff is present logical :: glc_present ! .true. => glc is present logical :: wav_present ! .true. => wav is present + logical :: iac_present ! .true. => iac is present logical :: atm_prognostic ! .true. => atm comp expects input logical :: lnd_prognostic ! .true. => lnd comp expects input @@ -90,6 +91,7 @@ module seq_hist_mod logical :: rof_prognostic ! .true. => rof comp expects input logical :: glc_prognostic ! .true. => glc comp expects input logical :: wav_prognostic ! .true. => wav comp expects input + logical :: iac_prognostic ! .true. => iac comp expects input logical :: histavg_atm ! .true. => write atm fields to average history file logical :: histavg_lnd ! .true. => write lnd fields to average history file @@ -98,6 +100,7 @@ module seq_hist_mod logical :: histavg_rof ! .true. => write rof fields to average history file logical :: histavg_glc ! .true. => write glc fields to average history file logical :: histavg_wav ! .true. => write wav fields to average history file + logical :: histavg_iac ! .true. => write iac fields to average history file logical :: histavg_xao ! .true. => write flux xao fields to average history file logical :: single_column @@ -110,6 +113,7 @@ module seq_hist_mod integer(IN) :: rof_nx, rof_ny ! nx,ny of 2d grid, if known integer(IN) :: glc_nx, glc_ny ! nx,ny of 2d grid, if known integer(IN) :: wav_nx, wav_ny ! nx,ny of 2d grid, if known + integer(IN) :: iac_nx, iac_ny ! nx,ny of 2d grid, if known !--- temporary pointers --- type(mct_aVect), pointer :: r2x_ox(:) @@ -124,9 +128,9 @@ module seq_hist_mod !=============================================================================== subroutine seq_hist_write(infodata, EClock_d, & - atm, lnd, ice, ocn, rof, glc, wav, & + atm, lnd, ice, ocn, rof, glc, wav, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, fractions_rx, & - fractions_gx, fractions_wx, cpl_inst_tag) + fractions_gx, fractions_wx, fractions_zx, cpl_inst_tag) implicit none ! @@ -140,6 +144,7 @@ subroutine seq_hist_write(infodata, EClock_d, & type (component_type) , intent(inout) :: rof(:) type (component_type) , intent(inout) :: glc(:) type (component_type) , intent(inout) :: wav(:) + type (component_type) , intent(inout) :: iac(:) type(mct_aVect) , intent(inout) :: fractions_ax(:) ! Fractions on atm grid/decomp type(mct_aVect) , intent(inout) :: fractions_lx(:) ! Fractions on lnd grid/decomp type(mct_aVect) , intent(inout) :: fractions_ix(:) ! Fractions on ice grid/decomp @@ -147,6 +152,7 @@ subroutine seq_hist_write(infodata, EClock_d, & type(mct_aVect) , intent(inout) :: fractions_rx(:) ! Fractions on rof grid/decomp type(mct_aVect) , intent(inout) :: fractions_gx(:) ! Fractions on glc grid/decomp type(mct_aVect) , intent(inout) :: fractions_wx(:) ! Fractions on wav grid/decomp + type(mct_aVect) , intent(inout) :: fractions_zx(:) ! Fractions on iac grid/decomp character(len=*) , intent(in) :: cpl_inst_tag ! ! Local Variables @@ -187,6 +193,7 @@ subroutine seq_hist_write(infodata, EClock_d, & ocn_present=ocn_present, & glc_present=glc_present, & wav_present=wav_present, & + iac_present=iac_present, & atm_prognostic=atm_prognostic, & lnd_prognostic=lnd_prognostic, & ice_prognostic=ice_prognostic, & @@ -195,12 +202,14 @@ subroutine seq_hist_write(infodata, EClock_d, & rof_prognostic=rof_prognostic, & glc_prognostic=glc_prognostic, & wav_prognostic=wav_prognostic, & + iac_prognostic=iac_prognostic, & atm_nx=atm_nx, atm_ny=atm_ny, & lnd_nx=lnd_nx, lnd_ny=lnd_ny, & rof_nx=rof_nx, rof_ny=rof_ny, & ice_nx=ice_nx, ice_ny=ice_ny, & glc_nx=glc_nx, glc_ny=glc_ny, & wav_nx=wav_nx, wav_ny=wav_ny, & + iac_nx=iac_nx, iac_ny=iac_ny, & ocn_nx=ocn_nx, ocn_ny=ocn_ny, & single_column=single_column, & case_name=case_name, & @@ -381,6 +390,19 @@ subroutine seq_hist_write(infodata, EClock_d, & call seq_io_write(hist_file, wav, 'x2c', 'x2w_wx', & nx=wav_nx, ny=wav_ny, nt=1, whead=whead, wdata=wdata, pre='x2w') endif + + if (iac_present) then + gsmap => component_get_gsmap_cx(iac(1)) + dom => component_get_dom_cx(iac(1)) + call seq_io_write(hist_file, gsmap, dom%data, 'dom_zx', & + nx=iac_nx, ny=iac_ny, nt=1, whead=whead, wdata=wdata, pre='domz') + call seq_io_write(hist_file, gsmap, fractions_zx, 'fractions_zx', & + nx=iac_nx, ny=iac_ny, nt=1, whead=whead, wdata=wdata, pre='fracz') + call seq_io_write(hist_file, iac, 'c2x', 'z2x_zx', & + nx=iac_nx, ny=iac_ny, nt=1, whead=whead, wdata=wdata, pre='w2x') + call seq_io_write(hist_file, iac, 'x2c', 'x2z_zx', & + nx=iac_nx, ny=iac_ny, nt=1, whead=whead, wdata=wdata, pre='x2w') + endif enddo call seq_io_close(hist_file) @@ -392,7 +414,7 @@ end subroutine seq_hist_write !=============================================================================== subroutine seq_hist_writeavg(infodata, EClock_d, & - atm, lnd, ice, ocn, rof, glc, wav, write_now, cpl_inst_tag) + atm, lnd, ice, ocn, rof, glc, wav, iac, write_now, cpl_inst_tag) implicit none @@ -405,6 +427,7 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & type (component_type) , intent(in) :: rof(:) type (component_type) , intent(in) :: glc(:) type (component_type) , intent(in) :: wav(:) + type (component_type) , intent(in) :: iac(:) logical , intent(in) :: write_now ! write or accumulate character(len=*) , intent(in) :: cpl_inst_tag @@ -441,6 +464,8 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & type(mct_aVect), save :: x2g_gx_avg(num_inst_glc) type(mct_aVect), save :: w2x_wx_avg(num_inst_wav) type(mct_aVect), save :: x2w_wx_avg(num_inst_wav) + type(mct_aVect), save :: z2x_zx_avg(num_inst_iac) + type(mct_aVect), save :: x2z_zx_avg(num_inst_iac) type(mct_aVect), save, pointer :: xao_ox_avg(:) type(mct_aVect), save, pointer :: xao_ax_avg(:) @@ -477,6 +502,7 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & ocn_present=ocn_present, & glc_present=glc_present, & wav_present=wav_present, & + iac_present=iac_present, & atm_prognostic=atm_prognostic, & lnd_prognostic=lnd_prognostic, & ice_prognostic=ice_prognostic, & @@ -490,6 +516,7 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & ice_nx=ice_nx, ice_ny=ice_ny, & glc_nx=glc_nx, glc_ny=glc_ny, & wav_nx=wav_nx, wav_ny=wav_ny, & + iac_nx=iac_nx, iac_ny=iac_ny, & ocn_nx=ocn_nx, ocn_ny=ocn_ny, & histavg_atm=histavg_atm, & histavg_lnd=histavg_lnd, & @@ -498,6 +525,7 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & histavg_rof=histavg_rof, & histavg_glc=histavg_glc, & histavg_wav=histavg_wav, & + histavg_iac=histavg_iac, & histavg_xao=histavg_xao, & model_doi_url=model_doi_url) @@ -599,6 +627,19 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & call mct_aVect_zero(x2w_wx_avg(iidx)) enddo endif + if (iac_present .and. histavg_iac) then + do iidx = 1, num_inst_iac + c2x => component_get_c2x_cx(iac(iidx)) + lsize = mct_aVect_lsize(c2x) + call mct_aVect_init(z2x_zx_avg(iidx), c2x, lsize) + call mct_aVect_zero(z2x_zx_avg(iidx)) + + x2c => component_get_x2c_cx(iac(iidx)) + lsize = mct_aVect_lsize(x2c) + call mct_aVect_init(x2z_zx_avg(iidx), x2c, lsize) + call mct_aVect_zero(x2z_zx_avg(iidx)) + enddo + endif if (ocn_present .and. histavg_xao) then allocate(xao_ox_avg(num_inst_xao)) xao_ox => prep_aoflux_get_xao_ox() @@ -680,6 +721,14 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & x2w_wx_avg(iidx)%rAttr = x2w_wx_avg(iidx)%rAttr + x2c%rAttr enddo endif + if (iac_present .and. histavg_iac) then + do iidx = 1, num_inst_iac + c2x => component_get_c2x_cx(iac(iidx)) + x2c => component_get_x2c_cx(iac(iidx)) + z2x_zx_avg(iidx)%rAttr = z2x_zx_avg(iidx)%rAttr + c2x%rAttr + x2z_zx_avg(iidx)%rAttr = x2z_zx_avg(iidx)%rAttr + x2c%rAttr + enddo + endif if (ocn_present .and. histavg_xao) then xao_ox => prep_aoflux_get_xao_ox() do iidx = 1, num_inst_ocn @@ -753,6 +802,14 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & x2w_wx_avg(iidx)%rAttr = (x2w_wx_avg(iidx)%rAttr + x2c%rAttr) / (cnt * 1.0_r8) enddo endif + if (iac_present .and. histavg_iac) then + do iidx = 1, num_inst_iac + c2x => component_get_c2x_cx(iac(iidx)) + x2c => component_get_x2c_cx(iac(iidx)) + z2x_zx_avg(iidx)%rAttr = (z2x_zx_avg(iidx)%rAttr + c2x%rAttr) / (cnt * 1.0_r8) + x2z_zx_avg(iidx)%rAttr = (x2z_zx_avg(iidx)%rAttr + x2c%rAttr) / (cnt * 1.0_r8) + enddo + endif if (ocn_present .and. histavg_xao) then xao_ox => prep_aoflux_get_xao_ox() do iidx = 1, num_inst_ocn @@ -901,6 +958,18 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & nx=wav_nx, ny=wav_ny, nt=1, whead=whead, wdata=wdata, & pre='x2wavg', tavg=.true.) endif + if (iac_present .and. histavg_iac) then + gsmap => component_get_gsmap_cx(iac(1)) + dom => component_get_dom_cx(iac(1)) + call seq_io_write(hist_file, gsmap, dom%data, 'dom_zx', & + nx=iac_nx, ny=iac_ny, nt=1, whead=whead, wdata=wdata, pre='domw') + call seq_io_write(hist_file, gsmap, z2x_zx_avg, 'z2x_zx', & + nx=iac_nx, ny=iac_ny, nt=1, whead=whead, wdata=wdata, & + pre='z2xavg', tavg=.true.) + call seq_io_write(hist_file, gsmap, x2z_zx_avg, 'x2z_zx', & + nx=iac_nx, ny=iac_ny, nt=1, whead=whead, wdata=wdata, & + pre='x2zavg', tavg=.true.) + endif if (ocn_present .and. histavg_xao) then gsmap => component_get_gsmap_cx(ocn(1)) call seq_io_write(hist_file, gsmap, xao_ox_avg, 'xao_ox', & @@ -960,6 +1029,12 @@ subroutine seq_hist_writeavg(infodata, EClock_d, & call mct_aVect_zero(x2w_wx_avg(iidx)) enddo endif + if (iac_present .and. histavg_iac) then + do iidx = 1, num_inst_wav + call mct_aVect_zero(z2x_zx_avg(iidx)) + call mct_aVect_zero(x2z_zx_avg(iidx)) + enddo + endif if (ocn_present .and. histavg_xao) then do iidx = 1, num_inst_xao call mct_aVect_zero(xao_ox_avg(iidx)) diff --git a/driver-mct/main/seq_rest_mod.F90 b/driver-mct/main/seq_rest_mod.F90 index 258bea527736..f97b4ca51417 100644 --- a/driver-mct/main/seq_rest_mod.F90 +++ b/driver-mct/main/seq_rest_mod.F90 @@ -105,6 +105,7 @@ module seq_rest_mod logical :: glc_present ! .true. => glc is present logical :: wav_present ! .true. => wav is present logical :: esp_present ! .true. => esp is present + logical :: iac_present ! .true. => iac is present logical :: atm_prognostic ! .true. => atm comp expects input logical :: lnd_prognostic ! .true. => lnd comp expects input @@ -114,6 +115,7 @@ module seq_rest_mod logical :: glc_prognostic ! .true. => glc comp expects input logical :: wav_prognostic ! .true. => wav comp expects input logical :: esp_prognostic ! .true. => esp comp expects input + logical :: iac_prognostic ! .true. => iac comp expects input !--- temporary pointers --- type(mct_gsMap), pointer :: gsmap @@ -131,9 +133,9 @@ module seq_rest_mod !=============================================================================== subroutine seq_rest_read(rest_file, infodata, & - atm, lnd, ice, ocn, rof, glc, wav, esp, & + atm, lnd, ice, ocn, rof, glc, wav, esp, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, & - fractions_rx, fractions_gx, fractions_wx) + fractions_rx, fractions_gx, fractions_wx, fractions_zx) implicit none @@ -147,6 +149,7 @@ subroutine seq_rest_read(rest_file, infodata, & type (component_type) , intent(inout) :: glc(:) type (component_type) , intent(inout) :: wav(:) type (component_type) , intent(inout) :: esp(:) + type (component_type) , intent(inout) :: iac(:) type(mct_aVect) , intent(inout) :: fractions_ax(:) ! Fractions on atm grid/decomp type(mct_aVect) , intent(inout) :: fractions_lx(:) ! Fractions on lnd grid/decomp type(mct_aVect) , intent(inout) :: fractions_ix(:) ! Fractions on ice grid/decomp @@ -154,6 +157,7 @@ subroutine seq_rest_read(rest_file, infodata, & type(mct_aVect) , intent(inout) :: fractions_rx(:) ! Fractions on rof grid/decomp type(mct_aVect) , intent(inout) :: fractions_gx(:) ! Fractions on glc grid/decomp type(mct_aVect) , intent(inout) :: fractions_wx(:) ! Fractions on wav grid/decomp + type(mct_aVect) , intent(inout) :: fractions_zx(:) ! Fractions on iac grid/decomp integer(IN) :: n,n1,n2,n3 real(r8),allocatable :: ds(:) ! for reshaping diag data for restart file @@ -184,6 +188,7 @@ subroutine seq_rest_read(rest_file, infodata, & glc_present=glc_present, & wav_present=wav_present, & esp_present=esp_present, & + iac_present=iac_present, & atm_prognostic=atm_prognostic, & lnd_prognostic=lnd_prognostic, & ice_prognostic=ice_prognostic, & @@ -192,6 +197,7 @@ subroutine seq_rest_read(rest_file, infodata, & ocnrof_prognostic=ocnrof_prognostic, & glc_prognostic=glc_prognostic, & wav_prognostic=wav_prognostic, & + iac_prognostic=iac_prognostic, & esp_prognostic=esp_prognostic) if (iamin_CPLID) then @@ -255,6 +261,11 @@ subroutine seq_rest_read(rest_file, infodata, & call seq_io_read(rest_file, gsmap, fractions_wx, 'fractions_wx') call seq_io_read(rest_file, wav, 'c2x', 'w2x_wx') endif + if (iac_present) then + gsmap => component_get_gsmap_cx(iac(1)) + call seq_io_read(rest_file, gsmap, fractions_zx, 'fractions_zx') + call seq_io_read(rest_file, iac, 'c2x', 'z2x_zx') + endif ! Add ESP restart read here n = size(budg_dataG) @@ -285,9 +296,10 @@ end subroutine seq_rest_read !=============================================================================== subroutine seq_rest_write(EClock_d, seq_SyncClock, infodata, & - atm, lnd, ice, ocn, rof, glc, wav, esp, & + atm, lnd, ice, ocn, rof, glc, wav, esp, iac, & fractions_ax, fractions_lx, fractions_ix, fractions_ox, & - fractions_rx, fractions_gx, fractions_wx, tag, rest_file) + fractions_rx, fractions_gx, fractions_wx, fractions_zx, & + tag, rest_file) implicit none @@ -302,6 +314,7 @@ subroutine seq_rest_write(EClock_d, seq_SyncClock, infodata, & type (component_type) , intent(inout) :: glc(:) type (component_type) , intent(inout) :: wav(:) type (component_type) , intent(inout) :: esp(:) + type (component_type) , intent(inout) :: iac(:) type(mct_aVect) , intent(inout) :: fractions_ax(:) ! Fractions on atm grid/decomp type(mct_aVect) , intent(inout) :: fractions_lx(:) ! Fractions on lnd grid/decomp type(mct_aVect) , intent(inout) :: fractions_ix(:) ! Fractions on ice grid/decomp @@ -309,6 +322,7 @@ subroutine seq_rest_write(EClock_d, seq_SyncClock, infodata, & type(mct_aVect) , intent(inout) :: fractions_rx(:) ! Fractions on rof grid/decomp type(mct_aVect) , intent(inout) :: fractions_gx(:) ! Fractions on glc grid/decomp type(mct_aVect) , intent(inout) :: fractions_wx(:) ! Fractions on wav grid/decomp + type(mct_aVect) , intent(inout) :: fractions_zx(:) ! Fractions on iac grid/decomp character(len=*) , intent(in) :: tag character(len=CL) , intent(out) :: rest_file ! Restart filename @@ -356,6 +370,7 @@ subroutine seq_rest_write(EClock_d, seq_SyncClock, infodata, & glc_present=glc_present, & wav_present=wav_present, & esp_present=esp_present, & + iac_present=iac_present, & atm_prognostic=atm_prognostic, & lnd_prognostic=lnd_prognostic, & ice_prognostic=ice_prognostic, & @@ -365,6 +380,7 @@ subroutine seq_rest_write(EClock_d, seq_SyncClock, infodata, & glc_prognostic=glc_prognostic, & wav_prognostic=wav_prognostic, & esp_prognostic=esp_prognostic, & + iac_prognostic=iac_prognostic, & case_name=case_name, & model_doi_url=model_doi_url) @@ -527,6 +543,13 @@ subroutine seq_rest_write(EClock_d, seq_SyncClock, infodata, & call seq_io_write(rest_file, wav, 'c2x', 'w2x_wx', & whead=whead, wdata=wdata) endif + if (iac_present) then + gsmap => component_get_gsmap_cx(iac(1)) + call seq_io_write(rest_file, gsmap, fractions_zx, 'fractions_zx', & + whead=whead, wdata=wdata) + call seq_io_write(rest_file, iac, 'c2x', 'z2x_zx', & + whead=whead, wdata=wdata) + endif ! Write ESP restart data here enddo diff --git a/driver-mct/shr/seq_comm_mct.F90 b/driver-mct/shr/seq_comm_mct.F90 index 90efeb4f24bc..4664143e0be8 100644 --- a/driver-mct/shr/seq_comm_mct.F90 +++ b/driver-mct/shr/seq_comm_mct.F90 @@ -66,9 +66,9 @@ module seq_comm_mct integer, public :: global_mype = -1 !! To be initialized -!!! Note - NUM_COMP_INST_XXX are cpp variables set in buildlib.csm_share + !!! Note - NUM_COMP_INST_XXX are cpp variables set in buildlib.csm_share - integer, parameter :: ncomptypes = 8 ! total number of component types + integer, parameter :: ncomptypes = 9 ! total number of component types integer, parameter :: ncouplers = 1 ! number of couplers integer, parameter, public :: num_inst_atm = NUM_COMP_INST_ATM integer, parameter, public :: num_inst_lnd = NUM_COMP_INST_LND @@ -77,6 +77,7 @@ module seq_comm_mct integer, parameter, public :: num_inst_glc = NUM_COMP_INST_GLC integer, parameter, public :: num_inst_wav = NUM_COMP_INST_WAV integer, parameter, public :: num_inst_rof = NUM_COMP_INST_ROF + integer, parameter, public :: num_inst_iac = NUM_COMP_INST_IAC integer, parameter, public :: num_inst_esp = NUM_COMP_INST_ESP integer, parameter, public :: num_inst_total= num_inst_atm + & @@ -86,6 +87,7 @@ module seq_comm_mct num_inst_glc + & num_inst_wav + & num_inst_rof + & + num_inst_iac + & num_inst_esp + 1 integer, public :: num_inst_min, num_inst_max @@ -103,11 +105,13 @@ module seq_comm_mct integer, parameter, public :: num_inst_phys = num_inst_atm + num_inst_lnd + & num_inst_ocn + num_inst_ice + & num_inst_glc + num_inst_rof + & - num_inst_wav + num_inst_esp + num_inst_wav + num_inst_esp + & + num_inst_iac integer, parameter, public :: num_cpl_phys = num_inst_atm + num_inst_lnd + & num_inst_ocn + num_inst_ice + & num_inst_glc + num_inst_rof + & - num_inst_wav + num_inst_esp + num_inst_wav + num_inst_esp + & + num_inst_iac integer, parameter :: ncomps = (1 + ncouplers + 2*ncomptypes + num_inst_phys + num_cpl_phys) integer, public :: GLOID @@ -120,6 +124,7 @@ module seq_comm_mct integer, public :: ALLGLCID integer, public :: ALLROFID integer, public :: ALLWAVID + integer, public :: ALLIACID integer, public :: ALLESPID integer, public :: CPLALLATMID @@ -129,6 +134,7 @@ module seq_comm_mct integer, public :: CPLALLGLCID integer, public :: CPLALLROFID integer, public :: CPLALLWAVID + integer, public :: CPLALLIACID integer, public :: CPLALLESPID integer, public :: ATMID(num_inst_atm) @@ -138,6 +144,7 @@ module seq_comm_mct integer, public :: GLCID(num_inst_glc) integer, public :: ROFID(num_inst_rof) integer, public :: WAVID(num_inst_wav) + integer, public :: IACID(num_inst_iac) integer, public :: ESPID(num_inst_esp) integer, public :: CPLATMID(num_inst_atm) @@ -147,6 +154,7 @@ module seq_comm_mct integer, public :: CPLGLCID(num_inst_glc) integer, public :: CPLROFID(num_inst_rof) integer, public :: CPLWAVID(num_inst_wav) + integer, public :: CPLIACID(num_inst_iac) integer, public :: CPLESPID(num_inst_esp) integer, parameter, public :: seq_comm_namelen=16 @@ -198,7 +206,7 @@ module seq_comm_mct character(len=32), public :: & atm_layout, lnd_layout, ice_layout, glc_layout, rof_layout, & - ocn_layout, wav_layout, esp_layout + ocn_layout, wav_layout, esp_layout, iac_layout logical :: seq_comm_mct_initialized = .false. ! whether this module has been initialized @@ -244,6 +252,7 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) rof_ntasks, rof_rootpe, rof_pestride, rof_nthreads, & ocn_ntasks, ocn_rootpe, ocn_pestride, ocn_nthreads, & esp_ntasks, esp_rootpe, esp_pestride, esp_nthreads, & + iac_ntasks, iac_rootpe, iac_pestride, iac_nthreads, & cpl_ntasks, cpl_rootpe, cpl_pestride, cpl_nthreads, & info_taskmap_model @@ -256,6 +265,7 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) rof_ntasks, rof_rootpe, rof_pestride, rof_nthreads, rof_layout, & ocn_ntasks, ocn_rootpe, ocn_pestride, ocn_nthreads, ocn_layout, & esp_ntasks, esp_rootpe, esp_pestride, esp_nthreads, esp_layout, & + iac_ntasks, iac_rootpe, iac_pestride, iac_nthreads, iac_layout, & cpl_ntasks, cpl_rootpe, cpl_pestride, cpl_nthreads, & info_taskmap_model, info_taskmap_comp !---------------------------------------------------------- @@ -324,6 +334,7 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) call comp_pelayout_init(numpes, wav_ntasks, wav_rootpe, wav_pestride, wav_nthreads, wav_layout) call comp_pelayout_init(numpes, glc_ntasks, glc_rootpe, glc_pestride, glc_nthreads, glc_layout) call comp_pelayout_init(numpes, esp_ntasks, esp_rootpe, esp_pestride, esp_nthreads, esp_layout) + call comp_pelayout_init(numpes, iac_ntasks, iac_rootpe, iac_pestride, iac_nthreads, iac_layout) call comp_pelayout_init(numpes, cpl_ntasks, cpl_rootpe, cpl_pestride, cpl_nthreads) info_taskmap_model = 0 info_taskmap_comp = 0 @@ -351,6 +362,7 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) call shr_mpi_bcast(wav_nthreads,DRIVER_COMM,'wav_nthreads') call shr_mpi_bcast(rof_nthreads,DRIVER_COMM,'rof_nthreads') call shr_mpi_bcast(esp_nthreads,DRIVER_COMM,'esp_nthreads') + call shr_mpi_bcast(iac_nthreads,DRIVER_COMM,'iac_nthreads') call shr_mpi_bcast(cpl_nthreads,DRIVER_COMM,'cpl_nthreads') call shr_mpi_bcast(atm_layout,DRIVER_COMM,'atm_layout') @@ -360,6 +372,7 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) call shr_mpi_bcast(glc_layout,DRIVER_COMM,'glc_layout') call shr_mpi_bcast(wav_layout,DRIVER_COMM,'wav_layout') call shr_mpi_bcast(rof_layout,DRIVER_COMM,'rof_layout') + call shr_mpi_bcast(iac_layout,DRIVER_COMM,'iac_layout') call shr_mpi_bcast(esp_layout,DRIVER_COMM,'esp_layout') call shr_mpi_bcast(info_taskmap_model,DRIVER_COMM,'info_taskmap_model') @@ -421,10 +434,10 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) error_state = .false. num_inst_min = min(num_inst_atm, num_inst_lnd, num_inst_ocn,& num_inst_ice, num_inst_glc, num_inst_wav, num_inst_rof,& - num_inst_esp) + num_inst_esp, num_inst_iac) num_inst_max = max(num_inst_atm, num_inst_lnd, num_inst_ocn,& num_inst_ice, num_inst_glc, num_inst_wav, num_inst_rof,& - num_inst_esp) + num_inst_esp, num_inst_iac) if (num_inst_min /= num_inst_max .and. num_inst_min /= 1) error_state = .true. if (num_inst_atm /= num_inst_min .and. num_inst_atm /= num_inst_max) error_state = .true. @@ -434,6 +447,7 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) if (num_inst_glc /= num_inst_min .and. num_inst_glc /= num_inst_max) error_state = .true. if (num_inst_wav /= num_inst_min .and. num_inst_wav /= num_inst_max) error_state = .true. if (num_inst_rof /= num_inst_min .and. num_inst_rof /= num_inst_max) error_state = .true. + if (num_inst_iac /= num_inst_min .and. num_inst_iac /= num_inst_max) error_state = .true. if (num_inst_esp /= num_inst_min .and. num_inst_esp /= num_inst_max) error_state = .true. if (error_state) then @@ -466,6 +480,7 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) pelist(2,1) = cpl_rootpe + (cpl_ntasks -1) * cpl_pestride pelist(3,1) = cpl_pestride end if + call mpi_bcast(pelist, size(pelist), MPI_INTEGER, 0, DRIVER_COMM, ierr) call seq_comm_setcomm(CPLID,pelist,nthreads=cpl_nthreads,iname='CPL') @@ -485,6 +500,8 @@ subroutine seq_comm_init(global_comm_in, driver_comm_in, nmlfile, drv_comm_id) CPLID, WAVID, CPLWAVID, ALLWAVID, CPLALLWAVID, 'WAV', count, drv_comm_id) call comp_comm_init(driver_comm, esp_rootpe, esp_nthreads, esp_layout, esp_ntasks, esp_pestride, num_inst_esp, & CPLID, ESPID, CPLESPID, ALLESPID, CPLALLESPID, 'ESP', count, drv_comm_id) + call comp_comm_init(driver_comm, iac_rootpe, iac_nthreads, iac_layout, iac_ntasks, iac_pestride, num_inst_iac, & + CPLID, IACID, CPLIACID, ALLIACID, CPLALLIACID, 'IAC', count, drv_comm_id) if (count /= ncomps) then write(logunit,*) trim(subname),' ERROR in ID count ',count,ncomps diff --git a/driver-mct/shr/seq_flds_mod.F90 b/driver-mct/shr/seq_flds_mod.F90 index 654a926cfb70..3a21de4824f7 100644 --- a/driver-mct/shr/seq_flds_mod.F90 +++ b/driver-mct/shr/seq_flds_mod.F90 @@ -212,6 +212,11 @@ module seq_flds_mod character(CXX) :: seq_flds_r2o_liq_fluxes character(CXX) :: seq_flds_r2o_ice_fluxes + !character(CXX) :: seq_flds_x2z_states + !character(CXX) :: seq_flds_z2x_states + character(CXX) :: seq_flds_z2x_fluxes + character(CXX) :: seq_flds_x2z_fluxes + !---------------------------------------------------------------------------- ! combined state/flux fields !---------------------------------------------------------------------------- diff --git a/driver-mct/shr/seq_infodata_mod.F90 b/driver-mct/shr/seq_infodata_mod.F90 index 1249be4d8dc5..12644e258707 100644 --- a/driver-mct/shr/seq_infodata_mod.F90 +++ b/driver-mct/shr/seq_infodata_mod.F90 @@ -27,7 +27,7 @@ MODULE seq_infodata_mod use seq_comm_mct, only: seq_comm_setptrs, seq_comm_iamroot, seq_comm_iamin use seq_comm_mct, only: num_inst_atm, num_inst_lnd, num_inst_rof use seq_comm_mct, only: num_inst_ocn, num_inst_ice, num_inst_glc - use seq_comm_mct, only: num_inst_wav + use seq_comm_mct, only: num_inst_wav, num_inst_iac use shr_orb_mod, only: SHR_ORB_UNDEF_INT, SHR_ORB_UNDEF_REAL, shr_orb_params implicit none @@ -118,6 +118,7 @@ MODULE seq_infodata_mod character(SHR_KIND_CL) :: rof_gnam ! rof grid character(SHR_KIND_CL) :: glc_gnam ! glc grid character(SHR_KIND_CL) :: wav_gnam ! wav grid + character(SHR_KIND_CL) :: iac_gnam ! iac grid logical :: shr_map_dopole ! pole corrections in shr_map_mod character(SHR_KIND_CL) :: vect_map ! vector mapping option, none, cart3d, cart3d_diag, cart3d_uvw, cart3d_uvw_diag character(SHR_KIND_CS) :: aoflux_grid ! grid for atm ocn flux calc @@ -150,6 +151,7 @@ MODULE seq_infodata_mod logical :: histavg_rof ! cpl writes rof fields in average history file logical :: histavg_glc ! cpl writes glc fields in average history file logical :: histavg_wav ! cpl writes wav fields in average history file + logical :: histavg_iac ! cpl writes iac fields in average history file logical :: histavg_xao ! cpl writes flux xao fields in average history file real(SHR_KIND_R8) :: eps_frac ! fraction error tolerance real(SHR_KIND_R8) :: eps_amask ! atm mask error tolerance @@ -197,6 +199,8 @@ MODULE seq_infodata_mod logical :: wav_prognostic ! does component model need input data from driver logical :: esp_present ! does component model exist logical :: esp_prognostic ! does component model need input data from driver + logical :: iac_present ! does component model exist + logical :: iac_prognostic ! does component model need input data from driver logical :: dead_comps ! do we have dead models integer(SHR_KIND_IN) :: atm_nx ! nx, ny of "2d" grid integer(SHR_KIND_IN) :: atm_ny ! nx, ny of "2d" grid @@ -212,6 +216,8 @@ MODULE seq_infodata_mod integer(SHR_KIND_IN) :: glc_ny ! nx, ny of "2d" grid integer(SHR_KIND_IN) :: wav_nx ! nx, ny of "2d" grid integer(SHR_KIND_IN) :: wav_ny ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: iac_nx ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: iac_ny ! nx, ny of "2d" grid !--- set via components and may be time varying --- real(SHR_KIND_R8) :: nextsw_cday ! calendar of next atm shortwave @@ -224,6 +230,7 @@ MODULE seq_infodata_mod integer(SHR_KIND_IN) :: rof_phase ! rof phase integer(SHR_KIND_IN) :: wav_phase ! wav phase integer(SHR_KIND_IN) :: esp_phase ! esp phase + integer(SHR_KIND_IN) :: iac_phase ! iac phase logical :: atm_aero ! atmosphere aerosols logical :: glc_g2lupdate ! update glc2lnd fields in lnd model real(shr_kind_r8) :: max_cplstep_time ! abort if cplstep time exceeds this value @@ -356,6 +363,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) character(SHR_KIND_CL) :: rof_gnam ! rof grid character(SHR_KIND_CL) :: glc_gnam ! glc grid character(SHR_KIND_CL) :: wav_gnam ! wav grid + character(SHR_KIND_CL) :: iac_gnam ! iac grid logical :: shr_map_dopole ! pole corrections in shr_map_mod character(SHR_KIND_CL) :: vect_map ! vector mapping option character(SHR_KIND_CS) :: aoflux_grid ! grid for atm ocn flux calc @@ -387,6 +395,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) logical :: histavg_rof ! cpl writes rof fields in average history file logical :: histavg_glc ! cpl writes glc fields in average history file logical :: histavg_wav ! cpl writes wav fields in average history file + logical :: histavg_iac ! cpl writes wav fields in average history file logical :: histavg_xao ! cpl writes flux xao fields in average history file logical :: drv_threading ! is threading control in driver turned on real(SHR_KIND_R8) :: eps_frac ! fraction error tolerance @@ -423,7 +432,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) wv_sat_use_tables, wv_sat_table_spacing, & tfreeze_option, glc_renormalize_smb, & ice_gnam, rof_gnam, glc_gnam, wav_gnam, & - atm_gnam, lnd_gnam, ocn_gnam, cpl_decomp, & + atm_gnam, lnd_gnam, ocn_gnam, iac_gnam, cpl_decomp, & shr_map_dopole, vect_map, aoflux_grid, do_histinit, & do_budgets, drv_threading, & budget_inst, budget_daily, budget_month, & @@ -434,6 +443,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) histaux_double_precision, & histavg_atm, histavg_lnd, histavg_ocn, histavg_ice, & histavg_rof, histavg_glc, histavg_wav, histavg_xao, & + histavg_iac, & histaux_l2x1yrg, cpl_seq_option, & eps_frac, eps_amask, & eps_agrid, eps_aarea, eps_omask, eps_ogrid, & @@ -506,6 +516,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) rof_gnam = 'undefined' glc_gnam = 'undefined' wav_gnam = 'undefined' + iac_gnam = 'undefined' shr_map_dopole = .true. vect_map = 'cart3d' aoflux_grid = 'ocn' @@ -536,6 +547,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) histavg_rof = .true. histavg_glc = .true. histavg_wav = .true. + histavg_iac = .true. histavg_xao = .true. drv_threading = .false. eps_frac = 1.0e-02_SHR_KIND_R8 @@ -631,6 +643,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) infodata%rof_gnam = rof_gnam infodata%glc_gnam = glc_gnam infodata%wav_gnam = wav_gnam + infodata%iac_gnam = iac_gnam infodata%shr_map_dopole = shr_map_dopole #ifdef COMPARE_TO_NUOPC infodata%vect_map = 'none' @@ -665,6 +678,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) infodata%histavg_rof = histavg_rof infodata%histavg_glc = histavg_glc infodata%histavg_wav = histavg_wav + infodata%histavg_iac = histavg_iac infodata%histavg_xao = histavg_xao infodata%drv_threading = drv_threading infodata%eps_frac = eps_frac @@ -698,6 +712,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) infodata%glcocn_present = .true. infodata%glcice_present = .true. infodata%esp_present = .true. + infodata%iac_present = .true. infodata%atm_prognostic = .false. infodata%lnd_prognostic = .false. @@ -712,6 +727,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) ! in all cases. infodata%glc_coupled_fluxes = .true. infodata%wav_prognostic = .false. + infodata%iac_prognostic = .false. infodata%iceberg_prognostic = .false. infodata%esp_prognostic = .false. infodata%dead_comps = .false. @@ -730,6 +746,8 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) infodata%glc_ny = 0 infodata%wav_nx = 0 infodata%wav_ny = 0 + infodata%iac_nx = 0 + infodata%iac_ny = 0 infodata%nextsw_cday = -1.0_SHR_KIND_R8 infodata%precip_fact = 1.0_SHR_KIND_R8 @@ -740,6 +758,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) infodata%glc_phase = 1 infodata%rof_phase = 1 infodata%wav_phase = 1 + infodata%iac_phase = 1 infodata%atm_aero = .false. infodata%glc_g2lupdate = .false. infodata%glc_valid_input = .true. @@ -859,6 +878,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) infodata%ocn_present = .true. infodata%glc_present = .false. infodata%wav_present = .false. + infodata%iac_present = .false. infodata%glclnd_present = .false. infodata%glcocn_present = .false. infodata%glcice_present = .false. @@ -929,12 +949,13 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ atm_present, atm_prognostic, lnd_present, lnd_prognostic, rof_prognostic, & rof_present, ocn_present, ocn_prognostic, ocnrof_prognostic, & ice_present, ice_prognostic, glc_present, glc_prognostic, & + iac_present, iac_prognostic, & glc_coupled_fluxes, & flood_present, wav_present, wav_prognostic, rofice_present, & glclnd_present, glcocn_present, glcice_present, iceberg_prognostic,& esp_present, esp_prognostic, & bfbflag, lnd_gnam, cpl_decomp, cpl_seq_option, & - ice_gnam, rof_gnam, glc_gnam, wav_gnam, & + ice_gnam, rof_gnam, glc_gnam, wav_gnam, iac_gnam, & atm_gnam, ocn_gnam, info_debug, dead_comps, read_restart, & shr_map_dopole, vect_map, aoflux_grid, flux_epbalfact, & nextsw_cday, precip_fact, flux_epbal, flux_albav, & @@ -948,15 +969,15 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ histaux_a2x3hr, histaux_a2x3hrp , histaux_l2x1yrg, & histaux_a2x24hr, histaux_l2x , histaux_r2x , histaux_double_precision, & orb_obliq, histavg_atm, histavg_lnd, histavg_ocn, histavg_ice, & - histavg_rof, histavg_glc, histavg_wav, histavg_xao, & + histavg_rof, histavg_glc, histavg_wav, histavg_xao, histavg_iac, & orb_iyear, orb_iyear_align, orb_mode, orb_mvelp, & orb_eccen, orb_obliqr, orb_lambm0, orb_mvelpp, wv_sat_scheme, & wv_sat_transition_start, wv_sat_use_tables, wv_sat_table_spacing, & tfreeze_option, glc_renormalize_smb, & glc_phase, rof_phase, atm_phase, lnd_phase, ocn_phase, ice_phase, & - wav_phase, esp_phase, wav_nx, wav_ny, atm_nx, atm_ny, & + wav_phase, iac_phase, esp_phase, wav_nx, wav_ny, atm_nx, atm_ny, & lnd_nx, lnd_ny, rof_nx, rof_ny, ice_nx, ice_ny, ocn_nx, ocn_ny, & - glc_nx, glc_ny, eps_frac, eps_amask, & + iac_nx, iac_ny, glc_nx, glc_ny, eps_frac, eps_amask, & eps_agrid, eps_aarea, eps_omask, eps_ogrid, eps_oarea, & reprosum_use_ddpdd, reprosum_allow_infnan, & reprosum_diffmax, reprosum_recompute, & @@ -1024,6 +1045,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ character(len=*), optional, intent(OUT) :: rof_gnam ! rof grid character(len=*), optional, intent(OUT) :: glc_gnam ! glc grid character(len=*), optional, intent(OUT) :: wav_gnam ! wav grid + character(len=*), optional, intent(OUT) :: iac_gnam ! iac grid logical, optional, intent(OUT) :: shr_map_dopole ! pole corrections in shr_map_mod character(len=*), optional, intent(OUT) :: vect_map ! vector mapping option character(len=*), optional, intent(OUT) :: aoflux_grid ! grid for atm ocn flux calc @@ -1054,6 +1076,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ logical, optional, intent(OUT) :: histavg_rof logical, optional, intent(OUT) :: histavg_glc logical, optional, intent(OUT) :: histavg_wav + logical, optional, intent(OUT) :: histavg_iac logical, optional, intent(OUT) :: histavg_xao logical, optional, intent(OUT) :: drv_threading ! driver threading control flag real(SHR_KIND_R8), optional, intent(OUT) :: eps_frac ! fraction error tolerance @@ -1097,6 +1120,8 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ logical, optional, intent(OUT) :: glc_coupled_fluxes logical, optional, intent(OUT) :: wav_present logical, optional, intent(OUT) :: wav_prognostic + logical, optional, intent(OUT) :: iac_present + logical, optional, intent(OUT) :: iac_prognostic logical, optional, intent(OUT) :: esp_present logical, optional, intent(OUT) :: esp_prognostic integer(SHR_KIND_IN), optional, intent(OUT) :: atm_nx ! nx,ny 2d grid size global @@ -1113,6 +1138,8 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ integer(SHR_KIND_IN), optional, intent(OUT) :: glc_ny integer(SHR_KIND_IN), optional, intent(OUT) :: wav_nx integer(SHR_KIND_IN), optional, intent(OUT) :: wav_ny + integer(SHR_KIND_IN), optional, intent(OUT) :: iac_nx + integer(SHR_KIND_IN), optional, intent(OUT) :: iac_ny real(SHR_KIND_R8), optional, intent(OUT) :: nextsw_cday ! calendar of next atm shortwave real(SHR_KIND_R8), optional, intent(OUT) :: precip_fact ! precip factor @@ -1124,6 +1151,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ integer(SHR_KIND_IN), optional, intent(OUT) :: glc_phase ! glc phase integer(SHR_KIND_IN), optional, intent(OUT) :: rof_phase ! rof phase integer(SHR_KIND_IN), optional, intent(OUT) :: wav_phase ! wav phase + integer(SHR_KIND_IN), optional, intent(OUT) :: iac_phase ! wav phase integer(SHR_KIND_IN), optional, intent(OUT) :: esp_phase ! wav phase logical, optional, intent(OUT) :: atm_aero ! atmosphere aerosols logical, optional, intent(OUT) :: glc_g2lupdate ! update glc2lnd fields in lnd model @@ -1192,6 +1220,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ if ( present(rof_gnam) ) rof_gnam = infodata%rof_gnam if ( present(glc_gnam) ) glc_gnam = infodata%glc_gnam if ( present(wav_gnam) ) wav_gnam = infodata%wav_gnam + if ( present(iac_gnam) ) iac_gnam = infodata%iac_gnam if ( present(shr_map_dopole) ) shr_map_dopole = infodata%shr_map_dopole if ( present(vect_map) ) vect_map = infodata%vect_map if ( present(aoflux_grid) ) aoflux_grid = infodata%aoflux_grid @@ -1222,6 +1251,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ if ( present(histavg_rof) ) histavg_rof = infodata%histavg_rof if ( present(histavg_glc) ) histavg_glc = infodata%histavg_glc if ( present(histavg_wav) ) histavg_wav = infodata%histavg_wav + if ( present(histavg_iac) ) histavg_iac = infodata%histavg_iac if ( present(histavg_xao) ) histavg_xao = infodata%histavg_xao if ( present(drv_threading) ) drv_threading = infodata%drv_threading if ( present(eps_frac) ) eps_frac = infodata%eps_frac @@ -1267,6 +1297,8 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ if ( present(wav_prognostic) ) wav_prognostic = infodata%wav_prognostic if ( present(esp_present) ) esp_present = infodata%esp_present if ( present(esp_prognostic) ) esp_prognostic = infodata%esp_prognostic + if ( present(iac_present) ) iac_present = infodata%iac_present + if ( present(iac_prognostic) ) iac_prognostic = infodata%iac_prognostic if ( present(atm_nx) ) atm_nx = infodata%atm_nx if ( present(atm_ny) ) atm_ny = infodata%atm_ny if ( present(lnd_nx) ) lnd_nx = infodata%lnd_nx @@ -1281,6 +1313,8 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ if ( present(glc_ny) ) glc_ny = infodata%glc_ny if ( present(wav_nx) ) wav_nx = infodata%wav_nx if ( present(wav_ny) ) wav_ny = infodata%wav_ny + if ( present(iac_nx) ) iac_nx = infodata%iac_nx + if ( present(iac_ny) ) iac_ny = infodata%iac_ny if ( present(nextsw_cday) ) nextsw_cday = infodata%nextsw_cday if ( present(precip_fact) ) precip_fact = infodata%precip_fact @@ -1305,6 +1339,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ if ( present(rof_phase) ) rof_phase = infodata%rof_phase if ( present(wav_phase) ) wav_phase = infodata%wav_phase if ( present(esp_phase) ) esp_phase = infodata%esp_phase + if ( present(iac_phase) ) iac_phase = infodata%iac_phase if ( present(atm_aero) ) atm_aero = infodata%atm_aero if ( present(glc_g2lupdate) ) glc_g2lupdate = infodata%glc_g2lupdate if ( present(max_cplstep_time) ) max_cplstep_time = infodata%max_cplstep_time @@ -1383,6 +1418,11 @@ SUBROUTINE seq_infodata_GetData_bytype( component_firstletter, infodata, & wav_prognostic=comp_prognostic, wav_gnam=comp_gnam, & wav_phase=comp_phase, wav_nx=comp_nx, wav_ny=comp_ny, & histavg_wav=histavg_comp) + else if (component_firstletter == 'z') then + call seq_infodata_GetData(infodata, iac_present=comp_present, & + iac_prognostic=comp_prognostic, iac_gnam=comp_gnam, & + iac_phase=comp_phase, iac_nx=comp_nx, iac_ny=comp_ny, & + histavg_iac=histavg_comp) else if (component_firstletter == 'e') then if (present(comp_gnam)) then comp_gnam = '' @@ -1439,8 +1479,9 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ flood_present, wav_present, wav_prognostic, rofice_present, & glclnd_present, glcocn_present, glcice_present, iceberg_prognostic,& esp_present, esp_prognostic, & + iac_present, iac_prognostic, & bfbflag, lnd_gnam, cpl_decomp, cpl_seq_option, & - ice_gnam, rof_gnam, glc_gnam, wav_gnam, & + ice_gnam, rof_gnam, glc_gnam, wav_gnam, iac_gnam, & atm_gnam, ocn_gnam, info_debug, dead_comps, read_restart, & shr_map_dopole, vect_map, aoflux_grid, run_barriers, & nextsw_cday, precip_fact, flux_epbal, flux_albav, & @@ -1454,15 +1495,15 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ histaux_a2x3hr, histaux_a2x3hrp , histaux_l2x1yrg, & histaux_a2x24hr, histaux_l2x , histaux_r2x , histaux_double_precision, & orb_obliq, histavg_atm, histavg_lnd, histavg_ocn, histavg_ice, & - histavg_rof, histavg_glc, histavg_wav, histavg_xao, & + histavg_rof, histavg_glc, histavg_wav, histavg_xao, histavg_iac, & orb_iyear, orb_iyear_align, orb_mode, orb_mvelp, & orb_eccen, orb_obliqr, orb_lambm0, orb_mvelpp, wv_sat_scheme, & wv_sat_transition_start, wv_sat_use_tables, wv_sat_table_spacing, & tfreeze_option, glc_renormalize_smb, & glc_phase, rof_phase, atm_phase, lnd_phase, ocn_phase, ice_phase, & - wav_phase, esp_phase, wav_nx, wav_ny, atm_nx, atm_ny, & + wav_phase, iac_phase, esp_phase, wav_nx, wav_ny, atm_nx, atm_ny, & lnd_nx, lnd_ny, rof_nx, rof_ny, ice_nx, ice_ny, ocn_nx, ocn_ny, & - glc_nx, glc_ny, eps_frac, eps_amask, & + iac_nx, iac_ny, glc_nx, glc_ny, eps_frac, eps_amask, & eps_agrid, eps_aarea, eps_omask, eps_ogrid, eps_oarea, & reprosum_use_ddpdd, reprosum_allow_infnan, & reprosum_diffmax, reprosum_recompute, & @@ -1528,6 +1569,7 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ character(len=*), optional, intent(IN) :: rof_gnam ! rof grid character(len=*), optional, intent(IN) :: glc_gnam ! glc grid character(len=*), optional, intent(IN) :: wav_gnam ! wav grid + character(len=*), optional, intent(IN) :: iac_gnam ! iac grid logical, optional, intent(IN) :: shr_map_dopole ! pole corrections in shr_map_mod character(len=*), optional, intent(IN) :: vect_map ! vector mapping option character(len=*), optional, intent(IN) :: aoflux_grid ! grid for atm ocn flux calc @@ -1559,6 +1601,7 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ logical, optional, intent(IN) :: histavg_glc logical, optional, intent(IN) :: histavg_wav logical, optional, intent(IN) :: histavg_xao + logical, optional, intent(IN) :: histavg_iac logical, optional, intent(IN) :: drv_threading ! driver threading control flag real(SHR_KIND_R8), optional, intent(IN) :: eps_frac ! fraction error tolerance real(SHR_KIND_R8), optional, intent(IN) :: eps_amask ! atm mask error tolerance @@ -1603,6 +1646,8 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ logical, optional, intent(IN) :: wav_prognostic logical, optional, intent(IN) :: esp_present logical, optional, intent(IN) :: esp_prognostic + logical, optional, intent(IN) :: iac_present + logical, optional, intent(IN) :: iac_prognostic integer(SHR_KIND_IN), optional, intent(IN) :: atm_nx ! nx,ny 2d grid size global integer(SHR_KIND_IN), optional, intent(IN) :: atm_ny ! nx,ny 2d grid size global integer(SHR_KIND_IN), optional, intent(IN) :: lnd_nx @@ -1617,6 +1662,8 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ integer(SHR_KIND_IN), optional, intent(IN) :: glc_ny integer(SHR_KIND_IN), optional, intent(IN) :: wav_nx integer(SHR_KIND_IN), optional, intent(IN) :: wav_ny + integer(SHR_KIND_IN), optional, intent(IN) :: iac_nx + integer(SHR_KIND_IN), optional, intent(IN) :: iac_ny real(SHR_KIND_R8), optional, intent(IN) :: nextsw_cday ! calendar of next atm shortwave real(SHR_KIND_R8), optional, intent(IN) :: precip_fact ! precip factor @@ -1627,6 +1674,7 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ integer(SHR_KIND_IN), optional, intent(IN) :: glc_phase ! glc phase integer(SHR_KIND_IN), optional, intent(IN) :: rof_phase ! rof phase integer(SHR_KIND_IN), optional, intent(IN) :: wav_phase ! wav phase + integer(SHR_KIND_IN), optional, intent(IN) :: iac_phase ! iac phase integer(SHR_KIND_IN), optional, intent(IN) :: esp_phase ! esp phase logical, optional, intent(IN) :: atm_aero ! atm aerosols logical, optional, intent(IN) :: glc_g2lupdate ! update glc2lnd fields in lnd model @@ -1694,6 +1742,7 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ if ( present(rof_gnam) ) infodata%rof_gnam = rof_gnam if ( present(glc_gnam) ) infodata%glc_gnam = glc_gnam if ( present(wav_gnam) ) infodata%wav_gnam = wav_gnam + if ( present(iac_gnam) ) infodata%iac_gnam = iac_gnam if ( present(shr_map_dopole) ) infodata%shr_map_dopole = shr_map_dopole if ( present(vect_map) ) infodata%vect_map = vect_map if ( present(aoflux_grid) ) infodata%aoflux_grid = aoflux_grid @@ -1724,6 +1773,7 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ if ( present(histavg_rof) ) infodata%histavg_rof = histavg_rof if ( present(histavg_glc) ) infodata%histavg_glc = histavg_glc if ( present(histavg_wav) ) infodata%histavg_wav = histavg_wav + if ( present(histavg_iac) ) infodata%histavg_iac = histavg_iac if ( present(histavg_xao) ) infodata%histavg_xao = histavg_xao if ( present(drv_threading) ) infodata%drv_threading = drv_threading if ( present(eps_frac) ) infodata%eps_frac = eps_frac @@ -1767,6 +1817,8 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ if ( present(glc_coupled_fluxes)) infodata%glc_coupled_fluxes = glc_coupled_fluxes if ( present(wav_present) ) infodata%wav_present = wav_present if ( present(wav_prognostic) ) infodata%wav_prognostic = wav_prognostic + if ( present(iac_present) ) infodata%iac_present = iac_present + if ( present(iac_prognostic) ) infodata%iac_prognostic = iac_prognostic if ( present(esp_present) ) infodata%esp_present = esp_present if ( present(esp_prognostic) ) infodata%esp_prognostic = esp_prognostic if ( present(atm_nx) ) infodata%atm_nx = atm_nx @@ -1783,6 +1835,8 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ if ( present(glc_ny) ) infodata%glc_ny = glc_ny if ( present(wav_nx) ) infodata%wav_nx = wav_nx if ( present(wav_ny) ) infodata%wav_ny = wav_ny + if ( present(iac_nx) ) infodata%iac_nx = iac_nx + if ( present(iac_ny) ) infodata%iac_ny = iac_ny if ( present(nextsw_cday) ) infodata%nextsw_cday = nextsw_cday if ( present(precip_fact) ) infodata%precip_fact = precip_fact @@ -1793,6 +1847,7 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ if ( present(glc_phase) ) infodata%glc_phase = glc_phase if ( present(rof_phase) ) infodata%rof_phase = rof_phase if ( present(wav_phase) ) infodata%wav_phase = wav_phase + if ( present(iac_phase) ) infodata%iac_phase = iac_phase if ( present(esp_phase) ) infodata%esp_phase = esp_phase if ( present(atm_aero) ) infodata%atm_aero = atm_aero if ( present(glc_g2lupdate) ) infodata%glc_g2lupdate = glc_g2lupdate @@ -1870,6 +1925,11 @@ SUBROUTINE seq_infodata_PutData_bytype( component_firstletter, infodata, & wav_prognostic=comp_prognostic, wav_gnam=comp_gnam, & wav_phase=comp_phase, wav_nx=comp_nx, wav_ny=comp_ny, & histavg_wav=histavg_comp) + else if (component_firstletter == 'z') then + call seq_infodata_PutData(infodata, iac_present=comp_present, & + iac_prognostic=comp_prognostic, iac_gnam=comp_gnam, & + iac_phase=comp_phase, iac_nx=comp_nx, iac_ny=comp_ny, & + histavg_iac=histavg_comp) else if (component_firstletter == 'e') then if ((loglevel > 1) .and. seq_comm_iamroot(1)) then if (present(comp_gnam)) then @@ -1980,6 +2040,7 @@ subroutine seq_infodata_bcast(infodata,mpicom) call shr_mpi_bcast(infodata%rof_gnam, mpicom) call shr_mpi_bcast(infodata%glc_gnam, mpicom) call shr_mpi_bcast(infodata%wav_gnam, mpicom) + call shr_mpi_bcast(infodata%iac_gnam, mpicom) call shr_mpi_bcast(infodata%shr_map_dopole, mpicom) call shr_mpi_bcast(infodata%vect_map, mpicom) call shr_mpi_bcast(infodata%aoflux_grid, mpicom) @@ -2010,6 +2071,7 @@ subroutine seq_infodata_bcast(infodata,mpicom) call shr_mpi_bcast(infodata%histavg_rof , mpicom) call shr_mpi_bcast(infodata%histavg_glc , mpicom) call shr_mpi_bcast(infodata%histavg_wav , mpicom) + call shr_mpi_bcast(infodata%histavg_iac , mpicom) call shr_mpi_bcast(infodata%histavg_xao , mpicom) call shr_mpi_bcast(infodata%drv_threading, mpicom) call shr_mpi_bcast(infodata%eps_frac, mpicom) @@ -2055,6 +2117,8 @@ subroutine seq_infodata_bcast(infodata,mpicom) call shr_mpi_bcast(infodata%wav_prognostic, mpicom) call shr_mpi_bcast(infodata%esp_present, mpicom) call shr_mpi_bcast(infodata%esp_prognostic, mpicom) + call shr_mpi_bcast(infodata%iac_present, mpicom) + call shr_mpi_bcast(infodata%iac_prognostic, mpicom) call shr_mpi_bcast(infodata%atm_nx, mpicom) call shr_mpi_bcast(infodata%atm_ny, mpicom) @@ -2070,6 +2134,8 @@ subroutine seq_infodata_bcast(infodata,mpicom) call shr_mpi_bcast(infodata%glc_ny, mpicom) call shr_mpi_bcast(infodata%wav_nx, mpicom) call shr_mpi_bcast(infodata%wav_ny, mpicom) + call shr_mpi_bcast(infodata%iac_nx, mpicom) + call shr_mpi_bcast(infodata%iac_ny, mpicom) call shr_mpi_bcast(infodata%nextsw_cday, mpicom) call shr_mpi_bcast(infodata%precip_fact, mpicom) @@ -2080,6 +2146,7 @@ subroutine seq_infodata_bcast(infodata,mpicom) call shr_mpi_bcast(infodata%glc_phase, mpicom) call shr_mpi_bcast(infodata%rof_phase, mpicom) call shr_mpi_bcast(infodata%wav_phase, mpicom) + call shr_mpi_bcast(infodata%iac_phase, mpicom) call shr_mpi_bcast(infodata%atm_aero, mpicom) call shr_mpi_bcast(infodata%glc_g2lupdate, mpicom) call shr_mpi_bcast(infodata%glc_valid_input, mpicom) @@ -2123,6 +2190,7 @@ subroutine seq_infodata_Exchange(infodata,ID,type) logical :: ice2cpli,ice2cplr logical :: glc2cpli,glc2cplr logical :: wav2cpli,wav2cplr + logical :: iac2cpli,iac2cplr logical :: esp2cpli logical :: cpl2i,cpl2r logical :: logset @@ -2151,6 +2219,8 @@ subroutine seq_infodata_Exchange(infodata,ID,type) glc2cplr = .false. wav2cpli = .false. wav2cplr = .false. + iac2cpli = .false. + iac2cplr = .false. esp2cpli = .false. cpl2i = .false. cpl2r = .false. @@ -2227,6 +2297,16 @@ subroutine seq_infodata_Exchange(infodata,ID,type) logset = .true. endif + if (trim(type) == 'iac2cpl_init') then + iac2cpli = .true. + iac2cplr = .true. + logset = .true. + endif + if (trim(type) == 'iac2cpl_run') then + iac2cplr = .true. + logset = .true. + endif + if (trim(type) == 'esp2cpl_init') then esp2cpli = .true. logset = .true. @@ -2238,6 +2318,7 @@ subroutine seq_infodata_Exchange(infodata,ID,type) trim(type) == 'cpl2ocn_init' .or. & trim(type) == 'cpl2glc_init' .or. & trim(type) == 'cpl2wav_init' .or. & + trim(type) == 'cpl2iac_init' .or. & trim(type) == 'cpl2esp_init' .or. & trim(type) == 'cpl2ice_init') then cpl2i = .true. @@ -2251,6 +2332,7 @@ subroutine seq_infodata_Exchange(infodata,ID,type) trim(type) == 'cpl2ocn_run' .or. & trim(type) == 'cpl2glc_run' .or. & trim(type) == 'cpl2wav_run' .or. & + trim(type) == 'cpl2iac_run' .or. & trim(type) == 'cpl2ice_run') then cpl2r = .true. logset = .true. @@ -2351,6 +2433,17 @@ subroutine seq_infodata_Exchange(infodata,ID,type) if (deads .or. infodata%dead_comps) infodata%dead_comps = .true. endif + if (iac2cpli) then + call shr_mpi_bcast(infodata%iac_present, mpicom, pebcast=cmppe) + call shr_mpi_bcast(infodata%iac_prognostic, mpicom, pebcast=cmppe) + call shr_mpi_bcast(infodata%iac_nx, mpicom, pebcast=cmppe) + call shr_mpi_bcast(infodata%iac_ny, mpicom, pebcast=cmppe) + ! dead_comps is true if it's ever set to true + deads = infodata%dead_comps + call shr_mpi_bcast(deads, mpicom, pebcast=cmppe) + if (deads .or. infodata%dead_comps) infodata%dead_comps = .true. + endif + if (esp2cpli) then call shr_mpi_bcast(infodata%esp_present, mpicom, pebcast=cmppe) call shr_mpi_bcast(infodata%esp_prognostic, mpicom, pebcast=cmppe) @@ -2379,6 +2472,8 @@ subroutine seq_infodata_Exchange(infodata,ID,type) call shr_mpi_bcast(infodata%glc_coupled_fluxes, mpicom, pebcast=cplpe) call shr_mpi_bcast(infodata%wav_present, mpicom, pebcast=cplpe) call shr_mpi_bcast(infodata%wav_prognostic, mpicom, pebcast=cplpe) + call shr_mpi_bcast(infodata%iac_present, mpicom, pebcast=cplpe) + call shr_mpi_bcast(infodata%iac_prognostic, mpicom, pebcast=cplpe) call shr_mpi_bcast(infodata%esp_present, mpicom, pebcast=cplpe) call shr_mpi_bcast(infodata%esp_prognostic, mpicom, pebcast=cplpe) call shr_mpi_bcast(infodata%dead_comps, mpicom, pebcast=cplpe) @@ -2638,6 +2733,7 @@ SUBROUTINE seq_infodata_print( infodata ) write(logunit,F0A) subname,'rof_gridname = ', trim(infodata%rof_gnam) write(logunit,F0A) subname,'glc_gridname = ', trim(infodata%glc_gnam) write(logunit,F0A) subname,'wav_gridname = ', trim(infodata%wav_gnam) + write(logunit,F0A) subname,'iac_gridname = ', trim(infodata%iac_gnam) write(logunit,F0L) subname,'shr_map_dopole = ', infodata%shr_map_dopole write(logunit,F0A) subname,'vect_map = ', trim(infodata%vect_map) write(logunit,F0A) subname,'aoflux_grid = ', trim(infodata%aoflux_grid) @@ -2668,6 +2764,7 @@ SUBROUTINE seq_infodata_print( infodata ) write(logunit,F0L) subname,'histavg_rof = ', infodata%histavg_rof write(logunit,F0L) subname,'histavg_glc = ', infodata%histavg_glc write(logunit,F0L) subname,'histavg_wav = ', infodata%histavg_wav + write(logunit,F0L) subname,'histavg_iac = ', infodata%histavg_iac write(logunit,F0L) subname,'histavg_xao = ', infodata%histavg_xao write(logunit,F0L) subname,'drv_threading = ', infodata%drv_threading @@ -2715,6 +2812,8 @@ SUBROUTINE seq_infodata_print( infodata ) write(logunit,F0L) subname,'glc_coupled_fluxes = ', infodata%glc_coupled_fluxes write(logunit,F0L) subname,'wav_present = ', infodata%wav_present write(logunit,F0L) subname,'wav_prognostic = ', infodata%wav_prognostic + write(logunit,F0L) subname,'iac_present = ', infodata%iac_present + write(logunit,F0L) subname,'iac_prognostic = ', infodata%iac_prognostic write(logunit,F0L) subname,'esp_present = ', infodata%esp_present write(logunit,F0L) subname,'esp_prognostic = ', infodata%esp_prognostic @@ -2732,6 +2831,8 @@ SUBROUTINE seq_infodata_print( infodata ) write(logunit,F0I) subname,'glc_ny = ', infodata%glc_ny write(logunit,F0I) subname,'wav_nx = ', infodata%wav_nx write(logunit,F0I) subname,'wav_ny = ', infodata%wav_ny + write(logunit,F0I) subname,'iac_nx = ', infodata%iac_nx + write(logunit,F0I) subname,'iac_ny = ', infodata%iac_ny write(logunit,F0R) subname,'nextsw_cday = ', infodata%nextsw_cday write(logunit,F0R) subname,'precip_fact = ', infodata%precip_fact @@ -2744,6 +2845,7 @@ SUBROUTINE seq_infodata_print( infodata ) write(logunit,F0S) subname,'glc_phase = ', infodata%glc_phase write(logunit,F0S) subname,'rof_phase = ', infodata%rof_phase write(logunit,F0S) subname,'wav_phase = ', infodata%wav_phase + write(logunit,F0S) subname,'iac_phase = ', infodata%iac_phase write(logunit,F0L) subname,'glc_g2lupdate = ', infodata%glc_g2lupdate ! endif diff --git a/driver-mct/shr/seq_timemgr_mod.F90 b/driver-mct/shr/seq_timemgr_mod.F90 index 18ae5579c5a1..e945f28367d7 100644 --- a/driver-mct/shr/seq_timemgr_mod.F90 +++ b/driver-mct/shr/seq_timemgr_mod.F90 @@ -153,9 +153,10 @@ module seq_timemgr_mod seq_timemgr_nclock_glc = 6, & seq_timemgr_nclock_wav = 7, & seq_timemgr_nclock_rof = 8, & - seq_timemgr_nclock_esp = 9 + seq_timemgr_nclock_iac = 9, & + seq_timemgr_nclock_esp = 10 - integer(SHR_KIND_IN),private,parameter :: max_clocks = 9 + integer(SHR_KIND_IN),private,parameter :: max_clocks = 10 character(len=*),public,parameter :: & seq_timemgr_clock_drv = 'seq_timemgr_clock_drv' , & seq_timemgr_clock_atm = 'seq_timemgr_clock_atm' , & @@ -168,7 +169,8 @@ module seq_timemgr_mod seq_timemgr_clock_esp = 'seq_timemgr_clock_esp' character(len=8),private,parameter :: seq_timemgr_clocks(max_clocks) = & (/'drv ','atm ','lnd ','ocn ', & - 'ice ','glc ','wav ','rof ','esp '/) + 'ice ','glc ','wav ','rof ', & + 'iac ','esp '/) ! Alarms on both component clocks and driver clock integer(SHR_KIND_IN),private,parameter :: & @@ -188,9 +190,10 @@ module seq_timemgr_mod seq_timemgr_nalarm_histavg =14 , & ! driver and component clock alarm seq_timemgr_nalarm_rofrun =15 , & ! driver only clock alarm seq_timemgr_nalarm_wavrun =16 , & ! driver only clock alarm - seq_timemgr_nalarm_esprun =17 , & ! driver only clock alarm - seq_timemgr_nalarm_pause =18 , & - seq_timemgr_nalarm_barrier =19 , & ! driver and component clock alarm + seq_timemgr_nalarm_iacrun =17 , & ! driver only clock alarm + seq_timemgr_nalarm_esprun =18 , & ! driver only clock alarm + seq_timemgr_nalarm_pause =19 , & + seq_timemgr_nalarm_barrier =20 , & ! driver and component clock alarm max_alarms = seq_timemgr_nalarm_barrier character(len=*),public,parameter :: & @@ -210,6 +213,7 @@ module seq_timemgr_mod seq_timemgr_alarm_histavg = 'seq_timemgr_alarm_histavg ', & seq_timemgr_alarm_rofrun = 'seq_timemgr_alarm_rofrun ', & seq_timemgr_alarm_wavrun = 'seq_timemgr_alarm_wavrun ', & + seq_timemgr_alarm_iacrun = 'seq_timemgr_alarm_iacrun ', & seq_timemgr_alarm_esprun = 'seq_timemgr_alarm_esprun ', & seq_timemgr_alarm_pause = 'seq_timemgr_alarm_pause ', & seq_timemgr_alarm_barrier = 'seq_timemgr_alarm_barrier ' @@ -255,7 +259,7 @@ module seq_timemgr_mod subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioid, mpicom, & EClock_drv, EClock_atm, EClock_lnd, EClock_ocn, EClock_ice, Eclock_glc, & - Eclock_rof, EClock_wav, Eclock_esp) + Eclock_rof, EClock_wav, Eclock_esp, Eclock_iac) ! !USES: use pio, only : file_desc_T @@ -280,6 +284,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi type(ESMF_clock),target, intent(IN) :: EClock_glc ! glc clock type(ESMF_clock),target, intent(IN) :: EClock_rof ! rof clock type(ESMF_clock),target, intent(IN) :: EClock_wav ! wav clock + type(ESMF_clock),target, intent(IN) :: EClock_iac ! iac clock type(ESMF_clock),target, intent(IN) :: EClock_esp ! esp clock type(file_desc_t) :: pioid @@ -324,6 +329,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi logical :: pause_active_ice logical :: pause_active_rof logical :: pause_active_lnd + logical :: pause_active_iac logical :: data_assimilation_atm logical :: data_assimilation_cpl @@ -333,6 +339,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi logical :: data_assimilation_ice logical :: data_assimilation_rof logical :: data_assimilation_lnd + logical :: data_assimilation_iac character(SHR_KIND_CS) :: history_option ! History option units integer(SHR_KIND_IN) :: history_n ! Number until history interval @@ -360,6 +367,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi character(SHR_KIND_CS) :: glc_avg_period ! Glc avering coupling period integer(SHR_KIND_IN) :: rof_cpl_dt ! Runoff coupling interval integer(SHR_KIND_IN) :: wav_cpl_dt ! Wav coupling interval + integer(SHR_KIND_IN) :: iac_cpl_dt ! Iac coupling interval integer(SHR_KIND_IN) :: esp_cpl_dt ! Esp coupling interval integer(SHR_KIND_IN) :: atm_cpl_offset ! Atmosphere coupling interval integer(SHR_KIND_IN) :: lnd_cpl_offset ! Land coupling interval @@ -369,6 +377,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi integer(SHR_KIND_IN) :: wav_cpl_offset ! Wav coupling interval integer(SHR_KIND_IN) :: rof_cpl_offset ! Runoff coupling interval integer(SHR_KIND_IN) :: esp_cpl_offset ! Esp coupling interval + integer(SHR_KIND_IN) :: iac_cpl_offset ! Iac coupling interval logical :: esp_run_on_pause ! Run ESP on pause cycle logical :: end_restart ! Write restart at end of run integer(SHR_KIND_IN) :: ierr ! Return code @@ -386,6 +395,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi pause_active_cpl, & pause_active_ocn, & pause_active_wav, & + pause_active_iac, & pause_active_glc, & pause_active_ice, & pause_active_rof, & @@ -394,6 +404,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi data_assimilation_cpl, & data_assimilation_ocn, & data_assimilation_wav, & + data_assimilation_iac, & data_assimilation_glc, & data_assimilation_ice, & data_assimilation_rof, & @@ -407,6 +418,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi atm_cpl_offset, lnd_cpl_offset, ocn_cpl_offset, & ice_cpl_offset, glc_cpl_dt, glc_cpl_offset, glc_avg_period, & wav_cpl_dt, wav_cpl_offset, esp_cpl_dt, esp_cpl_offset, & + iac_cpl_dt, iac_cpl_offset, & rof_cpl_dt, rof_cpl_offset, esp_run_on_pause, end_restart !------------------------------------------------------------------------------- ! Notes: @@ -421,6 +433,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi SyncClock%ECP(seq_timemgr_nclock_rof)%EClock => EClock_rof SyncClock%ECP(seq_timemgr_nclock_wav)%EClock => EClock_wav SyncClock%ECP(seq_timemgr_nclock_esp)%EClock => EClock_esp + SyncClock%ECP(seq_timemgr_nclock_iac)%EClock => EClock_iac call mpi_comm_rank(mpicom,iam,ierr) @@ -451,6 +464,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi pause_active_ice = .false. pause_active_rof = .false. pause_active_lnd = .false. + pause_active_iac = .false. data_assimilation_atm = .false. data_assimilation_cpl = .false. data_assimilation_ocn = .false. @@ -459,6 +473,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi data_assimilation_ice = .false. data_assimilation_rof = .false. data_assimilation_lnd = .false. + data_assimilation_iac = .false. history_option = seq_timemgr_optNever history_n = -1 @@ -487,6 +502,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi rof_cpl_dt = 0 wav_cpl_dt = 0 esp_cpl_dt = 0 + iac_cpl_dt = 0 atm_cpl_offset = 0 lnd_cpl_offset = 0 ice_cpl_offset = 0 @@ -495,6 +511,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi rof_cpl_offset = 0 wav_cpl_offset = 0 esp_cpl_offset = 0 + iac_cpl_offset = 0 esp_run_on_pause = .true. end_restart = .true. @@ -550,6 +567,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi if (glc_cpl_dt == 0) glc_cpl_dt = atm_cpl_dt ! Copy atm coupling time into glc if (wav_cpl_dt == 0) wav_cpl_dt = atm_cpl_dt ! Copy atm coupling time into wav if (esp_cpl_dt == 0) esp_cpl_dt = atm_cpl_dt ! Copy atm coupling time into esp + if (iac_cpl_dt == 0) iac_cpl_dt = atm_cpl_dt ! Copy atm coupling time into iac if ( ref_ymd == 0 ) then ref_ymd = start_ymd @@ -632,6 +650,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi write(logunit,F0I) trim(subname),' rof_cpl_dt = ',rof_cpl_dt write(logunit,F0I) trim(subname),' wav_cpl_dt = ',wav_cpl_dt write(logunit,F0I) trim(subname),' esp_cpl_dt = ',esp_cpl_dt + write(logunit,F0I) trim(subname),' iac_cpl_dt = ',iac_cpl_dt write(logunit,F0I) trim(subname),' atm_cpl_offset = ',atm_cpl_offset write(logunit,F0I) trim(subname),' lnd_cpl_offset = ',lnd_cpl_offset write(logunit,F0I) trim(subname),' ice_cpl_offset = ',ice_cpl_offset @@ -640,6 +659,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi write(logunit,F0I) trim(subname),' rof_cpl_offset = ',rof_cpl_offset write(logunit,F0I) trim(subname),' wav_cpl_offset = ',wav_cpl_offset write(logunit,F0I) trim(subname),' esp_cpl_offset = ',esp_cpl_offset + write(logunit,F0I) trim(subname),' iac_cpl_offset = ',iac_cpl_offset write(logunit,F0A) ' ' !--------------------------------------------------------------------------- @@ -651,10 +671,10 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi lnd_cpl_dt /= atm_cpl_dt .or. & ice_cpl_dt /= atm_cpl_dt .or. & ocn_cpl_dt <= 0 .or. glc_cpl_dt <= 0 .or. rof_cpl_dt <=0 .or. & - wav_cpl_dt <=0 .or. esp_cpl_dt <=0) then + wav_cpl_dt <=0 .or. esp_cpl_dt <=0 .or. iac_cpl_dt <=0) then write(logunit,*) trim(subname),' ERROR: aliogrwe _cpl_dt = ', & atm_cpl_dt, lnd_cpl_dt, ice_cpl_dt, ocn_cpl_dt, glc_cpl_dt, & - rof_cpl_dt, wav_cpl_dt, esp_cpl_dt + rof_cpl_dt, wav_cpl_dt, esp_cpl_dt, iac_cpl_dt call shr_sys_abort( subname//': ERROR coupling intervals invalid' ) end if ! --- Coupling offsets -------------------------------------------------- @@ -665,10 +685,12 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi abs(rof_cpl_offset) > rof_cpl_dt .or. & abs(wav_cpl_offset) > wav_cpl_dt .or. & abs(esp_cpl_offset) > esp_cpl_dt .or. & + abs(iac_cpl_offset) > iac_cpl_dt .or. & abs(ocn_cpl_offset) > ocn_cpl_dt) then write(logunit,*) trim(subname),' ERROR: aliogrwe _cpl_offset = ', & atm_cpl_offset, lnd_cpl_offset, ice_cpl_offset, ocn_cpl_offset, & - glc_cpl_offset, rof_cpl_offset, wav_cpl_offset, esp_cpl_offset + glc_cpl_offset, rof_cpl_offset, wav_cpl_offset, esp_cpl_offset, & + iac_cpl_offset call shr_sys_abort( subname//': ERROR coupling offsets invalid' ) end if @@ -702,6 +724,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi call shr_mpi_bcast(pause_active_ice, mpicom ) call shr_mpi_bcast(pause_active_rof, mpicom ) call shr_mpi_bcast(pause_active_lnd, mpicom ) + call shr_mpi_bcast(pause_active_iac, mpicom ) call shr_mpi_bcast(data_assimilation_atm, mpicom ) call shr_mpi_bcast(data_assimilation_cpl, mpicom ) call shr_mpi_bcast(data_assimilation_ocn, mpicom ) @@ -710,6 +733,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi call shr_mpi_bcast(data_assimilation_ice, mpicom ) call shr_mpi_bcast(data_assimilation_rof, mpicom ) call shr_mpi_bcast(data_assimilation_lnd, mpicom ) + call shr_mpi_bcast(data_assimilation_iac, mpicom ) call shr_mpi_bcast( history_n, mpicom ) call shr_mpi_bcast( history_option, mpicom ) @@ -738,6 +762,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi call shr_mpi_bcast( rof_cpl_dt, mpicom ) call shr_mpi_bcast( wav_cpl_dt, mpicom ) call shr_mpi_bcast( esp_cpl_dt, mpicom ) + call shr_mpi_bcast( iac_cpl_dt, mpicom ) call shr_mpi_bcast( atm_cpl_offset, mpicom ) call shr_mpi_bcast( lnd_cpl_offset, mpicom ) call shr_mpi_bcast( ice_cpl_offset, mpicom ) @@ -746,6 +771,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi call shr_mpi_bcast( rof_cpl_offset, mpicom ) call shr_mpi_bcast( wav_cpl_offset, mpicom ) call shr_mpi_bcast( esp_cpl_offset, mpicom ) + call shr_mpi_bcast( iac_cpl_offset, mpicom ) call shr_mpi_bcast( esp_run_on_pause, mpicom ) call shr_mpi_bcast( end_restart, mpicom ) @@ -787,6 +813,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi pause_active(seq_timemgr_nclock_ice) = pause_active_ice pause_active(seq_timemgr_nclock_rof) = pause_active_rof pause_active(seq_timemgr_nclock_lnd) = pause_active_lnd + pause_active(seq_timemgr_nclock_iac) = pause_active_iac ! Figure out which compoments need to do post-data assimilation processing data_assimilation_active(seq_timemgr_nclock_atm) = data_assimilation_atm @@ -797,6 +824,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi data_assimilation_active(seq_timemgr_nclock_ice) = data_assimilation_ice data_assimilation_active(seq_timemgr_nclock_rof) = data_assimilation_rof data_assimilation_active(seq_timemgr_nclock_lnd) = data_assimilation_lnd + data_assimilation_active(seq_timemgr_nclock_iac) = data_assimilation_iac if ( ANY(pause_active) .and. & (trim(pause_option) /= seq_timemgr_optNONE) .and. & @@ -841,6 +869,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi dtime(seq_timemgr_nclock_rof ) = rof_cpl_dt dtime(seq_timemgr_nclock_wav ) = wav_cpl_dt dtime(seq_timemgr_nclock_esp ) = esp_cpl_dt + dtime(seq_timemgr_nclock_iac ) = iac_cpl_dt ! --- this finds the min of dtime excluding the driver value --- dtime(seq_timemgr_nclock_drv) = maxval(dtime) @@ -1003,6 +1032,7 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi offset(seq_timemgr_nclock_rof) = rof_cpl_offset offset(seq_timemgr_nclock_wav) = wav_cpl_offset offset(seq_timemgr_nclock_esp) = esp_cpl_offset + offset(seq_timemgr_nclock_iac) = iac_cpl_offset call seq_timemgr_alarmGet(SyncClock%EAlarm(seq_timemgr_nclock_drv, & seq_timemgr_nalarm_restart), IntSec=drvRestInterval) @@ -1084,6 +1114,15 @@ subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioi RefTime = OffsetTime, & alarmname = trim(seq_timemgr_alarm_wavrun)) + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_iac), rc=rc ) + OffsetTime = CurrTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_iacrun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_iac), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_iacrun)) + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_glc), rc=rc ) OffsetTime = CurrTime + TimeStep call ESMF_TimeIntervalSet( TimeStep, s=-offset(seq_timemgr_nclock_drv), rc=rc ) @@ -2244,6 +2283,8 @@ logical function seq_timemgr_data_assimilation_active(component_ntype) seq_timemgr_data_assimilation_active = data_assimilation_active(seq_timemgr_nclock_rof) case ('lnd') seq_timemgr_data_assimilation_active = data_assimilation_active(seq_timemgr_nclock_lnd) + case ('iac') + seq_timemgr_data_assimilation_active = data_assimilation_active(seq_timemgr_nclock_iac) case ('esp') seq_timemgr_data_assimilation_active = .FALSE. case default diff --git a/driver-mct/unit_test/CMakeLists.txt b/driver-mct/unit_test/CMakeLists.txt index fb27128d8574..289a49c8599e 100644 --- a/driver-mct/unit_test/CMakeLists.txt +++ b/driver-mct/unit_test/CMakeLists.txt @@ -9,6 +9,7 @@ add_definitions( -DNUM_COMP_INST_WAV=1 -DNUM_COMP_INST_ROF=1 -DNUM_COMP_INST_ESP=1 + -DNUM_COMP_INST_IAC=1 ) # The following definitions are needed when building with the mpi-serial library