Skip to content

Commit

Permalink
Merge tag 'cdeps1.0.43' into feature/add_dom_to_multilev
Browse files Browse the repository at this point in the history
cdeps1.0.43
  • Loading branch information
Mariana Vertenstein committed Jul 11, 2024
2 parents 873096e + 453a9d1 commit d0e8fc7
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 36 deletions.
29 changes: 12 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,18 @@ add_subdirectory(streams)
add_subdirectory(dshr)

if(NOT DISABLE_FoX)
if(IS_DIRECTORY "${FOX_ROOT}")
message(STATUS "FoX library is already checked out!")
message(STATUS "FoX source dir: ${FOX_ROOT}")
else()
FetchContent_Declare(fox
GIT_REPOSITORY https://github.com/ESMCI/fox.git
GIT_TAG 4.1.2.1
SOURCE_DIR ${FOX_ROOT}
BINARY_DIR ${FOX_ROOT}/..
)
FetchContent_GetProperties(fox)
if(NOT fox_POPULATED)
FetchContent_Populate(fox)
message(STATUS "FoX source dir: ${fox_SOURCE_DIR}")
message(STATUS "FoX binary dir: ${fox_BINARY_DIR}")
endif()
endif()
FetchContent_Declare(fox
GIT_REPOSITORY https://github.com/ESMCI/fox.git
GIT_TAG 4.1.2.1
SOURCE_DIR ${FOX_ROOT}
BINARY_DIR ${FOX_ROOT}/..
)
FetchContent_GetProperties(fox)
if(NOT fox_POPULATED)
FetchContent_Populate(fox)
message(STATUS "FoX source dir: ${fox_SOURCE_DIR}")
message(STATUS "FoX binary dir: ${fox_BINARY_DIR}")
endif()
add_subdirectory(fox)

