From 5a2913e07ddec1a6e6d6a17cbb6c0e3c513278e3 Mon Sep 17 00:00:00 2001 From: Atanas Trayanov Date: Mon, 27 Dec 2021 09:13:57 -0500 Subject: [PATCH 1/2] AT: This fixes a long-standing bug for E2E connections to always allocate such exports --- generic/MAPL_Generic.F90 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/generic/MAPL_Generic.F90 b/generic/MAPL_Generic.F90 index fe074f32874b..c5517dd02054 100644 --- a/generic/MAPL_Generic.F90 +++ b/generic/MAPL_Generic.F90 @@ -6496,9 +6496,14 @@ 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) - + if (.not. deferAlloc) 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 +6616,7 @@ subroutine MAPL_StateCreateFromSpecNew(STATE,SPEC,DEFER,range, RC) _VERIFY(STATUS) end if end if +20 continue else ! Create the appropriate ESMF FIELD From e65303d5e20d8b35f858c416ed7c404060e94d12 Mon Sep 17 00:00:00 2001 From: Atanas Trayanov Date: Mon, 27 Dec 2021 12:23:21 -0500 Subject: [PATCH 2/2] Fixes #1252. The proper fix needs a support from ESMF for field aliases Restricted E2E deferred export fix only for same name --- CHANGELOG.md | 1 + generic/MAPL_Generic.F90 | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cce48f7d4eb6..197c06d1aabc 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 c5517dd02054..2d672b2b15c3 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,7 +6497,8 @@ subroutine MAPL_StateCreateFromSpecNew(STATE,SPEC,DEFER,range, RC) isCreated = ESMF_FieldIsCreated(SPEC_FIELD, rc=status) _VERIFY(STATUS) if (isCreated) then - if (.not. deferAlloc) then + 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