Skip to content

Commit

Permalink
Fix GEOS-Chem tests by replacing StrSplit in chem_readnl
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lizziel committed Apr 18, 2023
1 parent d77da0b commit a16a4ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cime_config/testdefs/testlist_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</test>
<test compset="FC2000climo_GC" grid="f09_f09_mg17" name="ERP_Ln9_Vnuopc" testmods="cam/outfrq9s">
<machines>
<machine name="cheyenne" compiler="intel" category="geochem"/>
<machine name="cheyenne" compiler="intel" category="geoschem"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
Expand Down
15 changes: 8 additions & 7 deletions src/chemistry/geoschem/chemistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
!==============================================================
Expand All @@ -791,20 +789,19 @@ 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
DO WHILE ( LEN_TRIM( line ) > 0 )
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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a16a4ff

Please sign in to comment.