Skip to content
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if (DEFINED CIMEROOT)
set(CMAKE_CXX_COMPILER ${MPICXX})
endif()
set(CMAKE_Fortran_FLAGS "${FFLAGS} ${CPPDEFS} -I${LIBROOT}/include -I${LIBROOT}/finclude -I${LIBROOT}/nuopc/esmf/${NINST_VALUE}/include")
add_compile_definitions(CESMCOUPLED)
else()
set(BLD_STANDALONE TRUE)
endif()
Expand Down Expand Up @@ -56,7 +57,7 @@ if(BLD_STANDALONE)
endif()
if("${COMPILER}" STREQUAL "nag")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D__NAG__")
endif()
endif()
add_subdirectory(streams)
add_subdirectory(dshr)

Expand Down
20 changes: 16 additions & 4 deletions datm/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#ifdef CESMCOUPLED
module atm_comp_nuopc
#else
module cdeps_datm_comp
#endif

!----------------------------------------------------------------------------
! This is the NUOPC cap for DATM
Expand Down Expand Up @@ -142,7 +146,11 @@ module atm_comp_nuopc
logical :: diagnose_data = .true.
integer , parameter :: master_task = 0 ! task number of master task
character(len=*) , parameter :: rpfile = 'rpointer.atm'
#ifdef CESMCOUPLED
character(*) , parameter :: modName = "(atm_comp_nuopc)"
#else
character(*) , parameter :: modName = "(cdeps_datm_comp)"
#endif

character(*), parameter :: u_FILE_u = &
__FILE__
Expand Down Expand Up @@ -210,10 +218,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
integer :: nu ! unit number
integer :: ierr ! error code
logical :: exists ! check for file existence
character(len=*),parameter :: subname='(atm_comp_nuopc):(InitializeAdvertise) '
character(*) ,parameter :: F00 = "('(atm_comp_nuopc) ',8a)"
character(*) ,parameter :: F01 = "('(atm_comp_nuopc) ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(atm_comp_nuopc) ',a,l6)"
character(len=*),parameter :: subname=trim(modName) // ':(InitializeAdvertise) '
character(*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)"
character(*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)"
!-------------------------------------------------------------------------------

namelist / datm_nml / datamode, &
Expand Down Expand Up @@ -835,4 +843,8 @@ subroutine ModelFinalize(gcomp, rc)
end if
end subroutine ModelFinalize

#ifdef CESMCOUPLED
end module atm_comp_nuopc
#else
end module cdeps_datm_comp
#endif
11 changes: 5 additions & 6 deletions datm/cime_config/stream_definition_datm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2587,13 +2587,12 @@
<file>$DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.12.200618.nc</file>
</stream_datafiles>
<stream_datavars>
<var>u10 Sa_u</var>
<var>v10 Sa_v</var>
<var>t2m Sa_tbot</var>
<var>u10 Sa_u10m</var>
<var>v10 Sa_v10m</var>
<var>t2m Sa_t2m</var>
<var>skt Sa_tskn</var>
<var>d2m Sa_tdew</var>
<var>msl Sa_pslv</var>
<var>sp Sa_pbot</var>
<var>tp Faxa_rain</var>
<var>cp Faxa_rainc</var>
<var>lsp Faxa_rainl</var>
Expand All @@ -2618,15 +2617,15 @@
</stream_mapalgo>
<!-- <stream_vectors>u:v taux:tauy</stream_vectors> -->
<stream_vectors>u:v</stream_vectors>
<stream_year_align>1900</stream_year_align>
<stream_year_align>2019</stream_year_align>
<stream_year_first>2019</stream_year_first>
<stream_year_last>2019</stream_year_last>
<stream_offset>0</stream_offset>
<stream_tintalgo>
<tintalgo>linear</tintalgo>
</stream_tintalgo>
<stream_taxmode>
<taxmode>cycle</taxmode>
<taxmode>limit</taxmode>
</stream_taxmode>
<stream_dtlimit>
<dtlimit>1.5</dtlimit>
Expand Down
212 changes: 105 additions & 107 deletions datm/datm_datamode_era5_mod.F90

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions dice/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#ifdef CESMCOUPLED
module ice_comp_nuopc
#else
module cdeps_dice_comp
#endif

