Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions mediator/med_diag_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ subroutine med_diag_init(gcomp, rc)
call add_to_budget_diag(budget_diags%comps, c_ocn_arecv, 'a2c_ocn' ) ! comp index: ocn, on atm grid

call add_to_budget_diag(budget_diags%fields, f_area ,'area' ) ! field area (wrt to unit sphere)

! Note that this order is important here to determine f_heat_beg and f_heat_end
call add_to_budget_diag(budget_diags%fields, f_heat_frz ,'hfreeze' ) ! field heat : latent, freezing
call add_to_budget_diag(budget_diags%fields, f_heat_melt ,'hmelt' ) ! field heat : latent, melting
call add_to_budget_diag(budget_diags%fields, f_heat_swnet ,'hnetsw' ) ! field heat : short wave, net
Expand All @@ -290,6 +292,8 @@ subroutine med_diag_init(gcomp, rc)
call add_to_budget_diag(budget_diags%fields, f_heat_latf ,'hlatfus' ) ! field heat : latent, fusion, snow
call add_to_budget_diag(budget_diags%fields, f_heat_ioff ,'hiroff' ) ! field heat : latent, fusion, frozen runoff
call add_to_budget_diag(budget_diags%fields, f_heat_sen ,'hsen' ) ! field heat : sensible

! Note that this order is important here to determine f_watr_beg and f_watr_end
call add_to_budget_diag(budget_diags%fields, f_watr_frz ,'wfreeze' ) ! field water: freezing
call add_to_budget_diag(budget_diags%fields, f_watr_melt ,'wmelt' ) ! field water: melting
call add_to_budget_diag(budget_diags%fields, f_watr_rain ,'wrain' ) ! field water: precip, liquid
Expand All @@ -298,6 +302,7 @@ subroutine med_diag_init(gcomp, rc)
call add_to_budget_diag(budget_diags%fields, f_watr_salt ,'weqsaltf' ) ! field water: water equivalent of salt flux
call add_to_budget_diag(budget_diags%fields, f_watr_roff ,'wrunoff' ) ! field water: runoff/flood
call add_to_budget_diag(budget_diags%fields, f_watr_ioff ,'wfrzrof' ) ! field water: frozen runoff

call add_to_budget_diag(budget_diags%fields, f_watr_frz_16O ,'wfreeze_16O' ) ! field water isotope: freezing
call add_to_budget_diag(budget_diags%fields, f_watr_melt_16O ,'wmelt_16O' ) ! field water isotope: melting
call add_to_budget_diag(budget_diags%fields, f_watr_rain_16O ,'wrain_16O' ) ! field water isotope: precip, liquid
Expand Down Expand Up @@ -949,7 +954,7 @@ subroutine med_phases_diag_lnd( gcomp, rc)
call diag_lnd(is_local%wrap%FBImp(complnd,complnd), 'Fall_sen' , f_heat_sen , ic, areas, lfrac, budget_local, rc=rc)
call diag_lnd(is_local%wrap%FBImp(complnd,complnd), 'Fall_evap' , f_watr_evap , ic, areas, lfrac, budget_local, rc=rc)

