diff --git a/.github/workflows/bumpversion.yml b/.github/workflows/bumpversion.yml new file mode 100644 index 000000000..c682973c4 --- /dev/null +++ b/.github/workflows/bumpversion.yml @@ -0,0 +1,20 @@ +name: Bump version +on: + push: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - name: Bump version and push tag + uses: anothrNick/github-tag-action@1.26.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WITH_V: true + DEFAULT_BUMP: minor + RELEASE_BRANCHES: master + DRY_RUN: False diff --git a/CMakeLists.txt b/CMakeLists.txt index 733855ab2..e16facff3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,9 @@ if(BLD_STANDALONE) list(APPEND EXTRA_LIBS cdeps_share) list(APPEND EXTRA_INCLUDES "${CMAKE_BINARY_DIR}/share" ) endif() - +if("${COMPILER}" STREQUAL "nag") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D__NAG__") +endif() add_subdirectory(fox) add_subdirectory(streams) add_subdirectory(dshr) diff --git a/cime_config/buildlib b/cime_config/buildlib index c3ca2780a..72a21593c 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -89,7 +89,7 @@ def buildlib(bldroot, libroot, case, compname=None): expect(time_counter <= time_to_wait," Timeout waiting for {}".format(dwav_lib)) print("HERE exeroot {} bldroot {}".format(exe_root, bldroot)) - s,o,e = run_cmd("make install DESTDIR={}".format(libroot), from_dir=bldroot, verbose=True) + s,o,e = run_cmd("make install VERBOSE=1 DESTDIR={}".format(libroot), from_dir=bldroot, verbose=True) expect(not s,"ERROR from make output={}, error={}".format(o,e)) # Link the CDEPS component directories to the location expected by cime diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index 3f78d8026..6cc1d2ea2 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -27,3 +27,4 @@ target_include_directories (datm PRIVATE ${CMAKE_SOURCE_DIR}) target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) target_include_directories (datm PRIVATE ${PIO_Fortran_INCLUDE_DIR}) +target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 0e896454f..0e7069bb0 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -19,11 +19,11 @@ module atm_comp_nuopc use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, setVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_const_mod , only : shr_const_cday use shr_sys_mod , only : shr_sys_abort - use shr_cal_mod , only : shr_cal_ymd2date, shr_cal_ymd2julian, shr_cal_date2julian + use shr_cal_mod , only : shr_cal_ymd2date use shr_mpi_mod , only : shr_mpi_bcast use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance @@ -81,7 +81,7 @@ module atm_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -115,7 +115,6 @@ module atm_comp_nuopc character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from integer :: iradsw = 0 ! radiation interval (input namelist) character(CL) :: factorFn_mesh = 'null' ! file containing correction factors mesh character(CL) :: factorFn_data = 'null' ! file containing correction factors data @@ -218,7 +217,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) !------------------------------------------------------------------------------- namelist / datm_nml / datamode, & - model_meshfile, model_maskfile, model_createmesh_fromfile, & + model_meshfile, model_maskfile, & nx_global, ny_global, restfilm, iradsw, factorFn_data, factorFn_mesh, & flds_presaero, flds_co2, flds_wiso, bias_correct, anomaly_forcing @@ -252,7 +251,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) 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(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') call shr_mpi_bcast(nx_global , mpicom, 'nx_global') call shr_mpi_bcast(ny_global , mpicom, 'ny_global') call shr_mpi_bcast(iradsw , mpicom, 'iradsw') @@ -265,49 +263,21 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out if (my_task == master_task) then - write(logunit,F00)' case_name = ',trim(case_name) - write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if - write(logunit,F01)' nx_global = ',nx_global - write(logunit,F01)' ny_global = ',ny_global - write(logunit,F00)' restfilm = ',trim(restfilm) - write(logunit,F01)' iradsw = ',iradsw - write(logunit,F00)' factorFn_data = ',trim(factorFn_data) - write(logunit,F00)' factorFn_mesh = ',trim(factorFn_mesh) - write(logunit,F02)' flds_presaero = ',flds_presaero - write(logunit,F02)' flds_co2 = ',flds_co2 - write(logunit,F02)' flds_wiso = ',flds_wiso + write(logunit,F00)' case_name = ',trim(case_name) + write(logunit,F00)' datamode = ',trim(datamode) + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) + write(logunit,F01)' nx_global = ',nx_global + write(logunit,F01)' ny_global = ',ny_global + write(logunit,F00)' restfilm = ',trim(restfilm) + write(logunit,F01)' iradsw = ',iradsw + write(logunit,F00)' factorFn_data = ',trim(factorFn_data) + write(logunit,F00)' factorFn_mesh = ',trim(factorFn_mesh) + write(logunit,F02)' flds_presaero = ',flds_presaero + write(logunit,F02)' flds_co2 = ',flds_co2 + write(logunit,F02)' flds_wiso = ',flds_wiso end if - ! check that files exists - if (my_task == master_task) then - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if - endif - ! Validate sdat datamode if (masterproc) write(logunit,*) ' datm datamode = ',trim(datamode) if ( trim(datamode) == 'CORE2_NYF' .or. & @@ -378,6 +348,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(R8) :: orbLambm0 ! orb mean long of perhelion (radians) real(R8) :: orbObliqr ! orb obliquity (radians) logical :: isPresent, isSet + real(R8) :: dayofYear character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -387,8 +358,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, compid, and logunit call ESMF_TraceRegionEnter('datm_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ATM', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type @@ -412,7 +382,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Get the time to interpolate the stream data to call ESMF_ClockGet( clock, currTime=currTime, timeStep=timeStep, advanceCount=stepno, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeGet(currTime, yy=current_year, mm=current_mon, dd=current_day, s=current_tod, rc=rc ) + call ESMF_TimeGet(currTime, yy=current_year, mm=current_mon, dd=current_day, s=current_tod, & + dayofYear_r8=dayofYear, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(current_year, current_mon, current_day, current_ymd) @@ -447,7 +418,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call shr_sys_abort(subname//'Need to set attribute ScalarFieldIdxNextSwCday') endif - nextsw_cday = getNextRadCDay( current_ymd, current_tod, stepno, idt, iradsw, sdat%model_calendar ) + nextsw_cday = getNextRadCDay(dayofYear, current_tod, stepno, idt, iradsw) call dshr_state_SetScalar(nextsw_cday, flds_scalar_index_nextsw_cday, exportState, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -477,6 +448,7 @@ subroutine ModelAdvance(gcomp, rc) real(R8) :: orbMvelpp ! orb moving vernal eq (radians) real(R8) :: orbLambm0 ! orb mean long of perhelion (radians) real(R8) :: orbObliqr ! orb obliquity (radians) + real(R8) :: dayofYear character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' !------------------------------------------------------------------------------- @@ -495,7 +467,7 @@ subroutine ModelAdvance(gcomp, rc) call ESMF_ClockGet( clock, currTime=currTime, timeStep=timeStep, advanceCount=stepno, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return nextTime = currTime + timeStep - call ESMF_TimeGet( nextTime, yy=yr, mm=mon, dd=day, s=next_tod, rc=rc ) + call ESMF_TimeGet( nextTime, yy=yr, mm=mon, dd=day, s=next_tod, dayofYear_r8=dayofYear, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yr, mon, day, next_ymd) @@ -525,7 +497,9 @@ subroutine ModelAdvance(gcomp, rc) ! Update nextsw_cday for scalar data ! Use nextYMD and nextTOD here since since the component - clock is advance at the END of the time interval - nextsw_cday = getNextRadCDay( next_ymd, next_tod, stepno, idt, iradsw, sdat%model_calendar ) + + nextsw_cday = getNextRadCDay(dayofYear, next_tod, stepno, idt, iradsw) + call dshr_state_SetScalar(nextsw_cday, flds_scalar_index_nextsw_cday, exportState, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -677,23 +651,18 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe case('CORE2_NYF','CORE2_IAF') call datm_datamode_core2_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CORE_IAF_JRA') call datm_datamode_jra_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CLMNCEP') call datm_datamode_clmncep_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CPLHIST') call datm_datamode_cplhist_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') call datm_datamode_era5_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('GEFS') call datm_datamode_gefs_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) @@ -799,31 +768,47 @@ end subroutine datm_init_dfields end subroutine datm_comp_run !=============================================================================== - real(R8) function getNextRadCDay( ymd, tod, stepno, dtime, iradsw, calendar ) - - ! Return the calendar day of the next radiation time-step. - ! General Usage: nextswday = getNextRadCDay(curr_date) + real(R8) function getNextRadCDay( julday, tod, stepno, dtime, iradsw ) + + ! Return the calendar day of the next radiation time-step. + ! General Usage: nextswday = getNextRadCDay(curr_date) iradsw is + ! the frequency to update the next shortwave. in number of steps + ! (or hours if negative) Julian date. + ! -- values greater than 1 set + ! the next radiation to the present time plus 2 timesteps every iradsw + ! -- values less than 0 turn set the next radiation to the present time + ! plus two timesteps every -iradsw hours. + ! -- if iradsw is zero, the next radiation time is the + ! present time plus 1 timestep. ! input/output variables - integer , intent(in) :: ymd - integer , intent(in) :: tod - integer(i8), intent(in) :: stepno - integer , intent(in) :: dtime - integer , intent(in) :: iradsw - character(*),intent(in) :: calendar + real(r8) , intent(in) :: julday + integer , intent(in) :: tod + integer(i8) , intent(in) :: stepno + integer , intent(in) :: dtime + integer , intent(in) :: iradsw ! local variables real(R8) :: nextsw_cday - real(R8) :: julday integer :: liradsw + integer :: delta_radsw character(*),parameter :: subName = '(getNextRadCDay) ' !------------------------------------------------------------------------------- + ! Note that stepno is obtained via the advancecount argument to + ! ESMF_GetClock and is the number of times the ESMF_Clock has been + ! advanced. The ESMF clock is actually advanced an additional time + ! (in order to trigger alarms) in the routine dshr_set_runclock + ! which is the specialized routine for the model_lable_SetRunClock. + ! This is called each time the ModelAdvance phase is called. Hence + ! stepno is not used to trigger the calculation of nextsw_cday. + liradsw = iradsw if (liradsw < 0) liradsw = nint((-liradsw *3600._r8)/dtime) - call shr_cal_date2julian(ymd,tod,julday,calendar) + if (liradsw > 1) then - if (mod(stepno+1,liradsw) == 0 .and. stepno > 0) then + delta_radsw = liradsw * dtime + if (mod(tod+dtime,delta_radsw) == 0 .and. stepno > 0) then nextsw_cday = julday + 2*dtime/shr_const_cday else nextsw_cday = -1._r8 diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index 265274521..d0f75e00e 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -73,11 +73,20 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['datm_mode'] = datm_mode config['datm_co2_tseries'] = datm_co2_tseries config['datm_presaero'] = datm_presaero - config['cime_model'] = get_model() - if case.get_value('PTS_MODE'): - config['mode'] = 'single_column' + + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) else: - config['mode'] = case.get_value("ATM_DOMAIN_MESH") + scol_lat = -999. + if case.get_value('ATM_DOMAIN_FILE'): + if scol_lon > -999. and scol_lat > -999. and case.get_value("ATM_DOMAIN_FILE") != "UNSET": + config['single_column'] = 'true' + else: + config['single_column'] = 'false' nmlgen.init_defaults(infile, config) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index eaaf9290d..320a3b1e7 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -43,10 +43,12 @@ CORE2_IAF.GCGCS.PREC,CORE2_IAF.GISS.LWDN,CORE2_IAF.GISS.SWDN,CORE2_IAF.GISS.SWUP,CORE2_IAF.NCEP.DN10,CORE2_IAF.NCEP.Q_10,CORE2_IAF.NCEP.SLP_,CORE2_IAF.NCEP.T_10,CORE2_IAF.NCEP.U_10,CORE2_IAF.NCEP.V_10,CORE2_IAF.CORE2.ArcFactor + + CORE_IAF_JRA_1p4_2018.GCGCS.PREC,CORE_IAF_JRA_1p4_2018.GISS.LWDN,CORE_IAF_JRA_1p4_2018.GISS.SWDN,CORE_IAF_JRA_1p4_2018.NCEP.Q_10,CORE_IAF_JRA_1p4_2018.NCEP.SLP_,CORE_IAF_JRA_1p4_2018.NCEP.T_10,CORE_IAF_JRA_1p4_2018.NCEP.U_10,CORE_IAF_JRA_1p4_2018.NCEP.V_10 + - CORE_IAF_JRA.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 + 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_1p4_2018.GCGCS.PREC,CORE_IAF_JRA_1p4_2018.GISS.LWDN,CORE_IAF_JRA_1p4_2018.GISS.SWDN,CORE_IAF_JRA_1p4_2018.NCEP.Q_10,CORE_IAF_JRA_1p4_2018.NCEP.SLP_,CORE_IAF_JRA_1p4_2018.NCEP.T_10,CORE_IAF_JRA_1p4_2018.NCEP.U_10,CORE_IAF_JRA_1p4_2018.NCEP.V_10 CORE2_IAF.NCEP.DENS.SOFS,CORE2_IAF.NCEP.PSLV.SOFS,CORE2_IAF.PREC.SOFS.DAILY,CORE2_IAF.LWDN.SOFS.DAILY,CORE2_IAF.SWDN.SOFS.DAILY,CORE2_IAF.SWUP.SOFS.DAILY,CORE2_IAF.SHUM.SOFS.6HOUR,CORE2_IAF.TBOT.SOFS.6HOUR,CORE2_IAF.U.SOFS.6HOUR,CORE2_IAF.V.SOFS.6HOUR,CORE2_IAF.CORE2.ArcFactor @@ -133,8 +135,7 @@ $ATM_DOMAIN_MESH - null - null + null @@ -148,23 +149,7 @@ $ATM_DOMAIN_MESH - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE - - - - - char - streams - abs - datm_nml - - file specifying model mesh - - - null - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE + null @@ -177,6 +162,7 @@ $ATM_NX + 1 @@ -189,8 +175,10 @@ $ATM_NY + 1 + char datm diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index 24af2bacd..7608c1072 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -211,7 +211,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -243,7 +242,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -279,7 +277,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -304,7 +301,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.cdf5.c2016.0.5d.ESMFmesh_c210330.nc $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Solar6Hrly/clmforc.cruncep.V7.c2016.0.5d.Solr.%ym.nc @@ -335,7 +332,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.cdf5.c2016.0.5d.ESMFmesh_c210330.nc $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Precip6Hrly/clmforc.cruncep.V7.c2016.0.5d.Prec.%ym.nc @@ -366,7 +363,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.cdf5.c2016.0.5d.ESMFmesh_c210330.nc $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/TPHWL6Hrly/clmforc.cruncep.V7.c2016.0.5d.TPQWL.%ym.nc @@ -380,7 +377,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -416,7 +412,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -448,7 +443,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -483,7 +477,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -519,7 +512,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -551,7 +543,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -586,7 +577,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -611,7 +601,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.cdf5.0.125d.v1.ESMFmesh_120620_c210330.nc $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Solar/ctsmforc.NLDAS2.0.125d.v1.Solr.%ym.nc @@ -642,7 +632,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.cdf5.0.125d.v1.ESMFmesh_120620_c210330.nc $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Precip/ctsmforc.NLDAS2.0.125d.v1.Prec.%ym.nc @@ -673,7 +663,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.cdf5.0.125d.v1.ESMFmesh_120620_c210330.nc $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/TPQWL/ctsmforc.NLDAS2.0.125d.v1.TPQWL.%ym.nc @@ -862,7 +852,6 @@ null bilinear - nn null 1979 @@ -894,7 +883,6 @@ null bilinear - nn null 1979 @@ -926,7 +914,6 @@ null bilinear - nn null 1979 @@ -951,7 +938,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.pr.ccsm4.rcp45.2006-2300.nc @@ -962,7 +949,6 @@ null bilinear - nn null 2006 @@ -983,7 +969,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.tas.ccsm4.rcp45.2006-2300.nc @@ -994,7 +980,6 @@ null bilinear - nn null 2006 @@ -1015,7 +1000,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.ps.ccsm4.rcp45.2006-2300.nc @@ -1026,7 +1011,6 @@ null bilinear - nn null 2006 @@ -1047,7 +1031,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.huss.ccsm4.rcp45.2006-2300.nc @@ -1058,7 +1042,6 @@ null bilinear - nn null 2006 @@ -1079,7 +1062,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.uas.ccsm4.rcp45.2006-2300.nc @@ -1090,7 +1073,6 @@ null bilinear - nn null 2006 @@ -1111,7 +1093,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.vas.ccsm4.rcp45.2006-2300.nc @@ -1122,7 +1104,6 @@ null bilinear - nn null 2006 @@ -1143,7 +1124,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rsds.ccsm4.rcp45.2006-2300.nc @@ -1154,7 +1135,6 @@ null bilinear - nn null 2006 @@ -1175,7 +1155,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rlds.ccsm4.rcp45.2006-2300.nc @@ -1186,7 +1166,6 @@ null bilinear - nn null 2006 @@ -1224,7 +1203,6 @@ null bilinear - nn u:v 1 @@ -1256,7 +1234,6 @@ null bilinear - nn u:v 1 @@ -1293,7 +1270,6 @@ null bilinear - nn u:v 1 @@ -1329,7 +1305,6 @@ null bilinear - nn u:v 1 @@ -1361,7 +1336,6 @@ null bilinear - nn u:v 1 @@ -1393,7 +1367,6 @@ null bilinear - nn u:v 1 @@ -1425,7 +1398,6 @@ null bilinear - nn u:v 1 @@ -1457,7 +1429,6 @@ null bilinear - nn u:v 1 @@ -1489,7 +1460,6 @@ null bilinear - nn u:v 1 @@ -1521,7 +1491,6 @@ null bilinear - nn u:v 1 @@ -1553,7 +1522,6 @@ null bilinear - nn u:v 1 @@ -1585,7 +1553,6 @@ null bilinear - nn u:v 1 @@ -1617,7 +1584,6 @@ null bilinear - nn u:v 1 @@ -1650,7 +1616,6 @@ null bilinear - nn u:v 1 @@ -1683,7 +1648,6 @@ null bilinear - nn u:v 1 @@ -1716,7 +1680,6 @@ null bilinear - nn u:v 1 @@ -1749,7 +1712,6 @@ null bilinear - nn u:v 1 @@ -1784,7 +1746,6 @@ null bilinear - nn u:v 1 @@ -1819,7 +1780,6 @@ null bilinear - nn u:v 1 @@ -1854,7 +1814,6 @@ null bilinear - nn u:v 1 @@ -1889,7 +1848,6 @@ null bilinear - nn u:v 1 @@ -1924,7 +1882,6 @@ null bilinear - nn u:v 1 @@ -1959,7 +1916,6 @@ null bilinear - nn u:v 1 @@ -1991,7 +1947,6 @@ null bilinear - nn u:v 1 @@ -2018,16 +1973,16 @@ - - - + + + - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.190528.nc prec Faxa_prec @@ -2035,12 +1990,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2054,12 +2008,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.190528.nc lwdn Faxa_lwdn @@ -2067,12 +2021,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2086,12 +2039,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.190528.nc swdn Faxa_swdn @@ -2099,12 +2052,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 -5400 coszen @@ -2118,12 +2070,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.190528.nc q_10 Sa_shum @@ -2131,12 +2083,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2150,12 +2101,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.190528.nc slp Sa_pslv @@ -2163,12 +2114,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2182,12 +2132,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.190528.nc t_10 Sa_tbot @@ -2195,12 +2145,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2214,12 +2163,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.190528.nc u_10 Sa_u @@ -2227,12 +2176,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2246,12 +2194,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.190528.nc v_10 Sa_v @@ -2259,7 +2207,41 @@ null bilinear - nn + + u:v + 1 + 1958 + 2018 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.171019.nc + + + prec Faxa_prec + + null + + bilinear u:v 1 @@ -2278,20 +2260,19 @@ single - + - $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/atm/datm7/CORE2/CORE2.t_10.ArcFactor.T62.1997-2004.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.171019.nc - TarcFactor tarcf + lwdn Faxa_lwdn null bilinear - nn u:v 1 @@ -2305,7 +2286,193 @@ cycle - 1.e30 + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.171019.nc + + + swdn Faxa_swdn + + null + + bilinear + + u:v + 1 + 1958 + 2016 + -5400 + + coszen + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.171019.nc + + + q_10 Sa_shum + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.171019.nc + + + slp Sa_pslv + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.171019.nc + + + t_10 Sa_tbot + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.171019.nc + + + u_10 Sa_u + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.171019.nc + + + v_10 Sa_v + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 single @@ -2361,7 +2528,6 @@ null bilinear - nn u:v @@ -2493,7 +2659,6 @@ null none - nn null 2015 @@ -2525,7 +2690,6 @@ null none - nn null 2015 @@ -2557,7 +2721,6 @@ null none - nn null 2015 @@ -2589,7 +2752,6 @@ null none - nn null 2015 @@ -2621,7 +2783,6 @@ null none - nn null 2015 @@ -2653,7 +2814,6 @@ null none - nn null 2015 @@ -2685,7 +2845,6 @@ null none - nn null 2015 @@ -2717,7 +2876,6 @@ null none - nn null 2015 @@ -2749,7 +2907,6 @@ null none - nn null 2015 @@ -2781,7 +2938,6 @@ null none - nn null 2015 @@ -2813,7 +2969,6 @@ null none - nn null 2015 @@ -2845,7 +3000,6 @@ null none - nn null 2015 @@ -2877,7 +3031,6 @@ null none - nn null 2015 @@ -2909,7 +3062,6 @@ null none - nn null 2015 @@ -2941,7 +3093,6 @@ null none - nn null 2015 @@ -2973,7 +3124,6 @@ null none - nn null 2015 @@ -3022,7 +3172,6 @@ null bilinear - nn null 1 @@ -3069,7 +3218,6 @@ null bilinear - nn null 1 @@ -3116,7 +3264,6 @@ null bilinear - nn null 1 @@ -3163,7 +3310,6 @@ null bilinear - nn null 1849 @@ -3210,7 +3356,6 @@ null bilinear - nn null 2015 @@ -3257,7 +3402,6 @@ null bilinear - nn null 2015 @@ -3304,7 +3448,6 @@ null bilinear - nn null 2015 @@ -3351,7 +3494,6 @@ null bilinear - nn null 2015 @@ -3398,7 +3540,6 @@ null bilinear - nn null 2015 @@ -3435,7 +3576,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3479,7 +3619,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3514,7 +3653,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3550,7 +3688,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3590,7 +3727,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3623,7 +3759,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3659,7 +3794,6 @@ null bilinear - nn null 1 diff --git a/datm/cime_config/testdefs/testmods_dirs/datm/scam/shell_commands b/datm/cime_config/testdefs/testmods_dirs/datm/scam/shell_commands index 8c3db56c2..3ebb269f8 100755 --- a/datm/cime_config/testdefs/testmods_dirs/datm/scam/shell_commands +++ b/datm/cime_config/testdefs/testmods_dirs/datm/scam/shell_commands @@ -2,7 +2,6 @@ # this should correspond to the forcing IOP coordinates ./xmlchange PTS_LON=206.0 ./xmlchange PTS_LAT=70.5 -./xmlchange PTS_MODE=TRUE # Specify the starting/ending time for the IOP # The complete time slice of IOP file is specified below diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 3dd53e0e9..45b566149 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -401,12 +401,12 @@ subroutine datm_datamode_clmncep_advance(masterproc, logunit, mpicom, rc) e = strm_rh(n) * 0.01_r8 * datm_esat(tbot,tbot) qsat = (0.622_r8 * e)/(pbot - 0.378_r8 * e) Sa_shum(n) = qsat - if (associated(strm_rh_16O) .and. associated(strm_rh_18O) .and. associated(strm_rh_HDO)) then +! if (associated(strm_rh_16O) .and. associated(strm_rh_18O) .and. associated(strm_rh_HDO)) then ! for isotopic tracer specific humidity, expect a delta, just keep the delta from the input file - Sa_shum_wiso(1,n) = strm_rh_16O(n) - Sa_shum_wiso(2,n) = strm_rh_18O(n) - Sa_shum_wiso(3,n) = strm_rh_HDO(n) - end if +! Sa_shum_wiso(1,n) = strm_rh_16O(n) +! Sa_shum_wiso(2,n) = strm_rh_18O(n) +! Sa_shum_wiso(3,n) = strm_rh_HDO(n) +! end if else if (associated(strm_tdew)) then if (tdewmax < 50.0_r8) strm_tdew(n) = strm_tdew(n) + tkFrz e = datm_esat(strm_tdew(n),tbot) diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 7f7815d04..6a29dba90 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -43,7 +43,6 @@ module datm_datamode_jra_mod ! stream data real(r8), pointer :: strm_prec(:) => null() real(r8), pointer :: strm_swdn(:) => null() - real(r8), pointer :: strm_tarcf(:) => null() ! othe module arrays real(R8), pointer :: yc(:) ! array of model latitudes @@ -145,8 +144,6 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_swdn , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'tarcf' , strm_tarcf , rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -185,10 +182,6 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) call shr_sys_abort(trim(subname)//'ERROR: prec and swdn must be in streams for CORE_IAF_JRA') endif - if (.not. associated(strm_tarcf)) then - call shr_sys_abort(trim(subname)//'ERROR: tarcf must be in an input stream for CORE_IAF_JRA') - endif - end subroutine datm_datamode_jra_init_pointers !=============================================================================== diff --git a/dice/CMakeLists.txt b/dice/CMakeLists.txt index bd24a640b..3118c33e2 100644 --- a/dice/CMakeLists.txt +++ b/dice/CMakeLists.txt @@ -17,8 +17,9 @@ add_library(dice ${SRCFILES}) add_dependencies(dice dshr streams) target_include_directories (dice PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../fox/include") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../dshr") target_include_directories (dice PRIVATE "${CMAKE_SOURCE_DIR}") -target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") -target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../share") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../streams") target_include_directories (dice PRIVATE "${PIO_Fortran_INCLUDE_DIR}") diff --git a/dice/cime_config/buildnml b/dice/cime_config/buildnml index aca70e45e..9bde0755b 100755 --- a/dice/cime_config/buildnml +++ b/dice/cime_config/buildnml @@ -63,15 +63,20 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config = {} config['ice_grid'] = ice_grid config['dice_mode'] = dice_mode - config['set_model_maskfile'] = 'false' - if case.get_value('PTS_MODE'): - config['mode'] = 'single_column' - config['set_model_maskfile'] = 'true' - else: - config['mode'] = case.get_value("ICE_DOMAIN_MESH") - if (ice_nx==atm_nx and ice_ny==atm_ny): - config['set_model_maskfile'] = 'true' + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if case.get_value('ATM_DOMAIN_FILE'): + if scol_lon > -999. and scol_lat >= -999. and case.get_value("ATM_DOMAIN_FILE") != "UNSET": + config['single_column'] = 'true' + else: + config['single_column'] = 'false' # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/dice/cime_config/namelist_definition_dice.xml b/dice/cime_config/namelist_definition_dice.xml index 7f375bfc1..64f68881a 100644 --- a/dice/cime_config/namelist_definition_dice.xml +++ b/dice/cime_config/namelist_definition_dice.xml @@ -54,8 +54,7 @@ file specifying model mesh $ICE_DOMAIN_MESH - null - null + null @@ -69,19 +68,7 @@ $MASK_MESH - - - - - char - streams - abs - dice_nml - file specifying if model mesh is to be created at runtime - - null - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE + null @@ -94,6 +81,7 @@ $ICE_NX + 1 @@ -106,6 +94,7 @@ $ICE_NY + 1 diff --git a/dice/dice_datamode_ssmi_mod.F90 b/dice/dice_datamode_ssmi_mod.F90 index f48244bb7..6f15fc9c7 100644 --- a/dice/dice_datamode_ssmi_mod.F90 +++ b/dice/dice_datamode_ssmi_mod.F90 @@ -6,7 +6,6 @@ module dice_datamode_ssmi_mod use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort - use shr_cal_mod , only : shr_cal_date2julian use shr_const_mod , only : shr_const_pi, shr_const_spval, shr_const_tkfrz, shr_const_latice use shr_frz_mod , only : shr_frz_freezetemp use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 2ebe8458d..7eef7caf8 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -11,14 +11,14 @@ module ice_comp_nuopc use ESMF , only : ESMF_AlarmIsRinging, ESMF_METHOD_INITIALIZE use ESMF , only : ESMF_ClockGet, ESMF_TimeGet, ESMF_MethodRemove, ESMF_MethodAdd use ESMF , only : ESMF_GridCompSetEntryPoint, operator(+), ESMF_AlarmRingerOff - use ESMF , only : ESMF_ClockGetAlarm + use ESMF , only : ESMF_ClockGetAlarm, ESMF_StateGet, ESMF_Field, ESMF_FieldGet use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise use NUOPC_Model , only : model_routine_SS => SetServices use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, cxx=>shr_kind_cxx, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_const_mod , only : shr_const_pi use shr_sys_mod , only : shr_sys_abort @@ -41,7 +41,7 @@ module ice_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -73,7 +73,6 @@ module ice_comp_nuopc character(CL) :: dataMode ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from real(R8) :: flux_swpf ! short-wave penatration factor real(R8) :: flux_Qmin ! bound on melt rate logical :: flux_Qacc ! activates water accumulation/melt wrt Q @@ -90,6 +89,7 @@ module ice_comp_nuopc ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() integer , pointer :: model_mask(:) => null() + logical :: valid_ice = .true. ! used for single column logic (ocn mask > 0) ! constants logical :: flds_i2o_per_cat ! .true. if select per ice thickness @@ -114,6 +114,7 @@ subroutine SetServices(gcomp, rc) !-------------------------------- rc = ESMF_SUCCESS + ! the NUOPC gcomp component will register the generic methods call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -170,7 +171,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) !------------------------------------------------------------------------------- namelist / dice_nml / case_name, datamode, & - model_meshfile, model_maskfile, model_createmesh_fromfile, & + model_meshfile, model_maskfile, & restfilm, nx_global, ny_global, flux_swpf, flux_Qmin, flux_Qacc, flux_Qacc0 rc = ESMF_SUCCESS @@ -201,12 +202,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) write(logunit,F01)' nx_global = ',nx_global write(logunit,F01)' ny_global = ',ny_global write(logunit,F03)' flux_swpf = ',flux_swpf @@ -214,43 +211,19 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F02)' flux_Qacc = ',flux_Qacc write(logunit,F03)' flux_Qacc0 = ',flux_Qacc0 write(logunit,F00)' restfilm = ',trim(restfilm) - - ! check that files exists - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if endif ! broadcast namelist input - call shr_mpi_bcast(datamode , mpicom, 'datamode') - call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') - call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') - 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(flux_swpf , mpicom, 'flux_swpf') - call shr_mpi_bcast(flux_Qmin , mpicom, 'flux_Qmin') - call shr_mpi_bcast(flux_Qacc , mpicom, 'flux_Qacc') - call shr_mpi_bcast(flux_Qacc0 , mpicom, 'flux_Qacc0') + 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(flux_swpf , mpicom, 'flux_swpf') + call shr_mpi_bcast(flux_Qmin , mpicom, 'flux_Qmin') + call shr_mpi_bcast(flux_Qacc , mpicom, 'flux_Qacc') + call shr_mpi_bcast(flux_Qacc0 , mpicom, 'flux_Qacc0') ! Validate datamode if ( trim(datamode) == 'ssmi' .or. trim(datamode) == 'ssmi_iaf') then @@ -293,6 +266,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(R8) :: cosarg ! for setting ice temp pattern real(R8) :: jday, jday0 ! elapsed day counters integer :: model_dt ! integer model timestep + type(ESMF_Field) :: lfield + character(CL) ,pointer :: lfieldnamelist(:) => null() + integer :: fieldcount + real(r8), pointer :: fldptr(:) + integer :: n character(len=*), parameter :: F00 = "('ice_comp_nuopc: ')',8a)" character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -302,8 +280,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('dice_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ICE', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type @@ -324,6 +301,30 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) subname//':diceImport', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! for single column, the target point might not be a point where the ice/ocn mask is > 0 + if (size(model_frac) == 1 .and. model_frac(1) == 0._r8) then + valid_ice = .false. + call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + if (trim(lfieldnamelist(n)) /= flds_scalar_name) then + call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, farrayPtr=fldptr, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr(:) = 0._r8 + end if + enddo + deallocate(lfieldnamelist) + ! ******************* + ! *** RETURN HERE *** + ! ******************* + RETURN + end if + ! Get the time to interpolate the stream data to call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -377,6 +378,10 @@ subroutine ModelAdvance(gcomp, rc) character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' !------------------------------------------------------------------------------- + if (.not. valid_ice) then + RETURN + end if + rc = ESMF_SUCCESS call ESMF_TraceRegionEnter(subname) diff --git a/dlnd/CMakeLists.txt b/dlnd/CMakeLists.txt index 92c20be7d..57e4426bd 100644 --- a/dlnd/CMakeLists.txt +++ b/dlnd/CMakeLists.txt @@ -15,8 +15,9 @@ add_library(dlnd ${SRCFILES}) add_dependencies(dlnd dshr streams) target_include_directories (dlnd PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../dshr") target_include_directories (dlnd PRIVATE "${CMAKE_SOURCE_DIR}") -target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") -target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../share") +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../streams") target_include_directories (dlnd PRIVATE "${PIO_Fortran_INCLUDE_DIR}") +target_include_directories (dlnd PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/dlnd/cime_config/buildnml b/dlnd/cime_config/buildnml index 667657784..941abcec5 100755 --- a/dlnd/cime_config/buildnml +++ b/dlnd/cime_config/buildnml @@ -63,8 +63,17 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['create_mesh'] = 'true' if case.get_value("LND_DOMAIN_MESH") == 'create_mesh' else 'false' # Do not allow single column mode for dlnd - expect(not case.get_value('PTS_MODE'), - "for DLND, single column mode is not allowed") + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if (scol_lon > -999. and scol_lat > 999.): + expect(False, + "single column mode for DLND is not currently allowed") # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/dlnd/cime_config/config_component.xml b/dlnd/cime_config/config_component.xml index 129cfa551..6fc60c254 100644 --- a/dlnd/cime_config/config_component.xml +++ b/dlnd/cime_config/config_component.xml @@ -49,7 +49,7 @@ char UNSET - $DIN_LOC_ROOT/lnd/dlnd7/CPLHIST_SNO/i.e20.I1850Clm50Sp.f09_g17.001_c180502 + $DIN_LOC_ROOT/lnd/dlnd7/CPLHIST_SNO/b.e21.B1850.f09_g17.CMIP6-piControl.001_c210324 run_component_dlnd env_run.xml @@ -60,7 +60,7 @@ char UNSET - i.e20.I1850Clm50Sp.f09_g17.001 + b.e21.B1850.f09_g17.CMIP6-piControl.001 run_component_dlnd env_run.xml @@ -94,7 +94,7 @@ integer -999 - 1 + 1971 run_component_dlnd env_run.xml @@ -105,7 +105,7 @@ integer -999 - 30 + 2000 run_component_dlnd env_run.xml diff --git a/dlnd/cime_config/namelist_definition_dlnd.xml b/dlnd/cime_config/namelist_definition_dlnd.xml index 0072c3662..9efa1b853 100644 --- a/dlnd/cime_config/namelist_definition_dlnd.xml +++ b/dlnd/cime_config/namelist_definition_dlnd.xml @@ -63,20 +63,6 @@ - - char - streams - abs - dlnd_nml - - file specifying model mesh - - - null - $LND_DOMAIN_PATH/$LND_DOMAIN_FILE - - - integer streams diff --git a/dlnd/cime_config/stream_definition_dlnd.xml b/dlnd/cime_config/stream_definition_dlnd.xml index 74ec272fe..292d8834d 100644 --- a/dlnd/cime_config/stream_definition_dlnd.xml +++ b/dlnd/cime_config/stream_definition_dlnd.xml @@ -19,7 +19,9 @@ $LND_DOMAIN_MESH - $DLND_CPLHIST_DIR/$DLND_CPLHIST_CASE.cpl.hl2x1yr_glc.%y-01-01.nc + + $DLND_CPLHIST_DIR/$DLND_CPLHIST_CASE.cpl.hl2x1yr_glc.%y-01-01.nc l2x1yr_glc_Sl_tsrf%glc Sl_tsrf_elev%glc diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index f863e2c84..8f8649d9e 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -17,7 +17,7 @@ module lnd_comp_nuopc use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort use shr_cal_mod , only : shr_cal_ymd2date @@ -36,7 +36,7 @@ module lnd_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -69,7 +69,6 @@ module lnd_comp_nuopc character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from character(CL) :: streamfilename ! filename to obtain stream info from character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from logical :: force_prognostic_true = .false. ! if true set prognostic true @@ -165,7 +164,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) character(*) , parameter :: F02 = "('(lnd_comp_nuopc) ',a,l6)" !------------------------------------------------------------------------------- - namelist / dlnd_nml / datamode, model_meshfile, model_maskfile, model_createmesh_fromfile, & + namelist / dlnd_nml / datamode, model_meshfile, model_maskfile, & nx_global, ny_global, restfilm, force_prognostic_true rc = ESMF_SUCCESS @@ -197,7 +196,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) 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(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') 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') @@ -205,12 +203,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out if (my_task == master_task) then - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) write(logunit ,*)' datamode = ',datamode write(logunit ,*)' nx_global = ',nx_global write(logunit ,*)' ny_global = ',ny_global @@ -218,30 +212,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit ,*)' force_prognostic_true = ',force_prognostic_true endif - ! Check that files exists - if (my_task == master_task) then - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if - endif - ! Validate sdat datamode if (trim(datamode) == 'copyall') then if (my_task == master_task) write(logunit,*) 'dlnd datamode = ',trim(datamode) @@ -283,13 +253,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat call ESMF_TraceRegionEnter('dlnd_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'LND', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) ! Initialize stream data type streamfilename = 'dlnd.streams'//trim(inst_suffix) #ifndef DISABLE_FoX - streamfilename = trim(streamfilename)'.xml' + streamfilename = trim(streamfilename)//'.xml' #endif call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'LND', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index 71c011478..36ad40542 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -19,8 +19,9 @@ add_library(docn ${SRCFILES}) add_dependencies(docn dshr streams) target_include_directories (docn PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/dshr) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../dshr) target_include_directories (docn PRIVATE ${CMAKE_SOURCE_DIR}) -target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) -target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../share) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../streams) target_include_directories (docn PRIVATE ${PIO_Fortran_INCLUDE_DIR}) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/docn/cime_config/buildnml b/docn/cime_config/buildnml index 16066f7a3..816305ad2 100755 --- a/docn/cime_config/buildnml +++ b/docn/cime_config/buildnml @@ -67,9 +67,22 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['model_grid'] = model_grid config['ocn_grid'] = ocn_grid config['docn_mode'] = docn_mode - config['create_mesh'] = 'true' if case.get_value("OCN_DOMAIN_MESH") == 'create_mesh' else 'false' config['aqua_planet'] = 'true' if 'aquap' in docn_mode else 'false' + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if case.get_value('ATM_DOMAIN_FILE'): + if scol_lon > -999. and scol_lat > -999. and case.get_value("ATM_DOMAIN_FILE") != "UNSET": + config['single_column'] = 'true' + else: + config['single_column'] = 'false' + nmlgen.init_defaults(infile, config) # Generate docn_in diff --git a/docn/cime_config/config_component.xml b/docn/cime_config/config_component.xml index 27ace8a99..8e5503db4 100644 --- a/docn/cime_config/config_component.xml +++ b/docn/cime_config/config_component.xml @@ -118,6 +118,19 @@ Sets globally constant SST value + + char + + unset + + $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.2degFV_c20170421.nc + $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.1degFV_c20170421.nc + + run_component_docn + env_run.xml + Sets SOM aquaplanet file + + char diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index aa5a050f5..dbf559068 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -18,8 +18,8 @@ prescribed interannual - som som_aquap + som aquapfile '' '' @@ -119,8 +119,7 @@ $OCN_DOMAIN_MESH - null - null + null @@ -135,21 +134,7 @@ $MASK_MESH $ATM_DOMAIN_MESH - - - - - char - streams - abs - docn_nml - - file specifying model mesh - - - null - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE + null @@ -162,6 +147,7 @@ $OCN_NX + 1 @@ -174,6 +160,7 @@ $OCN_NY + 1 diff --git a/docn/cime_config/stream_definition_docn.xml b/docn/cime_config/stream_definition_docn.xml index a1be32f34..1f3866404 100644 --- a/docn/cime_config/stream_definition_docn.xml +++ b/docn/cime_config/stream_definition_docn.xml @@ -114,11 +114,9 @@ $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.2degFV_c20170421.nc - $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.1degFV_c20170421.nc + $DOCN_SOMAQP_DATAFILE T So_t diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index 790990fa6..3bb1563c9 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -7,7 +7,6 @@ module docn_datamode_som_mod use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort - use shr_cal_mod , only : shr_cal_date2julian use shr_const_mod , only : shr_const_cpsw, shr_const_rhosw, shr_const_TkFrz use shr_const_mod , only : shr_const_TkFrzSw, shr_const_latice, shr_const_ocn_ref_sal use shr_const_mod , only : shr_const_zsrflyr, shr_const_pi @@ -162,8 +161,6 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(importState, 'Foxx_lwup' , fldptr1=Foxx_lwup , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Foxx_lwup' , fldptr1=Foxx_lwup , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(importState, 'Foxx_sen' , fldptr1=Foxx_sen , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(importState, 'Foxx_lat' , fldptr1=Foxx_lat , rc=rc) diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 86ad49a7e..46391bd36 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -11,13 +11,14 @@ module ocn_comp_nuopc use ESMF , only : ESMF_Alarm, ESMF_MethodRemove, ESMF_MethodAdd use ESMF , only : ESMF_GridCompSetEntryPoint, ESMF_ClockGetAlarm, ESMF_AlarmIsRinging use ESMF , only : ESMF_StateGet, operator(+), ESMF_AlarmRingerOff, ESMF_LogWrite + use ESMF , only : ESMF_Field, ESMF_FieldGet use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_Advertise, NUOPC_CompAttributeGet use NUOPC_Model , only : model_routine_SS => SetServices use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort use shr_cal_mod , only : shr_cal_ymd2date @@ -53,7 +54,7 @@ module ocn_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -86,7 +87,6 @@ module ocn_comp_nuopc character(CL) :: datamode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from real(R8) :: sst_constant_value ! sst constant value integer :: aquap_option ! if aqua-planet mode, option to use character(CL) :: restfilm = nullstr ! model restart file namelist @@ -101,6 +101,7 @@ module ocn_comp_nuopc ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() integer , pointer :: model_mask(:) => null() + logical :: valid_ocn = .true. ! used for single column logic ! constants logical :: aquaplanet = .false. @@ -181,7 +182,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) !------------------------------------------------------------------------------- namelist / docn_nml / datamode, & - model_meshfile, model_maskfile, model_createmesh_fromfile, & + model_meshfile, model_maskfile, & restfilm, nx_global, ny_global, sst_constant_value rc = ESMF_SUCCESS @@ -213,44 +214,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out write(logunit,F00)' case_name = ',trim(case_name) write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + 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) - - ! check that files exists - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if 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(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') 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') @@ -309,12 +283,17 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_Time) :: currTime - integer :: current_ymd ! model date - integer :: current_year ! model year - integer :: current_mon ! model month - integer :: current_day ! model day - integer :: current_tod ! model sec into model date + type(ESMF_Time) :: currTime + integer :: current_ymd ! model date + integer :: current_year ! model year + integer :: current_mon ! model month + integer :: current_day ! model day + integer :: current_tod ! model sec into model date + type(ESMF_Field) :: lfield + character(CL) ,pointer :: lfieldnamelist(:) => null() + integer :: fieldcount + real(r8), pointer :: fldptr(:) + integer :: n character(len=*), parameter :: subname=trim(module_name)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -323,8 +302,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize model mesh, restart flag, logunit, model_mask and model_frac call ESMF_TraceRegionEnter('docn_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'OCN', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type if not aqua planet @@ -348,6 +326,30 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) subname//trim(modelname)//':Import', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! for single column, the target point might not be a valid ocn point + if (size(model_mask) == 1 .and. model_mask(1) == 0) then + valid_ocn = .false. + call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + if (trim(lfieldnamelist(n)) /= flds_scalar_name) then + call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, farrayPtr=fldptr, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr(:) = 0._r8 + end if + enddo + deallocate(lfieldnamelist) + ! ******************* + ! *** RETURN HERE *** + ! ******************* + RETURN + end if + ! Get the time to interpolate the stream data to call ESMF_ClockGet(clock, currTime=currTime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -389,8 +391,13 @@ subroutine ModelAdvance(gcomp, rc) character(len=*),parameter :: subname=trim(module_name)//':(ModelAdvance) ' !------------------------------------------------------------------------------- + rc = ESMF_SUCCESS + if (.not. valid_ocn) then + RETURN + end if + call memcheck(subname, 5, my_task == master_task) ! query the Component for its clock, importState and exportState diff --git a/drof/CMakeLists.txt b/drof/CMakeLists.txt index 50bbb20f1..6186b2bff 100644 --- a/drof/CMakeLists.txt +++ b/drof/CMakeLists.txt @@ -15,8 +15,9 @@ add_library(drof ${SRCFILES}) add_dependencies(drof dshr streams) target_include_directories (drof PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../dshr") target_include_directories (drof PRIVATE "${CMAKE_SOURCE_DIR}") -target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") -target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../share") +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../streams") target_include_directories (drof PRIVATE "${PIO_Fortran_INCLUDE_DIR}") +target_include_directories (drof PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/drof/cime_config/buildnml b/drof/cime_config/buildnml index f7d567504..4d1455b19 100755 --- a/drof/cime_config/buildnml +++ b/drof/cime_config/buildnml @@ -60,11 +60,19 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # Note: always use model mesh file to set mask for drof config = {} config['drof_mode'] = drof_mode - config['create_mesh'] = 'true' if case.get_value("ROF_DOMAIN_MESH") == 'create_mesh' else 'false' # Do not allow single column mode for drof - expect(not case.get_value('PTS_MODE'), - "for, DROF single column mode is not allowed") + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if (scol_lon > -999. and scol_lat > 999.): + expect(False, + "single column mode for DROF is not currently allowed") # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/drof/cime_config/config_component.xml b/drof/cime_config/config_component.xml index 39e18c02e..7d0e8a62d 100644 --- a/drof/cime_config/config_component.xml +++ b/drof/cime_config/config_component.xml @@ -13,14 +13,22 @@ --> - Data runoff model + Data runoff model + NULL mode COREv2 normal year forcing: COREv2 interannual year forcing: COREv2 interannual year forcing: COREv2 interannual year forcing: COREv2 interannual year forcing: CPLHIST mode: + JRA55 interannual forcing, v1.4, through 2018 + JRA55 interannual forcing, v1.4, through 2018, no rofi around AIS + JRA55 interannual forcing, v1.4, through 2018, no rofl around AIS + JRA55 interannual forcing, v1.4, through 2018, no rofi or rofl around AIS JRA55 interannual forcing + JRA55 Repeat Year Forcing v1.3 1984-1985 + JRA55 Repeat Year Forcing v1.3 1990-1991 + JRA55 Repeat Year Forcing v1.3 2003-2004 @@ -34,9 +42,10 @@ char - CPLHIST,DIATREN_ANN_RX1,DIATREN_IAF_RX1,DIATREN_IAF_AIS00_RX1,DIATREN_IAF_AIS45_RX1,DIATREN_IAF_AIS55_RX1,IAF_JRA,IAF_JRA_1p4_2018 + CPLHIST,DIATREN_ANN_RX1,DIATREN_IAF_RX1,DIATREN_IAF_AIS00_RX1,DIATREN_IAF_AIS45_RX1,DIATREN_IAF_AIS55_RX1,IAF_JRA,IAF_JRA_1p4_2018,IAF_JRA_1p4_2018_AIS0ICE,IAF_JRA_1p4_2018_AIS0LIQ,IAF_JRA_1p4_2018_AIS0ROF,RYF8485_JRA,RYF9091_JRA,RYF0304_JRA,NULL DIATREN_ANN_RX1 + NULL DIATREN_ANN_RX1 DIATREN_ANN_AIS00_RX1 DIATREN_ANN_AIS45_RX1 @@ -48,15 +57,23 @@ CPLHIST IAF_JRA IAF_JRA_1p4_2018 + IAF_JRA_1p4_2018_AIS0ICE + IAF_JRA_1p4_2018_AIS0LIQ + IAF_JRA_1p4_2018_AIS0ROF + RYF8485_JRA + RYF9091_JRA + RYF0304_JRA + NULL run_component_drof env_run.xml - DROF mode. Values are CPLHIST, *_RX1. In *_RX1 mode, + DROF mode. Values are CPLHIST, *_RX1, and NULL. In *_RX1 mode, observational climatological or interannual 1-degree runoff data is used. In CPLHIST mode, runoff - data from a previous model run is read in. - In CPLHIST mode, runoff forcing data from a previous - model run is output by the coupler and read in by the data model. + data from a previous model run is read in. In NULL mode, the runoff + data is set to zero. In CPLHIST mode, runoff forcing data from a previous + model run is output by the coupler and read in by the data rof + model. In NULL mode, runoff forcing is set to zero and not used. The default is DIATREN_ANN_RX1. diff --git a/drof/cime_config/namelist_definition_drof.xml b/drof/cime_config/namelist_definition_drof.xml index be837ce15..4ce7daaff 100644 --- a/drof/cime_config/namelist_definition_drof.xml +++ b/drof/cime_config/namelist_definition_drof.xml @@ -51,7 +51,6 @@ $ROF_DOMAIN_MESH - null @@ -68,20 +67,6 @@ - - char - streams - abs - drof_nml - - file specifying model mesh - - - null - $ROF_DOMAIN_PATH/$ROF_DOMAIN_FILE - - - integer streams diff --git a/drof/cime_config/stream_definition_drof.xml b/drof/cime_config/stream_definition_drof.xml index 2a3efef97..8c3362a9d 100644 --- a/drof/cime_config/stream_definition_drof.xml +++ b/drof/cime_config/stream_definition_drof.xml @@ -320,7 +320,135 @@ $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.%y.170807.nc + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.190214.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.no_rofi.190214.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.no_rofl.190214.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.no_rofi.190214.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.no_rofi_no_rofl.190214.nc rofl Forr_rofl diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index a9937f1a6..5c901c5d0 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -17,7 +17,7 @@ module rof_comp_nuopc use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_const_mod , only : SHR_CONST_SPVAL use shr_sys_mod , only : shr_sys_abort @@ -36,6 +36,7 @@ module rof_comp_nuopc private ! except public :: SetServices + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -66,7 +67,6 @@ module rof_comp_nuopc character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from character(CL) :: restfilm = nullstr ! model restart file namelist integer :: nx_global integer :: ny_global @@ -161,7 +161,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) character(*) ,parameter :: F02 = "('(rof_comp_nuopc) ',a,l6)" !------------------------------------------------------------------------------- - namelist / drof_nml / datamode, model_meshfile, model_maskfile, model_createmesh_fromfile, & + namelist / drof_nml / datamode, model_meshfile, model_maskfile, & restfilm, nx_global, ny_global rc = ESMF_SUCCESS @@ -192,44 +192,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + 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) - - ! check that files exists - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if - endif + end if ! 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(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') 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') @@ -280,8 +253,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('drof_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ROF', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type diff --git a/dshr/CMakeLists.txt b/dshr/CMakeLists.txt index 05f94b901..4b227ba9c 100644 --- a/dshr/CMakeLists.txt +++ b/dshr/CMakeLists.txt @@ -19,9 +19,9 @@ endif() add_dependencies(dshr streams) target_include_directories (dshr PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) -target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) +target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../streams) +target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../share) target_include_directories (dshr PRIVATE "${PIO_Fortran_INCLUDE_DIR}") install(TARGETS dshr - LIBRARY DESTINATION lib) \ No newline at end of file + LIBRARY DESTINATION lib) diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index 72969d487..d950dc331 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -60,9 +60,9 @@ module dshr_mod public :: dshr_orbital_update public :: dshr_orbital_init - private :: dshr_mesh_create - private :: dshr_alarm_init - private :: dshr_time_init + private :: dshr_mesh_create_scol ! create mesh for single column mode + private :: dshr_alarm_init ! initialize alarms + private :: dshr_time_init ! initialize time ! Note that gridTofieldMap = 2, therefore the ungridded dimension is innermost @@ -212,8 +212,7 @@ end subroutine dshr_init !=============================================================================== subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, model_nyg, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, read_restart, rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, read_restart, rc) ! ---------------------------------------------- ! Initialize model mesh @@ -229,7 +228,6 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo integer , intent(in) :: model_nyg character(len=*) , intent(in) :: model_meshfile character(len=*) , intent(in) :: model_maskfile - character(len=*) , intent(in) :: model_createmesh_fromfile type(ESMF_Mesh) , intent(out) :: model_mesh integer , pointer , intent(out) :: model_mask(:) real(r8), pointer , intent(out) :: model_frac(:) @@ -238,25 +236,19 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo ! local variables type(ESMF_VM) :: vm - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar + logical :: masterproc type(ESMF_DistGrid) :: distGrid - integer, pointer :: model_gindex(:) ! model global index spzce - integer :: mpicom integer :: my_task - logical :: scol_mode real(r8) :: scol_lon real(r8) :: scol_lat character(CL) :: cvalue - integer :: lsize ! local size of mesh - integer :: petcount + integer :: lsize ! local size of mesh type(ESMF_Array) :: elemMaskArray - type(file_desc_t) :: pioid - type(var_desc_t) :: varid - integer :: rcode logical :: isPresent, isSet - logical :: masterproc - character(len=*), parameter :: subname='(dshr_mod:dshr_mesh_init)' + logical :: exists ! check for file existence + real(r8) :: scol_spval = -999._r8 character(*) , parameter :: F00 ="('(dshr_mesh_init) ',a)" + character(len=*), parameter :: subname='(dshr_mod:dshr_mesh_init)' ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -264,11 +256,11 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo ! generate local mpi comm call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMGet(vm, mpiCommunicator=mpicom, localPet=my_task, petcount=petcount, rc=rc) + call ESMF_VMGet(vm, localPet=my_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + masterproc = (my_task == master_task) ! Set restart flag - ! TODO: should this be a variable from the driver? call NUOPC_CompAttributeGet(gcomp, name='read_restart', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent .and. isSet) then @@ -277,66 +269,44 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo call shr_sys_abort(subname//' ERROR: read restart flag must be present') end if - masterproc = (my_task == master_task) - - ! Obtain the data model mesh - ! (1) if asked to create the mesh - ! - create mesh from input file given by model_createmesh_fromfile - ! - if single column find the nearest neighbor in model_createmesh_fromfile - ! (2) if not single column - obtain the mesh directly from the mesh input - ! - reset the model mesh if the model maskfile is not equal to the model mesh file + ! obtain the single column lon and lat + call NUOPC_CompAttributeGet(gcomp, name='scol_lon', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) then + read(cvalue,*) scol_lon + else + scol_lon = scol_spval + end if + call NUOPC_CompAttributeGet(gcomp, name='scol_lat', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) then + read(cvalue,*) scol_lat + else + scol_lat = scol_spval + end if - if (trim(model_meshfile) == nullstr) then + if (scol_lon > scol_spval .and. scol_lat > scol_spval) then - ! Get single column values - call NUOPC_CompAttributeGet(gcomp, name='single_column', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - read(cvalue,*) scol_mode - if (scol_mode) then - ! verify that ROF, WAV and LND are not trying to use single column mode - if (trim(compname) == 'ROF' .or. trim(compname) == 'LND' .or. trim(compname) == 'WAV') then - if (masterproc) then - write(logunit,*) subname,' ERROR: '//trim(compname)//' does not support single column mode ' - end if - call shr_sys_abort(subname//' ERROR: '//trim(compname)//' does not support single column mode ') - end if - - ! verify that are only using 1 pe - if (petcount > 1) then - if (masterproc) then - write(logunit,*) subname,' ERROR: single column mode must be run on one pe, petcount= ',petcount - end if - call shr_sys_abort(subname//' ERROR: single column mode must be run on 1 pe') - endif - - ! obtain the single column lon and lat - call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_lon - call NUOPC_CompAttributeGet(gcomp, name='scmlat', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_lat - if (my_task == master_task) then - write(logunit,*) ' single column mode, lon lat = ',scol_mode, scol_lon, scol_lat - end if - else - scol_lon = shr_const_spval - scol_lat = shr_const_spval - end if - else - scol_mode = .false. - scol_lon = shr_const_spval - scol_lat = shr_const_spval - end if - - ! Now create the model meshfile - call dshr_mesh_create(trim(model_createmesh_fromfile), scol_mode, scol_lon, scol_lat, & - trim(compname), sdat, my_task, logunit, model_mesh, model_mask, model_frac, rc=rc) + ! This is simply a single point run + call dshr_mesh_create_scol(gcomp, compname, scol_lon, scol_lat, model_mesh, model_mask, model_frac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else + ! check that model_meshfile and model_maskfile exists + if (my_task == master_task) then + inquire(file=trim(model_meshfile), exist=exists) + if (.not.exists) then + write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' + call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') + end if + inquire(file=trim(model_maskfile), exist=exists) + if (.not.exists) then + write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' + call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') + end if + endif + ! Read in the input model mesh model_mesh = ESMF_MeshCreate(trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -384,285 +354,78 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo end if end if - end subroutine dshr_mesh_init !=============================================================================== - subroutine dshr_mesh_create(filename, scol_mode, scol_lon, scol_lat, & - compname, sdat, my_task, logunit, model_mesh, model_mask, model_frac, rc) + subroutine dshr_mesh_create_scol(gcomp, compname, scol_lon, scol_lat, & + model_mesh, model_mask, model_frac, rc) - ! Create the model mesh from the domain file - for either single column mode - ! or for a regional grid + ! Create a single column mesh - the area is arbitrary ! input/output variables - character(len=*) , intent(in) :: filename - logical , intent(in) :: scol_mode + type(ESMF_GridComp) , intent(inout) :: gcomp + character(len=*) , intent(in) :: compname real(r8) , intent(inout) :: scol_lon real(r8) , intent(inout) :: scol_lat - character(len=*) , intent(in) :: compname - type(shr_strdata_type), intent(in) :: sdat - integer , intent(in) :: my_task - integer , intent(in) :: logunit type(ESMF_Mesh) , intent(out) :: model_mesh - integer , pointer , intent(out) :: model_mask(:) - real(r8), pointer , intent(out) :: model_frac(:) + integer , pointer , intent(inout) :: model_mask(:) + real(r8), pointer , intent(inout) :: model_frac(:) integer , intent(out) :: rc ! local variables - type(file_desc_t) :: pioid - integer :: rcode ! error code - type(var_desc_t) :: varid ! variable id - integer :: dimid ! dimension id - integer :: ni, nj, nv ! dimension sizes - integer :: i,j + type(ESMF_Grid) :: lgrid + character(CL) :: cvalue integer :: maxIndex(2) real(r8) :: mincornerCoord(2) real(r8) :: maxcornerCoord(2) - type(ESMF_Grid) :: lgrid - integer :: spatialDim ! number of dimension in mesh - integer :: numOwnedElements ! number of elements owned by this PET - real(r8), pointer :: ownedElemCoords(:) ! mesh element coordinates owned by this PET - integer :: n ! index - integer :: start(2) ! start index to read in for single column mode - integer :: count(2) ! number of points to read in - real(r8), allocatable :: xv(:,:,:), yv(:,:,:) ! coordinates of vertices - real(r8), allocatable :: xc(:,:), yc(:,:) ! coordinates of centers - real(r8) :: scol_data(1) ! temporary - integer , allocatable :: mask(:) ! temporary - real(r8), allocatable :: lats(:) ! temporary - real(r8), allocatable :: lons(:) ! temporary - real(r8), allocatable :: pos_lons(:) ! temporary - real(r8) :: pos_scol_lon ! temporary - real(r8) :: scol_area ! temporary - character(len=*), parameter :: subname='(dshr_mesh_create)' + character(len=*), parameter :: subname='(dshr_mesh_create_single_column)' ! ---------------------------------------------- rc = ESMF_SUCCESS - !------------------------------------- - ! open domain file and get dimensions - !------------------------------------- - - rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) - call pio_check_err(rcode, 'error opening file '//trim(filename)) - call PIO_seterrorhandling(pioid, PIO_BCAST_ERROR) - - rcode = pio_inq_dimid(pioid, 'ni', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for ni in file '//trim(filename)) - rcode = pio_inquire_dimension(pioid, dimid, len=ni) - call pio_check_err(rcode, 'pio_inq_dimension for ni in file '//trim(filename)) - - rcode = pio_inq_dimid(pioid, 'nj', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for nj in file '//trim(filename)) - rcode = pio_inquire_dimension(pioid, dimid, len=nj) - call pio_check_err(rcode, 'pio_inq_dimension for nj in file '//trim(filename)) - - rcode = pio_inq_dimid(pioid, 'nv', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for nv in file '//trim(filename)) - rcode = pio_inquire_dimension(pioid, dimid, len=nv) - call pio_check_err(rcode, 'pio_inq_dimension for nv in file '//trim(filename)) - - !------------------------------------- - ! Single column model (size 1) - !------------------------------------- - - if (scol_mode) then - - ! get lons from domain file - rcode = pio_inq_varid(pioid, 'xc', varid) - call pio_check_err(rcode, 'pio_inq_varid for xc in file '//trim(filename)) - allocate(xc(ni,nj)) - rcode = pio_get_var(pioid, varid, xc) - call pio_check_err(rcode, 'pio_get_var for xc in file '//trim(filename)) - - ! get lats from domain file - rcode = pio_inq_varid(pioid, 'yc', varid) - call pio_check_err(rcode, 'pio_inq_varid for yc in file '//trim(filename)) - allocate(yc(ni,nj)) - rcode = pio_get_var(pioid, varid, yc) - call pio_check_err(rcode, 'pio_get_var for yc in file '//trim(filename)) - - ! find nearest neighbor indices of scol_lon and scol_lat in domain file - allocate(lats(nj)) - allocate(lons(ni)) - allocate(pos_lons(ni)) - do i = 1,ni - lons(i) = xc(i,1) - end do - do j = 1,nj - lats(j) = yc(1,j) - end do - pos_lons(:) = mod(lons(:) + 360._r8, 360._r8) - pos_scol_lon = mod(scol_lon + 360._r8, 360._r8) - start(1) = (MINLOC(abs(pos_lons - pos_scol_lon), dim=1)) - start(2) = (MINLOC(abs(lats -scol_lat ), dim=1)) - count(:) = 1 - deallocate(lons) - deallocate(lats) - - ! read in value of nearest neighbor lon and RESET scol_lat - rcode = pio_inq_varid(pioid, 'xc' , varid) - call pio_check_err(rcode, 'pio_inq_varid for xc in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for xc in file '//trim(filename)) - scol_lon = scol_data(1) - - ! read in value of nearest neighbor lon and RESET scol_lon - rcode = pio_inq_varid(pioid, 'yc' , varid) - call pio_check_err(rcode, 'pio_inq_varid for yc in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for yc in file '//trim(filename)) - scol_lat = scol_data(1) - - ! get area of gridcell - rcode = pio_inq_varid(pioid, 'area', varid) - call pio_check_err(rcode, 'pio_inq_varid for area in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for area in file '//trim(filename)) - scol_area = scol_data(1) - - ! create the single column grid - maxIndex(1) = 1 ! number of lons - maxIndex(2) = 1 ! number of lats - mincornerCoord(1) = scol_lon - scol_area/2._r8 ! min lon - mincornerCoord(2) = scol_lat - scol_area/2._r8 ! min lat - maxcornerCoord(1) = scol_lon + scol_area/2._r8 ! max lon - maxcornerCoord(2) = scol_lat + scol_area/2._r8 ! max lat - - ! create the model grid - lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & - mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & - staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(model_mask(1)) + allocate(model_frac(1)) - ! create the mesh from the grid - model_mesh = ESMF_MeshCreate(lgrid, rc=rc) + if (compname == 'ATM') then + model_frac(1) = 1._r8 + model_mask(1) = 1 + else if (compname == 'LND') then + call NUOPC_CompAttributeGet(gcomp, name='scol_lndmask', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! For the ATM component - the fractions and masks are always 1 - don't read them - ! in or reset the mesh - - if (compname /= 'ATM') then - ! get model_mask - allocate(model_mask(1)) - rcode = pio_inq_varid(pioid, 'mask', varid) - call pio_check_err(rcode, 'pio_inq_varid for area in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, model_mask) - call pio_check_err(rcode, 'pio_get_var for area in file '//trim(filename)) - - ! get model_frac - allocate(model_frac(1)) - rcode = pio_inq_varid(pioid, 'frac', varid) - call pio_check_err(rcode, 'pio_inq_varid for area in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, model_frac) - call pio_check_err(rcode, 'pio_get_var for area in file '//trim(filename)) - - ! set the model mesh mask - call ESMF_MeshSet(model_mesh, elementMask=model_mask, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - end if - - !------------------------------------- - ! Non single-column mode - !------------------------------------- - - if (.not. scol_mode) then - - ! allocate xv and read it in - allocate(xv(nv,ni,nj)) - rcode = pio_inq_varid(pioid, 'xv', varid) - call pio_check_err(rcode, 'pio_inq_varid for xv in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, xv) - call pio_check_err(rcode, 'pio_get_var for xv in file '//trim(filename)) - - ! allocate yv and read it in - allocate(yv(nv,ni,nj)) - rcode = pio_inq_varid(pioid, 'yv', varid) - call pio_check_err(rcode, 'pio_inq_varid for yv in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, yv) - call pio_check_err(rcode, 'pio_get_var for yv in file '//trim(filename)) - - ! create grid from corner vertices - maxIndex(1) = ni ! number of lons - maxIndex(2) = nj ! number of lats - mincornerCoord(1) = xv(1,1,1) ! min lon - mincornerCoord(2) = yv(1,1,1) ! min lat - maxcornerCoord(1) = xv(3,ni,nj) ! max lon - maxcornerCoord(2) = yv(3,ni,nj) ! max lat - - ! create the model grid - lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & - mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & - staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) + read(cvalue,*) model_mask(1) + call NUOPC_CompAttributeGet(gcomp, name='scol_lndfrac', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! create the mesh from the grid - model_mesh = ESMF_MeshCreate(lgrid, rc=rc) + read(cvalue,*) model_frac(1) + else if (compname == 'OCN' .or. compname == 'ICE') then + call NUOPC_CompAttributeGet(gcomp, name='scol_ocnmask', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! For the ATM component - the fractions and masks are always 1 - don't read them - ! in or reset the mesh - if (compname /= 'ATM') then - ! allocate model_mask and read it in - allocate(model_mask(ni*nj)) - rcode = pio_inq_varid(pioid, 'mask', varid) - call pio_check_err(rcode, 'pio_inq_varid for mask in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, model_mask) - call pio_check_err(rcode, 'pio_get_var for mask in file '//trim(filename)) - - ! allocate model_frac and read it in - allocate(model_frac(ni*nj)) - rcode = pio_inq_varid(pioid, 'frac', varid) - call pio_check_err(rcode, 'pio_inq_varid for frac in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, model_frac) - call pio_check_err(rcode, 'pio_get_var for frac in file '//trim(filename)) - - ! reset the model mesh mask if not an atmosphere component - call ESMF_MeshSet(model_mesh, elementMask=mask, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - + read(cvalue,*) model_mask(1) + call NUOPC_CompAttributeGet(gcomp, name='scol_ocnfrac', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) model_frac(1) + else + call shr_sys_abort('ERROR: currently component '//trim(compname)//' is not supported for single column') end if - !------------------------------------- - ! close domain file and write diagnostic output - !------------------------------------- - - call pio_seterrorhandling(pioid, PIO_INTERNAL_ERROR) - call pio_closefile(pioid) - - call ESMF_MeshGet(model_mesh, numOwnedElements=numOwnedElements, spatialDim=spatialDim, rc=rc) + ! Use center and come up with arbitrary area delta lon and lat = .1 degree + maxIndex(1) = 1 ! number of lons + maxIndex(2) = 1 ! number of lats + mincornerCoord(1) = scol_lon - .1_r8 ! min lon + mincornerCoord(2) = scol_lat - .1_r8 ! min lat + maxcornerCoord(1) = scol_lon + .1_r8 ! max lon + maxcornerCoord(2) = scol_lat + .1_r8 ! max lat + + ! create the model grid + lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & + mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & + staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ownedElemCoords(spatialDim*numOwnedElements)) ! this is a pointer and must be deallocated - call ESMF_MeshGet(model_mesh, ownedElemCoords=ownedElemCoords) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(lons(numOwnedElements)) - allocate(lats(numOwnedElements)) - do n = 1, numOwnedElements - lons(n) = ownedElemCoords(2*n-1) - lats(n) = ownedElemCoords(2*n) - end do - if (my_task == master_task) then - write(logunit,*)' Mesh created from file ',trim(filename) - write(logunit,*)' mesh element lons = ',lons(:) - write(logunit,*)' mesh element lats = ',lats(:) - end if - deallocate(ownedElemCoords) - - contains - subroutine pio_check_err(ierror, description) - integer , intent(in) :: ierror - character(*), intent(in) :: description - if (ierror /= PIO_NOERR) then - write (*,'(6a)') 'ERROR ', trim(description) - call shr_sys_abort() - endif - end subroutine pio_check_err + ! create the mesh from the grid + model_mesh = ESMF_MeshCreate(lgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - end subroutine dshr_mesh_create + end subroutine dshr_mesh_create_scol !=============================================================================== subroutine dshr_set_runclock(gcomp, rc) @@ -1535,43 +1298,6 @@ subroutine dshr_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm end subroutine dshr_orbital_update - !=============================================================================== - real(R8) function getNextRadCDay_i8( ymd, tod, stepno, dtime, iradsw, calendar ) - - ! Return the calendar day of the next radiation time-step. - ! General Usage: nextswday = getNextRadCDay(curr_date) - - ! input/output variables - integer , intent(in) :: ymd - integer , intent(in) :: tod - integer(I8), intent(in) :: stepno - integer , intent(in) :: dtime - integer , intent(in) :: iradsw - character(*),intent(in) :: calendar - - ! local variables - real(R8) :: nextsw_cday - real(R8) :: julday - integer :: liradsw - character(*),parameter :: subName = '(getNextRadCDay) ' - !------------------------------------------------------------------------------- - - liradsw = iradsw - if (liradsw < 0) liradsw = nint((-liradsw *3600._r8)/dtime) - call shr_cal_date2julian(ymd,tod,julday,calendar) - if (liradsw > 1) then - if (mod(stepno+1,liradsw) == 0 .and. stepno > 0) then - nextsw_cday = julday + 2*dtime/shr_const_cday - else - nextsw_cday = -1._r8 - end if - else - nextsw_cday = julday + dtime/shr_const_cday - end if - getNextRadCDay_i8 = nextsw_cday - - end function getNextRadCDay_i8 - !=============================================================================== subroutine dshr_set_modelmask(mesh_dst, meshfile_mask, compname, mask_dst, frac_dst, rc) @@ -1652,7 +1378,7 @@ subroutine dshr_set_modelmask(mesh_dst, meshfile_mask, compname, mask_dst, frac_ termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! now determine mask_dst and frac_dst + ! now determine mask_dst and frac_dst call ESMF_MeshGet(mesh_dst, spatialDim=spatialDim, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldGet(field_dst, farrayptr=dataptr1d, rc=rc) @@ -1687,7 +1413,7 @@ subroutine dshr_set_modelmask(mesh_dst, meshfile_mask, compname, mask_dst, frac_ ! deallocate memory call ESMF_RouteHandleDestroy(rhandle, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldDestroy(field_mask, rc=rc) + call ESMF_FieldDestroy(field_mask, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldDestroy(field_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -1723,7 +1449,8 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) logical :: pio_rearr_comm_enable_hs_io2comp logical :: pio_rearr_comm_enable_isend_io2comp integer :: pio_rearr_comm_max_pend_req_io2comp - logical :: isPresent, isSet, ret + logical :: isPresent, isSet + integer :: ret character(len=CL) :: cvalue character(len=CS) :: cname character(len=CL) :: logmsg @@ -1742,7 +1469,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) petCount=petCount, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! query component specific PIO attributes + ! query component specific PIO attributes ! pio_netcdf_format call NUOPC_CompAttributeGet(gcomp, name='pio_netcdf_format', value=cvalue, & isPresent=isPresent, isSet=isSet, rc=rc) @@ -1778,9 +1505,9 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) if (isPresent .and. isSet) then cvalue = ESMF_UtilStringUpperCase(cvalue) if (trim(cvalue) .eq. 'NETCDF') then - sdat%io_type = PIO_IOTYPE_NETCDF + sdat%io_type = PIO_IOTYPE_NETCDF else if (trim(cvalue) .eq. 'PNETCDF') then - sdat%io_type = PIO_IOTYPE_PNETCDF + sdat%io_type = PIO_IOTYPE_PNETCDF else if (trim(cvalue) .eq. 'NETCDF4C') then sdat%io_type = PIO_IOTYPE_NETCDF4C else if (trim(cvalue) .eq. 'NETCDF4P') then @@ -1811,7 +1538,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) endif pio_root = min(pio_root, petCount-1) else - pio_root = 1 + pio_root = 1 end if if (my_task == master_task) write(logunit,*) trim(subname)//' : pio_root = ', & pio_root @@ -1956,8 +1683,8 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) call pio_init(my_task, mpicom, pio_numiotasks, 0, pio_stride, & pio_rearranger, sdat%pio_subsystem, base=pio_root) - ! query shared PIO rearranger attributes - ! pio_rearr_comm_type + ! query shared PIO rearranger attributes + ! pio_rearr_comm_type call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_type', value=cvalue, & isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1979,7 +1706,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) pio_rearr_comm_type = PIO_REARR_COMM_P2P end if if (my_task == master_task) write(logunit,*) trim(subname)// & - ' : pio_rearr_comm_type = ', trim(cvalue), pio_rearr_comm_type + ' : pio_rearr_comm_type = ', trim(cvalue), pio_rearr_comm_type ! pio_rearr_comm_fcd call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_fcd', value=cvalue, & @@ -2030,7 +1757,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else pio_rearr_comm_enable_isend_comp2io = .false. end if - + ! pio_rearr_comm_max_pend_req_comp2io call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_max_pend_req_comp2io', & value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) diff --git a/dwav/CMakeLists.txt b/dwav/CMakeLists.txt index 97fccbd52..4dcee6175 100644 --- a/dwav/CMakeLists.txt +++ b/dwav/CMakeLists.txt @@ -15,8 +15,9 @@ add_library(dwav ${SRCFILES}) add_dependencies(dwav dshr streams) target_include_directories (dwav PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../dshr") target_include_directories (dwav PRIVATE "${CMAKE_SOURCE_DIR}") -target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") -target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../share") +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../streams") target_include_directories (dwav PRIVATE "${PIO_Fortran_INCLUDE_DIR}") +target_include_directories (dwav PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/dwav/cime_config/buildnml b/dwav/cime_config/buildnml index 5f9f508c8..6802f2b27 100755 --- a/dwav/cime_config/buildnml +++ b/dwav/cime_config/buildnml @@ -61,8 +61,17 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['dwav_mode'] = dwav_mode # do not allow single column mode for dwav - expect(not case.get_value('PTS_MODE'), - "for, DWAV single column mode is not allowed") + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if (scol_lon > -999. and scol_lat > 999.): + expect(False, + "single column mode for DWAV is not currently allowed") # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/dwav/cime_config/namelist_definition_dwav.xml b/dwav/cime_config/namelist_definition_dwav.xml index 6707ed013..ce9cc85e4 100644 --- a/dwav/cime_config/namelist_definition_dwav.xml +++ b/dwav/cime_config/namelist_definition_dwav.xml @@ -45,7 +45,6 @@ $WAV_DOMAIN_MESH - null @@ -62,20 +61,6 @@ - - char - streams - abs - dwav_nml - - file specifying model mesh - - - null - $WAV_DOMAIN_PATH/$WAV_DOMAIN_FILE - - - integer streams diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index 2159a8c16..8dc4978c1 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -17,7 +17,7 @@ module wav_comp_nuopc use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort use shr_cal_mod , only : shr_cal_ymd2date @@ -35,7 +35,7 @@ module wav_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -69,7 +69,6 @@ module wav_comp_nuopc character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from character(CL) :: restfilm = nullstr ! model restart file namelist integer :: nx_global integer :: ny_global @@ -160,7 +159,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) character(*) ,parameter :: F02 = "('(wav_comp_nuopc) ',a,l6)" !------------------------------------------------------------------------------- - namelist / dwav_nml / datamode, model_meshfile, model_maskfile, model_createmesh_fromfile, & + namelist / dwav_nml / datamode, model_meshfile, model_maskfile, & restfilm, nx_global, ny_global rc = ESMF_SUCCESS @@ -191,44 +190,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + 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) - - ! check that files exists - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if 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(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') 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') @@ -268,8 +240,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat - create the model domain mesh and intialize the sdat clock call ESMF_TraceRegionEnter('dwav_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'WAV', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type if not aqua planet diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index d24e8f93c..62a87f226 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -5,42 +5,27 @@ set (GenF90_SRCS shr_infnan_mod.F90 shr_assert_mod.F90) add_library(cdeps_share ${GenF90_SRCS} - glc_elevclass_mod.F90 - shr_timer_mod.F90 - shr_cal_mod.F90 + glc_elevclass_mod.F90 + shr_timer_mod.F90 + shr_cal_mod.F90 shr_kind_mod.F90 shr_sys_mod.F90 shr_abort_mod.F90 - shr_const_mod.F90 - shr_orb_mod.F90 - shr_mpi_mod.F90 - shr_log_mod.F90 - shr_strconvert_mod.F90 - shr_precip_mod.F90 - shr_string_mod.F90) + shr_const_mod.F90 + shr_orb_mod.F90 + shr_mpi_mod.F90 + shr_log_mod.F90 + shr_strconvert_mod.F90 + shr_precip_mod.F90 + shr_string_mod.F90) target_include_directories (cdeps_share PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${ESMF_F90COMPILEPATHS} ${PIO_Fortran_INCLUDE_DIRS}) install(TARGETS cdeps_share LIBRARY DESTINATION lib) - #===== genf90 ===== -if (DEFINED GENF90_PATH) - add_custom_target(genf90 - DEPENDS ${GENF90_PATH}/genf90.pl) -else () - ExternalProject_Add (genf90 - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/genf90 - GIT_REPOSITORY https://github.com/PARALLELIO/genf90 - GIT_TAG genf90_200608 - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "") - ExternalProject_Get_Property (genf90 SOURCE_DIR) - set (GENF90_PATH ${SOURCE_DIR}) - unset (SOURCE_DIR) -endif () +set(GENF90_PATH ${CMAKE_CURRENT_SOURCE_DIR}/genf90) +add_custom_target(genf90 DEPENDS ${GENF90_PATH}/genf90.pl) add_dependencies (cdeps_share genf90) #===== Fortran Source Generation with GenF90 ===== diff --git a/streams/CMakeLists.txt b/streams/CMakeLists.txt index ee9a924e3..5d76e0416 100644 --- a/streams/CMakeLists.txt +++ b/streams/CMakeLists.txt @@ -23,10 +23,10 @@ if(BLD_STANDALONE) add_dependencies(streams cdeps_share) endif() -target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/fox/include) +target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) target_include_directories (streams PRIVATE ${ESMF_F90COMPILEPATHS}) target_include_directories (streams PRIVATE ${PIO_Fortran_INCLUDE_DIR}) -target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) +target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../share) install(TARGETS streams LIBRARY DESTINATION lib) diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 653524ea5..2e2d62ce4 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -148,7 +148,11 @@ module dshr_strdata_mod integer function shr_strdata_get_stream_count(sdat) type(shr_strdata_type) , intent(in) :: sdat - shr_strdata_get_stream_count = size(sdat%stream) + if(associated(sdat%stream)) then + shr_strdata_get_stream_count = size(sdat%stream) + else + shr_strdata_get_stream_count = 0 + endif end function shr_strdata_get_stream_count !===============================================================================