Skip to content

Use area-scaled biharmonic viscosity in coarse examples#111

Open
glwagner wants to merge 6 commits into
mainfrom
glw/update-examples
Open

Use area-scaled biharmonic viscosity in coarse examples#111
glwagner wants to merge 6 commits into
mainfrom
glw/update-examples

Conversation

@glwagner
Copy link
Copy Markdown
Member

@glwagner glwagner commented Mar 5, 2026

Summary

  • Add area_scaled_biharmonic_viscosity() in src/Oceans/ocean_simulation.jl returning a HorizontalScalarBiharmonicDiffusivity with ν = Az² / timescale (default 15 days), so the effective viscosity adapts to local cell area.
  • Export area_scaled_biharmonic_viscosity from NumericalEarth and the Oceans submodule.
  • Use it as the viscous closure in the one_degree_simulation and global_climate_simulation examples, alongside the existing Gent-McWilliams IsopycnalSkewSymmetricDiffusivity. In global_climate_simulation it replaces the constant ν=1e12 biharmonic viscosity; in one_degree_simulation it is added next to GM and CATKE.

Test plan

  • Verify the one-degree simulation runs with the new closure
  • Verify the global climate simulation runs with the new closure
  • Check that grid-scale artifacts are suppressed

🤖 Generated with Claude Code

Remove IsopycnalSkewSymmetricDiffusivity (Gent-McWilliams) from the
one-degree and global climate simulation examples. Add a new
`area_scaled_biharmonic_viscosity()` function that computes ν = Az² / λ,
where Az is the horizontal cell area and λ is a damping timescale
(default 15 days). This resolution-dependent viscosity adapts to local
grid cell size, providing appropriate grid-scale dissipation at all
latitudes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@glwagner glwagner requested a review from xkykai March 5, 2026 20:46
@xkykai
Copy link
Copy Markdown
Collaborator

xkykai commented Mar 5, 2026

out of curiosity why don't we want GM, especially in the 1degree model?

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Oceans/ocean_simulation.jl 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@glwagner
Copy link
Copy Markdown
Member Author

glwagner commented Mar 5, 2026

out of curiosity why don't we want GM, especially in the 1degree model?

didn't you find that it has no effect? I've been telling people this...

@glwagner
Copy link
Copy Markdown
Member Author

glwagner commented Mar 5, 2026

out of curiosity why don't we want GM, especially in the 1degree model?

@xkykai are you saying that we should keep GM? I am happy to do that if that is your recommendation.

@xkykai
Copy link
Copy Markdown
Collaborator

xkykai commented Mar 5, 2026

out of curiosity why don't we want GM, especially in the 1degree model?

didn't you find that it has no effect? I've been telling people this...

They have an effect, just less significant than expected/on other models.

For 0.5 degree I'll be running another test against ECCO data and fluxes in the next few days, but by and large without GM is ok.

For 1 degree:
20
here are some meridional sections to compare after 200 years of repeat forcing. Even though the solutions are less sensitive to GM than initially expected, I would still recommend having some GM at 1 degree as the solutions are less noisy.

@glwagner
Copy link
Copy Markdown
Member Author

glwagner commented Mar 5, 2026

I would still recommend having some GM at 1 degree as the solutions are less noisy.

Do these solutions have biharmonic viscosity?

@glwagner
Copy link
Copy Markdown
Member Author

glwagner commented Mar 5, 2026

@xkykai did you try running with only the symmetric part of the diffusivity? Theoretically we might expect that we don't need the skew part (baroclinic conversion is represented) but we still a symmetric diffusivity (bc tracer stirring not captured if no eddies)

@xkykai
Copy link
Copy Markdown
Collaborator

xkykai commented Mar 5, 2026

I would still recommend having some GM at 1 degree as the solutions are less noisy.

Do these solutions have biharmonic viscosity?

No they don't. I haven't run comparison of GM with biharmonic viscosity as well.

@glwagner
Copy link
Copy Markdown
Member Author

glwagner commented Mar 5, 2026

I would still recommend having some GM at 1 degree as the solutions are less noisy.

Do these solutions have biharmonic viscosity?

No they don't. I haven't run comparison of GM with biharmonic viscosity as well.

In the previous runs, the solutions have grid imprinting without biharmonic viscosity (unsure what other dissipation you might have though). So I am not sure GM is the right fix for noise, strictly speaking, even though it may be good to include for other reasons.

@xkykai
Copy link
Copy Markdown
Collaborator

