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
53 changes: 52 additions & 1 deletion mediator/fd_cesm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@
canonical_units: N m-2
description: mediator export
#
- standard_name: Faox_tauxa
alias: stress_on_air_ocn_zonal (atm)
canonical_units: N m-2
description: mediator export
#
- standard_name: Faox_tauya
alias: stress_on_air_ocn_merid (atm)
canonical_units: N m-2
description: mediator export
#
- standard_name: area
canonical_units: radians**2
description: mediator area for component
Expand Down Expand Up @@ -226,6 +236,16 @@
description: atmosphere export
mean downward SW heat flux
#
- standard_name: Faxa_wsxadj
canonical_units: Pa
description: (from) atmosphere export to flux_atmocn (for now)
mean wind-stess correction due to PBL iteration, zonal component
#
- standard_name: Faxa_wsyadj
canonical_units: Pa
description: (from) atmosphere export to flux_atmocn (for now)
mean wind-stess correction due to PBL iteration, meridional component
#
- standard_name: Faxa_ndep
canonical_units: kg(N)/m2/sec
description: atmosphere export to land and ocean - currently nhx and noy
Expand Down Expand Up @@ -259,6 +279,11 @@
- standard_name: Faxa_rainl_wiso
canonical_units: kg m-2 s-1
description: atmosphere export
#
- standard_name: Faxa_hrain
alias: mean_matentf_of_rain
canonical_units: W m-2
description: atmosphere export
#
- standard_name: Faxa_snow
alias: mean_fprec_rate
Expand All @@ -284,6 +309,11 @@
- standard_name: Faxa_snowl_wiso
canonical_units: kg m-2 s-1
description: atmosphere export
#
- standard_name: Faxa_hsnow
alias: mean_matentf_of_snow
canonical_units: W m-2
description: atmosphere export
#
- standard_name: Faxa_swnet
canonical_units: W m-2
Expand Down Expand Up @@ -407,6 +437,11 @@
alias: mean_laten_heat_flx_atm
canonical_units: W m-2
description: atmosphere export
#
- standard_name: Faxa_hevap
alias: mean_matentf_of_vapour
canonical_units: W m-2
description: atmosphere export
#
- standard_name: Faxa_sen
alias: mean_sensi_heat_flx_atm
Expand Down Expand Up @@ -1146,6 +1181,22 @@
canonical_units: 1
description: ocean import - fractional atmosphere coverage used in radiation computations wrt ocean
#
- standard_name: Sw_swh
canonical_units: m
description: wave import - significant wave height
#
- standard_name: Sw_mwl
canonical_units: m
description: wave import - mean wave length
#
- standard_name: Sw_ch
canonical_units: nondmnsnl
description: wave import - Charnock parameter
#
- standard_name: Sw_z0
canonical_units: m
description: wave import - roughness length
#
- standard_name: Sw_hstokes
canonical_units: m
description: ocean import - Stokes drift depth
Expand Down Expand Up @@ -1179,7 +1230,7 @@
#
#-----------------------------------
# section: wave import
#-----------------------------------
# -----------------------------------
#
- standard_name: Fwxx_taux
alias: mean_zonal_moment_flx
Expand Down
73 changes: 64 additions & 9 deletions mediator/med_enthalpy_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ subroutine med_compute_enthalpy(is_local, rc)
real(r8), pointer :: rainl(:), rainc(:), tbot(:)
real(r8), pointer :: snowl(:), snowc(:), ofrac(:)
real(r8), pointer :: hrain(:), hsnow(:), hevap(:), hcond(:), hrofl(:), hrofi(:)
real(r8), pointer :: hrain_a(:), hevap_a(:), hsnow_a(:), hrofl_a(:), hrofi_a(:)
real(r8), allocatable :: hcorr(:)
real(r8), pointer :: areas(:)
real(r8), parameter :: glob_area_inv = 1._r8 / (4._r8 * pi)
Expand All @@ -50,8 +51,13 @@ subroutine med_compute_enthalpy(is_local, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
nmax = size(tocn)

call FB_GetFldPtr(is_local%wrap%FBImp(compatm, compocn), 'Sa_tbot', tbot, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (FB_fldchk(is_local%wrap%FBExp(compocn), 'Sa_tbot' , rc=rc)) then
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Sa_tbot', tbot, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
call FB_GetFldPtr(is_local%wrap%FBImp(compatm, compocn), 'Sa_tbot', tbot, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif

if(FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_rain', rc)) then
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Faxa_rain' , rain, rc=rc)
Expand Down Expand Up @@ -143,16 +149,63 @@ subroutine med_compute_enthalpy(is_local, rc)
call fldbun_getdata1d(is_local%wrap%FBImp(compocn,compocn), 'So_omask', ofrac, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_hrain' , rc=rc)) then
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Faxa_hrain', hrain_a, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
do n = 1,nmax
hrain(n) = hrain_a(n) - tkfrz*rain(n)*cpfw * ofrac(n)
enddo
else if (FB_fldchk(is_local%wrap%FBExp(compocn), 'Sa_tbot' , rc=rc)) then
do n = 1,nmax
hrain(n) = max((tbot(n) - tkfrz), 0._r8) * rain(n) * cpfw * ofrac(n)
enddo
else
do n = 1,nmax
hrain(n) = max((tocn(n) - tkfrz), 0._r8) * rain(n) * cpfw * ofrac(n)
enddo
endif

if (FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_hevap' , rc=rc)) then
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Faxa_hevap', hevap_a, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
do n = 1,nmax
hevap(n) = min(hevap_a(n),0._r8) - tkfrz * min(evap(n),0._r8) * cpwv * ofrac(n)
hcond(n) = max(hevap_a(n),0._r8) - tkfrz * max(evap(n),0._r8) * cpwv * ofrac(n)
enddo
else
do n = 1,nmax
hevap(n) = (tocn(n) - tkfrz) * min(evap(n),0._r8) * cpwv * ofrac(n)
hcond(n) = (tocn(n) - tkfrz) * max(evap(n),0._r8) * cpwv * ofrac(n)
enddo
endif

if (FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_hsnow' , rc=rc)) then
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Faxa_hsnow', hsnow_a, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
do n = 1,nmax
hsnow(n) = hsnow_a(n) - tkfrz * snow(n) * cpice * ofrac(n)
enddo
else if (FB_fldchk(is_local%wrap%FBExp(compocn), 'Sa_tbot' , rc=rc)) then
do n = 1,nmax
hsnow(n) = min((tbot(n) - tkfrz), 0._r8) * snow(n) * cpice * ofrac(n)
enddo
else
do n = 1,nmax
hsnow(n) = min((tocn(n) - tkfrz), 0._r8) * snow(n) * cpice * ofrac(n)
enddo
endif


do n=1,nmax
! for F cases (docn) tocn is non-zero over land and so ofrac must be included
! so that only ocean points are included in calculation
! Need max to ensure that will not have an enthalpy contribution if the water is below 0C
hrain(n) = max((tbot(n) - tkfrz), 0._r8) * rain(n) * cpfw * ofrac(n)
hsnow(n) = min((tbot(n) - tkfrz), 0._r8) * snow(n) * cpice * ofrac(n)
hevap(n) = (tocn(n) - tkfrz) * min(evap(n), 0._r8) * cpwv * ofrac(n)
hcond(n) = (tocn(n) - tkfrz) * max(evap(n), 0._r8) * cpwv * ofrac(n)
hrofl(n) = max((tocn(n) - tkfrz), 0._r8) * rofl(n) * cpfw * ofrac(n)
hrofi(n) = min((tocn(n) - tkfrz), 0._r8) * rofi(n) * cpice * ofrac(n)

hrofl_a(n)= max( tocn(n) , tkfrz ) * rofl(n) * cpsw * ofrac(n)
hrofi_a(n)= min( tocn(n) , tkfrz ) * rofi(n) * cpsw * ofrac(n)

hrofl(n) = max((tocn(n) - tkfrz), 0._r8) * rofl(n) * cpsw * ofrac(n)
hrofi(n) = min((tocn(n) - tkfrz), 0._r8) * rofi(n) * cpsw * ofrac(n)
end do
if(.not. FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_rain', rc)) deallocate(rain)
if(.not. FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_snow', rc)) deallocate(snow)
Expand All @@ -166,8 +219,10 @@ subroutine med_compute_enthalpy(is_local, rc)
allocate(hcorr(nmax))
areas => is_local%wrap%mesh_info(compocn)%areas
do n = 1,nmax
hcorr(n) = (hrain(n) + hsnow(n) + hcond(n) + hevap(n) + hrofl(n) + hrofi(n)) * &
hcorr(n) = (hrain_a(n) + hsnow_a(n) + hevap_a(n) + hrofl_a(n) + hrofi_a(n)) * &
areas(n) * glob_area_inv

! hcorr(n) = (hrofl_a(n) + hrofi_a(n)) *areas(n) *glob_area_inv
end do

! Determine sum of enthalpy correction for each hcorr index locally
Expand Down