Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in volcano extension causing crash when volcano turned off #230

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions src/Extensions/hcox_volcano_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -354,23 +354,7 @@ SUBROUTINE HCOX_Volcano_Init( HcoState, ExtName,ExtState, RC )

! Extension Nr.
ExtNr = GetExtNr( HcoState%Config%ExtList, TRIM(ExtName) )

! Print to log
IF ( HcoState%amIRoot ) THEN
IF ( ExtNr > 0 ) THEN
! Write the name of the extension regardless of the verbose setting
msg = 'Using HEMCO extension: Volcano (volcanic SO2 emissions)'
IF ( HCO_IsVerb( HcoState%Config%Err ) ) THEN
CALL HCO_Msg( HcoState%Config%Err, msg, sep1='-' ) ! with separator
ELSE
CALL HCO_Msg( msg, verb=.TRUE. ) ! w/o separator
ENDIF
ELSE
MSG = 'The Volcano extension is turned off.'
CALL HCO_MSG( HcoState%Config%Err, MSG )
RETURN
ENDIF
ENDIF
IF ( ExtNr <= 0 ) RETURN

! Enter
CALL HCO_ENTER( HcoState%Config%Err, LOC, RC )
Expand All @@ -379,15 +363,24 @@ SUBROUTINE HCOX_Volcano_Init( HcoState, ExtName,ExtState, RC )
RETURN
ENDIF

! Create Volcano instance for this simulation
! Create instance for this simulation
Inst => NULL()
CALL InstCreate( ExtNr, ExtState%Volcano, Inst, RC )
IF ( RC /= HCO_SUCCESS ) THEN
CALL HCO_Error( &
'Cannot create Volcano instance', RC )
CALL HCO_Error( 'Cannot create Volcano instance', RC )
RETURN
ENDIF

! Write the name of the extension regardless of the verbose settings
IF ( HcoState%amIRoot ) THEN
msg = 'Using HEMCO extension: Volcano (volcanic SO2 emissions)'
IF ( HCO_IsVerb( HcoState%Config%Err ) ) THEN
CALL HCO_Msg( HcoState%Config%Err, msg, sep1='-' ) ! with separator
ELSE
CALL HCO_Msg( msg, verb=.TRUE. ) ! w/o separator
ENDIF
ENDIF

! Get species IDs.
CALL HCO_GetExtHcoID( HcoState, ExtNr, Inst%SpcIDs, &
SpcNames, Inst%nSpc, RC )
Expand Down Expand Up @@ -483,9 +476,6 @@ SUBROUTINE HCOX_Volcano_Init( HcoState, ExtName,ExtState, RC )

! Verbose mode
IF ( HcoState%amIRoot ) THEN
MSG = 'Use emissions extension `Volcano`:'
CALL HCO_MSG( HcoState%Config%Err, MSG )

MSG = ' - use the following species (Name, HcoID, Scaling relative to kgS):'
CALL HCO_MSG( HcoState%Config%Err, MSG)
DO N = 1, Inst%nSpc
Expand Down