diff --git a/CHANGELOG.md b/CHANGELOG.md index fac3a5bf..67b16b59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] - 2024-05-14 + +### Added + +- Required attributes for the 2D GOCART export fields in AERO_DP bundle have been set in subroutine append_to_bundle in Chem_AeroGeneric.F90. These export fields are imported by OBIO via Surface GC, and the missing of the attributes was causing the writing of surface import checkpoint to fail. The issue has been explained in detail on https://github.com/GEOS-ESM/GOCART/issues/258 + + ## [Unreleased] - 2023-07-24 diff --git a/ESMF/Shared/Chem_AeroGeneric.F90 b/ESMF/Shared/Chem_AeroGeneric.F90 index e1da972b..a0f8bbb1 100644 --- a/ESMF/Shared/Chem_AeroGeneric.F90 +++ b/ESMF/Shared/Chem_AeroGeneric.F90 @@ -7,8 +7,8 @@ !BOP ! -! !MODULE: Chem_AeroGeneric - Utilitarian subroutines used by GOCART2G children. -! +! !MODULE: Chem_AeroGeneric - Utilitarian subroutines used by GOCART2G children. +! ! ! !INTERFACE: ! @@ -48,7 +48,7 @@ module Chem_AeroGeneric !==================================================================================== subroutine add_aero (state, label, label2, grid, typekind, ptr, rc) -! Description: Adds fields to aero state for aerosol optics calcualtions. +! Description: Adds fields to aero state for aerosol optics calcualtions. implicit none @@ -109,7 +109,7 @@ recursive subroutine determine_data_driven(COMP_NAME, data_driven, RC) __Iam__('determine_data_driven') -! Begin... +! Begin... ! Is DU data driven? ! ------------------ @@ -142,7 +142,7 @@ subroutine append_to_bundle(varName, providerState, prefix, bundle, rc) integer :: dimCount, i real, pointer :: orig_ptr(:,:,:) real, pointer :: ptr2d(:,:) - character(len=ESMF_MAXSTR) :: bin_index, varNameNew + character(len=ESMF_MAXSTR) :: bin_index, varNameNew, units, longname ! Description: Adds deposition variables to deposition bundle @@ -155,18 +155,25 @@ subroutine append_to_bundle(varName, providerState, prefix, bundle, rc) call ESMF_FieldGet (field, dimCount=dimCount, __RC__) if (dimCount == 2) then ! this handles data instances - call MAPL_FieldBundleAdd (bundle, field, __RC__) + call MAPL_FieldBundleAdd (bundle, field, __RC__) else if (dimCount == 3) then ! this handles computational instances call ESMF_FieldGet (field, grid=grid, __RC__) call MAPL_GetPointer (providerState, orig_ptr, trim(prefix)//trim(varName), __RC__) + call ESMF_AttributeGet(field, name='UNITS', value=units, __RC__) + call ESMF_AttributeGet(field, name='LONG_NAME', value=longname, __RC__) + longname=longname(1:index(trim(longname), '(Bin')-1) if ((index(trim(varname), 'DU') > 0) .or. (index(trim(varname), 'SS') > 0)) then do i = 1, size(orig_ptr, 3) write (bin_index,'(A, I0.3)') '', i ptr2d => orig_ptr(:,:,i) - field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farrayPtr=ptr2d,& - name=trim(varName)//trim(bin_index) , __RC__) + field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farray=ptr2d,& + name=trim(varName)//trim(bin_index) , indexflag=ESMF_INDEX_DELOCAL, __RC__) + call ESMF_AttributeSet(field2d, name='DIMS', value=MAPL_DimsHorzOnly, _RC) + call ESMF_AttributeSet(field2d, name='VLOCATION', value=MAPL_VLocationNone, _RC) + call ESMF_AttributeSet(field2d, name='UNITS', value=trim(units), _RC) + call ESMF_AttributeSet(field2d, name='LONG_NAME', value=trim(longname)//' Bin '//trim(bin_index), _RC) call MAPL_AllocateCoupling (field2D, __RC__) call MAPL_FieldBundleAdd (bundle, field2D, __RC__) end do @@ -174,8 +181,12 @@ subroutine append_to_bundle(varName, providerState, prefix, bundle, rc) if (index(trim(varname), 'SU') > 0) then ! only use SO4, which is the 3rd index ptr2d => orig_ptr(:,:,3) - field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farrayPtr=ptr2d,& - name=trim(varName)//'003' , __RC__) + field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farray=ptr2d,& + name=trim(varName)//'003' , indexflag=ESMF_INDEX_DELOCAL, __RC__) + call ESMF_AttributeSet(field2d, name='DIMS', value=MAPL_DimsHorzOnly, _RC) + call ESMF_AttributeSet(field2d, name='VLOCATION', value=MAPL_VLocationNone, _RC) + call ESMF_AttributeSet(field2d, name='UNITS', value=units, _RC) + call ESMF_AttributeSet(field2d, name='LONG_NAME', value=trim(longname)//' Bin 003', _RC) call MAPL_AllocateCoupling (field2D, __RC__) call MAPL_FieldBundleAdd (bundle, field2D, __RC__) end if @@ -185,8 +196,12 @@ subroutine append_to_bundle(varName, providerState, prefix, bundle, rc) write (bin_index,'(A, I0.3)') '', i ptr2d => orig_ptr(:,:,i) varNameNew = 'OC'//varName(6:7) - field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farrayPtr=ptr2d,& - name=trim(varNameNew)//trim(bin_index) , __RC__) + field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farray=ptr2d,& + name=trim(varNameNew)//trim(bin_index) , indexflag=ESMF_INDEX_DELOCAL, __RC__) + call ESMF_AttributeSet(field2d, name='DIMS', value=MAPL_DimsHorzOnly, _RC) + call ESMF_AttributeSet(field2d, name='VLOCATION', value=MAPL_VLocationNone, _RC) + call ESMF_AttributeSet(field2d, name='UNITS', value=units, _RC) + call ESMF_AttributeSet(field2d, name='LONG_NAME', value=trim(longname)//' Bin '//trim(bin_index), _RC) call MAPL_AllocateCoupling (field2D, __RC__) call MAPL_FieldBundleAdd (bundle, field2D, __RC__) end do @@ -197,8 +212,12 @@ subroutine append_to_bundle(varName, providerState, prefix, bundle, rc) write (bin_index,'(A, I0.3)') '', i ptr2d => orig_ptr(:,:,i) varNameNew = 'BC'//varName(6:7) - field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farrayPtr=ptr2d,& - name=trim(varNameNew)//trim(bin_index) , __RC__) + field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farray=ptr2d,& + name=trim(varNameNew)//trim(bin_index) , indexflag=ESMF_INDEX_DELOCAL, __RC__) + call ESMF_AttributeSet(field2d, name='DIMS', value=MAPL_DimsHorzOnly, _RC) + call ESMF_AttributeSet(field2d, name='VLOCATION', value=MAPL_VLocationNone, _RC) + call ESMF_AttributeSet(field2d, name='UNITS', value=units, _RC) + call ESMF_AttributeSet(field2d, name='LONG_NAME', value=trim(longname)//' Bin '//trim(bin_index), _RC) call MAPL_AllocateCoupling (field2D, __RC__) call MAPL_FieldBundleAdd (bundle, field2D, __RC__) end do @@ -206,7 +225,7 @@ subroutine append_to_bundle(varName, providerState, prefix, bundle, rc) else if (dimCount > 3) then if(mapl_am_i_root()) print*,'Chem_AeroGenric::append_to_bundle does not currently support fields greater than 3 dimensions' - VERIFY_(824) + VERIFY_(824) end if RETURN_(ESMF_SUCCESS) @@ -232,7 +251,7 @@ subroutine setZeroKlid(km, klid, int_ptr) ! ! !REVISION HISTORY: ! -! 25Aug2020 E.Sherman - Written +! 25Aug2020 E.Sherman - Written ! ! !Local Variables integer :: k @@ -269,7 +288,7 @@ subroutine setZeroKlid4d (km, klid, int_ptr) ! ! !REVISION HISTORY: ! -! 25Aug2020 E.Sherman - Written +! 25Aug2020 E.Sherman - Written ! ! !Local Variables integer :: k, n @@ -312,7 +331,7 @@ subroutine findKlid (klid, plid, ple, rc) ! ! !REVISION HISTORY: ! -! 25Aug2020 E.Sherman - Written +! 25Aug2020 E.Sherman - Written ! ! !Local Variables integer :: k, j, i