From fac966a3a7d655d2bf4e900c535e9c29a58c0389 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 14 Sep 2023 14:27:22 -0600 Subject: [PATCH 1/2] add Thomas Toniazzo changes --- mediator/fd_cesm.yaml | 53 ++++++++++++++++++++++++++- mediator/med_enthalpy_mod.F90 | 69 +++++++++++++++++++++++++++++++---- 2 files changed, 113 insertions(+), 9 deletions(-) diff --git a/mediator/fd_cesm.yaml b/mediator/fd_cesm.yaml index c09a63c58..9db92f6a5 100644 --- a/mediator/fd_cesm.yaml +++ b/mediator/fd_cesm.yaml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -1179,7 +1230,7 @@ # #----------------------------------- # section: wave import - #----------------------------------- + # ----------------------------------- # - standard_name: Fwxx_taux alias: mean_zonal_moment_flx diff --git a/mediator/med_enthalpy_mod.F90 b/mediator/med_enthalpy_mod.F90 index 38b3f6a8e..a74b4530c 100644 --- a/mediator/med_enthalpy_mod.F90 +++ b/mediator/med_enthalpy_mod.F90 @@ -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) @@ -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) @@ -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) From d6fefa03a8594039f83fc35cdb66c87f34e90422 Mon Sep 17 00:00:00 2001 From: James Edwards Date: Fri, 15 Sep 2023 09:51:57 -0600 Subject: [PATCH 2/2] correct hcorr calculation --- mediator/med_enthalpy_mod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mediator/med_enthalpy_mod.F90 b/mediator/med_enthalpy_mod.F90 index a74b4530c..a996913b3 100644 --- a/mediator/med_enthalpy_mod.F90 +++ b/mediator/med_enthalpy_mod.F90 @@ -219,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