Skip to content

Commit

Permalink
merge to cmeps main
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Aug 20, 2024
2 parents 2dc4f21 + b978ffd commit 3e1683b
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 98 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/srt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,6 @@ jobs:
popd
# the following can be used by developers to login to the github server in case of errors
# see https://github.com/marketplace/actions/debugging-with-tmate for further details
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
31 changes: 22 additions & 9 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1986,15 +1986,15 @@
https://www.unidata.ucar.edu/software/netcdf/docs/data_type.html
</desc>
<values>
<value compclass="ATM">64bit_offset</value>
<value compclass="CPL">64bit_offset</value>
<value compclass="OCN">64bit_offset</value>
<value compclass="WAV">64bit_offset</value>
<value compclass="GLC">64bit_offset</value>
<value compclass="ICE">64bit_offset</value>
<value compclass="ROF">64bit_offset</value>
<value compclass="LND">64bit_offset</value>
<value compclass="ESP">64bit_offset</value>
<value compclass="ATM">64bit_data</value>
<value compclass="CPL">64bit_data</value>
<value compclass="OCN">64bit_data</value>
<value compclass="WAV">64bit_data</value>
<value compclass="GLC">64bit_data</value>
<value compclass="ICE">64bit_data</value>
<value compclass="ROF">64bit_data</value>
<value compclass="LND">64bit_data</value>
<value compclass="ESP">64bit_data</value>
</values>
</entry>

Expand Down Expand Up @@ -2412,6 +2412,19 @@
</entry>

<!-- ===================================================================== -->
<!-- optionally connect the case to a remote git repository, -->
<!-- the branch is the case name and must be unique in remote -->
<!-- ===================================================================== -->

<entry id="CASE_GIT_REPOSITORY">
<type>char</type>
<default_value></default_value>
<group>case_git</group>
<file>env_build.xml</file>
<desc>Remote git repository used for this case</desc>
</entry>

<!-- ===================================================================== -->
<!-- Include the AOFLUX calculation for this compset -->
<!-- ===================================================================== -->

Expand Down
19 changes: 3 additions & 16 deletions cime_config/config_component_cesm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
<value compset="_DATM">none</value>
<value compset="_DATM%CPLHIST.+POP\d">CO2A</value>
<value compset="_DATM%CPLHIST.+BLOM%ECO">CO2A</value>
<value compset="^OMIP_DATM%IAF.*_POP2%[^_]*ECO">CO2A</value>
<value compset="^OMIP_DATM%JRA.*_POP2%[^_]*ECO">CO2A</value>
<value compset="^OMIP_DATM%IAF.*_MOM6%[^_]*MARBL">CO2A</value>
<value compset="^OMIP_DATM%JRA.*_MOM6%[^_]*MARBL">CO2A</value>
<value compset="HIST.*_DATM.*_CLM">CO2A</value>
<value compset="SSP.*_DATM.*_CLM">CO2A</value>
<value compset="_BGC%BPRP">CO2C</value>
Expand Down Expand Up @@ -236,15 +236,12 @@
<!-- =================================================== -->
<!-- C compsets -->
<!-- =================================================== -->
<value compset="_DATM.*_DICE.*_POP2">24</value>
<value compset="_DATM.*_DICE.*_MOM6">24</value>
<value compset="_DATM.*_DICE.*_BLOM">24</value>
<!-- NOTE: currently a NUOPC runseqence cannot be generated with the ATM_NCPL < OCN_NCPL -->
<!-- =================================================== -->
<!-- G compsets -->
<!-- =================================================== -->
<value compset="_DATM.*_SLND.*_CICE.*_POP2">24</value>
<value compset="_DATM.*_SLND.*_CICE.*_POP2" grid="oi%tx0.1v3">144</value>
<value compset="_DATM.*_SLND.*_CICE.*_MOM6">24</value>
<value compset="_DATM.*_SLND.*_CICE.*_BLOM">24</value>
<value compset="_DATM.*_CICE.*_DOCN">24</value>
Expand Down Expand Up @@ -330,11 +327,6 @@
<values match="last">
<value compset="_MOM6">24</value>
<value compset="_BLOM">24</value>
<value compset="_POP2" grid="oi%gx3v7">1</value>
<value compset="_POP2" grid="oi%gx1v6">24</value>
<value compset="_POP2" grid="oi%gx1v7">24</value>
<value compset="_POP2" grid="oi%tx0.1v2">48</value>
<value compset="_POP2" grid="oi%tx0.1v3">48</value>
<value compset="_DLND.*_CISM\d">1</value>
<value compset="_NEMO">24</value>
</values>
Expand Down Expand Up @@ -386,7 +378,6 @@
<type>integer</type>
<default_value>8</default_value>
<values match="last">
<value compset="_DATM.*_POP2.*_DROF" grid="oi%gx3v7">1</value>
<value compset="_DATM.*_MOM6.*_DROF" >$ATM_NCPL</value>
<value compset="_DATM.*_BLOM.*_DROF" >$ATM_NCPL</value>
<value compset="_DATM.*_DOCN%SOM" >$ATM_NCPL</value>
Expand Down Expand Up @@ -475,11 +466,8 @@
<default_value>TIGHT</default_value>
<values match="last">
<value compset="_DATM.*_DOCN%SOM" >OPTION2</value>
<value compset="_POP2" >OPTION2</value>
<value compset="_MOM6" >OPTION1</value>
<value compset="_BLOM" >OPTION1</value>
<value compset="_POP2" grid="oi%gx1v6" >OPTION1</value>
<value compset="_POP2" grid="oi%gx1v7" >OPTION1</value>
<value compset="_DATM%NYF.*_SLND.*_DICE.*_DOCN" >OPTION2</value>
<value compset="_XATM.*_XLND.*_XICE.*_XOCN" >OPTION2</value>
<value compset="_SOCN" >OPTION2</value>
Expand Down Expand Up @@ -555,8 +543,7 @@
<default_value>284.7</default_value>
<values match="last">
<value compset="^2000">367.0</value>
<value compset="DATM.*_POP2%[^_]*ECO">284.317</value>
<value compset="DATM.*_POP2%[^_]*ECOCESM20">284.7</value>
<value compset="DATM.*_MOM6%[^_]*MARBL">284.317</value>
</values>
<group>run_co2</group>
<file>env_run.xml</file>
Expand Down
3 changes: 2 additions & 1 deletion cime_config/namelist_definition_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,8 @@
default: ogrid
</desc>
<values>
<value>ogrid</value>
<value samegrid_atm_ocn='false'>xgrid</value>
<value samegrid_atm_ocn='true'>ogrid</value>
</values>
</entry>
<entry id="ocn_surface_flux_scheme">
Expand Down
20 changes: 3 additions & 17 deletions mediator/esmFldsExchange_cesm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
! ---------------------------------------------------------------------
! to ocn: enthalpy from atm rain, snow, evaporation
! to ocn: enthalpy from liquid and ice river runoff
! to ocn: enthalpy from liquid and ice glacier runoff
! to ocn: enthalpy from ice melt
! ---------------------------------------------------------------------
! Note - do not need to add addmap or addmrg for the following since they
Expand All @@ -2213,23 +2214,8 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
call addfld_to(compocn, 'Foxx_hcond')
call addfld_to(compocn, 'Foxx_hrofl')
call addfld_to(compocn, 'Foxx_hrofi')

call addfld_from(compatm, 'Faxa_hrain')
call addfld_from(compatm, 'Faxa_hsnow')
call addfld_from(compatm, 'Faxa_hevap')
else
if ( fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_hrain', rc=rc)) then
! fldchk(is_local%wrap%FBExp(compocn) , 'Foxx_hrain', rc=rc)) then
call addmap_from(compatm, 'Faxa_hrain', compocn, mapconsf, 'one', atm2ocn_map)
end if
if ( fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_hsnow', rc=rc)) then
! fldchk(is_local%wrap%FBExp(compocn) , 'Foxx_hsnow', rc=rc)) then
call addmap_from(compatm, 'Faxa_hsnow', compocn, mapconsf, 'one', atm2ocn_map)
end if
if ( fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_hevap', rc=rc)) then
! fldchk(is_local%wrap%FBExp(compocn) , 'Foxx_hevap', rc=rc)) then
call addmap_from(compatm, 'Faxa_hevap', compocn, mapconsf, 'one', atm2ocn_map)
end if
call addfld_to(compocn, 'Foxx_hrofl_glc')
call addfld_to(compocn, 'Foxx_hrofi_glc')
end if

! ---------------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions mediator/fd_cesm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,16 @@
canonical_units: W m-2
description: med export to ocn heat content of ice runoff
#
- standard_name: Foxx_hrofl_glc
alias: heat_content_rofl_glc
canonical_units: W m-2
description: med export to ocn heat content of liquid glc runoff
#
- standard_name: Foxx_hrofi_glc
alias: heat_content_rofi_glc
canonical_units: W m-2
description: med export to ocn heat content of ice glc runoff
#
- standard_name: Foxx_evap
alias: mean_evap_rate
canonical_units: kg m-2 s-1
Expand Down
7 changes: 3 additions & 4 deletions mediator/med.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2173,14 +2173,13 @@ subroutine DataInitialize(gcomp, rc)
end if
is_local%wrap%nx(n1) = nint(real_nx)
is_local%wrap%ny(n1) = nint(real_ny)
endif
if (is_local%wrap%comp_present(n1)) then

write(msgString,'(3i8)') is_local%wrap%nx(n1), is_local%wrap%ny(n1), is_local%wrap%ntile(n1)
call ESMF_LogWrite(trim(subname)//":"//trim(compname(n1))//":"//trim(msgString), ESMF_LOGMSG_INFO)
if (maintask) then
write(logunit,'(a)') 'global nx,ny,ntile sizes for '//trim(compname(n1))//":"//trim(msgString)
end if
call ESMF_LogWrite(trim(subname)//":"//trim(compname(n1))//":"//trim(msgString), ESMF_LOGMSG_INFO)
endif
end if
end do
if (maintask) write(logunit,*)

Expand Down
22 changes: 15 additions & 7 deletions mediator/med_diag_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ module med_diag_mod
integer :: f_heat_cond = unset_index ! heat : heat content of evaporation
integer :: f_heat_rofl = unset_index ! heat : heat content of liquid runoff
integer :: f_heat_rofi = unset_index ! heat : heat content of ice runoff
integer :: f_heat_rofl_glc = unset_index ! heat : heat content of liquid glc runoff
integer :: f_heat_rofi_glc = unset_index ! heat : heat content of ice glc runoff

integer :: f_watr_frz = unset_index ! water: freezing
integer :: f_watr_melt = unset_index ! water: melting
Expand Down Expand Up @@ -331,14 +333,16 @@ subroutine med_diag_init(gcomp, rc)
f_heat_beg = f_heat_frz ! field first index for heat
f_heat_end = f_heat_sen ! field last index for heat
else if (trim(budget_table_version) == 'v1') then
call add_to_budget_diag(budget_diags%fields, f_heat_rain ,'hrain' ) ! field heat : enthalpy of rain
call add_to_budget_diag(budget_diags%fields, f_heat_snow ,'hsnow' ) ! field heat : enthalpy of snow
call add_to_budget_diag(budget_diags%fields, f_heat_evap ,'hevap' ) ! field heat : enthalpy of evaporation
call add_to_budget_diag(budget_diags%fields, f_heat_cond ,'hcond' ) ! field heat : enthalpy of evaporation
call add_to_budget_diag(budget_diags%fields, f_heat_rofl ,'hrofl' ) ! field heat : enthalpy of liquid runoff
call add_to_budget_diag(budget_diags%fields, f_heat_rofi ,'hrofi' ) ! field heat : enthalpy of ice runoff
call add_to_budget_diag(budget_diags%fields, f_heat_rain ,'hrain' ) ! field heat : enthalpy of rain
call add_to_budget_diag(budget_diags%fields, f_heat_snow ,'hsnow' ) ! field heat : enthalpy of snow
call add_to_budget_diag(budget_diags%fields, f_heat_evap ,'hevap' ) ! field heat : enthalpy of evaporation
call add_to_budget_diag(budget_diags%fields, f_heat_cond ,'hcond' ) ! field heat : enthalpy of evaporation
call add_to_budget_diag(budget_diags%fields, f_heat_rofl ,'hrofl' ) ! field heat : enthalpy of liquid runoff
call add_to_budget_diag(budget_diags%fields, f_heat_rofi ,'hrofi' ) ! field heat : enthalpy of ice runoff
call add_to_budget_diag(budget_diags%fields, f_heat_rofl_glc,'hrofl_glc' ) ! field heat : enthalpy of liquid glc runoff
call add_to_budget_diag(budget_diags%fields, f_heat_rofi_glc,'hrofi_glc' ) ! field heat : enthalpy of ice glc runoff
f_heat_beg = f_heat_frz ! field first index for heat
f_heat_end = f_heat_rofi ! field last index for heat
f_heat_end = f_heat_rofi_glc ! field last index for heat
end if

! -----------------------------------------
Expand Down Expand Up @@ -1620,6 +1624,10 @@ subroutine med_phases_diag_ocn( gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_ocn(is_local%wrap%FBExp(compocn), 'Foxx_hrofi', f_heat_rofi , ic, areas, sfrac, budget_local, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_ocn(is_local%wrap%FBExp(compocn), 'Foxx_hrofl_glc', f_heat_rofl_glc, ic, areas, sfrac, budget_local, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_ocn(is_local%wrap%FBExp(compocn), 'Foxx_hrofi_glc', f_heat_rofi_glc , ic, areas, sfrac, budget_local, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

budget_local(f_heat_latf,ic,ip) = -budget_local(f_watr_snow,ic,ip)*shr_const_latice
budget_local(f_heat_ioff,ic,ip) = -budget_local(f_watr_ioff,ic,ip)*shr_const_latice
Expand Down
89 changes: 60 additions & 29 deletions mediator/med_io_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -870,24 +870,28 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &

ng = maxval(maxIndexPTile)
if (tiles) then
lnx = nx
lny = ny
lntile = ng/(lnx*lny)
write(tmpstr,*) subname, 'ng,lnx,lny,lntile = ',ng,lnx,lny,lntile
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
if (lntile /= ntile) then
call ESMF_LogWrite(trim(subname)//' ERROR: grid2d size and ntile are not consistent ', ESMF_LOGMSG_INFO)
call ESMF_Finalize(endflag=ESMF_END_ABORT)
endif
lnx = ng
lny = 1
lntile = 1
if (nx > 0) lnx = nx
if (ny > 0) lny = ny
if (ntile > 0) lntile = ntile
write(tmpstr,*) subname, 'ng,lnx,lny,lntile = ',ng,lnx,lny,lntile
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
if (lnx*lny*lntile /= ng) then
write(tmpstr,*) subname,' ERROR: grid size not consistent ',ng,lnx,lny,lntile
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
call ESMF_Finalize(endflag=ESMF_END_ABORT)
end if
else
lnx = ng
lny = 1
if (nx > 0) lnx = nx
if (ny > 0) lny = ny
if (lnx*lny /= ng) then
write(tmpstr,*) subname,' WARNING: grid2d size not consistent ',ng,lnx,lny
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
endif
lnx = ng
lny = 1
if (nx > 0) lnx = nx
if (ny > 0) lny = ny
if (lnx*lny /= ng) then
write(tmpstr,*) subname,' WARNING: grid2d size not consistent ',ng,lnx,lny
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
endif
end if
deallocate(minIndexPTile, maxIndexPTile)

Expand All @@ -902,7 +906,7 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &
if (tiles) then
rcode = pio_def_dim(io_file, trim(lpre)//'_nx', lnx, dimid3(1))
rcode = pio_def_dim(io_file, trim(lpre)//'_ny', lny, dimid3(2))
rcode = pio_def_dim(io_file, trim(lpre)//'_ntile', ntile, dimid3(3))
rcode = pio_def_dim(io_file, trim(lpre)//'_ntile', lntile, dimid3(3))
if (present(nt)) then
dimid4(1:3) = dimid3
rcode = pio_inq_dimid(io_file, 'time', dimid4(4))
Expand Down Expand Up @@ -1020,10 +1024,18 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &
write(tmpstr,*) subname,' dof = ',ns,size(dof),dof(1),dof(ns) !,minval(dof),maxval(dof)
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
if (tiles) then
call pio_initdecomp(io_subsystem, pio_double, (/lnx,lny,ntile/), dof, iodesc)
if (luse_float) then
call pio_initdecomp(io_subsystem, pio_real, (/lnx,lny,lntile/), dof, iodesc)
else
call pio_initdecomp(io_subsystem, pio_double, (/lnx,lny,lntile/), dof, iodesc)
end if
else
call pio_initdecomp(io_subsystem, pio_double, (/lnx,lny/), dof, iodesc)
!call pio_writedof(lpre, (/lnx,lny/), int(dof,kind=PIO_OFFSET_KIND), mpicom)
if (luse_float) then
call pio_initdecomp(io_subsystem, pio_real, (/lnx,lny/), dof, iodesc)
else
call pio_initdecomp(io_subsystem, pio_double, (/lnx,lny/), dof, iodesc)
end if
!call pio_writedof(lpre, (/lnx,lny/), int(dof,kind=PIO_OFFSET_KIND), mpicom)
end if
deallocate(dof)

Expand Down Expand Up @@ -1056,10 +1068,18 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &
rcode = pio_inq_varid(io_file, trim(name1), varid)
call pio_setframe(io_file,varid,frame)

if (gridToFieldMap(1) == 1) then
call pio_write_darray(io_file, varid, iodesc, fldptr2(:,n), rcode, fillval=lfillvalue)
else if (gridToFieldMap(1) == 2) then
call pio_write_darray(io_file, varid, iodesc, fldptr2(n,:), rcode, fillval=lfillvalue)
if (luse_float) then
if (gridToFieldMap(1) == 1) then
call pio_write_darray(io_file, varid, iodesc, real(fldptr2(:,n),r4), rcode, fillval=real(lfillvalue,r4))
else if (gridToFieldMap(1) == 2) then
call pio_write_darray(io_file, varid, iodesc, real(fldptr2(n,:),r4), rcode, fillval=real(lfillvalue,r4))
end if
else
if (gridToFieldMap(1) == 1) then
call pio_write_darray(io_file, varid, iodesc, fldptr2(:,n), rcode, fillval=lfillvalue)
else if (gridToFieldMap(1) == 2) then
call pio_write_darray(io_file, varid, iodesc, fldptr2(n,:), rcode, fillval=lfillvalue)
end if
end if
end do
else if (rank == 1 .or. rank == 0) then
Expand All @@ -1068,7 +1088,11 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &
call pio_setframe(io_file,varid,frame)
! fix for writing data on exchange grid, which has no data in some PETs
if (rank == 0) nullify(fldptr1)
call pio_write_darray(io_file, varid, iodesc, fldptr1, rcode, fillval=lfillvalue)
if (luse_float) then
call pio_write_darray(io_file, varid, iodesc, real(fldptr1,r4), rcode, fillval=real(lfillvalue,r4))
else
call pio_write_darray(io_file, varid, iodesc, fldptr1, rcode, fillval=lfillvalue)
end if
end if ! end if rank is 2 or 1 or 0

end if ! end if not "hgt"
Expand All @@ -1077,12 +1101,19 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &
! Fill coordinate variables - why is this being done each time?
rcode = pio_inq_varid(io_file, trim(coordvarnames(1)), varid)
call pio_setframe(io_file,varid,frame)
call pio_write_darray(io_file, varid, iodesc, ownedElemCoords_x, rcode, fillval=lfillvalue)
if (luse_float) then
call pio_write_darray(io_file, varid, iodesc, real(ownedElemCoords_x,r4), rcode, fillval=real(lfillvalue,r4))
else
call pio_write_darray(io_file, varid, iodesc, ownedElemCoords_x, rcode, fillval=lfillvalue)
end if

rcode = pio_inq_varid(io_file, trim(coordvarnames(2)), varid)
call pio_setframe(io_file,varid,frame)
call pio_write_darray(io_file, varid, iodesc, ownedElemCoords_y, rcode, fillval=lfillvalue)

if (luse_float) then
call pio_write_darray(io_file, varid, iodesc, real(ownedElemCoords_y,r4), rcode, fillval=real(lfillvalue,r4))
else
call pio_write_darray(io_file, varid, iodesc, ownedElemCoords_y, rcode, fillval=lfillvalue)
end if
call pio_syncfile(io_file)
call pio_freedecomp(io_file, iodesc)
endif
Expand Down
Loading

0 comments on commit 3e1683b

Please sign in to comment.