fix: error on inconsistent diffusion option #4051
Open
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.
This pull request introduces improved error handling and model differentiation in the
update_jacobian!
function within themanual_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:
AbstractEDMF
turbulence convection models in the conditional logic, making the code more robust and maintainable.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 hasvert_diff: false
, and no EDMF).It is likely due to incorrectly configured yaml file: i.e.
implicit_diffusion: true
is only compatible withDecayWithHeightDiffusion
,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.