!----------------------------------------------------------------------------
! This is the NUOPC cap for DICE
Expand Down Expand Up @@ -97,7 +101,11 @@ module ice_comp_nuopc

logical :: diagnose_data = .true.
integer , parameter :: master_task=0 ! task number of master task
#ifdef CESMCOUPLED
character(*) , parameter :: modName = "(ice_comp_nuopc)"
#else
character(*) , parameter :: modName = "(cdeps_dice_comp)"
#endif
character(*) , parameter :: u_FILE_u = &
__FILE__

Expand Down Expand Up @@ -164,10 +172,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
integer :: ierr ! error code
logical :: exists ! check for file existence
character(len=*),parameter :: subname=trim(modName)//':(InitializeAdvertise) '
character(*) ,parameter :: F00 = "('(ice_comp_nuopc) ',8a)"
character(*) ,parameter :: F01 = "('(ice_comp_nuopc) ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(ice_comp_nuopc) ',a,l6)"
character(*) ,parameter :: F03 = "('(ice_comp_nuopc) ',a,d13.5)"
character(*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)"
character(*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)"
character(*) ,parameter :: F03 = "('(" // trim(modName) // ") ',a,d13.5)"
!-------------------------------------------------------------------------------

namelist / dice_nml / case_name, datamode, &
Expand Down Expand Up @@ -271,7 +279,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
integer :: fieldcount
real(r8), pointer :: fldptr(:)
integer :: n
character(len=*), parameter :: F00 = "('ice_comp_nuopc: ')',8a)"
character(len=*), parameter :: F00 = "('" // trim(modName) // ": ')',8a)"
character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) '
!-------------------------------------------------------------------------------

Expand Down Expand Up @@ -551,4 +559,8 @@ subroutine ModelFinalize(gcomp, rc)
end if
end subroutine ModelFinalize

#ifdef CESMCOUPLED
end module ice_comp_nuopc
#else
end module cdeps_dice_comp
#endif
18 changes: 15 additions & 3 deletions dlnd/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#ifdef CESMCOUPLED
module lnd_comp_nuopc
#else
module cdeps_dlnd_comp
#endif

!----------------------------------------------------------------------------
! This is the NUOPC cap for DLND
Expand Down Expand Up @@ -92,7 +96,11 @@ module lnd_comp_nuopc
logical :: diagnose_data = .true.
integer , parameter :: master_task=0 ! task number of master task
character(*) , parameter :: rpfile = 'rpointer.lnd'
#ifdef CESMCOUPLED
character(*) , parameter :: modName = "(lnd_comp_nuopc)"
#else
character(*) , parameter :: modName = "(cdeps_dlnd_comp)"
#endif
character(*) , parameter :: u_FILE_u = &
__FILE__

Expand Down Expand Up @@ -159,9 +167,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
integer :: ierr ! error code
logical :: exists ! check for file existence
character(len=*) , parameter :: subname=trim(modName)//':(InitializeAdvertise) '
character(*) , parameter :: F00 = "('(lnd_comp_nuopc) ',8a)"
character(*) , parameter :: F01 = "('(lnd_comp_nuopc) ',a,2x,i8)"
character(*) , parameter :: F02 = "('(lnd_comp_nuopc) ',a,l6)"
character(*) , parameter :: F00 = "('(" // trim(modName) // ") ',8a)"
character(*) , parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)"
character(*) , parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)"
!-------------------------------------------------------------------------------

namelist / dlnd_nml / datamode, model_meshfile, model_maskfile, &
Expand Down Expand Up @@ -559,4 +567,8 @@ subroutine dlnd_comp_run(importState, exportState, target_ymd, target_tod, rc)

end subroutine dlnd_comp_run

#ifdef CESMCOUPLED
end module lnd_comp_nuopc
#else
end module cdeps_dlnd_comp
#endif
20 changes: 16 additions & 4 deletions docn/ocn_comp_nuopc.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#ifdef CESMCOUPLED
module ocn_comp_nuopc
#else
module cdeps_docn_comp
#endif

