From 0602beb046a5053620f7dcfaf9e792c8d7fd738e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 25 Oct 2023 20:53:38 -0600 Subject: [PATCH] Use a consf mapping already created for land-mask rather than a new consd mapping, this resolves mizuRoute issue: https://github.com/ESCOMP/mizuRoute/issues/426, which is #409 --- mediator/med_fraction_mod.F90 | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mediator/med_fraction_mod.F90 b/mediator/med_fraction_mod.F90 index 521ba0007..3050b94bf 100644 --- a/mediator/med_fraction_mod.F90 +++ b/mediator/med_fraction_mod.F90 @@ -151,11 +151,13 @@ subroutine med_fraction_init(gcomp, rc) use med_internalstate_mod , only : coupling_mode use med_internalstate_mod , only : compatm, compocn, compice, complnd use med_internalstate_mod , only : comprof, compglc, compwav, compname - use med_internalstate_mod , only : mapfcopy, mapconsd, mapnstod_consd + use med_internalstate_mod , only : mapfcopy, mapconsd, mapconsf, mapnstod_consd use med_internalstate_mod , only : InternalState, logunit, mastertask use med_map_mod , only : med_map_routehandles_init, med_map_rh_is_created use med_methods_mod , only : State_getNumFields => med_methods_State_getNumFields + use med_methods_mod , only : field_getdata1d => med_methods_Field_getdata1d use perf_mod , only : t_startf, t_stopf + use shr_sys_mod , only : shr_sys_abort ! input/output variables type(ESMF_GridComp) :: gcomp @@ -508,7 +510,7 @@ subroutine med_fraction_init(gcomp, rc) ! Set 'lfrac' in FBFrac(comprof) if (is_local%wrap%comp_present(complnd)) then - maptype = mapconsd + maptype = mapconsf if (.not. med_map_RH_is_created(is_local%wrap%RH(complnd,comprof,:),maptype, rc=rc)) then call med_map_routehandles_init( complnd, comprof, & FBSrc=is_local%wrap%FBImp(complnd,complnd), & @@ -518,10 +520,21 @@ subroutine med_fraction_init(gcomp, rc) end if call ESMF_FieldBundleGet(is_local%wrap%FBfrac(complnd), 'lfrac', field=field_src, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call field_getdata1d(field_src, lfrac, rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if ( (minval(lfrac) < -eps_fraclim) .or. (maxval(lfrac) > 1._r8+eps_fraclim) )then + ! call shr_sys_abort( "lfrac on the LND grid is out of bounds" ) + !end if call ESMF_FieldBundleGet(is_local%wrap%FBfrac(comprof), 'lfrac', field=field_dst, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call med_map_field(field_src, field_dst, is_local%wrap%RH(complnd,comprof,:), maptype, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call field_getdata1d(field_dst, lfrac, rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if ( (minval(lfrac) < -eps_fraclim) .or. (maxval(lfrac) > 1._r8+eps_fraclim) )then + ! write(logunit,*) 'minval, maxval of lfrac = ', minval(lfrac), maxval(lfrac) + ! call shr_sys_abort( "lfrac on the ROF grid is out of bounds" ) + !end if endif endif