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

Errors with Hg Bidirectional Flux Simulations #172

Closed
chogrefe opened this issue May 6, 2022 · 1 comment
Closed

Errors with Hg Bidirectional Flux Simulations #172

chogrefe opened this issue May 6, 2022 · 1 comment

Comments

@chogrefe
Copy link
Contributor

chogrefe commented May 6, 2022

Description

CMAQ simulations for mercury with the CTM_HGBIDI option set to T will fail due to two issues in the current CMAQ code except for when using the STAGE dry deposition option for a single day simulation. The first issue affects only the M3Dry dry deposition option and causes a model crash if CTM_HGBIDI is set to T but CTM_ABFLUX (bidirectional flux option for NH3) is set to F. The second issue affects both the M3Dry and STAGE dry deposition options and leads to a model crash on the second day of the simulation when using a MEDIA_CONC restart file.

Scope and Impact

The current CMAQ code with not complete successfully for mercury simulations with the CTM_HGBIDI option set to T for multi-day simulations for both the M3Dry and STAGE dry deposition options. For M3Dry, the code will not complete successfully even on the first day of the simulation unless the CTM_ABFLUX is also set to T.

Solution

The first issue is caused by the land use fraction array needed by the Hg bidirectional calculations not being allocated and assigned a value in the M3Dry version of ASX_DATA_MOD.F. To fix this issue, change these statements on lines 557 and 638 from

   If ( ABFLUX) Then

To

   If ( ABFLUX .or. HGBIDI ) Then 

The second issue is caused by subroutine INIT_BIDI in BIDI_MOD.F being called twice in both M3Dry and STAGE, leading to a duplicate allocation error. To fix this issue, the beginning of that subroutine should be modified as follows:

Current code (lines 75 – 80 in the M3Dry version of BIDI_MOD.F):

     Integer         :: STATUS
     
    C--------------------------------------------------------------------------
     ! Set Mercury BiDi Processing Flag equal to false if there is
     ! no mercury gas-phase species.
     If ( INDEX1( 'HG', N_GC_DDEP, GC_DDEP ) .EQ. 0 ) HGBIDI = .FALSE.

Updated code:

     Integer         :: STATUS
     Logical, SAVE   :: INITIALIZED = .FALSE.

     C--------------------------------------------------------------------------
     C Prevent initilializing the code twice 
     If ( INITIALIZED ) Return 

     INITIALIZED = .TRUE.

     ! Set Mercury BiDi Processing Flag equal to false if there is
     ! no mercury gas-phase species.
     If ( INDEX1( 'HG', N_GC_DDEP, GC_DDEP ) .EQ. 0 ) HGBIDI = .FALSE.

For STAGE, corresponding changes would have to be made in lines 73 – 76 of the STAGE version of BIDI_MOD.F

Additional context

These issues will be fixed in the next release of CMAQ.

@kmfoley
Copy link
Collaborator

kmfoley commented Oct 14, 2022

This issue is resolved with the release of CMAQv5.4.

@kmfoley kmfoley closed this as completed Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants