From a16a4ffbe3c5c10ac844abd56a27dcb52777a083 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 18 Apr 2023 16:09:21 -0600 Subject: [PATCH] Fix GEOS-Chem tests by replacing StrSplit in chem_readnl For some reason the StrSplit routine in GEOS-Chem charpak_mod.F90 has unexpected behavior when run within the CAM test suite. Replacing it with basic Fortran fixes the issue reading advected species from geoschem_config.yml. Signed-off-by: Lizzie Lundgren --- cime_config/testdefs/testlist_cam.xml | 2 +- src/chemistry/geoschem/chemistry.F90 | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 9ffad598cd..4806d18d52 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -19,7 +19,7 @@ - + diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 41b1464d51..dea62ead0e 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -686,7 +686,6 @@ subroutine chem_readnl(nlfile) #endif use gckpp_Model, only : nSpec, Spc_Names use chem_mods, only : drySpc_ndx - use charpak_mod, only : strsplit ! args CHARACTER(LEN=*), INTENT(IN) :: nlfile ! filepath for file containing namelist input @@ -771,7 +770,6 @@ subroutine chem_readnl(nlfile) Write(iulog,'(/,a,/)') 'Now defining GEOS-Chem tracers and dry deposition mapping...' - !============================================================== ! Read GEOS-Chem advected species from geoschem_config.yml !============================================================== @@ -791,7 +789,7 @@ subroutine chem_readnl(nlfile) IF ( INDEX( LINE, 'transported_species' ) > 0 ) EXIT ENDDO - if (debug .and. masterproc) write(iulog,'(a)') 'chem_readnl: reading advected species list from geoschem_config.yml' + if (debug) write(iulog,'(a)') 'chem_readnl: reading advected species list from geoschem_config.yml' ! Read in all advected species names and add them to tracer names list nTracers = 0 @@ -799,12 +797,11 @@ subroutine chem_readnl(nlfile) READ(unitn,'(a)', IOSTAT=IERR) line IF ( IERR .NE. 0 ) CALL ENDRUN('chem_readnl: error setting adv spc list') line = ADJUSTL( ADJUSTR( line ) ) - IF ( INDEX( line, 'passive_species' ) > 0 ) EXIT - CALL StrSplit( line, '-', substrs, N ) IF ( INDEX( LINE, '-' ) > 0 ) THEN + substrs(1) = LINE(3:) substrs(1) = ADJUSTL( ADJUSTR( substrs(1) ) ) - + ! Remove quotes (i.e. 'NO' -> NO) I = INDEX( substrs(1), "'" ) IF ( I > 0 ) THEN @@ -857,7 +854,11 @@ subroutine chem_readnl(nlfile) !============================================================== unitn = getunit() - OPEN( unitn, FILE=TRIM(nlfile), STATUS='old' ) + OPEN( unitn, FILE=TRIM(nlfile), STATUS='old', IOSTAT=IERR ) + IF (IERR .NE. 0) THEN + CALL ENDRUN('chem_readnl: ERROR opening '//TRIM(nlfile)) + ENDIF + CALL find_group_name(unitn, 'chem_inparm', STATUS=IERR) IF (IERR == 0) THEN READ(unitn, chem_inparm, IOSTAT=IERR)