Skip to content

Commit

Permalink
now functional for F case
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Aug 30, 2023
1 parent c55d808 commit 39e6b18
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 5 additions & 1 deletion mediator/med_enthalpy_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module med_enthalpy_mod
use med_utils_mod , only : chkerr => med_utils_ChkErr
use med_methods_mod , only : FB_fldchk => med_methods_FB_FldChk
use med_methods_mod , only : FB_GetFldPtr => med_methods_FB_GetFldPtr
use med_internalstate_mod, only : compocn, compatm, InternalState
use med_internalstate_mod, only : compocn, compatm, comprof, InternalState
use perf_mod, only : t_startf, t_stopf


Expand Down Expand Up @@ -110,6 +110,8 @@ subroutine med_compute_enthalpy(is_local, rc)
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Foxx_rofl' , rofl, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
call FB_GetFldPtr(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofl', rofl, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif
if(FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrofl', rc)) then
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Foxx_hrofl', hrofl, rc=rc)
Expand All @@ -122,6 +124,8 @@ subroutine med_compute_enthalpy(is_local, rc)
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Foxx_rofi' , rofi, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
call FB_GetFldPtr(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofi', rofi, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif
if(FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_hrofi', rc)) then
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Foxx_hrofi', hrofi, rc=rc)
Expand Down
5 changes: 4 additions & 1 deletion mediator/med_internalstate_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ module med_internalstate_mod
logical :: ocn2glc_coupling = .false. ! obtained from attribute
logical :: lnd2glc_coupling = .false.
logical :: accum_lnd2glc = .false.

logical :: docn_present ! aoflux calc requires med_coupling_active true even for docn
! so we need an additional flag
! Mediator vm
type(ESMF_VM) :: vm

Expand Down Expand Up @@ -282,8 +283,10 @@ subroutine med_internalstate_init(gcomp, rc)
end if
call NUOPC_CompAttributeGet(gcomp, name='OCN_model', value=ocn_name, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
is_local%wrap%docn_present = .false.
if (isPresent .and. isSet) then
if (trim(ocn_name) /= 'socn') is_local%wrap%comp_present(compocn) = .true.
if (trim(ocn_name) == 'docn') is_local%wrap%docn_present = .true.
end if
call NUOPC_CompAttributeGet(gcomp, name='ICE_model', value=ice_name, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down
9 changes: 5 additions & 4 deletions mediator/med_phases_prep_atm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module med_phases_prep_atm_mod
use med_kind_mod , only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_Field, ESMF_FieldGet, ESMF_FieldBundleGet
use ESMF , only : ESMF_GridComp, ESMF_GridCompGet
use ESMF , only : ESMF_GridComp, ESMF_GridCompGet, ESMF_FieldBundleIsCreated
use med_constants_mod , only : dbug_flag => med_constants_dbug_flag
use med_utils_mod , only : memcheck => med_memcheck
use med_utils_mod , only : chkerr => med_utils_ChkErr
Expand Down Expand Up @@ -239,9 +239,10 @@ subroutine med_phases_prep_atm(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! IF data ocn case compute first, otherwise computed in prep_ocn_mod

! call med_compute_enthalpy(is_local, rc)
! if (ChkErr(rc,__LINE__,u_FILE_u)) return
if(is_local%wrap%docn_present) then
call med_compute_enthalpy(is_local, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif
do n = 1,size(dataptr1)
dataptr1(n) = dataptr1(n) + med_enthalpy_get_global_htot_corr()
end do
Expand Down

0 comments on commit 39e6b18

Please sign in to comment.