From f9bf581a1bb368ddfd0d981d6df117ce2e2a9d35 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 27 Nov 2024 10:27:36 -0500 Subject: [PATCH 1/3] v11: Convert Solar GC to use gFTL StringVector --- .circleci/config.yml | 8 +- GEOSsolar_GridComp/GEOS_SolarGridComp.F90 | 90 ++++++++++++++++------- 2 files changed, 66 insertions(+), 32 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5c89ea6..fda19df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ version: 2.1 #bcs_version: &bcs_version v11.4.0 orbs: - ci: geos-esm/circleci-tools@2 + ci: geos-esm/circleci-tools@4 workflows: build-test: @@ -17,7 +17,7 @@ workflows: - docker-hub-creds matrix: parameters: - compiler: [gfortran, ifort] + compiler: [gfortran, ifort, ifx] #baselibs_version: *baselibs_version repo: GEOSgcm checkout_fixture: true @@ -31,7 +31,7 @@ workflows: - docker-hub-creds matrix: parameters: - compiler: [gfortran, ifort] + compiler: [gfortran, ifort, ifx] requires: - build-GEOSgcm-on-<< matrix.compiler >> repo: GEOSgcm @@ -45,7 +45,7 @@ workflows: - docker-hub-creds matrix: parameters: - compiler: [gfortran, ifort] + compiler: [gfortran, ifort, ifx] requires: - build-GEOSgcm-on-<< matrix.compiler >> repo: GEOSgcm diff --git a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 index 4b7f8e0..58d9384 100644 --- a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 +++ b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 @@ -2832,12 +2832,15 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) logical :: do_no_aero_calc - ! list of strings facility - integer :: i - type S_ - character(len=:), allocatable :: str - end type S_ - type(S_), allocatable :: list(:) + type(StringVector) :: string_vec + type(StringVectorIterator) :: string_vec_iter + character(len=:), pointer :: string_pointer + + ! which bands require OSR output? + ! (only RRTMG[P]; OSRBbbRG, ISRBbbRG, and TBRBbbRG) + logical :: band_output (nbndsw) + integer :: ibnd + character*2 :: bb !============================================================================= @@ -3204,27 +3207,50 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Optional without-aerosol diagnostics ! ------------------------------------ - ! this line temporarily needed because of compiler bug - allocate(list(1)); list(1) = S_('dummy') - ! are without-aerosol exports requested? do_no_aero_calc = .false. - list = [S_('FSWNA'), S_('FSWUNA'), S_('FSWDNA'), & - S_('FSCNA'), S_('FSCUNA'), S_('FSCDNA'), & - S_('FSWBANDNA')] - do i = 1, size(list) - call MAPL_GetPointer( EXPORT, ptr3d, list(i)%str, __RC__) - do_no_aero_calc = (do_no_aero_calc .or. associated(ptr3d)) - end do - list = [S_('RSRNA'), S_('RSRSNA'), S_('OSRNA') , & - S_('RSCNA'), S_('RSCSNA'), S_('OSRCNA'), & - S_('SLRSFNA'), S_('SLRSUFNA'), & - S_('SLRSFCNA'), S_('SLRSUFCNA')] - do i = 1, size(list) - call MAPL_GetPointer( EXPORT, ptr2d, list(i)%str, __RC__) - do_no_aero_calc = (do_no_aero_calc .or. associated(ptr2d)) + + call string_vec%push_back('FSWNA') + call string_vec%push_back('FSWUNA') + call string_vec%push_back('FSWDNA') + call string_vec%push_back('FSCNA') + call string_vec%push_back('FSCUNA') + call string_vec%push_back('FSCDNA') + call string_vec%push_back('FSWBANDNA') + + string_vec_iter = string_vec%begin() + do while ( string_vec_iter /= string_vec%end() ) + string_pointer => string_vec_iter%get() + call MAPL_GetPointer( EXPORT, ptr3d, string_pointer, __RC__) + do_no_aero_calc = (do_no_aero_calc .or. associated(ptr3d)) + call string_vec_iter%next() end do + if (.not. do_no_aero_calc) then + + call string_vec%clear() + + call string_vec%push_back('RSRNA') + call string_vec%push_back('RSRSNA') + call string_vec%push_back('OSRNA') + call string_vec%push_back('RSCNA') + call string_vec%push_back('RSCSNA') + call string_vec%push_back('OSRCNA') + call string_vec%push_back('SLRSFNA') + call string_vec%push_back('SLRSUFNA') + call string_vec%push_back('SLRSFCNA') + call string_vec%push_back('SLRSUFCNA') + + string_vec_iter = string_vec%begin() + + do while ( string_vec_iter /= string_vec%end() ) + string_pointer => string_vec_iter%get() + call MAPL_GetPointer( EXPORT, ptr2d, string_pointer, __RC__) + do_no_aero_calc = (do_no_aero_calc .or. associated(ptr2d)) + call string_vec_iter%next() + end do + end if + if (do_no_aero_calc) then ! do a calculation without aerosols: @@ -3239,11 +3265,19 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) else ! otherwise, zero the no-aerosol internals - list = [S_('FSWNAN'), S_('FSWUNAN'), & - S_('FSCNAN'), S_('FSCUNAN'), S_('FSWBANDNAN')] - do i = 1, size(list) - call MAPL_GetPointer( INTERNAL, ptr3d, list(i)%str, __RC__) - ptr3d = 0. + call string_vec%clear() + + call string_vec%push_back('FSWNAN') + call string_vec%push_back('FSWUNAN') + call string_vec%push_back('FSCNAN') + call string_vec%push_back('FSCUNAN') + call string_vec%push_back('FSWBANDNAN') + string_vec_iter = string_vec%begin() + do while ( string_vec_iter /= string_vec%end() ) + string_pointer => string_vec_iter%get() + call MAPL_GetPointer( INTERNAL, ptr3d, string_pointer, __RC__) + ptr3d = 0. + call string_vec_iter%next() end do end if From 50bcf4566515dd3427d8e173479ea2510c47f8aa Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 27 Nov 2024 10:41:59 -0500 Subject: [PATCH 2/3] Actually use gftl --- GEOSsolar_GridComp/GEOS_SolarGridComp.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 index 58d9384..7e7327a 100644 --- a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 +++ b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 @@ -167,6 +167,7 @@ module GEOS_SolarGridCompMod use ESMF use MAPL + use gFTL_StringVector ! for RRTMGP use mo_gas_optics_rrtmgp, only: ty_gas_optics_rrtmgp From 1311ac77ce0a8dad253905cf802056429e59fc1d Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 27 Nov 2024 10:55:31 -0500 Subject: [PATCH 3/3] Fix bad merge --- .circleci/config.yml | 2 +- GEOSsolar_GridComp/GEOS_SolarGridComp.F90 | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fda19df..1214ac3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,7 +45,7 @@ workflows: - docker-hub-creds matrix: parameters: - compiler: [gfortran, ifort, ifx] + compiler: [gfortran, ifort] requires: - build-GEOSgcm-on-<< matrix.compiler >> repo: GEOSgcm diff --git a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 index 7e7327a..33735f2 100644 --- a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 +++ b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 @@ -2837,12 +2837,6 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) type(StringVectorIterator) :: string_vec_iter character(len=:), pointer :: string_pointer - ! which bands require OSR output? - ! (only RRTMG[P]; OSRBbbRG, ISRBbbRG, and TBRBbbRG) - logical :: band_output (nbndsw) - integer :: ibnd - character*2 :: bb - !============================================================================= ! Get the target components name and set-up traceback handle.