xkykai commented Mar 5, 2026

@xkykai did you try running with only the symmetric part of the diffusivity? Theoretically we might expect that we don't need the skew part (baroclinic conversion is represented) but we still a symmetric diffusivity (bc tracer stirring not captured if no eddies)

no, don't think we ever turned off skew viscosity completely

@glwagner
Copy link
Copy Markdown
Member Author

glwagner commented Mar 5, 2026

@xkykai did you try running with only the symmetric part of the diffusivity? Theoretically we might expect that we don't need the skew part (baroclinic conversion is represented) but we still a symmetric diffusivity (bc tracer stirring not captured if no eddies)

no, don't think we ever turned off skew viscosity completely

I'll add ISSD back here, but with only the symmetric turned on. Maybe that will provide some inspiration for future work.

@xkykai
Copy link
Copy Markdown
Collaborator

xkykai commented Mar 5, 2026

I would still recommend having some GM at 1 degree as the solutions are less noisy.

Do these solutions have biharmonic viscosity?

No they don't. I haven't run comparison of GM with biharmonic viscosity as well.

In the previous runs, the solutions have grid imprinting without biharmonic viscosity (unsure what other dissipation you might have though). So I am not sure GM is the right fix for noise, strictly speaking, even though it may be good to include for other reasons.

GM also brings about a bit more subduction and the flattening of the isopycnals (from the figure), to what degree of that is needed still remains to be seen.

… to examples

Use κ_symmetric=1000, κ_skew=0 for isopycnal lateral tracer mixing
without the GM skew flux.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@xkykai xkykai left a comment

Choose a reason for hiding this comment

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

up to your discretion to merge!

@navidcy navidcy requested a review from simone-silvestri March 6, 2026 09:16
@navidcy
Copy link
Copy Markdown
Member

navidcy commented Mar 6, 2026

@simone-silvestri was also claiming we do need (at least a bit?) GM, but not sure about the rationale behind it...

@simone-silvestri
Copy link
Copy Markdown
Member

yeah at 1 degree we probably still need it. I am unsure at 0.5, I think I still see some differences with + without although I see a lot of other biases I am trying to debug so we need much more investigation before being conclusive. I would also keep GM for the practical reason of seeing that it works as intended (although maybe in 1 year of simulation the impact is not that large)

@glwagner
Copy link
Copy Markdown
Member Author

glwagner commented Mar 9, 2026

yeah at 1 degree we probably still need it. I am unsure at 0.5, I think I still see some differences with + without although I see a lot of other biases I am trying to debug so we need much more investigation before being conclusive. I would also keep GM for the practical reason of seeing that it works as intended (although maybe in 1 year of simulation the impact is not that large)

I think it's important that the examples reflect a "recommended" configuration --- so if GM is not a good idea at 1 degree, and we want an example that uses GM, we should add a coarser case / any case which does actually require it.

If we can't find a case that benefits then its questionable why we need an example that uses it...

@simone-silvestri
Copy link
Copy Markdown
Member

simone-silvestri commented Mar 10, 2026

then remove the "probably". At one degree we need it for sure. I wouldn't know the value we should use though. Maybe 500? Typically people use 1000. I am planning to run a complete OMIP with the orca grid and after we have understood what parameters we need we can use that one as an example.

@simone-silvestri simone-silvestri added build all examples add this label to build all the examples in the PR and removed build docs 📖 labels Mar 10, 2026
@glwagner
Copy link
Copy Markdown
Member Author

Typically people use 1000.

Isn't it also the case that the Oceananigans solution is quite unusual and expresses more variability than other models at this resolution? So we should not expect to use the same value as others.

@glwagner glwagner changed the title Replace GM with area-scaled biharmonic viscosity in coarse examples Use area-scaled biharmonic viscosity in coarse examples May 21, 2026
@glwagner glwagner requested a review from xkykai May 21, 2026 21:05
@glwagner
Copy link
Copy Markdown
Member Author

@xkykai @simone-silvestri changing this PR so that it just adds viscosity to the coarse example, but does not remove GM. Let me know what you think.

# Conflicts:
#	src/NumericalEarth.jl
#	src/Oceans/ocean_simulation.jl
@xkykai
Copy link
Copy Markdown
Collaborator

xkykai commented May 21, 2026

lgtm!

@navidcy
Copy link
Copy Markdown
Member

navidcy commented May 24, 2026

Docs break because of Metadataset fixes included in #277 or #283

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

Labels

build all examples add this label to build all the examples in the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants