From a546d4a201054642eb04b3d9c8ed8b712a9e6f69 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 24 Jan 2023 12:23:02 -0700 Subject: [PATCH 1/9] addition of cplhist and ocnimport capabilities --- datm/cime_config/config_component.xml | 24 +-- docn/CMakeLists.txt | 6 +- docn/cime_config/config_component.xml | 63 ++++++- docn/cime_config/namelist_definition_docn.xml | 65 ++++--- docn/cime_config/stream_definition_docn.xml | 43 ++++- docn/docn_datamode_cplhist_mod.F90 | 160 ++++++++++++++++++ docn/docn_import_atmdata_mod.F90 | 76 +++++++++ docn/ocn_comp_nuopc.F90 | 42 ++++- streams/dshr_strdata_mod.F90 | 22 +-- 9 files changed, 438 insertions(+), 63 deletions(-) create mode 100644 docn/docn_datamode_cplhist_mod.F90 create mode 100644 docn/docn_import_atmdata_mod.F90 diff --git a/datm/cime_config/config_component.xml b/datm/cime_config/config_component.xml index 9ff459f5..de8840a0 100644 --- a/datm/cime_config/config_component.xml +++ b/datm/cime_config/config_component.xml @@ -49,18 +49,18 @@ CLMCRUNCEPv7, CLMGSWP3v1, CLMNLDAS2 and 1PT are modes using observational data for forcing prognostic land components. WARNING for CLMNLDAS2: This is a regional forcing dataset over the U.S. (25-53N, 235-293E). Garbage data will be produced for runs extending beyond this regional domain. - CORE2_NYF - CORE2_IAF - CORE_IAF_JRA - CORE_IAF_JRA_1p4_2018 - CLM_QIAN - CLM_QIAN_WISO - CLMCRUNCEPv7 - CLMGSWP3v1 - CLMNLDAS2 - 1PT - CPLHIST - ERA5 + CORE2_NYF + CORE2_IAF + CORE_IAF_JRA + CORE_IAF_JRA_1p4_2018 + CLM_QIAN + CLM_QIAN_WISO + CLMCRUNCEPv7 + CLMGSWP3v1 + CLMNLDAS2 + 1PT + ERA5 + CPLHIST diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index 36ad4054..5a2e5b3b 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -1,9 +1,11 @@ project(docn Fortran) set(SRCFILES ocn_comp_nuopc.F90 - docn_datamode_copyall_mod.F90 + docn_datamode_copyall_mod.F90 docn_datamode_som_mod.F90 docn_datamode_aquaplanet_mod.F90 - docn_datamode_iaf_mod.F90) + docn_datamode_iaf_mod.F90 + docn_datamode_cplhist_mod.F90 + docn_import_atmdata_mod.F90) foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.docn/${FILE}") diff --git a/docn/cime_config/config_component.xml b/docn/cime_config/config_component.xml index 2bcd256b..81c6dc54 100644 --- a/docn/cime_config/config_component.xml +++ b/docn/cime_config/config_component.xml @@ -13,7 +13,7 @@ This file may have ocn desc entries. --> - DOCN + DOCN prescribed ocean mode slab ocean mode aquaplanet slab ocean mode @@ -31,6 +31,7 @@ analytic aquaplanet sst - option 10 file input aquaplanet sst globally constant SST for idealized experiments, such as RCE + mediator history output for ocean fields imported to mediator @@ -44,7 +45,7 @@ char - prescribed,sst_aquap1,sst_aquap2,sst_aquap3,sst_aquap4,sst_aquap5,sst_aquap6,sst_aquap7,sst_aquap8,sst_aquap9,sst_aquap10,sst_aquapfile,som,som_aquap,sst_aquap_constant,interannual,null + prescribed,sst_aquap1,sst_aquap2,sst_aquap3,sst_aquap4,sst_aquap5,sst_aquap6,sst_aquap7,sst_aquap8,sst_aquap9,sst_aquap10,sst_aquapfile,som,som_aquap,sst_aquap_constant,interannual,cplhist prescribed prescribed @@ -63,6 +64,7 @@ sst_aquap10 sst_aquapfile sst_aquap_constant + cplhist run_component_docn env_run.xml @@ -249,6 +251,63 @@ This is only used when DOCN_MODE=prescribed. + + char + + UNSET + run_component_docn + env_run.xml + directory for coupler history data mode (only used for when DOCN_MODE is CPLHIST) + + + + char + + UNSET + run_component_docn + env_run.xml + case name used to determine stream filenames when DOCN_MODE is CPLHIST + + + + integer + + 1 + run_component_docn + env_run.xml + + Simulation year corresponding to DOCN_CPLHIST_YR_START. A common usage + is to set this to RUN_STARTDATE. With this setting, the forcing + in the first year of the run will be the forcing of year + DOCN_CPLHIST_YR_START. Another use case is to align the calendar + of transient forcing with the model calendar. For example, + setting DOCN_CPLHIST_YR_ALIGN=DOCN_CPLHIST_YR_START will lead to + the forcing calendar being the same as the model calendar. The + forcing for a given model year would be the forcing of the same + year. This would be appropriate in transient runs where the + model calendar is setup to span the same year range as the + forcing data. + + + + + integer + + 1 + run_component_docn + env_run.xml + starting year to loop data over + + + + integer + + 1 + run_component_docn + env_run.xml + ending year to loop data over + + logical TRUE,FALSE diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index 9020ac17..4db36656 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -11,15 +11,15 @@ streams streams_file - List of streams that docn supports. - The following are supported: prescribed, aquapfile, som, som_aquqp, interannual, and blank. - The streamslist + List of streams for a given docn_mode value. Each docn_mode can + have zero or more streams that are associated with it. prescribed interannual som_aquap som + cplhist aquapfile '' '' @@ -39,9 +39,9 @@ char docn docn_nml - sstdata,sst_aquap1,sst_aquap2,sst_aquap3,sst_aquap4,sst_aquap5,sst_aquap6,sst_aquap7,sst_aquap8,sst_aquap9,sst_aquap10,sst_aquapfile,sst_aquap_constant,som,som_aquap,iaf + sstdata,sst_aquap1,sst_aquap2,sst_aquap3,sst_aquap4,sst_aquap5,sst_aquap6,sst_aquap7,sst_aquap8,sst_aquap9,sst_aquap10,sst_aquapfile,sst_aquap_constant,som,som_aquap,iaf,cplhist - General method that operates on the data. + General method that operates on the data for a given docn_mode. ==> dataMode = "sstdata" sstdata mode assumes the only field in the input stream is SST. It also assumes the SST is in Celsius and must be converted to Kelvin. @@ -72,21 +72,21 @@ application. A tool is available to derive valid SOM forcing. (1) map the xml variable DOCN_MODE => config variable docn_mode => namelist variable datamode - compset="_DOCN%DOM_" => docn_mode=prescribed => datamode=prescribed - compset="_DOCN%IAF_" => docn_mode=interannual => datamode=interannual - compset="_DOCN%SOM_" => docn_mode=som => datamode=som - compset="_DOCN%SOMAQP_" => docn_mode=som_aquap => datamode=som_aquap - compset="_DOCN%AQP1_" => docn_mode=sst_aquap1 => datamode=sst_aquap1 - compset="_DOCN%AQP2_" => docn_mode=sst_aquap2 => datamode=sst_aquap2 - compset="_DOCN%AQP3_" => docn_mode=sst_aquap3 => datamode=sst_aquap3 - compset="_DOCN%AQP4_" => docn_mode=sst_aquap4 => datamode=sst_aquap4 - compset="_DOCN%AQP5_" => docn_mode=sst_aquap5 => datamode=sst_aquap5 - compset="_DOCN%AQP6_" => docn_mode=sst_aquap6 => datamode=sst_aquap6 - compset="_DOCN%AQP7_" => docn_mode=sst_aquap7 => datamode=sst_aquap7 - compset="_DOCN%AQP8_" => docn_mode=sst_aquap8 => datamode=sst_aquap8 - compset="_DOCN%AQP9_" => docn_mode=sst_aquap9 => datamode=sst_aquap9 - compset="_DOCN%AQP10_" => docn_mode=sst_aquap10 => datamode=sst_aquap10 - compset="_DOCN%AQPFILE_" => docn_mode=sst_aquapfile => datamode=sst_aquap_file + compset="_DOCN%DOM_" => docn_mode=prescribed => datamode=prescribed + compset="_DOCN%IAF_" => docn_mode=interannual => datamode=interannual + compset="_DOCN%SOM_" => docn_mode=som => datamode=som + compset="_DOCN%SOMAQP_" => docn_mode=som_aquap => datamode=som_aquap + compset="_DOCN%AQP1_" => docn_mode=sst_aquap1 => datamode=sst_aquap1 + compset="_DOCN%AQP2_" => docn_mode=sst_aquap2 => datamode=sst_aquap2 + compset="_DOCN%AQP3_" => docn_mode=sst_aquap3 => datamode=sst_aquap3 + compset="_DOCN%AQP4_" => docn_mode=sst_aquap4 => datamode=sst_aquap4 + compset="_DOCN%AQP5_" => docn_mode=sst_aquap5 => datamode=sst_aquap5 + compset="_DOCN%AQP6_" => docn_mode=sst_aquap6 => datamode=sst_aquap6 + compset="_DOCN%AQP7_" => docn_mode=sst_aquap7 => datamode=sst_aquap7 + compset="_DOCN%AQP8_" => docn_mode=sst_aquap8 => datamode=sst_aquap8 + compset="_DOCN%AQP9_" => docn_mode=sst_aquap9 => datamode=sst_aquap9 + compset="_DOCN%AQP10_" => docn_mode=sst_aquap10 => datamode=sst_aquap10 + compset="_DOCN%AQPFILE_" => docn_mode=sst_aquapfile => datamode=sst_aquap_file compset="_DOCN%AQPCONST_" => docn_mode=sst_aquap_constant => datamode=sst_aquap_constant @@ -106,10 +106,11 @@ sst_aquap10 sst_aquap_file sst_aquap_constant + cplhist - + char streams abs @@ -119,11 +120,11 @@ $OCN_DOMAIN_MESH - null + null - + char streams abs @@ -134,7 +135,7 @@ $MASK_MESH $ATM_DOMAIN_MESH - null + null @@ -147,7 +148,7 @@ $OCN_NX - 1 + 1 @@ -160,7 +161,7 @@ $OCN_NY - 1 + 1 @@ -203,4 +204,16 @@ + + logical + docn + docn_nml + + If set to true, then advertise will include import fields from datm. + + + .false. + + + diff --git a/docn/cime_config/stream_definition_docn.xml b/docn/cime_config/stream_definition_docn.xml index 4fb67ede..c29607db 100644 --- a/docn/cime_config/stream_definition_docn.xml +++ b/docn/cime_config/stream_definition_docn.xml @@ -4,7 +4,7 @@ - + $SSTICE_MESH_FILENAME @@ -35,7 +35,7 @@ single - + $DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_1x1_clim_c101029_ESMFmesh_120520.nc @@ -66,7 +66,7 @@ single - + $DIN_LOC_ROOT/ocn/docn7/SOM/pop_frc.1x1d.SCRIP.030620_ESMFmesh.nc @@ -104,7 +104,7 @@ single - + $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc @@ -144,7 +144,7 @@ single - + %DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc @@ -175,4 +175,37 @@ single + + + $OCN_DOMAIN_MESH + + + UNSET + + + ocnImp_So_bldepth So_bldepth + ocnImp_So_t So_t + ocnImp_So_u So_u + ocnImp_So_v So_topo + + null + + bilinear + + null + $DOCN_CPLHIST_YR_ALIGN + $DOCN_CPLHIST_YR_START + $DOCN_CPLHIST_YR_END + 0 + + nearest + + + extend + + + 1.e30 + + single + diff --git a/docn/docn_datamode_cplhist_mod.F90 b/docn/docn_datamode_cplhist_mod.F90 new file mode 100644 index 00000000..3ff9e65c --- /dev/null +++ b/docn/docn_datamode_cplhist_mod.F90 @@ -0,0 +1,160 @@ +module docn_datamode_cplhist_mod + + use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS + use NUOPC , only : NUOPC_Advertise + use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs + use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal + use shr_sys_mod , only : shr_sys_abort + use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + use dshr_mod , only : dshr_restart_read, dshr_restart_write + use dshr_strdata_mod , only : shr_strdata_type + + implicit none + private ! except + + public :: docn_datamode_cplhist_advertise + public :: docn_datamode_cplhist_init_pointers + public :: docn_datamode_cplhist_advance + public :: docn_datamode_cplhist_restart_read + public :: docn_datamode_cplhist_restart_write + + ! export fields + real(r8), pointer :: So_omask(:) => null() ! real ocean fraction sent to mediator + real(r8), pointer :: So_t(:) => null() + real(r8), pointer :: So_u(:) => null() + real(r8), pointer :: So_v(:) => null() + real(r8), pointer :: So_bldepth(:) => null() + + real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) + real(r8) , parameter :: ocnsalt = shr_const_ocn_ref_sal ! ocean reference salinity + + character(*) , parameter :: nullstr = 'null' + character(*) , parameter :: rpfile = 'rpointer.ocn' + character(*) , parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine docn_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_name, rc) + + ! input/output variables + type(esmf_State) , intent(inout) :: exportState + type(fldlist_type) , pointer :: fldsexport + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(out) :: rc + + ! local variables + type(fldlist_type), pointer :: fldList + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Advertise export fields + call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) + call dshr_fldList_add(fldsExport, 'So_omask' ) + call dshr_fldList_add(fldsExport, 'So_t' ) + call dshr_fldList_add(fldsExport, 'So_u' ) + call dshr_fldList_add(fldsExport, 'So_v' ) + call dshr_fldList_add(fldsExport, 'So_bldepth' ) + + fldlist => fldsExport ! the head of the linked list + do while (associated(fldlist)) + call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite('(docn_comp_advertise): Fr_ocn'//trim(fldList%stdname), ESMF_LOGMSG_INFO) + fldList => fldList%next + enddo + + end subroutine docn_datamode_cplhist_advertise + + !=============================================================================== + subroutine docn_datamode_cplhist_init_pointers(exportState, ocn_fraction, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + real(r8) , intent(in) :: ocn_fraction(:) + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(docn_init_pointers): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! initialize pointers to export fields + call dshr_state_getfldptr(exportState, 'So_omask' , fldptr1=So_omask , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'So_t' , fldptr1=So_t , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'So_u' , fldptr1=So_u , allowNullReturn=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'So_v' , fldptr1=So_v , allowNullReturn=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'So_bldepth', fldptr1=So_bldepth, allowNullReturn=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + So_u(:) = 0.0_r8 + So_v(:) = 0.0_r8 + So_t(:) = TkFrz + So_bldepth(:) = 0.0_r8 + + ! Set export state ocean fraction (So_omask) + So_omask(:) = ocn_fraction(:) + + end subroutine docn_datamode_cplhist_init_pointers + + !=============================================================================== + subroutine docn_datamode_cplhist_advance(rc) + + ! input/output variables + integer, intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(docn_datamode_cplhist_advance): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + So_t(:) = So_t(:) + TkFrz + + end subroutine docn_datamode_cplhist_advance + + !=============================================================================== + subroutine docn_datamode_cplhist_restart_write(case_name, inst_suffix, ymd, tod, & + logunit, my_task, sdat) + + ! input/output variables + character(len=*) , intent(in) :: case_name + character(len=*) , intent(in) :: inst_suffix + integer , intent(in) :: ymd ! model date + integer , intent(in) :: tod ! model sec into model date + integer , intent(in) :: logunit + integer , intent(in) :: my_task + type(shr_strdata_type) , intent(inout) :: sdat + !------------------------------------------------------------------------------- + + call dshr_restart_write(rpfile, case_name, 'docn', inst_suffix, ymd, tod, & + logunit, my_task, sdat) + + end subroutine docn_datamode_cplhist_restart_write + + !=============================================================================== + subroutine docn_datamode_cplhist_restart_read(rest_filem, inst_suffix, logunit, my_task, mpicom, sdat) + + ! input/output arguments + character(len=*) , intent(inout) :: rest_filem + character(len=*) , intent(in) :: inst_suffix + integer , intent(in) :: logunit + integer , intent(in) :: my_task + integer , intent(in) :: mpicom + type(shr_strdata_type) , intent(inout) :: sdat + !------------------------------------------------------------------------------- + + call dshr_restart_read(rest_filem, rpfile, inst_suffix, nullstr, logunit, my_task, mpicom, sdat) + + end subroutine docn_datamode_cplhist_restart_read + +end module docn_datamode_cplhist_mod diff --git a/docn/docn_import_atmdata_mod.F90 b/docn/docn_import_atmdata_mod.F90 new file mode 100644 index 00000000..4513e3cc --- /dev/null +++ b/docn/docn_import_atmdata_mod.F90 @@ -0,0 +1,76 @@ +module docn_import_atmdata_mod + + use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS + use NUOPC , only : NUOPC_Advertise + use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + use dshr_methods_mod , only : chkerr + + implicit none + private ! except + + public :: docn_import_atmdata_advertise + + character(*) , parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine docn_import_atmdata_advertise(importState, fldsimport, flds_scalar_name, rc) + + ! input/output variables + type(esmf_State) , intent(inout) :: importState + type(fldlist_type) , pointer :: fldsimport + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(out) :: rc + + ! local variables + type(fldlist_type), pointer :: fldList + !------------------------------------------------------------------------------- + + ! Advertise import fields from DATM if appropriate + call dshr_fldList_add(fldsImport, trim(flds_scalar_name)) + call dshr_fldList_add(fldsImport, 'Sa_z' ) + call dshr_fldList_add(fldsImport, 'Sa_u' ) + call dshr_fldList_add(fldsImport, 'Sa_v' ) + call dshr_fldList_add(fldsImport, 'Sa_ptem' ) + call dshr_fldList_add(fldsImport, 'Sa_dens' ) + call dshr_fldList_add(fldsImport, 'Sa_pslv' ) + call dshr_fldList_add(fldsImport, 'Sa_tbot' ) + call dshr_fldList_add(fldsImport, 'Sa_pbot' ) + call dshr_fldList_add(fldsImport, 'Sa_shum' ) + call dshr_fldList_add(fldsImport, 'Faxa_rainc' ) + call dshr_fldList_add(fldsImport, 'Faxa_rainl' ) + call dshr_fldList_add(fldsImport, 'Faxa_snowc' ) + call dshr_fldList_add(fldsImport, 'Faxa_snowl' ) + call dshr_fldList_add(fldsImport, 'Faxa_swndr' ) + call dshr_fldList_add(fldsImport, 'Faxa_swvdr' ) + call dshr_fldList_add(fldsImport, 'Faxa_swndf' ) + call dshr_fldList_add(fldsImport, 'Faxa_swvdf' ) + call dshr_fldList_add(fldsImport, 'Faxa_swnet' ) + call dshr_fldList_add(fldsImport, 'Faxa_lwdn' ) + call dshr_fldList_add(fldsImport, 'Faxa_swdn' ) + + call dshr_fldList_add(fldsImport, 'Sa_co2prog') + call dshr_fldList_add(fldsImport, 'Sa_co2diag') + + call dshr_fldList_add(fldsImport, 'Faxa_bcph' , ungridded_lbound=1, ungridded_ubound=3) + call dshr_fldList_add(fldsImport, 'Faxa_ocph' , ungridded_lbound=1, ungridded_ubound=3) + call dshr_fldList_add(fldsImport, 'Faxa_dstwet' , ungridded_lbound=1, ungridded_ubound=4) + call dshr_fldList_add(fldsImport, 'Faxa_dstdry' , ungridded_lbound=1, ungridded_ubound=4) + + call dshr_fldList_add(fldsImport, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=2) + + fldlist => fldsImport ! the head of the linked list + do while (associated(fldlist)) + call NUOPC_Advertise(importState, standardName=fldlist%stdname, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite('(docn_comp_advertise): To_ocn'//trim(fldList%stdname), ESMF_LOGMSG_INFO) + fldList => fldList%next + enddo + + end subroutine docn_import_atmdata_advertise + +end module docn_import_atmdata_mod diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 64fde425..1ea2f359 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -53,6 +53,12 @@ module cdeps_docn_comp use docn_datamode_aquaplanet_mod , only : docn_datamode_aquaplanet_advertise use docn_datamode_aquaplanet_mod , only : docn_datamode_aquaplanet_init_pointers use docn_datamode_aquaplanet_mod , only : docn_datamode_aquaplanet_advance + use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_advertise + use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_init_pointers + use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_advance + use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_restart_read + use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_restart_write + use docn_import_atmdata_mod , only : docn_import_atmdata_advertise implicit none private ! except @@ -179,10 +185,11 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - integer :: inst_index ! number of current instance (ie. 1) - integer :: nu ! unit number - integer :: ierr ! error code - logical :: exists ! check for file existence + integer :: inst_index ! number of current instance (ie. 1) + integer :: nu ! unit number + integer :: ierr ! error code + logical :: exists ! check for file existence + logical :: get_atm_import ! if true, obtain atm import data even if its not used character(len=*),parameter :: subname=trim(module_name)//':(InitializeAdvertise) ' character(*) ,parameter :: F00 = "('(" // trim(module_name) // ") ',8a)" character(*) ,parameter :: F01 = "('(" // trim(module_name) // ") ',a,2x,i8)" @@ -192,7 +199,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) namelist / docn_nml / datamode, & model_meshfile, model_maskfile, & - restfilm, nx_global, ny_global, sst_constant_value, skip_restart_read + restfilm, nx_global, ny_global, sst_constant_value, skip_restart_read, & + get_atm_import + rc = ESMF_SUCCESS @@ -210,6 +219,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (my_task == main_task) then + ! Set default + get_atm_import = .false. + ! Read docn_nml from nlfilename nlfilename = "docn_in"//trim(inst_suffix) open (newunit=nu,file=trim(nlfilename),status="old",action="read") @@ -229,6 +241,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F01)' ny_global = ',ny_global write(logunit,F00)' restfilm = ',trim(restfilm) write(logunit,F02)' skip_restart_read = ',skip_restart_read + write(logunit,F02)' get_atm_import = ',get_atm_import endif ! Broadcast namelist input @@ -240,6 +253,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_mpi_bcast(restfilm , mpicom, 'restfilm') call shr_mpi_bcast(sst_constant_value , mpicom, 'sst_constant_value') call shr_mpi_bcast(skip_restart_read , mpicom, 'skip_restart_read') + call shr_mpi_bcast(get_atm_import , mpicom, 'get_atm_import') ! Special logic for prescribed aquaplanet if (datamode(1:9) == 'sst_aquap' .and. trim(datamode) /= 'sst_aquap_constant') then @@ -259,6 +273,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) trim(datamode) == 'sst_aquap_file' .or. & ! read stream, no import data trim(datamode) == 'som' .or. & ! read stream, needs import data trim(datamode) == 'som_aquap' .or. & ! read stream, needs import data + trim(datamode) == 'cplhist' .or. & ! read stream, needs import data trim(datamode) == 'sst_aquap_analytic' .or. & ! analytic, no streams, import or export data trim(datamode) == 'sst_aquap_constant' ) then ! analytic, no streams, import or export data ! success do nothing @@ -280,6 +295,14 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) else if (trim(datamode) == 'iaf') then call docn_datamode_iaf_advertise(importState, exportState, fldsImport, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + else if (trim(datamode) == 'cplhist') then + call docn_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + if (get_atm_import) then + call docn_import_atmdata_advertise(importState, fldsImport, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if end subroutine InitializeAdvertise @@ -499,6 +522,9 @@ subroutine docn_comp_run(importState, exportState, clock, target_ymd, target_tod case('sst_aquap_analytic', 'sst_aquap_constant') call docn_datamode_aquaplanet_init_pointers(exportState, model_frac, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('cplhist') + call docn_datamode_cplhist_init_pointers(exportState, model_frac, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select ! Read restart if needed @@ -553,6 +579,9 @@ subroutine docn_comp_run(importState, exportState, clock, target_ymd, target_tod case('sst_aquap_constant') call docn_datamode_aquaplanet_advance(exportState, model_mesh, sst_constant_value=sst_constant_value, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('cplhist') + call docn_datamode_cplhist_advance(rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select ! Write restarts if needed (no restarts for aquaplanet analytic or aquaplanet input file) @@ -567,6 +596,9 @@ subroutine docn_comp_run(importState, exportState, clock, target_ymd, target_tod case('som','som_aquap') call docn_datamode_som_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) + case('cplhist') + call docn_datamode_cplhist_restart_write(case_name, inst_suffix, target_ymd, target_tod, & + logunit, my_task, sdat) end select end if diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 5de2e97a..e963c2f4 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -624,7 +624,7 @@ subroutine shr_strdata_init(sdat, model_clock, stream_name, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (mainproc) then write(sdat%stream(1)%logunit,'(a,i8)') "creating ESMF stream vector field with names" //& - trim(stream_vector_names)//" for stream ",ns + trim(stream_vector_names)//" for stream ",ns end if end if enddo @@ -792,9 +792,9 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) ! - Model is no_leap, data is Gregorian and leapyear date 2/29 is encountered in data - skip date ! - Model is Gregorian, data is no_leap and leapyear date 2/29 is encountered in model - repeat 2/28 data ! - Model is Gregorian, data is gregorian but leapyears do not align. - ! - if in model leap year repeat data from 2/28 + ! - if in model leap year repeat data from 2/28 ! - if in data leap year skip date 2/29 - ! + ! ! ! (1) The stream is a no leap calendar and the model is gregorian: ! Time interpolate on the noleap calendar. If the model date is Feb 29, @@ -993,7 +993,7 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) timeint = timeUB-timeLB call ESMF_TimeIntervalGet(timeint, StartTimeIn=timeLB, d=dday) if (ChkErr(rc,__LINE__,u_FILE_u)) return - + if (.not. sdat%pstrm(ns)%override_annual_cycle) then if(sdat%stream(ns)%dtlimit == -1) then sdat%pstrm(ns)%override_annual_cycle = .true. @@ -1002,17 +1002,17 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) endif else dtime = abs(real(dday,r8) + real(sdat%pstrm(ns)%todUB-sdat%pstrm(ns)%todLB,r8)/shr_const_cDay) - + sdat%pstrm(ns)%dtmin = min(sdat%pstrm(ns)%dtmin,dtime) sdat%pstrm(ns)%dtmax = max(sdat%pstrm(ns)%dtmax,dtime) - + if ((sdat%pstrm(ns)%dtmax/sdat%pstrm(ns)%dtmin) > sdat%stream(ns)%dtlimit) then if (sdat%mainproc) then - write(sdat%stream(1)%logunit,*) trim(subname),' ERROR: for stream ',ns - write(sdat%stream(1)%logunit,*) trim(subname),' ERROR: dday = ',dday - write(sdat%stream(1)%logunit,*) trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',& + write(sdat%stream(1)%logunit,'(a,i8)') trim(subname),' ERROR: for stream ',ns + write(sdat%stream(1)%logunit,'(a,i8)') trim(subname),' ERROR: dday = ',dday + write(sdat%stream(1)%logunit,'(a,4(f15.5,2x))') trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',& dtime, sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit - write(sdat%stream(1)%logunit,*) trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', & + write(sdat%stream(1)%logunit,'(a,4(i10,2x))') trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', & sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB end if write(6,*) trim(subname),' ERROR: for stream ',ns, ' and calendar ',trim(calendar) @@ -1428,7 +1428,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & real(r8) :: fillvalue_r8 logical :: handlefill = .false. integer :: old_error_handle - real(r8), pointer :: dataptr(:) + real(r8), pointer :: dataptr(:) real(r8), pointer :: dataptr1d(:) ! field bundle data real(r8), pointer :: dataptr2d(:,:) ! field bundle data real(r8), pointer :: dataptr2d_src(:,:) ! field bundle data From c2062d40489b4e29030cfd6ec3f3be236149de69 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 25 Jan 2023 03:34:25 -0700 Subject: [PATCH 2/9] generalize import data functionality for docn --- docn/CMakeLists.txt | 2 +- docn/cime_config/namelist_definition_docn.xml | 4 ++-- ...atmdata_mod.F90 => docn_import_data_mod.F90} | 16 ++++++++++------ docn/ocn_comp_nuopc.F90 | 17 +++++++---------- 4 files changed, 20 insertions(+), 19 deletions(-) rename docn/{docn_import_atmdata_mod.F90 => docn_import_data_mod.F90} (88%) diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index 5a2e5b3b..a80ef79f 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -5,7 +5,7 @@ set(SRCFILES ocn_comp_nuopc.F90 docn_datamode_aquaplanet_mod.F90 docn_datamode_iaf_mod.F90 docn_datamode_cplhist_mod.F90 - docn_import_atmdata_mod.F90) + docn_import_data_mod.F90) foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.docn/${FILE}") diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index 4db36656..149c29c7 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -204,12 +204,12 @@ - + logical docn docn_nml - If set to true, then advertise will include import fields from datm. + If set to true, then advertise will include import fields normally sent to prognostic ocean. .false. diff --git a/docn/docn_import_atmdata_mod.F90 b/docn/docn_import_data_mod.F90 similarity index 88% rename from docn/docn_import_atmdata_mod.F90 rename to docn/docn_import_data_mod.F90 index 4513e3cc..f4bd4e3a 100644 --- a/docn/docn_import_atmdata_mod.F90 +++ b/docn/docn_import_data_mod.F90 @@ -1,4 +1,4 @@ -module docn_import_atmdata_mod +module docn_import_data_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use NUOPC , only : NUOPC_Advertise @@ -9,7 +9,7 @@ module docn_import_atmdata_mod implicit none private ! except - public :: docn_import_atmdata_advertise + public :: docn_import_data_advertise character(*) , parameter :: u_FILE_u = & __FILE__ @@ -18,7 +18,7 @@ module docn_import_atmdata_mod contains !=============================================================================== - subroutine docn_import_atmdata_advertise(importState, fldsimport, flds_scalar_name, rc) + subroutine docn_import_data_advertise(importState, fldsimport, flds_scalar_name, rc) ! input/output variables type(esmf_State) , intent(inout) :: importState @@ -30,7 +30,7 @@ subroutine docn_import_atmdata_advertise(importState, fldsimport, flds_scalar_na type(fldlist_type), pointer :: fldList !------------------------------------------------------------------------------- - ! Advertise import fields from DATM if appropriate + ! Advertise import fields from datm, dice and med_aofluxes if appropriate call dshr_fldList_add(fldsImport, trim(flds_scalar_name)) call dshr_fldList_add(fldsImport, 'Sa_z' ) call dshr_fldList_add(fldsImport, 'Sa_u' ) @@ -63,6 +63,10 @@ subroutine docn_import_atmdata_advertise(importState, fldsimport, flds_scalar_na call dshr_fldList_add(fldsImport, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=2) + call dshr_fldList_add(fldsImport, 'Si_ifrac' ) + + call dshr_fldList_add(fldsImport, 'So_duu10n') + fldlist => fldsImport ! the head of the linked list do while (associated(fldlist)) call NUOPC_Advertise(importState, standardName=fldlist%stdname, rc=rc) @@ -71,6 +75,6 @@ subroutine docn_import_atmdata_advertise(importState, fldsimport, flds_scalar_na fldList => fldList%next enddo - end subroutine docn_import_atmdata_advertise + end subroutine docn_import_data_advertise -end module docn_import_atmdata_mod +end module docn_import_data_mod diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 1ea2f359..2df37e41 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -58,7 +58,7 @@ module cdeps_docn_comp use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_advance use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_restart_read use docn_datamode_cplhist_mod , only : docn_datamode_cplhist_restart_write - use docn_import_atmdata_mod , only : docn_import_atmdata_advertise + use docn_import_data_mod , only : docn_import_data_advertise implicit none private ! except @@ -189,7 +189,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: nu ! unit number integer :: ierr ! error code logical :: exists ! check for file existence - logical :: get_atm_import ! if true, obtain atm import data even if its not used + logical :: get_import_data ! if true, obtain atm import data even if its not used character(len=*),parameter :: subname=trim(module_name)//':(InitializeAdvertise) ' character(*) ,parameter :: F00 = "('(" // trim(module_name) // ") ',8a)" character(*) ,parameter :: F01 = "('(" // trim(module_name) // ") ',a,2x,i8)" @@ -200,7 +200,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) namelist / docn_nml / datamode, & model_meshfile, model_maskfile, & restfilm, nx_global, ny_global, sst_constant_value, skip_restart_read, & - get_atm_import + get_import_data rc = ESMF_SUCCESS @@ -219,9 +219,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (my_task == main_task) then - ! Set default - get_atm_import = .false. - ! Read docn_nml from nlfilename nlfilename = "docn_in"//trim(inst_suffix) open (newunit=nu,file=trim(nlfilename),status="old",action="read") @@ -241,7 +238,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F01)' ny_global = ',ny_global write(logunit,F00)' restfilm = ',trim(restfilm) write(logunit,F02)' skip_restart_read = ',skip_restart_read - write(logunit,F02)' get_atm_import = ',get_atm_import + write(logunit,F02)' get_import_data = ',get_import_data endif ! Broadcast namelist input @@ -253,7 +250,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_mpi_bcast(restfilm , mpicom, 'restfilm') call shr_mpi_bcast(sst_constant_value , mpicom, 'sst_constant_value') call shr_mpi_bcast(skip_restart_read , mpicom, 'skip_restart_read') - call shr_mpi_bcast(get_atm_import , mpicom, 'get_atm_import') + call shr_mpi_bcast(get_import_data , mpicom, 'get_import_data') ! Special logic for prescribed aquaplanet if (datamode(1:9) == 'sst_aquap' .and. trim(datamode) /= 'sst_aquap_constant') then @@ -300,8 +297,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - if (get_atm_import) then - call docn_import_atmdata_advertise(importState, fldsImport, flds_scalar_name, rc) + if (get_import_data) then + call docn_import_data_advertise(importState, fldsImport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if From 7984201cef3687bd3d76495b17bb9608b7645bc9 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 27 Jan 2023 05:48:36 -0700 Subject: [PATCH 3/9] more refactoring for ocn import fields --- docn/cime_config/namelist_definition_docn.xml | 12 ++ docn/docn_import_data_mod.F90 | 130 +++++++++++++----- docn/ocn_comp_nuopc.F90 | 52 +++---- 3 files changed, 132 insertions(+), 62 deletions(-) diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index 149c29c7..f36ee90f 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -216,4 +216,16 @@ + + char + docn + docn_nml + + If get_import_data is true, then colon delimited set of fields to advertise as import data + + + Faxa_bcph:Faxa_dstdry:Faxa_dstwet:So_duu10n:Si_ifrac + + + diff --git a/docn/docn_import_data_mod.F90 b/docn/docn_import_data_mod.F90 index f4bd4e3a..130d555f 100644 --- a/docn/docn_import_data_mod.F90 +++ b/docn/docn_import_data_mod.F90 @@ -1,6 +1,7 @@ module docn_import_data_mod use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS + use ESMF , only : ESMF_LOGMSG_ERROR, ESMF_FAILURE use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add @@ -11,61 +12,48 @@ module docn_import_data_mod public :: docn_import_data_advertise + private :: docn_get_import_fields + character(*) , parameter :: u_FILE_u = & __FILE__ -!=============================================================================== + !=============================================================================== contains -!=============================================================================== + !=============================================================================== - subroutine docn_import_data_advertise(importState, fldsimport, flds_scalar_name, rc) + subroutine docn_import_data_advertise(importState, fldsimport, flds_scalar_name, import_data_fields, rc) ! input/output variables type(esmf_State) , intent(inout) :: importState type(fldlist_type) , pointer :: fldsimport character(len=*) , intent(in) :: flds_scalar_name + character(len=*) , intent(in) :: import_data_fields integer , intent(out) :: rc ! local variables type(fldlist_type), pointer :: fldList + character(CL), allocatable :: fieldnamelist(:) + integer :: n !------------------------------------------------------------------------------- + ! Translate the colon deliminted string (import_data_fields) into a character array (fieldnamelist) + ! Note that the following call allocates the memory for fieldnamelist + call docn_get_import_fields(import_data_fields, fieldnamelist, rc) + ! Advertise import fields from datm, dice and med_aofluxes if appropriate call dshr_fldList_add(fldsImport, trim(flds_scalar_name)) - call dshr_fldList_add(fldsImport, 'Sa_z' ) - call dshr_fldList_add(fldsImport, 'Sa_u' ) - call dshr_fldList_add(fldsImport, 'Sa_v' ) - call dshr_fldList_add(fldsImport, 'Sa_ptem' ) - call dshr_fldList_add(fldsImport, 'Sa_dens' ) - call dshr_fldList_add(fldsImport, 'Sa_pslv' ) - call dshr_fldList_add(fldsImport, 'Sa_tbot' ) - call dshr_fldList_add(fldsImport, 'Sa_pbot' ) - call dshr_fldList_add(fldsImport, 'Sa_shum' ) - call dshr_fldList_add(fldsImport, 'Faxa_rainc' ) - call dshr_fldList_add(fldsImport, 'Faxa_rainl' ) - call dshr_fldList_add(fldsImport, 'Faxa_snowc' ) - call dshr_fldList_add(fldsImport, 'Faxa_snowl' ) - call dshr_fldList_add(fldsImport, 'Faxa_swndr' ) - call dshr_fldList_add(fldsImport, 'Faxa_swvdr' ) - call dshr_fldList_add(fldsImport, 'Faxa_swndf' ) - call dshr_fldList_add(fldsImport, 'Faxa_swvdf' ) - call dshr_fldList_add(fldsImport, 'Faxa_swnet' ) - call dshr_fldList_add(fldsImport, 'Faxa_lwdn' ) - call dshr_fldList_add(fldsImport, 'Faxa_swdn' ) - - call dshr_fldList_add(fldsImport, 'Sa_co2prog') - call dshr_fldList_add(fldsImport, 'Sa_co2diag') - - call dshr_fldList_add(fldsImport, 'Faxa_bcph' , ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsImport, 'Faxa_ocph' , ungridded_lbound=1, ungridded_ubound=3) - call dshr_fldList_add(fldsImport, 'Faxa_dstwet' , ungridded_lbound=1, ungridded_ubound=4) - call dshr_fldList_add(fldsImport, 'Faxa_dstdry' , ungridded_lbound=1, ungridded_ubound=4) - - call dshr_fldList_add(fldsImport, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=2) - - call dshr_fldList_add(fldsImport, 'Si_ifrac' ) - - call dshr_fldList_add(fldsImport, 'So_duu10n') + do n = 1,size(fieldnamelist) + if (trim(fieldnamelist(n)) == 'Faxa_bcph' .or. trim(fieldnamelist(n)) == 'Faxa_ocph') then + call dshr_fldList_add(fldsImport, trim(fieldnamelist(n)), ungridded_lbound=1, ungridded_ubound=3) + else if (trim(fieldnamelist(n)) == 'Faxa_dstwet' .or. trim(fieldnamelist(n)) == 'Faxa_dstdry') then + call dshr_fldList_add(fldsImport, trim(fieldnamelist(n)), ungridded_lbound=1, ungridded_ubound=4) + else + call dshr_fldList_add(fldsImport, trim(fieldnamelist(n))) + end if + end do + + ! Deallocate memory from fieldnamelist + deallocate(fieldnamelist) ! this was allocated in docn_get_import_fields fldlist => fldsImport ! the head of the linked list do while (associated(fldlist)) @@ -77,4 +65,72 @@ subroutine docn_import_data_advertise(importState, fldsimport, flds_scalar_name, end subroutine docn_import_data_advertise + + !=============================================================================== + subroutine docn_get_import_fields(str, flds, rc) + + ! input/output variables + character(len=*) , intent(in) :: str ! colon deliminted string to search + character(len=*) , allocatable , intent(out) :: flds(:) ! memory will be allocate for flds + integer , intent(out) :: rc + ! local variables + integer :: i,k,n ! generic indecies + integer :: nflds ! allocatable size of flds + integer :: count ! counts occurances of char + integer :: kFlds ! number of fields in list + integer :: i0,i1 ! name = list(i0:i1) + integer :: nChar ! temporary + logical :: valid ! check if str is valid + !--------------------------------------- + + rc = ESMF_SUCCESS + + ! check that this is a str is a valid colon dlimited list + valid = .true. + nChar = len_trim(str) + if (nChar < 1) then ! list is an empty string + valid = .false. + else if (str(1:1) == ':') then ! first char is delimiter + valid = .false. + else if (str(nChar:nChar) == ':') then ! last char is delimiter + valid = .false. + else if (index(trim(str)," ") > 0) then ! white-space in a field name + valid = .false. + end if + if (.not. valid) then + call ESMF_LogWrite("ERROR: invalid list = "//trim(str), ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + end if + ! get number of fields in a colon delimited string list + nflds = 0 + if (len_trim(str) > 0) then + count = 0 + do n = 1, len_trim(str) + if (str(n:n) == ':') count = count + 1 + end do + nflds = count + 1 + endif + ! allocate memory for flds) + allocate(flds(nflds)) + do k = 1,nflds + ! start with whole list + i0 = 1 + i1 = len_trim(str) + ! remove field names before kth field + do n = 2,k + i = index(str(i0:i1),':') + i0 = i0 + i + end do + ! remove field names after kth field + if (k < nFlds) then + i = index(str(i0:i1),':') + i1 = i0 + i - 2 + end if + ! set flds(k) + flds(k) = str(i0:i1)//" " + end do + + end subroutine docn_get_import_fields + end module docn_import_data_mod diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 2df37e41..bdc8cf28 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -185,11 +185,12 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - integer :: inst_index ! number of current instance (ie. 1) - integer :: nu ! unit number - integer :: ierr ! error code - logical :: exists ! check for file existence - logical :: get_import_data ! if true, obtain atm import data even if its not used + integer :: inst_index ! number of current instance (ie. 1) + integer :: nu ! unit number + integer :: ierr ! error code + logical :: exists ! check for file existence + logical :: get_import_data ! if true, obtain atm import data even if its not used + character(len=CL) :: import_data_fields ! colon deliminted strings of input data fields character(len=*),parameter :: subname=trim(module_name)//':(InitializeAdvertise) ' character(*) ,parameter :: F00 = "('(" // trim(module_name) // ") ',8a)" character(*) ,parameter :: F01 = "('(" // trim(module_name) // ") ',a,2x,i8)" @@ -200,8 +201,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) namelist / docn_nml / datamode, & model_meshfile, model_maskfile, & restfilm, nx_global, ny_global, sst_constant_value, skip_restart_read, & - get_import_data - + get_import_data, import_data_fields rc = ESMF_SUCCESS @@ -230,27 +230,29 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if ! write namelist input to standard out - write(logunit,F00)' case_name = ',trim(case_name) - write(logunit,F00)' datamode = ',trim(datamode) - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - write(logunit,F01)' nx_global = ',nx_global - write(logunit,F01)' ny_global = ',ny_global - write(logunit,F00)' restfilm = ',trim(restfilm) + write(logunit,F00)' case_name = ',trim(case_name) + write(logunit,F00)' datamode = ',trim(datamode) + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) + write(logunit,F01)' nx_global = ',nx_global + write(logunit,F01)' ny_global = ',ny_global + write(logunit,F00)' restfilm = ',trim(restfilm) write(logunit,F02)' skip_restart_read = ',skip_restart_read - write(logunit,F02)' get_import_data = ',get_import_data + write(logunit,F02)' get_import_data = ',get_import_data + write(logunit,F00)' import_data_flds = ',trim(import_data_fields) endif ! Broadcast namelist input - call shr_mpi_bcast(datamode , mpicom, 'datamode') - call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') - call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(nx_global , mpicom, 'nx_global') - call shr_mpi_bcast(ny_global , mpicom, 'ny_global') - call shr_mpi_bcast(restfilm , mpicom, 'restfilm') - call shr_mpi_bcast(sst_constant_value , mpicom, 'sst_constant_value') - call shr_mpi_bcast(skip_restart_read , mpicom, 'skip_restart_read') - call shr_mpi_bcast(get_import_data , mpicom, 'get_import_data') + call shr_mpi_bcast(datamode , mpicom, 'datamode') + call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') + call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') + call shr_mpi_bcast(nx_global , mpicom, 'nx_global') + call shr_mpi_bcast(ny_global , mpicom, 'ny_global') + call shr_mpi_bcast(restfilm , mpicom, 'restfilm') + call shr_mpi_bcast(sst_constant_value , mpicom, 'sst_constant_value') + call shr_mpi_bcast(skip_restart_read , mpicom, 'skip_restart_read') + call shr_mpi_bcast(get_import_data , mpicom, 'get_import_data') + call shr_mpi_bcast(import_data_fields , mpicom, 'import_data_fields') ! Special logic for prescribed aquaplanet if (datamode(1:9) == 'sst_aquap' .and. trim(datamode) /= 'sst_aquap_constant') then @@ -298,7 +300,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if if (get_import_data) then - call docn_import_data_advertise(importState, fldsImport, flds_scalar_name, rc) + call docn_import_data_advertise(importState, fldsImport, flds_scalar_name, import_data_fields, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if From 633641e72dae9cc8f979b00957bb8c199d6900d0 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 30 Jan 2023 05:55:34 -0700 Subject: [PATCH 4/9] updates for adding ocean import fields more flexibly --- docn/cime_config/config_component.xml | 8 ++++++++ docn/cime_config/namelist_definition_docn.xml | 18 +++--------------- docn/ocn_comp_nuopc.F90 | 7 ++----- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/docn/cime_config/config_component.xml b/docn/cime_config/config_component.xml index 81c6dc54..f57b1a0a 100644 --- a/docn/cime_config/config_component.xml +++ b/docn/cime_config/config_component.xml @@ -318,6 +318,14 @@ + + char + none + run_component_docn + env_run.xml + none or colon deliminted string of import fields that DOCN will advertise + + ========================================= DOCN naming conventions diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index f36ee90f..a44ae344 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -204,27 +204,15 @@ - - logical - docn - docn_nml - - If set to true, then advertise will include import fields normally sent to prognostic ocean. - - - .false. - - - - + char docn docn_nml - If get_import_data is true, then colon delimited set of fields to advertise as import data + Colon delimited set of fields to advertise as import data - Faxa_bcph:Faxa_dstdry:Faxa_dstwet:So_duu10n:Si_ifrac + $DOCN_IMPORT_FIELDS diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index bdc8cf28..4fc902e4 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -189,7 +189,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: nu ! unit number integer :: ierr ! error code logical :: exists ! check for file existence - logical :: get_import_data ! if true, obtain atm import data even if its not used character(len=CL) :: import_data_fields ! colon deliminted strings of input data fields character(len=*),parameter :: subname=trim(module_name)//':(InitializeAdvertise) ' character(*) ,parameter :: F00 = "('(" // trim(module_name) // ") ',8a)" @@ -201,7 +200,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) namelist / docn_nml / datamode, & model_meshfile, model_maskfile, & restfilm, nx_global, ny_global, sst_constant_value, skip_restart_read, & - get_import_data, import_data_fields + import_data_fields rc = ESMF_SUCCESS @@ -238,7 +237,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F01)' ny_global = ',ny_global write(logunit,F00)' restfilm = ',trim(restfilm) write(logunit,F02)' skip_restart_read = ',skip_restart_read - write(logunit,F02)' get_import_data = ',get_import_data write(logunit,F00)' import_data_flds = ',trim(import_data_fields) endif @@ -251,7 +249,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_mpi_bcast(restfilm , mpicom, 'restfilm') call shr_mpi_bcast(sst_constant_value , mpicom, 'sst_constant_value') call shr_mpi_bcast(skip_restart_read , mpicom, 'skip_restart_read') - call shr_mpi_bcast(get_import_data , mpicom, 'get_import_data') call shr_mpi_bcast(import_data_fields , mpicom, 'import_data_fields') ! Special logic for prescribed aquaplanet @@ -299,7 +296,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - if (get_import_data) then + if (trim(import_data_fields) /= 'none') then call docn_import_data_advertise(importState, fldsImport, flds_scalar_name, import_data_fields, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if From 054e4b869255b9366593dab9848b1811336a6301 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 30 Jan 2023 08:26:42 -0700 Subject: [PATCH 5/9] fixed typo --- docn/cime_config/stream_definition_docn.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docn/cime_config/stream_definition_docn.xml b/docn/cime_config/stream_definition_docn.xml index c29607db..0dd4baf5 100644 --- a/docn/cime_config/stream_definition_docn.xml +++ b/docn/cime_config/stream_definition_docn.xml @@ -186,7 +186,7 @@ ocnImp_So_bldepth So_bldepth ocnImp_So_t So_t ocnImp_So_u So_u - ocnImp_So_v So_topo + ocnImp_So_v So_v null From cb4a969051c768fba196368f434f212e63c0214c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 30 Jan 2023 08:42:31 -0700 Subject: [PATCH 6/9] simplified DOCN%CPLHIST xml variables for now --- docn/cime_config/config_component.xml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/docn/cime_config/config_component.xml b/docn/cime_config/config_component.xml index f57b1a0a..a06201aa 100644 --- a/docn/cime_config/config_component.xml +++ b/docn/cime_config/config_component.xml @@ -251,24 +251,6 @@ This is only used when DOCN_MODE=prescribed. - - char - - UNSET - run_component_docn - env_run.xml - directory for coupler history data mode (only used for when DOCN_MODE is CPLHIST) - - - - char - - UNSET - run_component_docn - env_run.xml - case name used to determine stream filenames when DOCN_MODE is CPLHIST - - integer From 61579cf7f519f59bebf621ec615491b426948bef Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 30 Jan 2023 09:17:06 -0700 Subject: [PATCH 7/9] removed unused variable --- docn/docn_import_data_mod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/docn/docn_import_data_mod.F90 b/docn/docn_import_data_mod.F90 index 130d555f..13273625 100644 --- a/docn/docn_import_data_mod.F90 +++ b/docn/docn_import_data_mod.F90 @@ -77,7 +77,6 @@ subroutine docn_get_import_fields(str, flds, rc) integer :: i,k,n ! generic indecies integer :: nflds ! allocatable size of flds integer :: count ! counts occurances of char - integer :: kFlds ! number of fields in list integer :: i0,i1 ! name = list(i0:i1) integer :: nChar ! temporary logical :: valid ! check if str is valid From 1bb6010700fa4a13be1e5ba329053b04b6b7afb0 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 31 Jan 2023 05:03:46 -0700 Subject: [PATCH 8/9] fixed alignment --- docn/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index 2b83705c..b8a2b44e 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -1,11 +1,11 @@ project(docn Fortran) set(SRCFILES ocn_comp_nuopc.F90 - docn_datamode_copyall_mod.F90 - docn_datamode_som_mod.F90 - docn_datamode_aquaplanet_mod.F90 - docn_datamode_iaf_mod.F90 - docn_datamode_cplhist_mod.F90 - docn_import_data_mod.F90) + docn_datamode_copyall_mod.F90 + docn_datamode_som_mod.F90 + docn_datamode_aquaplanet_mod.F90 + docn_datamode_iaf_mod.F90 + docn_datamode_cplhist_mod.F90 + docn_import_data_mod.F90) foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.docn/${FILE}") From 0405140463f0935e87ab98e0666830b546eb728d Mon Sep 17 00:00:00 2001 From: mvertens Date: Wed, 1 Feb 2023 17:40:52 +0100 Subject: [PATCH 9/9] updated documentation for new docn changes and to document env_run.xml cdeps variables --- doc/source/datm.rst | 111 +++++++++++---- doc/source/dice.rst | 31 +++-- doc/source/dlnd.rst | 56 ++++++-- doc/source/docn.rst | 127 ++++++++++++++---- doc/source/drof.rst | 102 +++++++++----- doc/source/dwav.rst | 26 ++-- drof/cime_config/namelist_definition_drof.xml | 6 +- 7 files changed, 335 insertions(+), 124 deletions(-) diff --git a/doc/source/datm.rst b/doc/source/datm.rst index e606bb14..ff067209 100644 --- a/doc/source/datm.rst +++ b/doc/source/datm.rst @@ -5,13 +5,13 @@ Data Atmosphere (DATM) DATM is normally used to provide observational forcing data (or forcing data produced by a previous run using active components) to -drive prognostic components. The various ways of running DATM is +drive prognostic components. The various ways of running DATM is referred to as its mode. -In the case of CESM, the active model components would be: CTSM, -POP2, MOM6, POP2, CICE5-6, WW3 and MOSART. As examples, CORE2_NYF -(CORE2 normal year forcing) is the DATM mode used in driving -POP2 and MOM6. On the other hand CLM_QIAN, CLMCRUNCEP, CLMGSWP3 +In the case of CESM, the active model components would be: CTSM, +POP2, MOM6, POP2, CICE5-6, WW3 and MOSART. As examples, CORE2_NYF +(CORE2 normal year forcing) is the DATM mode used in driving +POP2 and MOM6. On the other hand CLM_QIAN, CLMCRUNCEP, CLMGSWP3 and CLM1PT are DATM modes using observational data for forcing CTSM. .. _datm-datamodes: @@ -36,7 +36,7 @@ CLMNCEP (``datm_datamode_clmncep_mod.F90``) infrastructure and data models to do active-land-only simulations. CORE2_NYF (``datm_datamode_core2_mod.F90``) - - Coordinated Ocean-ice Reference Experiments (CORE) Version 2 + - Coordinated Ocean-ice Reference Experiments (CORE) Version 2 Normalst_aquap[1-10]Year Forcing. CORE2_IAF (``datm_datamode_core2_mod.F90``) @@ -60,16 +60,16 @@ ERA5 (``datm_datamode_era5_mod.F90``) .. note:: Due to the high temporal and spatial resoultion of ERA5 dataset, only 2019 - data is staged on NCAR's Cheyenne platform under + data is staged on NCAR's Cheyenne platform under `$CESMDATAROOT/inputdata/atm/datm7/ERA5` .. note:: - In addition to the exiting DATM data modes, the `CDEPS fork `_ - used by `NOAA's UFS Weather Model `_ - also includes additional data modes such as CFSR, GEFS and GFS. These data modes are not + In addition to the exiting DATM data modes, the `CDEPS fork `_ + used by `NOAA's UFS Weather Model `_ + also includes additional data modes such as CFSR, GEFS and GFS. These data modes are not merged with the NCAR's authoritative repository yet but it is tested under UFS Weather model. - + .. _datm-cime-vars: --------------------------------------- @@ -77,25 +77,26 @@ Configuring DATM from CIME --------------------------------------- If CDEPS is coupled to the CIME-CCS then the CIME ``$CASEROOT`` xml -variable ``DATM_MODE`` sets the collection of streams that -are associated with DATM and also sets the datm namelist variable -``datamode`` in the file ``datm_in``. The following are the supported -DATM ``datamode`` values, as defined in the file -``namelist_definition_datm.xml``. +variable ``DATM_MODE`` will be generated based on the compset +specification ``DATM%{DATM_MODE}``. ``DATM_MODE`` will in term be +used in the ``namelist_definition_datm.xml`` file to determine the +collection of streams that are associated with DATM and also sets the +datm namelist variable ``datamode`` in the file ``datm_in``. -The following table describes the valid values of ``DATM_MODE`` +The following list describes the valid values of ``DATM_MODE`` (defined in the ``config_component.xml`` file for DATM), and how they relate to the associated input streams and the ``datamode`` namelist -variable. CIME will generate a value of ``DATM_MODE`` based on the -compset. +variable. -CORE2_NYF +DATM%CORE2_NYF, - CORE2 normal year forcing (CESM C ang G compsets) + - datm_mode: CORE2_NYF - streams: CORE2_NYF.GISS,CORE2_NYF.GXGXS,CORE2_NYF.NCEP - datamode: CORE2_NYF -CORE2_IAF +DATM%CORE2_IAF, - CORE2 interannual year forcing (CESM C ang G compsets) + - datm_mode: CORE2_IAF - streams: CORE2_IAF.GCGCS.PREC,CORE2_IAF.GISS.LWDN, CORE2_IAF.GISS.SWDN,CORE2_IAF.GISS.SWUP, CORE2_IAF.NCEP.DN10,CORE2_IAF.NCEP.Q_10, @@ -103,45 +104,97 @@ CORE2_IAF CORE2_IAF.NCEP.V_10,CORE2_IAF.CORE2.ArcFactor - datamode: CORE2_IAF -CORE_IAF_JRA +DATM%CORE_IAF_JRA - JRA-55 intra-annual year forcing (CESM C ang G compsets) - streams: CORE_IAF_JRA.PREC,CORE_IAF_JRA.LWDN,CORE_IAF_JRA.SWDN, CORE_IAF_JRA.Q_10,CORE_IAF_JRA.SLP\_,CORE_IAF_JRA.T_10,CORE_IAF_JRA.U_10, CORE_IAF_JRA.V_10,CORE_IAF_JRA.CORE2.ArcFactor - datamode: CORE_IAF_JRA -CLM_QIAN_WISO +DATM%CLM_QIAN_WISO - QIAN atm input data with water isotopes (CESM I compsets) + - datm_mode: CLMNCEP - streams: CLM_QIAN_WISO.Solar,CLM_QIAN_WISO.Precip,CLM_QIAN_WISO.TPQW - datamode: CLMNCEP -CLM_QIAN +DATM%CLM_QIAN - QIAN atm input data (CESM I compsets) + - datm_mode: CLMNCEP - streams: CLM_QIAN.Solar,CLM_QIAN.Precip,CLM_QIAN.TPQW - datamode: CLMNCEP -CLMCRUNCEPv7 +DATM%CLMCRUNCEPv7 - CRUNCEP atm input data (CESM I compsets) + - datm_mode: CLMNCEP - streams: CLMCRUNCEP.Solar,CLMCRUNCEP.Precip,CLMCRUNCEP.TPQW - datamode: CLMNCEP -CLMGSWP3 +DATM%CLMGSWP3 - GSWP3 atm input data (I compsets) + - datm_mode: CLMNCEP - streams: CLMGSWP3.Solar,CLMGSWP3.Precip,CLMGSWP3.TPQW - datamode: CLMNCEP -CLM1PT +DATM%CLM1PT - single point tower site atm input data + - datm_mode: CLMNCEP - streams: CLM1PT.$ATM_GRID - datamode: CLMNCEP -ERA5 +DATM%ERA5 - ERA5 atm input data (not used any compset) + - datm_mode: ERA5 - streams: ERA5_HOURLY - datamode: ERA5 -CPLHIST +DATM%CPLHIST - user generated forcing data from using coupler history files used to spinup relevant prognostic components (for CESM this is CLM, POP and CISM) + - datm_mode:CPLHIST - streams: CPLHISTForcing.Solar,CPLHISTForcing.nonSolarFlux, - datamode: CPLHIST + +In addition, the following DATM specific CIME-CCS xml variables will appear in ``$CASEROOT/env_run.xml``: + +DATM_PRESAERO + - DATM prescribed aerosol forcing mode + +DATM_TOPO + - DATM surface topography forcing (only needed for compsets with active land) + +DATM_CO2_TSERIES + - Full pathname for domain file for datm when DATM_MODE is + CPLHIST, NOTE: if this is set to 'null' (the default), then + domain information is read in from the first coupler history + file in the target stream and it is assumed that the first + coupler stream file that is pointed to contains the domain + information for that stream. + +DATM_CPLHIST_CASE + - Case name used to determine stream filenames when DATM_MODE is CPLHIST + +DATM_YR_START + - Starting year to loop data over + +DATM_YR_END + - Ending year to loop data over + +DATM_YR_ALIGN + - Simulation year corresponding to DATM_YR_START. A common usage + is to set this to RUN_STARTDATE. With this setting, the forcing + in the first year of the run will be the forcing of year + DATM_YR_START. Another use case is to align the calendar + of transient forcing with the model calendar. For example, + setting DATM_YR_ALIGN=DATM_YR_START will lead to + the forcing calendar being the same as the model calendar. The + forcing for a given model year would be the forcing of the same + year. This would be appropriate in transient runs where the + model calendar is setup to span the same year range as the + forcing data. + +DATM_SKIP_RESTART_READ + - If set to true, than datm restarts will not be read on a continuation run. + This capability is used, for example, in CTSM spinup runs. + + + diff --git a/doc/source/dice.rst b/doc/source/dice.rst index 2793edee..ebd5084b 100644 --- a/doc/source/dice.rst +++ b/doc/source/dice.rst @@ -4,7 +4,7 @@ Data Ice (DICE) =============== DICE is normally used to provide observational forcing data to -drive prognostic components. The various ways of running DICE is +drive prognostic components. The various ways of running DICE is referred to as its mode. .. _dice-datamodes: @@ -34,24 +34,27 @@ Configuring DICE from CIME --------------------------------------- If CDEPS is coupled to the CIME-CCS then the CIME ``$CASEROOT`` xml -variable ``DICE_MODE`` sets the collection of streams that -are associated with DICE and also sets the dice namelist variable -``datamode`` in the file ``dice_in``. The following are the supported -DICE ``datamode`` values, as defined in the file -``namelist_definition_dice.xml``. +variable ``DICE_MODE`` will be generated based on the compset +specification ``DICE%{DICE_MODE}``. ``DICE_MODE`` will in term be +used in the ``namelist_definition_dice.xml`` file to determine the +collection of streams that are associated with DICE and also sets the +dice namelist variable ``datamode`` in the file ``dice_in``. -The following table describes the valid values of ``DICE_MODE`` +The following list describes the valid values of ``DICE_MODE`` (defined in the ``config_component.xml`` file for DICE), and how they relate to the associated input streams and the ``datamode`` namelist -variable. CIME will generate a value of ``DICE_MODE`` based on the -compset. +variable. -ssmi +DICE%SSMI - Reads data from file + - dice_mode: ssmi - streams: ssmi_nyf - - datamode: ssmi + - datamode: ssmi -ssmi_iaf - - Reads data from file +DICE%IAF + - Reads data from file + - dice_mode: ssmi_iaf - streams: ssmi_iaf - - datamode: ssmi_iaf + - datamode: ssmi_iaf + +There are currently no DICE other specific xml variables in ``$CASEROOT/env_run.xml``. diff --git a/doc/source/dlnd.rst b/doc/source/dlnd.rst index 7a34983f..679cf58f 100644 --- a/doc/source/dlnd.rst +++ b/doc/source/dlnd.rst @@ -4,7 +4,7 @@ Data Land (DLND) ================ DLND is normally used to provide forcing data produced by a previous run -using active components to drive prognostic components. Currently, there +using active components to drive prognostic components. Currently, there is one way of running DLND is referred to as its mode. .. _dlnd-datamodes: @@ -21,7 +21,7 @@ with a DLND source file that carries out these operations and these are listed in parentheses next to the mode name. copyall (``lnd_comp_nuopc.F90``) - - This mode assumes that the data file has following variables: + - This mode assumes that the data file has following variables: 1. Surface temperature (`Sl_tsrf_elev`) in each elevation class 2. Surface topography (`Sl_topo_elev`) in each elevation class 3. SMB flux (`Flgl_qice_elev`) in each elevation class @@ -29,30 +29,58 @@ copyall (``lnd_comp_nuopc.F90``) .. _dlnd-cime-vars: --------------------------------------- -Configuring DLND from CIME +Configuring DLND using the CIME-CCS --------------------------------------- If CDEPS is coupled to the CIME-CCS then the CIME ``$CASEROOT`` xml -variable ``DLND_MODE`` sets the collection of streams that -are associated with DLND and also sets the dlnd namelist variable -``datamode`` in the file ``dlnd_in``. The following are the supported -DLND ``datamode`` values, as defined in the file -``namelist_definition_dlnd.xml``. +variable ``DLND_MODE`` will be generated based on the compset +specification ``DLND%{DLND_MODE}``. ``DLND_MODE`` will in term be +used in the ``namelist_definition_dlnd.xml`` file to determine the +collection of streams that are associated with DLND and also sets the +dlnd namelist variable ``datamode`` in the file ``dlnd_in``. -The following table describes the valid values of ``DLND_MODE`` +The following list describes the valid values of ``DLND_MODE`` (defined in the ``config_component.xml`` file for DLND), and how they relate to the associated input streams and the ``datamode`` namelist -variable. CIME will generate a value of ``DLND_MODE`` based on the -compset. +variable. -LCPL +DLND%LCPL - Non-snow coupling mode. Land forcing data (produced by CLM) from a previous - model run is read in from a coupler history file. + model run is read in from a coupler history file. + - dlnd_mode: SCPL - streams: lnd.cplhist - datamode: copyall -SCPL +DLND%SCPL - Snow coupling mode. Glacier coupling data (produced by CISM) from a previous model run is read in from a coupler history file. + - dlnd_mode: LCPL - streams: sno.cplhist - datamode: copyall + +In addition, the following DLND specific CIME-CCS xml variables will appear in ``$CASEROOT/env_run.xml``: + +DLND_CPLHIST_DIR + - directory for coupler history data mode + +DLND_CPLHIST_CASE + - case name for coupler history data mode + +DLND_CPLHIST_YR_START + - starting year to loop data over + +DLND_CPLHIST_YR_ALIGN + - Simulation year corresponding to DLND_CPLHIST_YR_START (only used + when DLND_MODE is CPLHIST or GLC_CPLHIST). A common usage is to + set this to RUN_STARTDATE. With this setting, the forcing in the + first year of the run will be the forcing of year + DLND_CPLHIST_YR_START. Another use case is to align the calendar + of transient forcing with the model calendar. For example, setting + DLND_CPLHIST_YR_ALIGN=DLND_CPLHIST_YR_START will lead to the + forcing calendar being the same as the model calendar. The forcing + for a given model year would be the forcing of the same year. This + would be appropriate in transient runs where the model calendar is + setup to span the same year range as the forcing data. + +DLND_SKIP_RESTART_READ + - If set to true, than dlnd restarts will not be read on a continuation run. diff --git a/doc/source/docn.rst b/doc/source/docn.rst index 80f7765c..d10852a6 100644 --- a/doc/source/docn.rst +++ b/doc/source/docn.rst @@ -5,7 +5,7 @@ Data Ocean (DOCN) DOCN is normally used to provide observational forcing data (or forcing data produced by a previous run using active components) to -drive prognostic components. The various ways of running DOCN is +drive prognostic components. The various ways of running DOCN is referred to as its mode. .. _docn-datamodes: @@ -22,8 +22,8 @@ with a DOCN source file that carries out these operations and these are listed in parentheses next to the mode name. sstdata and sst_aquap_file (``docn_datamode_copyall_mod.F90``) - - `sstdata` and `sst_aquap_file` modes assume that the only field in the - input stream is SST. It also assumes the SST is in Celsius and must be + - `sstdata` and `sst_aquap_file` modes assume that the only field in the + input stream is SST. It also assumes the SST is in Celsius and must be converted to Kelvin. All other fields are set to zero. .. note:: @@ -40,7 +40,7 @@ iaf (``docn_datamode_iaf_mod.F90``) sst_aquap_analytic, sst_aquap_constant and sst_aquap[1-10] (``docn_datamode_aquaplanet_mod.F90``) - This mode creates analytic sea surface temperature. In case of using `sst_aquap[1-10]` data mode, an additional information (`sst_option`) - is extracted from the data mode to change the behaviour of the + is extracted from the data mode to change the behaviour of the data mode such as the method of calculation of sea surface temperature. som and som_aquap (``docn_datamode_som_mod.F90``) @@ -56,61 +56,142 @@ som and som_aquap (``docn_datamode_som_mod.F90``) appropriate and is provided for testing and development purposes only. Users must create scientifically appropriate data for their particular application. A tool is available to derive valid SOM forcing. - + The only difference between `som` and `som_aquap` is that `som_aquap` limits sea surface temperature based on calculated value of freezing temperature. +cplhist (``docn_datamode_cplhist_mod.F90``) + .. _docn-cime-vars: --------------------------------------- -Configuring DOCN from CIME +Configuring DOCN using CIME-CCS --------------------------------------- If CDEPS is coupled to the CIME-CCS then the CIME ``$CASEROOT`` xml -variable ``DOCN_MODE`` sets the collection of streams that -are associated with DOCN and also sets the docn namelist variable -``datamode`` in the file ``docn_in``. The following are the supported -DOCN ``datamode`` values, as defined in the file -``namelist_definition_docn.xml``. +variable ``DOCN_MODE`` will be generated based on the compset +specification ``DOCN%{DOCN_MODE}``. ``DOCN_MODE`` will in term be +used in the ``namelist_definition_docn.xml`` file to determine the +collection of streams that are associated with DOCN and also sets the +docn namelist variable ``datamode`` in the file ``docn_in``. -The following table describes the valid values of ``DOCN_MODE`` +The following list describes the valid values of ``DOCN_MODE`` (defined in the ``config_component.xml`` file for DOCN), and how they relate to the associated input streams and the ``datamode`` namelist -variable. CIME will generate a value of ``DOCN_MODE`` based on the -compset. +variable. -prescribed +DOCN%DOM - SST data provided by a file - - streams: prescribed + - docn_mode: prescribed + - streams: prescribed - datamode: sstdata -interannual +DOCN%IAF - SST data provided by a file + - docn_mode: interannual - streams: interannual - datamode: iaf -som +DOCN%SOM - Slab Ocean Model is used to calculate sea surface temperature. + - docn_mode: som - streams: som - datamode: som -som_aquap +DOCN%SOMAQP - Slab Ocean Model is used to calculate sea surface temperature. - - streams: som_aquap + - docn_mode: som_aquap + - streams: N/A - datamode: som_aquap -sst_aquap[1-10] +DOCN%AQP[1-10] - Lattitude varying analytical sea surface data + - docn_mode: sst_aquap[1-10] - streams: N/A - datamode: sst_aquap[1-10] -sst_aquap_file +DOCN%AQPFILE - SST data provided by a file + - docn_mode: sst_aquap_file - streams: aquapfile - datamode: sst_aquapfile -sst_aquap_constant +DOCN%AQPCONST - Constant sea surface data from aquaplanet + - docn_mode: sst_aquap_constant - streams: N/A - datamode: sst_aquap_constant + + +In addition, the following list outlines the DOCN specific CIME-CCS xml variables that appear in ``$CASEROOT/env_run.xml``: + +SSTICE_DATA_FILENAME + - Prescribed SST and ice coverage data file name. + Sets SST and ice coverage data file name. + This is only used when DOCN%DOM or DOCN%IAF is present in the compset. + (used by both DOCN and CICE running in prescribed mode) + +SSTICE_MESH_FILENAME + - Prescribed SST and ice coverage mesh file name. + Sets SST and ice coverage grid file name for prescribed runs. + This is only used when DOCN%DOM or DOCN%IAF is present in the compset. + (used by both DOCN and CICE running in prescribed mode) + +SSTICE_YR_START + - Starting year to loop data over + (only used by both DOCN runing in prescribed mode and CICE running in prescribed mode) + +SSTICE_YR_END + - Ending year to loop data over + (only used by both DOCN runing in prescribed mode and CICE running in prescribed mode) + +SSTICE_YR_ALIGN + - The model year that corresponds to SSTICE_YEAR_START on the data file. + Prescribed SST and ice coverage data will be aligned so that the first year of + data corresponds to SSTICE_YEAR_ALIGN in the model. For instance, if the first + year of prescribed data is the same as the first year of the model run, this + should be set to the year given in RUN_STARTDATE. + If SSTICE_YEAR_ALIGN is later than the model's starting year, or if the model is + run after the prescribed data ends (as determined by SSTICE_YEAR_END), the + default behavior is to assume that the data from SSTICE_YEAR_START to + SSTICE_YEAR_END cyclically repeats. This behavior is controlled by the + "taxmode" stream option; see the data model documentation for more details. + (only used by both DOCN runing in prescribed mode and CICE running in prescribed mode) + +DOCN_AQPCONST_VALUE + - Sets globally constant SST value and is only used when DOCN%AQPCONST is present in the compset. + +DOCN_SOMAQP_DATAFILE + - Sets the SOM aquaplanet file and is only used when DOCN%AQPFILE is present in the compset. + +DOCN_CPLHIST_YR_START + - Starting year to loop data over + Only used if DOCN_MODE=cplhist. + +DOCN_CPLHIST_YR_END + - Ending year to loop data over + Only used if DOCN_MODE=cplhist. + +DOCN_CPLHIST_YR_ALIGN + - Simulation year corresponding to DOCN_CPLHIST_YR_START. A common usage + is to set this to RUN_STARTDATE. With this setting, the forcing + in the first year of the run will be the forcing of year + DOCN_CPLHIST_YR_START. Another use case is to align the calendar + of transient forcing with the model calendar. For example, + setting DOCN_CPLHIST_YR_ALIGN=DOCN_CPLHIST_YR_START will lead to + the forcing calendar being the same as the model calendar. The + forcing for a given model year would be the forcing of the same + year. This would be appropriate in transient runs where the + model calendar is setup to span the same year range as the forcing data. + Only used if DOCN_MODE=cplhist. + +DOCN_IMPORT_FIELDS + - A column delimited set of import fields that are advertised by DOCN but never used. + In some cases it is needed for DOCN to advertise import fields even though it never will actually use them. + This is needed in order for the mediator to add fields that would + be sent to the ocean from the atmosphere, ice and runoff if the + ocean were prognostic. + If the value of DOCN_IMPORT_FIELDS is 'none' then no import fields are advertised + by DOCN. If the DOCN_IMPORT_FIELDS is set to 'Faxa_bcph:Faxa_dstdry:Faxa_dstwet:So_duu10n:Si_ifrac' then + these fields will be written to the mediator history file(s). diff --git a/doc/source/drof.rst b/doc/source/drof.rst index 9457d445..abcda2f4 100644 --- a/doc/source/drof.rst +++ b/doc/source/drof.rst @@ -32,84 +32,124 @@ Configuring DROF from CIME --------------------------------------- If CDEPS is coupled to the CIME-CCS then the CIME ``$CASEROOT`` xml -variable ``DROF_MODE`` sets the collection of streams that -are associated with DROF and also sets the DROF namelist variable -``datamode`` in the file ``drof_in``. The following are the supported -DROF ``datamode`` values, as defined in the file -``namelist_definition_drof.xml``. +variable ``DROF_MODE`` will be generated based on the compset +specification ``DROF%{DROF_MODE}``. ``DROF_MODE`` will in term be +used in the ``namelist_definition_drof.xml`` file to determine the +collection of streams that are associated with DROF and also sets the +drof namelist variable ``datamode`` in the file ``drof_in``. -The following table describes the valid values of ``DROF_MODE`` +The following list describes the valid values of ``DROF_MODE`` (defined in the ``config_component.xml`` file for DROF), and how they relate to the associated input streams and the ``datamode`` namelist -variable. CIME will generate a value of ``DROF_MODE`` based on the -compset. +variable. -CPLHIST +DROF%CPLHIST - Reads data from coupler history file + - drof_mode: CPLHIST - streams: rof.cplhist - datamode: copyall -DIATREN_ANN_RX1 +DROF%DIATREN_ANN_RX1 - Annual Average data from Dai_Trenberth Continental Freshwater Discharge + - drof_mode: DIATREN_ANN_RX1 - streams: rof.diatren_ann_rx1 - datamode: copyall -DIATREN_ANN_AIS00_RX1 +DROF%DIATREN_ANN_AIS00_RX1 - Annual Average data from Dai_Trenberth Continental Freshwater Discharge + - drof_mode: DIATREN_ANN_AIS00_RX1 - streams: rof.diatren_ann_ais00_rx1 - datamode: copyall -DIATREN_ANN_AIS45_RX1 +DROF%DIATREN_ANN_AIS45_RX1 - Annual Average data from Dai_Trenberth Continental Freshwater Discharge + - drof_mode: DIATREN_ANN_AIS45_RX1 - streams: rof.diatren_ann_ais45_rx1 - datamode: copyall -DIATREN_ANN_AIS55_RX1 +DROF%DIATREN_ANN_AIS55_RX1 - Annual Average data from Dai_Trenberth Continental Freshwater Discharge + - drof_mode: DIATREN_ANN_AIS55_RX1 - streams: rof.diatren_ann_ais55_rx1 - datamode: copyall -DIATREN_IAF_AIS00_RX1 +DROF%DIATREN_IAF_RX1 - Monthly data from Dai_Trenberth Continental Freshwater Discharge - - streams: rof.diatren_iaf_ais00_rx1 + - drof_mode: DIATREN_IAF_RX1 + - streams: rof.diatren_iaf_rx1 - datamode: copyall -DIATREN_IAF_RX1 +DROF%DIATREN_IAF_AIS00_RX1 - Monthly data from Dai_Trenberth Continental Freshwater Discharge - - streams: rof.diatren_iaf_rx1 + - drof_mode: DIATREN_IAF_AIS00_RX1 + - streams: rof.diatren_iaf_ais00_rx1 - datamode: copyall -DIATREN_IAF_AIS45_RX1 +DROF%DIATREN_IAF_AIS45_RX1 - Monthly data from Dai_Trenberth Continental Freshwater Discharge + - drof_mode: DIATREN_IAF_AIS45_RX1 - streams: rof.diatren_iaf_ais45_rx1 - datamode: copyall -DIATREN_IAF_AIS55_RX1 +DROF%DIATREN_IAF_AIS55_RX1 - Monthly data from Dai_Trenberth Continental Freshwater Discharge + - drof_mode: DIATREN_IAF_AIS55_RX1 - streams: rof.diatren_iaf_ais55_rx1 - datamode: copyall -IAF_JRA_1p4_2018 - - JRA-55 based river runoff data (2018) - - streams: rof.iaf_jra_1p4_2018 - - datamode: copyall - -IAF_JRA +DROF%IAF_JRA - JRA-55 based river runoff data + - drof_mode: IAF_JRA - streams: rof.iaf_jra - datamode: copyall -RYF8485_JRA - - JRA55 v1.3 1984 May - 1985 Apr RAF +DROF%IAF_JRA_1p4_2018 + - JRA-55 based river runoff data (2018) + - drof_mode: IAF_JRA_1p4_2018 + - streams: rof.iaf_jra_1p4_2018 + - datamode: copyall + +DROF%RYF8485_JRA + - JRA55 v1.3 data from 1984 May - 1985 Apr RAF + - drof_mode: RYF8485_JRA - streams: rof.ryf8485_jra - datamode: copyall -RYF9091_JRA - - JRA55 v1.3 1990 May - 1991 Apr RAF +DROF%RYF9091_JRA + - JRA55 v1.3 data from 1990 May - 1991 Apr RAF + - drof_mode: RYF9091_JRA - streams: rof.ryf9091_jra - datamode: copyall -RYF0304_JRA - - JRA55 v1.3 2003 May - 2004 Apr RAF +DROF%RYF0304_JRA + - JRA55 v1.3 data form 2003 May - 2004 Apr RAF + - drof_mode: RYF0304_JRA - streams: rof.ryf0304_jra - datamode: copyall + +In addition, the following DATM specific CIME-CCS xml variables will appear in ``$CASEROOT/env_run.xml``: + +DROF_CPLHIST_CASE + - Case name used to determine stream filenames when DROF_MODE is CPLHIST + +DROF_CPLHIST_YR_START + - starting year to loop data over (only used when DROF_MODE is CPLHIST) + +DROF_CPLHIST_YR_END + - ending year to loop data over (only used when DROF_MODE is CPLHIST) + +DROF_CPLHIST_YR_ALIGN + - Simulation year corresponding to DROF_CPLHIST_YR_START (only used + when DROF_MODE is CPLHIST). A common usage is to set this to + RUN_STARTDATE. With this setting, the forcing in the first year of + the run will be the forcing of year DROF_CPLHIST_YR_START. Another + use case is to align the calendar of transient forcing with the + model calendar. For example, setting + DROF_CPLHIST_YR_ALIGN=DROF_CPLHIST_YR_START will lead to the + forcing calendar being the same as the model calendar. The forcing + for a given model year would be the forcing of the same year. This + would be appropriate in transient runs where the model calendar is + setup to span the same year range as the forcing data. + +DROF_SKIP_RESTART_READ + - If set to true, than drof restarts will not be read on a continuation run diff --git a/doc/source/dwav.rst b/doc/source/dwav.rst index 551c4443..94bb9f30 100644 --- a/doc/source/dwav.rst +++ b/doc/source/dwav.rst @@ -39,23 +39,29 @@ copyall (``wav_comp_nuopc.F90``) .. _dwav-cime-vars: --------------------------------------- -Configuring DWAV from CIME +Configuring DWAV using the CIME-CCS --------------------------------------- If CDEPS is coupled to the CIME-CCS then the CIME ``$CASEROOT`` xml -variable ``DWAV_MODE`` sets the collection of streams that -are associated with DWAV and also sets the DWAV namelist variable -``datamode`` in the file ``dwav_in``. The following are the supported -DROF ``datamode`` values, as defined in the file -``namelist_definition_dwav.xml``. +variable ``DWAV_MODE`` will be generated based on the compset +specification ``DWAV%{DWAV_MODE}``. ``DWAV_MODE`` will in term be +used in the ``namelist_definition_dwav.xml`` file to determine the +collection of streams that are associated with DWAV and also sets the +dwav namelist variable ``datamode`` in the file ``dwav_in``. -The following table describes the valid values of ``DWAV_MODE`` +The following list describes the valid values of ``DWAV_MODE`` (defined in the ``config_component.xml`` file for DWAV), and how they relate to the associated input streams and the ``datamode`` namelist -variable. CIME will generate a value of ``DWAV_MODE`` based on the -compset. +variable. -CLIMO +DWAV%CLIMO - Reads data from wave climatology file + - dwav_mode: CLIMO - streams: climo - datamode: copyall + +In addition, the following DICE specific CIME-CCS xml variables will appear in ``$CASEROOT/env_run.xml``: + +DWAV_SKIP_RESTART_READ + - If set to true, than dice restarts will not be read on a continuation run. + diff --git a/drof/cime_config/namelist_definition_drof.xml b/drof/cime_config/namelist_definition_drof.xml index 846139e1..88a3493b 100644 --- a/drof/cime_config/namelist_definition_drof.xml +++ b/drof/cime_config/namelist_definition_drof.xml @@ -10,17 +10,17 @@ streams_file List of streams used for the given drof_mode. - rof.cplhist + rof.cplhist rof.diatren_ann_rx1 rof.diatren_ann_ais00_rx1 rof.diatren_ann_ais45_rx1 rof.diatren_ann_ais55_rx1 - rof.diatren_iaf_ais00_rx1 rof.diatren_iaf_rx1 + rof.diatren_iaf_ais00_rx1 rof.diatren_iaf_ais45_rx1 rof.diatren_iaf_ais55_rx1 - rof.iaf_jra_1p4_2018 rof.iaf_jra + rof.iaf_jra_1p4_2018 rof.ryf8485_jra rof.ryf9091_jra rof.ryf0304_jra