!----------------------------------------------------------------------------
! This is the NUOPC cap for DOCN
Expand Down Expand Up @@ -107,7 +111,11 @@ module ocn_comp_nuopc
logical :: aquaplanet = .false.
logical :: diagnose_data = .true.
integer , parameter :: master_task = 0 ! task number of master task
#ifdef CESMCOUPLED
character(*) , parameter :: module_name = "(ocn_comp_nuopc)"
#else
character(*) , parameter :: module_name = "(cdeps_docn_comp)"
#endif
character(*) , parameter :: modelname = 'docn'
character(*) , parameter :: u_FILE_u = &
__FILE__
Expand Down Expand Up @@ -175,10 +183,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
integer :: ierr ! error code
logical :: exists ! check for file existence
character(len=*),parameter :: subname=trim(module_name)//':(InitializeAdvertise) '
character(*) ,parameter :: F00 = "('(ocn_comp_nuopc) ',8a)"
character(*) ,parameter :: F01 = "('(ocn_comp_nuopc) ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(ocn_comp_nuopc) ',a,l6)"
character(*) ,parameter :: F03 = "('(ocn_comp_nuopc) ',a,f8.5,2x,f8.5)"
character(*) ,parameter :: F00 = "('(" // trim(module_name) // ") ',8a)"
character(*) ,parameter :: F01 = "('(" // trim(module_name) // ") ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(" // trim(module_name) // ") ',a,l6)"
character(*) ,parameter :: F03 = "('(" // trim(module_name) // ") ',a,f8.5,2x,f8.5)"
!-------------------------------------------------------------------------------

namelist / docn_nml / datamode, &
Expand Down Expand Up @@ -614,4 +622,8 @@ subroutine ModelFinalize(gcomp, rc)
end if
end subroutine ModelFinalize

#ifdef CESMCOUPLED
end module ocn_comp_nuopc
#else
end module cdeps_docn_comp
#endif
21 changes: 17 additions & 4 deletions drof/rof_comp_nuopc.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#ifdef CESMCOUPLED
module rof_comp_nuopc
#else
module cdeps_drof_comp
#endif


!----------------------------------------------------------------------------
! This is the NUOPC cap for DROF
Expand Down Expand Up @@ -74,7 +79,11 @@ module rof_comp_nuopc
logical :: diagnose_data = .true.
integer , parameter :: master_task=0 ! task number of master task
character(*) , parameter :: rpfile = 'rpointer.rof'
#ifdef CESMCOUPLED
character(*) , parameter :: modName = "(rof_comp_nuopc)"
#else
character(*) , parameter :: modName = "(cdeps_drof_comp)"
#endif

! linked lists
type(fldList_type) , pointer :: fldsExport => null()
Expand Down Expand Up @@ -156,9 +165,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
logical :: exists ! check for file existence
type(fldlist_type), pointer :: fldList
character(len=*),parameter :: subname=trim(modName)//':(InitializeAdvertise) '
character(*) ,parameter :: F00 = "('(rof_comp_nuopc) ',8a)"
character(*) ,parameter :: F01 = "('(rof_comp_nuopc) ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(rof_comp_nuopc) ',a,l6)"
character(*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)"
character(*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)"
!-------------------------------------------------------------------------------

namelist / drof_nml / datamode, model_meshfile, model_maskfile, &
Expand Down Expand Up @@ -244,7 +253,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
integer :: current_mon ! model month
integer :: current_day ! model day
integer :: current_tod ! model sec into model date
character(len=*), parameter :: F00 = "('rof_comp_nuopc: ')',8a)"
character(len=*), parameter :: F00 = "('" // trim(modName) // ": ')',8a)"
character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) '
!-------------------------------------------------------------------------------

Expand Down Expand Up @@ -454,4 +463,8 @@ subroutine ModelFinalize(gcomp, rc)
end if
end subroutine ModelFinalize