call diag_lnd(is_local%wrap%FBImp(complnd,complnd), 'Flrl_rofsur', f_watr_roff, ic, &
call diag_lnd(is_local%wrap%FBImp(complnd,complnd), 'Flrl_rofsur', f_watr_roff, ic,&
areas, lfrac, budget_local, minus=.true., rc=rc)
call diag_lnd(is_local%wrap%FBImp(complnd,complnd), 'Flrl_rofgwl', f_watr_roff, ic,&
areas, lfrac, budget_local, minus=.true., rc=rc)
Expand All @@ -969,6 +974,8 @@ subroutine med_phases_diag_lnd( gcomp, rc)
call diag_lnd_wiso(is_local%wrap%FBImp(complnd,complnd), 'Flrl_rofi_wiso', &
f_watr_ioff_16O, f_watr_ioff_18O, f_watr_ioff_HDO, ic, areas, lfrac, budget_local, rc=rc)

budget_local(f_heat_ioff,ic,ip) = -budget_local(f_watr_ioff,ic,ip)*shr_const_latice

!-------------------------------
! to land from mediator
!-------------------------------
Expand Down Expand Up @@ -997,7 +1004,6 @@ subroutine med_phases_diag_lnd( gcomp, rc)
call diag_lnd_wiso(is_local%wrap%FBExp(complnd), 'Flrl_flood_wiso', &
f_watr_roff_16O, f_watr_roff_18O, f_watr_roff_HDO, ic, areas, lfrac, budget_local, minus=.true., rc=rc)

budget_local(f_heat_ioff,ic,ip) = -budget_local(f_watr_ioff,ic,ip)*shr_const_latice
budget_local(f_heat_latf,ic,ip) = -budget_local(f_watr_snow,ic,ip)*shr_const_latice

call t_stopf('MED:'//subname)
Expand Down Expand Up @@ -1108,7 +1114,7 @@ subroutine med_phases_diag_rof( gcomp, rc)
! from river to mediator
!-------------------------------

ic = c_rof_send
ic = c_rof_recv
ip = period_inst

call diag_rof(is_local%wrap%FBImp(comprof,comprof), 'Flrr_flood', f_watr_roff, ic, areas, budget_local, rc=rc)
Expand All @@ -1129,7 +1135,7 @@ subroutine med_phases_diag_rof( gcomp, rc)
! to river from mediator
!-------------------------------

ic = c_rof_recv
ic = c_rof_send
ip = period_inst

call diag_rof(is_local%wrap%FBExp(comprof), 'Flrl_rofsur', f_watr_roff, ic, areas, budget_local, rc=rc)
Expand Down Expand Up @@ -1254,7 +1260,7 @@ subroutine med_phases_diag_glc( gcomp, rc)
!-------------------------------

! TODO: this will not be correct if there is more than 1 ice sheet
ic = c_glc_send
ic = c_glc_recv
ip = period_inst

do ns = 1,num_icesheets
Expand Down
8 changes: 0 additions & 8 deletions mediator/med_phases_prep_ice_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ subroutine med_phases_prep_ice(gcomp, rc)
real(r8) :: nextsw_cday
integer :: scalar_id
real(r8) :: tmp(1)
logical :: first_call = .true.
logical :: first_precip_fact_call = .true.
character(len=*),parameter :: subname='(med_phases_prep_ice)'
!---------------------------------------
Expand Down Expand Up @@ -104,10 +103,6 @@ subroutine med_phases_prep_ice(gcomp, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
scalar_id=is_local%wrap%flds_scalar_index_precip_factor
precip_fact(1) = dataptr_scalar_ocn(scalar_id,1)
if (first_call) then
write(logunit,'(a)')'(merge_to_ice): Scaling rain, snow, liquid and ice runoff by precip_fact from ocn'
first_call = .false.
end if
if (precip_fact(1) /= 1._r8) then
write(logunit,'(a,f21.13)')&
'(merge_to_ice): Scaling rain, snow, liquid and ice runoff by non-unity precip_fact ',&
Expand Down Expand Up @@ -156,9 +151,6 @@ subroutine med_phases_prep_ice(gcomp, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
end if

! Set first call logical to false
first_call = .false.

if (dbug_flag > 5) then
call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO)
endif
Expand Down
5 changes: 0 additions & 5 deletions mediator/med_phases_prep_ocn_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ subroutine med_phases_prep_ocn_custom_cesm(gcomp, rc)
integer :: n
integer :: lsize
real(R8) :: c1,c2,c3,c4
logical :: first_call = .true.
character(len=64), allocatable :: fldnames(:)
character(len=*), parameter :: subname='(med_phases_prep_ocn_custom_cesm)'
!---------------------------------------
Expand Down Expand Up @@ -451,10 +450,6 @@ subroutine med_phases_prep_ocn_custom_cesm(gcomp, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
scalar_id=is_local%wrap%flds_scalar_index_precip_factor
precip_fact(1) = dataptr_scalar_ocn(scalar_id,1)
if (first_call) then
write(logunit,'(a)')'(merge_to_ocn): Scaling rain, snow, liquid and ice runoff by precip_fact from ocn'
first_call = .false.
end if
if (precip_fact(1) /= 1._r8) then
write(logunit,'(a,f21.13)')&
'(merge_to_ocn): Scaling rain, snow, liquid and ice runoff by non-unity precip_fact ',&
Expand Down