Skip to content

Conversation

@singhbalwinder
Copy link
Contributor

@singhbalwinder singhbalwinder commented Nov 12, 2025

Improves error messages in modal_aer_opt.F90 to provide more detailed diagnostic information when aerosol optical depth errors occur, making it easier to debug crashes.

Key changes:

Replaced generic error messages with detailed messages that include the specific value of dopaer(i) causing the error
Added error_str variable to construct comprehensive error messages with file/line information

Fixes #7877

[BFB]

@singhbalwinder singhbalwinder self-assigned this Nov 12, 2025
@singhbalwinder singhbalwinder added BFB PR leaves answers BFB EAM Fortran-based E3SM Atmosphere Model labels Nov 12, 2025
Copilot finished reviewing on behalf of singhbalwinder November 12, 2025 15:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error messages in modal_aer_opt.F90 to provide more detailed diagnostic information when aerosol optical depth errors occur, making it easier to debug crashes.

Key changes:

  • Replaced generic error messages with detailed messages that include the specific value of dopaer(i) causing the error
  • Added error_str variable to construct comprehensive error messages with file/line information
Comments suppressed due to low confidence (1)

components/eam/src/physics/cam/modal_aer_opt.F90:1146

  • The condition has been hardcoded to .true., which will cause this error-checking block to execute unconditionally for every iteration. This should be reverted to the original condition (dopaer(i) <= -1.e-10_r8) .or. (dopaer(i) >= 30._r8) to only trigger when actual errors occur.
               if ((dopaer(i) <= -1.e-10_r8) .or. (dopaer(i) >= 30._r8)) then


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@singhbalwinder singhbalwinder changed the title EAM: Fixes error messages in modal_aer_opt.F90 EAM: Improves error messages in modal_aer_opt.F90 Nov 12, 2025
@singhbalwinder
Copy link
Contributor Author

@rljacob : The error message automatically includes "ERROR" in itself when we call endrun. Therefore, I didn't include "ERROR" explicitly in the error messages.


nerr_dopaer = nerr_dopaer + 1
if (dopaer(i) < -1.e-10_r8) then
write(error_str, *) 'ERROR: dopaer(', i, ')=', dopaer(i) ,' which is < -1.e-10_r8 (negative aerosol optical depth) in ',&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok to have ERROR appear twice. Please put it back. When searching the log, I want to find this message by searching for ERROR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the "ERROR" string back to the error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BFB PR leaves answers BFB EAM Fortran-based E3SM Atmosphere Model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Badly formed error message in modal_aer_opt.F90

3 participants