#ifdef CESMCOUPLED
end module rof_comp_nuopc
#else
end module cdeps_drof_comp
#endif
35 changes: 24 additions & 11 deletions dshr/dshr_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module dshr_mod
use ESMF , only : ESMF_TERMORDER_SRCSEQ, ESMF_FieldRegridStore, ESMF_SparseMatrixWrite
use ESMF , only : ESMF_Region_Flag, ESMF_REGION_TOTAL, ESMF_MAXSTR, ESMF_RC_NOT_VALID
use ESMF , only : ESMF_UtilStringUpperCase
use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx, i8=>shr_kind_i8
use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, cx=>shr_kind_cx, cxx=>shr_kind_cxx, i8=>shr_kind_i8
use shr_sys_mod , only : shr_sys_abort
use shr_mpi_mod , only : shr_mpi_bcast
use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_calendarname
Expand All @@ -42,6 +42,7 @@ module dshr_mod
use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat
#endif
use dshr_strdata_mod , only : shr_strdata_type, SHR_STRDATA_GET_STREAM_COUNT
use shr_string_mod , only : shr_string_toLower
use dshr_methods_mod , only : chkerr
use pio

Expand Down Expand Up @@ -124,10 +125,10 @@ subroutine dshr_init(gcomp, compname, sdat, mpicom, my_task, inst_index, inst_su
! local variables
type(ESMF_VM) :: vm
logical :: isPresent, isSet
character(len=CL) :: cvalue
character(len=CL) :: logmsg
character(len=CL) :: diro
character(len=CL) :: logfile
character(len=CX) :: cvalue
character(len=CX) :: logmsg
character(len=CX) :: diro
character(len=CX) :: logfile
character(len=*),parameter :: subname='(dshr_advertise)'
! ----------------------------------------------

Expand Down Expand Up @@ -176,12 +177,24 @@ subroutine dshr_init(gcomp, compname, sdat, mpicom, my_task, inst_index, inst_su
endif

! set output logging
if (my_task == master_task) then
call NUOPC_CompAttributeGet(gcomp, name="diro", value=diro, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call NUOPC_CompAttributeGet(gcomp, name="logfile", value=logfile, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
open(newunit=logunit,file=trim(diro)//"/"//trim(logfile))
call NUOPC_CompAttributeGet(gcomp, name="diro", value=diro, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (.not. (isPresent .and. isSet)) then
diro = "."
endif

call NUOPC_CompAttributeGet(gcomp, name="logfile", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) logfile
else
logfile = "d"//shr_string_toLower(compname)//".log"
endif

if (my_task == master_task) then
call ESMF_LogWrite(trim(subname)//' : output logging is written to '//trim(diro)//"/"//trim(logfile), ESMF_LOGMSG_INFO)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
open(newunit=logunit, file=trim(diro)//"/"//trim(logfile))
else
logUnit = 6
endif
Expand Down
18 changes: 15 additions & 3 deletions dwav/wav_comp_nuopc.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#ifdef CESMCOUPLED
module wav_comp_nuopc
#else
module cdeps_dwav_comp
#endif

!----------------------------------------------------------------------------
! This is the NUOPC cap for DWAV
Expand Down Expand Up @@ -77,7 +81,11 @@ module wav_comp_nuopc
logical :: diagnose_data = .true.
integer , parameter :: master_task=0 ! task number of master task
character(*) , parameter :: rpfile = 'rpointer.wav'
#ifdef CESMCOUPLED
character(*) , parameter :: modName = "(wav_comp_nuopc)"
#else
character(*) , parameter :: modName = "(cdeps_dwav_comp)"
#endif

! linked lists
type(fldList_type) , pointer :: fldsExport => null()
Expand Down Expand Up @@ -154,9 +162,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
integer :: ierr ! error code
logical :: exists
character(len=*),parameter :: subname=trim(modName)//':(InitializeAdvertise) '
character(*) ,parameter :: F00 = "('(wav_comp_nuopc) ',8a)"
character(*) ,parameter :: F01 = "('(wav_comp_nuopc) ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(wav_comp_nuopc) ',a,l6)"
character(*) ,parameter :: F00 = "('(" // trim(modName) // ") ',8a)"
character(*) ,parameter :: F01 = "('(" // trim(modName) // ") ',a,2x,i8)"
character(*) ,parameter :: F02 = "('(" // trim(modName) // ") ',a,l6)"
!-------------------------------------------------------------------------------

namelist / dwav_nml / datamode, model_meshfile, model_maskfile, &
Expand Down Expand Up @@ -493,4 +501,8 @@ subroutine dwav_comp_run(logunit, target_ymd, target_tod, sdat, rc)

end subroutine dwav_comp_run

#ifdef CESMCOUPLED
end module wav_comp_nuopc
#else
end module cdeps_dwav_comp
#endif