Add module for designating patch/col/etc. as "debug"#4018
Open
samsrabin wants to merge 1 commit into
Open
Conversation
samsrabin
commented
May 13, 2026
| use shr_log_mod , only : errMsg => shr_log_errMsg | ||
| use clm_time_manager , only : timemgr_restart_io, get_nstep, get_curr_date | ||
| use clm_varctl , only : iulog | ||
| use clm_varcon , only : nameg, namel, namec, namep |
Member
Author
There was a problem hiding this comment.
Need to remove a bunch of unused things.
samsrabin
commented
May 13, 2026
| ! public :: do_debug_patch | ||
| public :: do_debug_column | ||
| ! public :: do_debug_landunit | ||
| ! public :: do_debug_gridcell |
Member
Author
There was a problem hiding this comment.
Need to uncomment all these.
samsrabin
commented
May 13, 2026
| ! Global indices for objects to debug. | ||
| ! When merging to a CTSM branch, these must always be < 1!! | ||
| integer, parameter :: debug_p = -999 | ||
| integer, parameter :: debug_c = 2787 |
Member
Author
|
Good idea from @mvdebolskiy: Add an option to the functions that would have them return true if any parent is debug. So for instance, you could set a column, landunit, or gridcell to debug, then do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Often we want to add
writestatements as part of debugging model behavior, but this can quickly become hard to parse if we don't limit the scope of the messaging. If we're debugging just one patch, column, gridcell, or landunit, we can make the messaging conditional on the object having the correct index. This PR adds a new module,debugMod, that facilitates this.debugModallows the user to hard-code a global index for patch, column, landunit, and/or gridcell to debug. It then provides functions where the user can give either a local or global index and get back a boolean that's true if it's the debugged one and false otherwise.Specific notes
Contributors other than yourself, if any:
CTSM issues resolved or otherwise addressed, if any:
Any user interface changes (namelist or namelist defaults changes)? No
Testing planned or performed, if any:
Requirements before merge: