Skip to content

Conversation

@glwagner
Copy link
Member

@glwagner glwagner commented Dec 5, 2025

@glwagner glwagner changed the title Add horizontal viscosity to ocean simulation closure Add ocean horizontal viscosity to 1 deg ocean simulation example Dec 5, 2025
@simone-silvestri
Copy link
Collaborator

simone-silvestri commented Dec 5, 2025

Looks good! I have found a bit more success using the biharmonic viscosity, with something like $\nu = \frac{Az^2}{15days}$

something like

@inline νhb(i, j, k, grid, ℓx, ℓy, ℓz, clock, fields, λ) = Oceananigans.Operators.Az(i, j, k, grid, ℓx, ℓy, ℓz)^2 / λ
horizontal_viscosity = HorizontalScalarBiharmonicDiffusivity=νhb, discrete_form=true, parameters=15days)

@glwagner glwagner added the build docs Add this label to built the docs in a PR label Dec 5, 2025
@glwagner
Copy link
Member Author

glwagner commented Dec 5, 2025

Looks good! I have found a bit more success using the biharmonic viscosity, with something like ν = A z 2 15 d a y s

something like

@inline νhb(i, j, k, grid, ℓx, ℓy, ℓz, clock, fields, λ) = Oceananigans.Operators.Az(i, j, k, grid, ℓx, ℓy, ℓz)^2 / λ
horizontal_viscosity = HorizontalScalarBiharmonicDiffusivity=νhb, discrete_form=true, parameters=15days)

Ok let's try it. We may want to implement this function in Oceananigans.

@navidcy
Copy link
Member

navidcy commented Dec 6, 2025

https://clima.github.io/ClimaOceanDocumentation/previews/PR697/literated/one_degree_simulation/

Simulation results look OK.
But what are all those JLD2 warnings after run!(simulation)?

@glwagner
Copy link
Member Author

glwagner commented Dec 7, 2025

Looks like it has something to do with using a function in ScalarBiharmonicDiffusivity. I think the results like much better. The grid imprinting seems to be gone.

@navidcy
Copy link
Member

navidcy commented Dec 7, 2025

I've never seen that warning before. Did we change something recently related to ScalarBiharmonicDiffusivity?

@glwagner
Copy link
Member Author

glwagner commented Dec 7, 2025

I've never seen that warning before. Did we change something recently related to ScalarBiharmonicDiffusivity?

It's the kind of message that occurs when we try to load something after it has been serialized with JLD2. I don't know why JLD2 is trying to serialize model.closure.

@navidcy
Copy link
Member

navidcy commented Dec 7, 2025

It's because the JLD2Writer is trying to save the function

@inline νhb(i, j, k, grid, ℓx, ℓy, ℓz, clock, fields, λ) = Oceananigans.Operators.Az(i, j, k, grid, ℓx, ℓy, ℓz)^2 / λ

@navidcy navidcy self-requested a review December 7, 2025 23:32
Copy link
Member

@navidcy navidcy left a comment

Choose a reason for hiding this comment

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

Happy to merge this. But do we want it with all those JLD2 warnings?

@navidcy
Copy link
Member

navidcy commented Dec 8, 2025

I don't think we can avoid them...

@glwagner
Copy link
Member Author

glwagner commented Dec 8, 2025

I think we can write including = [] in the constructor for JLD2Writer:

https://github.com/CliMA/Oceananigans.jl/blob/58c6b7a7b4760abc4da76ddef1ae8d198ea82b6b/src/OutputWriters/jld2_writer.jl#L35

the stuff saved is pretty arbitrary though. We should probably change that to just save the grid.

@glwagner
Copy link
Member Author

glwagner commented Dec 8, 2025

@simone-silvestri presumably you must hve seen this?

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

Labels

build docs Add this label to built the docs in a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants