Skip to content

Commit 1884692

Browse files
committed
v2.59: Backport ESMF v9 support from 2.61.0
1 parent 49bf501 commit 1884692

File tree

4 files changed

+37
-11
lines changed

4 files changed

+37
-11
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Deprecated
1919

20+
## [2.59.1] - 2025-09-19
21+
22+
### Changed
23+
24+
- Added support for ESMF 9
25+
- Requires `#ifdef` to support changes in deprecated `ESMF_Attribute` API in ESMF 9
26+
- Improved some error statements
27+
28+
2029
## [2.59.0] - 2025-08-06
2130

2231
### Fixed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ endif ()
88

99
project (
1010
MAPL
11-
VERSION 2.59.0
11+
VERSION 2.59.1
1212
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF
1313

1414
# Set the possible values of build type for cmake-gui

generic/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ target_include_directories (${this} PUBLIC
7171
target_link_libraries (${this} PUBLIC ESMF::ESMF NetCDF::NetCDF_Fortran
7272
PRIVATE OpenMP::OpenMP_Fortran)
7373

74+
# ESMF 9 made internal changes to the Info object that underlies the (now deprecated)
75+
# Attribute API. So, to get attributes by index, we need to specify
76+
# the convention and purpose arguments. Once MAPL requires ESMF 9, remove this
77+
# ifdef. (Not applicable to MAPL3 which uses Info natively.)
78+
if (ESMF_VERSION VERSION_GREATER_EQUAL 9.0.0)
79+
message(STATUS "ESMF 9 detected. Setting -DESMF_VER_GE_9")
80+
target_compile_definitions(${this} PRIVATE ESMF_VER_GE_9)
81+
endif ()
82+
7483
if (PFUNIT_FOUND)
7584
add_subdirectory(tests EXCLUDE_FROM_ALL)
7685
endif ()

generic/MAPL_Generic.F90

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ end subroutine i_Run
448448
integer , pointer :: phase_coldstart(:)=> null()
449449
integer , pointer :: phase_refresh(:)=> null()
450450
procedure(i_run), public, nopass, pointer :: customRefresh => null()
451-
451+
452452
! Make accessors?
453453
type(ESMF_GridComp) :: RootGC
454454
type(ESMF_GridComp) , pointer :: parentGC => null()
@@ -6060,7 +6060,7 @@ subroutine MAPL_ESMFStateReadFromFile(STATE,CLOCK,FILENAME,MPL,HDR,RC)
60606060

60616061
nwrgt1 = (mpl%grid%num_readers > 1)
60626062

6063-
isNC4 = MAPL_FILETYPE_UNK
6063+
isNC4 = MAPL_FILETYPE_UNK
60646064
if (on_tiles) mpl%grid%split_restart = .false.
60656065
if(INDEX(FNAME,'*') == 0) then
60666066
if (AmIRoot) then
@@ -7855,18 +7855,26 @@ subroutine MAPL_CopyFriendlinessInField(FIELDOUT,FIELDIN,RC)
78557855
character(len=ESMF_MAXSTR) :: NAME
78567856
logical :: VALUE
78577857

7858-
call ESMF_AttributeGet(FIELDIN, count=NF, RC=status)
7859-
_VERIFY(status)
7858+
! ESMF 9 made internal changes to the Info object that underlies the (now deprecated)
7859+
! Attribute API. So, to get attributes by index, we need to specify
7860+
! the convention and purpose arguments. Once MAPL requires ESMF 9, remove this
7861+
! ifdef. (Not applicable to MAPL3 which uses Info natively.)
7862+
#ifdef ESMF_VER_GE_9
7863+
call ESMF_AttributeGet(FIELDIN, count=NF, convention="ESMF", purpose="General", _RC)
7864+
#else
7865+
call ESMF_AttributeGet(FIELDIN, count=NF, _RC)
7866+
#endif
78607867

78617868
do I=1,NF
7862-
call ESMF_AttributeGet(FIELDIN,attributeIndex=I,NAME=NAME,RC=status)
7863-
_VERIFY(status)
7869+
#ifdef ESMF_VER_GE_9
7870+
call ESMF_AttributeGet(FIELDIN,attributeIndex=I,NAME=NAME,convention="ESMF", purpose="General",_RC)
7871+
#else
7872+
call ESMF_AttributeGet(FIELDIN,attributeIndex=I,NAME=NAME,_RC)
7873+
#endif
78647874
NAME = trim(NAME)
78657875
if(NAME(1:10)=='FriendlyTo') then
7866-
call ESMF_AttributeGet(FIELDIN , NAME=NAME, VALUE=VALUE, RC=status)
7867-
_VERIFY(status)
7868-
call ESMF_AttributeSet(FIELDOUT, NAME=NAME, VALUE=VALUE, RC=status)
7869-
_VERIFY(status)
7876+
call ESMF_AttributeGet(FIELDIN , NAME=NAME, VALUE=VALUE, _RC)
7877+
call ESMF_AttributeSet(FIELDOUT, NAME=NAME, VALUE=VALUE, _RC)
78707878
end if
78717879
end do
78727880

0 commit comments

Comments
 (0)