Skip to content

Commit

Permalink
remove unintended changes in nems
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Aug 31, 2023
1 parent bffee2d commit 27433f1
Showing 1 changed file with 9 additions and 32 deletions.
41 changes: 9 additions & 32 deletions mediator/med_phases_prep_ocn_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module med_phases_prep_ocn_mod
public :: med_phases_prep_ocn_accum ! called from run sequence
public :: med_phases_prep_ocn_avg ! called from run sequence

private :: med_phases_prep_ocn_custom_cesm
private :: med_phases_prep_ocn_custom
private :: med_phases_prep_ocn_custom_nems

character(*), parameter :: u_FILE_u = &
Expand Down Expand Up @@ -79,8 +79,6 @@ subroutine med_phases_prep_ocn_accum(gcomp, rc)
use ESMF , only : ESMF_GridComp, ESMF_FieldBundleGet
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_FAILURE, ESMF_LOGMSG_ERROR
use med_constants_mod , only : shr_const_cpsw, shr_const_tkfrz, shr_const_pi
use med_constants_mod , only : shr_const_cpfw, shr_const_cpice, shr_const_cpwv
use med_enthalpy_mod , only : med_compute_enthalpy, mediator_compute_enthalpy

! input/output variables
Expand Down Expand Up @@ -138,10 +136,9 @@ subroutine med_phases_prep_ocn_accum(gcomp, rc)
end if

! custom merges to ocean
if (trim(coupling_mode) == 'cesm') then
call med_phases_prep_ocn_custom_cesm(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else if (trim(coupling_mode(1:5)) == 'nems_') then
call med_phases_prep_ocn_custom(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (trim(coupling_mode(1:5)) == 'nems_') then
call med_phases_prep_ocn_custom_nems(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
Expand Down Expand Up @@ -236,7 +233,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc)
end subroutine med_phases_prep_ocn_avg

!-----------------------------------------------------------------------------
subroutine med_phases_prep_ocn_custom_cesm(gcomp, rc)
subroutine med_phases_prep_ocn_custom(gcomp, rc)

!---------------------------------------
! custom calculations for cesm
Expand Down Expand Up @@ -293,7 +290,7 @@ subroutine med_phases_prep_ocn_custom_cesm(gcomp, rc)
integer :: lsize
real(R8) :: c1,c2,c3,c4
character(len=64), allocatable :: fldnames(:)
character(len=*), parameter :: subname='(med_phases_prep_ocn_custom_cesm)'
character(len=*), parameter :: subname='(med_phases_prep_ocn_custom)'
!---------------------------------------

rc = ESMF_SUCCESS
Expand Down Expand Up @@ -541,7 +538,7 @@ subroutine med_phases_prep_ocn_custom_cesm(gcomp, rc)
end if
call t_stopf('MED:'//subname)

end subroutine med_phases_prep_ocn_custom_cesm
end subroutine med_phases_prep_ocn_custom

!-----------------------------------------------------------------------------
subroutine med_phases_prep_ocn_custom_nems(gcomp, rc)
Expand All @@ -564,7 +561,6 @@ subroutine med_phases_prep_ocn_custom_nems(gcomp, rc)
real(R8), pointer :: ifrac(:)
real(R8), pointer :: ofrac(:)
integer :: lsize
real(R8) , parameter :: const_lhvap = 2.501e6_R8 ! latent heat of evaporation ~ J/kg
character(len=*), parameter :: subname='(med_phases_prep_ocn_custom_nems)'
!---------------------------------------

Expand Down Expand Up @@ -593,9 +589,9 @@ subroutine med_phases_prep_ocn_custom_nems(gcomp, rc)
if (trim(coupling_mode) == 'nems_orig' .or. &
trim(coupling_mode) == 'nems_frac' .or. &
trim(coupling_mode) == 'nems_frac_aoflux_sbs') then
customwgt(:) = -ofrac(:) / const_lhvap
customwgt(:) = -ofrac(:)
call med_merge_field(is_local%wrap%FBExp(compocn), 'Faxa_evap', &
FBinA=is_local%wrap%FBImp(compatm,compocn), fnameA='Faxa_lat' , wgtA=customwgt, rc=rc)
FBinA=is_local%wrap%FBImp(compatm,compocn), fnameA='Faxa_evap' , wgtA=customwgt, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

customwgt(:) = -ofrac(:)
Expand All @@ -614,25 +610,6 @@ subroutine med_phases_prep_ocn_custom_nems(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

! netsw_for_ocn = [downsw_from_atm*(1-ice_fraction)*(1-ocn_albedo)] + [pensw_from_ice*(ice_fraction)]
customwgt(:) = ofrac(:) * (1.0_R8 - 0.06_R8)
call med_merge_field(is_local%wrap%FBExp(compocn), 'Foxx_swnet_vdr', &
FBinA=is_local%wrap%FBImp(compatm,compocn), fnameA='Faxa_swvdr' , wgtA=customwgt, &
FBinB=is_local%wrap%FBImp(compice,compocn), fnameB='Fioi_swpen_vdr', wgtB=ifrac, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call med_merge_field(is_local%wrap%FBExp(compocn), 'Foxx_swnet_vdf', &
FBinA=is_local%wrap%FBImp(compatm,compocn), fnameA='Faxa_swvdf' , wgtA=customwgt, &
FBinB=is_local%wrap%FBImp(compice,compocn), fnameB='Fioi_swpen_vdf', wgtB=ifrac, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call med_merge_field(is_local%wrap%FBExp(compocn), 'Foxx_swnet_idr', &
FBinA=is_local%wrap%FBImp(compatm,compocn), fnameA='Faxa_swndr' , wgtA=customwgt, &
FBinB=is_local%wrap%FBImp(compice,compocn), fnameB='Fioi_swpen_idr', wgtB=ifrac, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call med_merge_field(is_local%wrap%FBExp(compocn), 'Foxx_swnet_idf', &
FBinA=is_local%wrap%FBImp(compatm,compocn), fnameA='Faxa_swndf' , wgtA=customwgt, &
FBinB=is_local%wrap%FBImp(compice,compocn), fnameB='Fioi_swpen_idf', wgtB=ifrac, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

deallocate(customwgt)

if (dbug_flag > 20) then
Expand Down

0 comments on commit 27433f1

Please sign in to comment.