target_include_directories(streams PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/fox/include>
Expand Down
4 changes: 2 additions & 2 deletions datm/cime_config/stream_definition_datm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3578,7 +3578,7 @@
<meshfile>none</meshfile>
</stream_meshfile>
<stream_datafiles>
<file>$DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP3-7.0__simyr_2014-2501_CMIP6_c190506.nc</file>
<file>$DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP3-7.0_simyr_1750-2501_CMIP6_c201101.nc</file>
</stream_datafiles>
<stream_datavars>
<var>CO2 Sa_co2diag</var>
Expand Down Expand Up @@ -4001,7 +4001,7 @@
<meshfile>$DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc</meshfile>
</stream_meshfile>
<stream_datafiles>
<file>$DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2014-2101_monthly_0.9x1.25_c190402.nc</file>
<file>$DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_1849-2101_monthly_0.9x1.25_c201103.nc</file>
</stream_datafiles>
<stream_datavars>
<var>BCDEPWET Faxa_bcphiwet</var>
Expand Down
25 changes: 15 additions & 10 deletions dglc/dglc_datamode_noevolve_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module dglc_datamode_noevolve_mod
use NUOPC , only : NUOPC_Advertise, NUOPC_IsConnected
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_const_mod , only : SHR_CONST_RHOICE, SHR_CONST_RHOSW, SHR_CONST_REARTH
use shr_const_mod , only : SHR_CONST_RHOICE, SHR_CONST_RHOSW, SHR_CONST_REARTH, SHR_CONST_TKFRZ
use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, chkerr
use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add
use dshr_strdata_mod , only : shr_strdata_type
Expand Down Expand Up @@ -40,22 +40,22 @@ module dglc_datamode_noevolve_mod
type(icesheet_ptr_t), allocatable :: Sg_ice_covered(:)
type(icesheet_ptr_t), allocatable :: Sg_icemask(:)
type(icesheet_ptr_t), allocatable :: Sg_icemask_coupled_fluxes(:)
type(icesheet_ptr_t), allocatable :: Fogg_rofi(:)
type(icesheet_ptr_t), allocatable :: Fgrg_rofi(:)

! Import fields
integer, parameter :: nlev_import = 30
type(icesheet_ptr_t), allocatable :: Sl_tsrf(:)
type(icesheet_ptr_t), allocatable :: Flgl_qice(:)
! type(icesheet_ptr_t), allocatable :: So_t(:)
! type(icesheet_ptr_t), allocatable :: So_q(:)
! type(icesheet_ptr_t), allocatable :: So_t(:)
! type(icesheet_ptr_t), allocatable :: So_q(:)

! Export Field names
character(len=*), parameter :: field_out_area = 'Sg_area'
character(len=*), parameter :: field_out_topo = 'Sg_topo'
character(len=*), parameter :: field_out_ice_covered = 'Sg_ice_covered'
character(len=*), parameter :: field_out_icemask = 'Sg_icemask'
character(len=*), parameter :: field_out_icemask_coupled_fluxes = 'Sg_icemask_coupled_fluxes'
character(len=*), parameter :: field_out_rofi = 'Fogg_rofi'
character(len=*), parameter :: field_out_rofi = 'Fgrg_rofi'

! Import Field names
character(len=*), parameter :: field_in_tsrf = 'Sl_tsrf'
Expand Down Expand Up @@ -162,7 +162,7 @@ subroutine dglc_datamode_noevolve_init_pointers(NStateExp, NstateImp, rc)
allocate(Sg_ice_covered(num_icesheets))
allocate(Sg_icemask(num_icesheets))
allocate(Sg_icemask_coupled_fluxes(num_icesheets))
allocate(Fogg_rofi(num_icesheets))
allocate(Fgrg_rofi(num_icesheets))

do ns = 1,num_icesheets
call dshr_state_getfldptr(NStateExp(ns), field_out_area, fldptr1=Sg_area(ns)%ptr, rc=rc)
Expand All @@ -175,8 +175,10 @@ subroutine dglc_datamode_noevolve_init_pointers(NStateExp, NstateImp, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(NStateExp(ns), field_out_icemask_coupled_fluxes, fldptr1=Sg_icemask_coupled_fluxes(ns)%ptr, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(NStateExp(ns), field_out_rofi, fldptr1=Fogg_rofi(ns)%ptr, rc=rc)
call dshr_state_getfldptr(NStateExp(ns), field_out_rofi, fldptr1=Fgrg_rofi(ns)%ptr, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

Fgrg_rofi(ns)%ptr(:) = 0._r8
end do

! initialize pointers to import fields if appropriate
Expand All @@ -193,6 +195,9 @@ subroutine dglc_datamode_noevolve_init_pointers(NStateExp, NstateImp, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(NStateImp(ns), field_in_qice, fldptr1=Flgl_qice(ns)%ptr, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

Sl_tsrf(ns)%ptr(:) = SHR_CONST_TKFRZ
Flgl_qice(ns)%ptr(:) = 0._r8
end do

end subroutine dglc_datamode_noevolve_init_pointers
Expand Down Expand Up @@ -365,10 +370,10 @@ subroutine dglc_datamode_noevolve_advance(pio_subsystem, io_type, io_format, &
end if

if (initialized_noevolve) then
! Compute Fogg_rofi
! Compute Fgrg_rofi
do ns = 1,num_icesheets
do ng = 1,size(Fogg_rofi(ns)%ptr)
Fogg_rofi(ns)%ptr(ng) = Flgl_qice(ns)%ptr(ng)
do ng = 1,size(Fgrg_rofi(ns)%ptr)
Fgrg_rofi(ns)%ptr(ng) = Flgl_qice(ns)%ptr(ng)
end do
end do
end if
Expand Down
2 changes: 1 addition & 1 deletion dglc/glc_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ subroutine ModelAdvance(gcomp, rc)
if (my_task == main_task) then
call ESMF_TimeGet(currTime, timestring=timestring, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
write(logunit,'(a,l)') trim(timestring)//': valid_input for dglc is ',valid_inputs
write(logunit,'(a,l6)') trim(timestring)//': valid_input for dglc is ',valid_inputs
end if

! determine if will write restart
Expand Down
5 changes: 5 additions & 0 deletions docn/docn_datamode_som_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module docn_datamode_som_mod
real(r8), pointer :: So_v(:) => null()
real(r8), pointer :: So_dhdx(:) => null()
real(r8), pointer :: So_dhdy(:) => null()
real(r8), pointer :: So_bldepth(:) => null()
real(r8), pointer :: Fioo_q(:) => null()
real(r8), pointer :: So_fswpen(:) => null()

Expand Down Expand Up @@ -98,6 +99,7 @@ subroutine docn_datamode_som_advertise(importState, exportState, fldsimport, fld
call dshr_fldList_add(fldsExport, 'So_v' )
call dshr_fldList_add(fldsExport, 'So_dhdx' )
call dshr_fldList_add(fldsExport, 'So_dhdy' )
call dshr_fldList_add(fldsExport, 'So_bldepth' )
call dshr_fldList_add(fldsExport, 'Fioo_q' )
call dshr_fldList_add(fldsExport, 'So_fswpen' )

Expand Down Expand Up @@ -189,6 +191,8 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f
if (chkerr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'So_dhdy' , fldptr1=So_dhdy , rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'So_bldepth' , fldptr1=So_bldepth , rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Fioo_q' , fldptr1=Fioo_q , rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

Expand Down Expand Up @@ -289,6 +293,7 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re

! save somtp to restart file
somtp(n) = So_t(n)
So_bldepth(n) = strm_h(n)
endif
end do
deallocate(tfreeze)
Expand Down
23 changes: 17 additions & 6 deletions streams/dshr_strdata_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,7 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc)
character(*), parameter :: F00 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,a)"
character(*), parameter :: F01 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,a)"
character(*), parameter :: F02 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,i8,2x,a)"
character(*), parameter :: F03 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,a)"
!-------------------------------------------------------------------------------

rc = ESMF_SUCCESS
Expand Down Expand Up @@ -2003,13 +2004,23 @@ subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc)

! determine io descriptor
if (ndims == 2) then
if (sdat%mainproc) then
write(sdat%stream(1)%logunit,F00) 'setting iodesc for : '//trim(fldname)// &
' with dimlens(1), dimlens2 = ',dimlens(1),dimlens(2),&
' variable has no time dimension '
rcode = pio_inq_dimname(pioid, dimids(ndims), dimname)
if (trim(dimname) == 'time' .or. trim(dimname) == 'nt') then
if (sdat%mainproc) then
write(sdat%stream(1)%logunit,F03) 'setting iodesc for : '//trim(fldname)// &
' with dimlens(1) = ',dimlens(1),' and the variable has a time dimension '
end if
call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1)/), compdof, &
per_stream%stream_pio_iodesc)
else
if (sdat%mainproc) then
write(sdat%stream(1)%logunit,F00) 'setting iodesc for : '//trim(fldname)// &
' with dimlens(1), dimlens(2) = ',dimlens(1),dimlens(2),&
' variable has no time dimension '
end if
call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, &
per_stream%stream_pio_iodesc)
end if
call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, &
per_stream%stream_pio_iodesc)

else if (ndims == 3) then
rcode = pio_inq_dimname(pioid, dimids(ndims), dimname)
Expand Down

0 comments on commit d0e8fc7

Please sign in to comment.