diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7aa80f484..c9d6ea9ff43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed +- exports propagated to parent by "E2E connections" were not properly deferred and were always allocated ### Added diff --git a/generic/MAPL_Generic.F90 b/generic/MAPL_Generic.F90 index fe074f32874..2d672b2b15c 100644 --- a/generic/MAPL_Generic.F90 +++ b/generic/MAPL_Generic.F90 @@ -6368,6 +6368,7 @@ subroutine MAPL_StateCreateFromSpecNew(STATE,SPEC,DEFER,range, RC) integer :: range_(2) type(MAPL_VarSpec), pointer :: varspec + character(len=ESMF_MAXSTR) :: fname if (present(range)) then range_ = range @@ -6496,9 +6497,15 @@ subroutine MAPL_StateCreateFromSpecNew(STATE,SPEC,DEFER,range, RC) isCreated = ESMF_FieldIsCreated(SPEC_FIELD, rc=status) _VERIFY(STATUS) if (isCreated) then - call MAPL_AllocateCoupling( SPEC_FIELD, RC=STATUS ) ! if 'DEFER' this allocates the data - _VERIFY(STATUS) - + call ESMF_FieldGet(SPEC_FIELD, name=fname, __RC__) + if (.not. deferAlloc .or. short_name/=fname) then + call MAPL_AllocateCoupling( SPEC_FIELD, RC=STATUS ) ! if 'DEFER' this allocates the data + _VERIFY(STATUS) + else + field = spec_field + goto 20 + end if + !ALT we are creating new field so that we can optionally change the name of the field; ! the important thing is that the data (ESMF_Array) is the SAME as the one in SPEC_Field @@ -6611,6 +6618,7 @@ subroutine MAPL_StateCreateFromSpecNew(STATE,SPEC,DEFER,range, RC) _VERIFY(STATUS) end if end if +20 continue else ! Create the appropriate ESMF FIELD