Skip to content

Add module for designating patch/col/etc. as "debug"#4018

Open
samsrabin wants to merge 5 commits into
ESCOMP:b4b-devfrom
samsrabin:add-debugmod
Open

Add module for designating patch/col/etc. as "debug"#4018
samsrabin wants to merge 5 commits into
ESCOMP:b4b-devfrom
samsrabin:add-debugmod

Conversation

@samsrabin
Copy link
Copy Markdown
Member

@samsrabin samsrabin commented May 13, 2026

Description of changes

Often we want to add write statements 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.

debugMod allows 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:

  • None

CTSM issues resolved or otherwise addressed, if any:

  • None

Any user interface changes (namelist or namelist defaults changes)? No

Testing planned or performed, if any:

  • Tested during some column-level troubleshooting
  • Add unit tests.

Requirements before merge:

  • The code in this PR branch builds with no errors.
  • The code in this PR branch runs with no errors. Column-level troubleshooting
  • This either (a) does not change answers, (b) it only changes answers at roundoff level, or (c) I have performed a scientific evaluation of the answer changes. Which?: A
  • I have reviewed relevant parts of the CLM documentation Tech Note or User's Guide to determine if anything needs to be changed or added. If it does, describe: Should add a bit in the Troubleshooting section of the User's Guide
  • This PR either (a) does not create a need to update the documentation or (b) includes required documentation updates (see guidelines for contributing documentation). Which?: Will include updates, but I haven't made them yet.

@samsrabin samsrabin changed the title Add module for designating patch/col/etc. as "debug Add module for designating patch/col/etc. as "debug" May 13, 2026
@samsrabin samsrabin self-assigned this May 13, 2026
@samsrabin samsrabin added b4b bit-for-bit size: small next this should get some attention in the next week or two. Normally each Thursday SE meeting. labels May 13, 2026
Comment thread src/main/debugMod.F90 Outdated
Comment thread src/main/debugMod.F90 Outdated
Comment thread src/main/debugMod.F90 Outdated
@samsrabin
Copy link
Copy Markdown
Member Author

samsrabin commented May 13, 2026

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 do_debug_patch(..., include_parent=.true.).

@samsrabin
Copy link
Copy Markdown
Member Author

samsrabin commented May 14, 2026

SE meeting:

  • Bill's POI module does this with lat/lon. Bring that in here.
  • (Done with 97d16bc.) Make indices namelist params and just require that no merged code leave in do_debug_* calls.

@samsrabin samsrabin removed the next this should get some attention in the next week or two. Normally each Thursday SE meeting. label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant