Skip to content

Conversation

haakon-e
Copy link
Member

@haakon-e haakon-e commented Oct 10, 2025

This pull request introduces improved error handling and model differentiation in the update_jacobian! function within the manual_sparse_jacobian.jl file. The changes ensure that unsupported or unknown vertical diffusion types are caught early and provide clearer handling for different turbulence convection models.

Key changes:

Model differentiation and error handling:

  • Added an explicit check for AbstractEDMF turbulence convection models in the conditional logic, making the code more robust and maintainable.
  • Introduced an error message for unknown vertical_diffusion types, preventing silent failures and aiding debugging.

Anna and I ran into this else block while working with Smagorinsky diffusion for her simulation setup (i.e. yaml has vert_diff: false, and no EDMF).

It is likely due to incorrectly configured yaml file: i.e. implicit_diffusion: true is only compatible with DecayWithHeightDiffusion, VerticalDiffusion, or (I presume) EDMF-type closures. For convenience, this PR proposes to explicitly check this both during model construction, and make it clearer within the jacobian that the last block pertains to EDMF.

Closes #3360

@haakon-e haakon-e force-pushed the he/fix-error-on-inconsistent branch 2 times, most recently from b5b3159 to 1aabddf Compare October 10, 2025 18:37
Copy link
Member

@szy21 szy21 left a comment

Choose a reason for hiding this comment

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

Thanks, I wanted to fix this for a while. Note that you probably need implicit diffusion for running simulation with smagorinsky diffusion, so you may need to add that.

@haakon-e haakon-e force-pushed the he/fix-error-on-inconsistent branch from 1aabddf to fec52f6 Compare October 14, 2025 16:59
@haakon-e haakon-e added this pull request to the merge queue Oct 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 18, 2025
@szy21 szy21 added this pull request to the merge queue Oct 18, 2025
Merged via the queue into main with commit a3905b2 Oct 18, 2025
22 of 32 checks passed
@szy21 szy21 deleted the he/fix-error-on-inconsistent branch October 18, 2025 01:11
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

Successfully merging this pull request may close these issues.

implicit_diffusion can be turned on without a turbconv model and with vert_diff = false

2 participants