Skip to content

Commit

Permalink
Merge branch 'stephenprice/glc/update-glc-budgets-new' (PR #6634)
Browse files Browse the repository at this point in the history
Update glc coupler budgets for active Greenland ice sheet

This PR adds functionality to coupler budget code so that x2g_ and l2x_
fields associated with Greenland ice sheet surface mass balance are
accounted for in the coupler budget tables. Also added, but currently
passing fields of zeroes, is support for g2x_ fields associated with
iceberg fluxes when running with a dynamic Greenland ice sheet. Includes
a correction to the renormalization scheme in prep_glc_mod.

[non-BFB] for configurations with active lnd and glc
  • Loading branch information
jonbob committed Dec 18, 2024
2 parents e58531e + 2a630b1 commit 0daf4c3
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 64 deletions.
6 changes: 4 additions & 2 deletions components/mpas-albany-landice/driver/glc_comp_mct.F
Original file line number Diff line number Diff line change
Expand Up @@ -1490,10 +1490,12 @@ subroutine glc_export_mct(g2x_g, errorCode)
do i = 1, nCellsSolve
n = n + 1

!call route_ice_runoff(0.0_RKIND, & !Recuperate runoff routing switch code (originally in glc_route_ice_runoff module in earlier code), and attach to ice calving flux once present...
! Recuperate runoff routing switch code (originally in glc_route_ice_runoff module in earlier code),
! and attach to ice calving flux once present...
!call route_ice_runoff(0.0_RKIND, &
! rofi_to_ocn=Fogg_rofi, &
! rofi_to_ice=Figg_rofi)
g2x_g % rAttr(index_g2x_Fogg_rofi,n)=0.0 !...and remove these placeholders
g2x_g % rAttr(index_g2x_Fogg_rofi,n)=0.0!...and remove these placeholders
g2x_g % rAttr(index_g2x_Figg_rofi,n)=0.0 !...and remove these placeholders
g2x_g % rAttr(index_g2x_Fogg_rofl,n) = 0.0 !Attach to subglacial liquid flux once present

Expand Down
19 changes: 16 additions & 3 deletions driver-mct/main/cime_comp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ module cime_comp_mod
! diagnostic routines
use seq_diag_mct, only : seq_diag_zero_mct , seq_diag_avect_mct, seq_diag_lnd_mct
use seq_diag_mct, only : seq_diag_rof_mct , seq_diag_ocn_mct , seq_diag_atm_mct
use seq_diag_mct, only : seq_diag_ice_mct , seq_diag_accum_mct, seq_diag_print_mct
use seq_diag_mct, only : seq_diag_ice_mct , seq_diag_glc_mct
use seq_diag_mct, only : seq_diag_accum_mct, seq_diag_print_mct
use seq_diagBGC_mct, only : seq_diagBGC_zero_mct , seq_diagBGC_avect_mct, seq_diagBGC_lnd_mct
use seq_diagBGC_mct, only : seq_diagBGC_rof_mct , seq_diagBGC_ocn_mct , seq_diagBGC_atm_mct
use seq_diagBGC_mct, only : seq_diagBGC_ice_mct , seq_diagBGC_accum_mct
Expand Down Expand Up @@ -3052,8 +3053,12 @@ subroutine cime_run()
!----------------------------------------------------------
!| GLC SETUP-SEND
!----------------------------------------------------------
if (glc_present .and. glcrun_alarm) then
call cime_run_glc_setup_send(lnd2glc_averaged_now, prep_glc_accum_avg_called)
if (glc_present) then
if (glcrun_alarm) then
call cime_run_glc_setup_send(lnd2glc_averaged_now, prep_glc_accum_avg_called)
else
call prep_glc_zero_fields()
endif
endif

! ------------------------------------------------------------------------
Expand Down Expand Up @@ -3100,6 +3105,7 @@ subroutine cime_run()

endif
endif

!----------------------------------------------------------
!| Budget with old fractions
!----------------------------------------------------------
Expand Down Expand Up @@ -4749,6 +4755,9 @@ subroutine cime_run_calc_budgets1(in_cplrun)
if (ice_present) then
call seq_diag_ice_mct(ice(ens1), fractions_ix(ens1), infodata, do_x2i=.true.)
endif
if (glc_present) then
call seq_diag_glc_mct(glc(ens1), fractions_gx(ens1), infodata, do_x2g=.true.)
endif
if (do_bgc_budgets) then
if (rof_present) then
call seq_diagBGC_rof_mct(rof(ens1), fractions_rx(ens1), infodata)
Expand Down Expand Up @@ -4788,6 +4797,9 @@ subroutine cime_run_calc_budgets2(in_cplrun)
if (ice_present) then
call seq_diag_ice_mct(ice(ens1), fractions_ix(ens1), infodata, do_i2x=.true.)
endif
if (glc_present) then
call seq_diag_glc_mct(glc(ens1), fractions_gx(ens1), infodata, do_g2x=.true.)
endif
if (do_bgc_budgets) then
if (atm_present) then
call seq_diagBGC_atm_mct(atm(ens1), fractions_ax(ens1), infodata, do_a2x=.true., do_x2a=.true.)
Expand Down Expand Up @@ -5595,3 +5607,4 @@ function copy_and_trim_rpointer_file(src, dst) result(out)
end function copy_and_trim_rpointer_file

end module cime_comp_mod

15 changes: 14 additions & 1 deletion driver-mct/main/prep_glc_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module prep_glc_mod
public :: prep_glc_get_l2gacc_lx
public :: prep_glc_get_l2gacc_lx_one_instance
public :: prep_glc_get_l2gacc_lx_cnt
public :: prep_glc_get_l2gacc_lx_cnt_avg

public :: prep_glc_get_o2x_gx
public :: prep_glc_get_x2gacc_gx
Expand Down Expand Up @@ -91,6 +92,7 @@ module prep_glc_mod

type(mct_aVect), pointer :: l2gacc_lx(:) ! Lnd export, lnd grid, cpl pes - allocated in driver
integer , target :: l2gacc_lx_cnt ! l2gacc_lx: number of time samples accumulated
integer , target :: l2gacc_lx_cnt_avg ! l2gacc_lx: number of time samples averaged

! other module variables
integer :: mpicom_CPLID ! MPI cpl communicator
Expand Down Expand Up @@ -195,6 +197,7 @@ subroutine prep_glc_init(infodata, lnd_c2_glc, ocn_c2_glcshelf)
call mct_aVect_zero(l2gacc_lx(eli))
end do
l2gacc_lx_cnt = 0
l2gacc_lx_cnt_avg = 0
end if

if (glc_present .and. lnd_c2_glc) then
Expand Down Expand Up @@ -502,6 +505,7 @@ subroutine prep_glc_accum_avg(timer, lnd2glc_averaged_now)
call mct_avect_avg(l2gacc_lx(eli), l2gacc_lx_cnt)
end do
end if
l2gacc_lx_cnt_avg = l2gacc_lx_cnt
l2gacc_lx_cnt = 0

! Accumulation for OCN
Expand Down Expand Up @@ -950,6 +954,7 @@ subroutine prep_glc_zero_fields()
type(mct_avect), pointer :: x2g_gx
!---------------------------------------------------------------


do egi = 1,num_inst_glc
x2g_gx => component_get_x2c_cx(glc(egi))
call mct_aVect_zero(x2g_gx)
Expand Down Expand Up @@ -1195,8 +1200,9 @@ subroutine prep_glc_renormalize_smb(eli, fractions_lx, g2x_gx, mapper_Fg2l, area
aream_l(:) = dom_l%data%rAttr(km,:)

! Export land fractions from fractions_lx to a local array
! Note that for E3SM we are using lfrin instead of lfrac
allocate(lfrac(lsize_l))
call mct_aVect_exportRattr(fractions_lx, "lfrac", lfrac)
call mct_aVect_exportRattr(fractions_lx, "lfrin", lfrac)

! Map Sg_icemask from the glc grid to the land grid.
! This may not be necessary, if Sg_icemask_l has already been mapped from Sg_icemask_g.
Expand Down Expand Up @@ -1379,6 +1385,8 @@ subroutine prep_glc_renormalize_smb(eli, fractions_lx, g2x_gx, mapper_Fg2l, area
endif

if (iamroot) then
write(logunit,*) 'global_accum_on_land_grid = ', global_accum_on_land_grid
write(logunit,*) 'global_accum_on_glc_grid = ', global_accum_on_glc_grid
write(logunit,*) 'accum_renorm_factor = ', accum_renorm_factor
write(logunit,*) 'ablat_renorm_factor = ', ablat_renorm_factor
endif
Expand Down Expand Up @@ -1424,6 +1432,11 @@ function prep_glc_get_l2gacc_lx_cnt()
prep_glc_get_l2gacc_lx_cnt => l2gacc_lx_cnt
end function prep_glc_get_l2gacc_lx_cnt

function prep_glc_get_l2gacc_lx_cnt_avg()
integer, pointer :: prep_glc_get_l2gacc_lx_cnt_avg
prep_glc_get_l2gacc_lx_cnt_avg => l2gacc_lx_cnt_avg
end function prep_glc_get_l2gacc_lx_cnt_avg

function prep_glc_get_o2x_gx()
type(mct_aVect), pointer :: prep_glc_get_o2x_gx(:)
prep_glc_get_o2x_gx => o2x_gx(:)
Expand Down
Loading

0 comments on commit 0daf4c3

Please sign in to comment.