Skip to content

Commit

Permalink
Merge pull request #489 from alperaltuntas/add_glc_runoff_heat_content
Browse files Browse the repository at this point in the history
Compute and export heat content associated with glc runoffs
  • Loading branch information
jedwards4b authored Aug 1, 2024
2 parents 72280dd + e6ad652 commit 739b964
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 21 deletions.
3 changes: 3 additions & 0 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,6 +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_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 @@ -1023,6 +1023,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
22 changes: 15 additions & 7 deletions mediator/med_diag_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,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 @@ -330,14 +332,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 @@ -1601,6 +1605,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
3 changes: 2 additions & 1 deletion mediator/med_phases_prep_atm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ subroutine med_phases_prep_atm_enthalpy_correction (gcomp, hcorr, rc)
! Note that this is only called if the following fields are in FBExp(compocn)
! 'Faxa_rain','Foxx_hrain','Faxa_snow' ,'Foxx_hsnow',
! 'Foxx_evap','Foxx_hevap','Foxx_hcond','Foxx_rofl',
! 'Foxx_hrofl','Foxx_rofi','Foxx_hrofi'
! 'Foxx_hrofl','Foxx_rofi','Foxx_hrofi','Foxx_rofl_glc',
! 'Foxx_hrofl_glc','Foxx_rofi_glc','Foxx_hrofi_glc'

use ESMF , only : ESMF_VMAllreduce, ESMF_GridCompGet, ESMF_REDUCE_SUM
use ESMF , only : ESMF_VM
Expand Down
44 changes: 31 additions & 13 deletions mediator/med_phases_prep_ocn_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ subroutine med_phases_prep_ocn_accum(gcomp, rc)
real(r8), pointer :: hcond(:)
real(r8), pointer :: rofl(:), hrofl(:)
real(r8), pointer :: rofi(:), hrofi(:)
real(r8), pointer :: rofl_glc(:), hrofl_glc(:)
real(r8), pointer :: rofi_glc(:), hrofi_glc(:)
real(r8), pointer :: areas(:)
real(r8), allocatable :: hcorr(:)
type(med_fldlist_type), pointer :: fldList
Expand Down Expand Up @@ -156,20 +158,24 @@ subroutine med_phases_prep_ocn_accum(gcomp, rc)
!---------------------------------------
!--- custom calculations
!---------------------------------------
! compute enthaly associated with rain, snow, condensation and liquid river runoff
! compute enthalpy associated with rain, snow, condensation and liquid river & glc runoff
! the sea-ice model already accounts for the enthalpy flux (as part of melth), so
! enthalpy from meltw **is not** included below
if ( FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_rain' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrain' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_snow' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hsnow' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_evap' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hevap' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hcond' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofl' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrofl' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofi' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrofi' , rc=rc)) then
if ( FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_rain' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrain' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_snow' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hsnow' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_evap' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hevap' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hcond' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofl' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrofl' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofi' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrofi' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Forr_rofl_glc' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrofl_glc' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Forr_rofi_glc' , rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrofi_glc' , rc=rc)) then

call FB_GetFldPtr(is_local%wrap%FBImp(compocn,compocn), 'So_t', tocn, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -201,6 +207,16 @@ subroutine med_phases_prep_ocn_accum(gcomp, rc)
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Foxx_hrofi', hrofi, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Forr_rofl_glc' , rofl_glc, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Foxx_hrofl_glc', hrofl_glc, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Forr_rofi_glc' , rofi_glc, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Foxx_hrofi_glc', hrofi_glc, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

do n = 1,size(tocn)
! Need max to ensure that will not have an enthalpy contribution if the water is below 0C
hrain(n) = max((tocn(n) - shr_const_tkfrz), 0._r8) * rain(n) * shr_const_cpsw
Expand All @@ -209,6 +225,8 @@ subroutine med_phases_prep_ocn_accum(gcomp, rc)
hcond(n) = max((tocn(n) - shr_const_tkfrz), 0._r8) * max(evap(n), 0._r8) * shr_const_cpsw
hrofl(n) = max((tocn(n) - shr_const_tkfrz), 0._r8) * rofl(n) * shr_const_cpsw
hrofi(n) = min((tocn(n) - shr_const_tkfrz), 0._r8) * rofi(n) * shr_const_cpsw
hrofl_glc(n) = max((tocn(n) - shr_const_tkfrz), 0._r8) * rofl_glc(n) * shr_const_cpsw
hrofi_glc(n) = min((tocn(n) - shr_const_tkfrz), 0._r8) * rofi_glc(n) * shr_const_cpsw
end do

! Determine enthalpy correction factor that will be added to the sensible heat flux sent to the atm
Expand All @@ -220,7 +238,7 @@ subroutine med_phases_prep_ocn_accum(gcomp, rc)
glob_area_inv = 1._r8 / (4._r8 * shr_const_pi)
areas => is_local%wrap%mesh_info(compocn)%areas
do n = 1,size(tocn)
hcorr(n) = (hrain(n) + hsnow(n) + hcond(n) + hevap(n) + hrofl(n) + hrofi(n)) * &
hcorr(n) = (hrain(n) + hsnow(n) + hcond(n) + hevap(n) + hrofl(n) + hrofi(n) + hrofl_glc(n) + hrofi_glc(n)) * &
areas(n) * glob_area_inv
end do
call med_phases_prep_atm_enthalpy_correction(gcomp, hcorr, rc)
Expand Down

0 comments on commit 739b964

Please sign in to comment.