Skip to content

Adds ORCA2 tripolar grid and changed ORCAGrid to ORCATripolarGrid#153

Open
jagoosw wants to merge 45 commits intomainfrom
jsw/orca2
Open

Adds ORCA2 tripolar grid and changed ORCAGrid to ORCATripolarGrid#153
jagoosw wants to merge 45 commits intomainfrom
jsw/orca2

Conversation

@jagoosw
Copy link
Copy Markdown
Collaborator

@jagoosw jagoosw commented Apr 2, 2026

This PR adds ORCA2 grids to data wrangling and makes some changes to grid construction to get it working. It also renamed ORCAGrid to ORCATripolarGrid, adds a "coarse" example on ORCA2, and adds the option to remove closed basins int he grid constructor.

ORCA2 is strange because it has regional refinement in the Mediterranean, Red, Black and Caspian Seas, as well as at the equator and south pole.

The underlying grid:
image

Nz = 31
z = ExponentialDiscretization(31, -5000, 0; scale = 1100)
grid = ORCAGrid(z = z.faces, Nz, dataset = ORCA2())

I had to add Tar and CodecZlib to the dependancies because the Zenodo I found with the grid has them in a tarball.

@simone-silvestri @glwagner

@info "Downloading ORCA2 data: $(metadatum.name) to $(metadatum.dir)..."
Downloads.download(fileurl, fileroute*"ORCA2L75.tar.gz"; progress=download_progress)
open(GzipDecompressorStream, fileroute*"ORCA2L75.tar.gz") do io
Tar.extract(io, fileroute*"/ORCA2L75")
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Tar.extract doesn't like the destination fileroute so the files actually live at fileroute*"/ORCA2L75/ORCA2L75"

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/DataWrangling/ORCA/ORCA.jl 80.95% 4 Missing ⚠️
src/Bathymetry/orca_tripolar_grid.jl 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@glwagner
Copy link
Copy Markdown
Member

glwagner commented Apr 2, 2026

Is this a tripolar grid? Does it have a zipper bc? Can we call it ORCATripolarGrid?

@glwagner
Copy link
Copy Markdown
Member

glwagner commented Apr 2, 2026

I had to add Tar and CodecZlib to the dependancies because the Zenodo I found with the grid has them in a tarball.

@giordano is this correct or should we use an extension

@jagoosw one possibility is to put this in a new package (we can put it in NumericalEarth) and then add an extension for the deps

@giordano
Copy link
Copy Markdown
Member

giordano commented Apr 2, 2026

@giordano is this correct or should we use an extension

I think this is correct: if this was in an extension, users would need to know in advance what kind of files they're downloading and explicitly load Tar/CodecZlib just to be safe (I'd assume at least Tar is already loaded via other dependencies anyway), which doesn't seem to be very user-friendly. Also, pkgextensions usually are meant to extend methods on types defined in the packages they glue, but the downloaded file isn't a different type depending on its format, so there wouldn't be many types for which to extend methods.

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 3, 2026

@jagoosw one possibility is to put this in a new package (we can put it in NumericalEarth) and then add an extension for the deps

Yeah its very similar to ORCA1 which is already in the file I added to, they just have some regional refinement too.

https://www.nemo-ocean.eu/doc/node108.html#Tab_orca_zgr

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 3, 2026

I think this is correct: if this was in an extension, users would need to know in advance what kind of files they're downloading and explicitly load Tar/CodecZlib just to be safe (I'd assume at least Tar is already loaded via other dependencies anyway), which doesn't seem to be very user-friendly. Also, pkgextensions usually are meant to extend methods on types defined in the packages they glue, but the downloaded file isn't a different type depending on its format, so there wouldn't be many types for which to extend methods.

I think you're right that Tar was already loaded

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 3, 2026

When I try to run the example I get NaNs on the first time step, it seems ORCA1 does the same too? (@simone-silvestri)

(The example I added is a copy of the one degree example, I don't know if we want it in the examples folder in this PR but there doesn't seem to be a validation folder)

Comment thread examples/coarse_example.jl Outdated
z = ExponentialDiscretization(Nz, -depth, 0; scale = depth/4, mutable = true)

grid = ORCAGri(arch, z = z.face, Nz, dataset = ORCA2())
grid = ORCAGrid(arch; z, Nz, dataset = ORCA2(), halo = (5, 5, 4))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use ORCATripolarGrid ?

Copy link
Copy Markdown
Member

@glwagner glwagner left a comment

Choose a reason for hiding this comment

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

ORCATripolarGrid?

@simone-silvestri
Copy link
Copy Markdown
Member

There were a couple of bugs that have been solved, now I can run an ORCA1 with 30minutes quite stably

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 24, 2026

I'm just sorting out the conflicts and everything is straight forward except the tests. I had modified the tests to do do all the same tests on the ORCA2 grid as the ORCA1 grid, but the incoming changes for ORCA12 don't test everything like metric consistency. Thinking about it now we probably don't need todo all the tests on all the grids because if the constructor works for one it should work for all of them? Should I make the tests just do basic tests on ORCA2 like ORCA12, or should I extend to include ORCA12 in all the tests, or do all the tests on 1 and 2 but not 12? @simone-silvestri @taimoorsohail

@simone-silvestri
Copy link
Copy Markdown
Member

I think they are quite simple tests so worth to add also ORCA12 to the more in-depth testing

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 24, 2026

Okay I added them and ORCA12 is failing the metric consistency tests:

ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102
  Expression: all((x->begin
                #= /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 =#
                x > 0
            end), interior) == true
   Evaluated: false == true

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:102 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:121
  Expression: n_west / Nx > 0.95
   Evaluated: 0.5002313743637204 > 0.95

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:121 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:129
  Expression: nsouth / length(φC) > 0.95
   Evaluated: 0.4337215751525236 > 0.95

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:129 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
ORCATripolarGrid (ORCA12) metric consistency: Test Failed at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:140
  Expression: boundary_jump < 10interior_variation + 1.0e-10
   Evaluated: NaN < NaN

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:140 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.10+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:80
Test Summary:                                | Pass  Fail  Total   Time
ORCATripolarGrid (ORCA12) metric consistency |   20    15     35  17.0s
ERROR: LoadError: Some tests did not pass: 20 passed, 15 failed, 0 errored, 0 broken.
in expression starting at /Users/jago/Documents/Projects/NumericalEarth.jl/test/test_orca_tripolar_grid.jl:17

@taimoorsohail have you managed to run a model using the ORCA12 grid?

@simone-silvestri
Copy link
Copy Markdown
Member

Ok then I guess and issue that tracks the failure is more suited 😅 So we can merge this PR and deal with ORCA12 in another PR

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 24, 2026

To summarise I think the tests are telling us that:

  • ORCA12 has interior points with grid spacing or areas <= 0
  • Lots of face points are the "wrong" side of the center points
  • Theres something wrong with the periodic boundary

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 24, 2026

Ok then I guess and issue that tracks the failure is more suited 😅 So we can merge this PR and deal with ORCA12 in another PR

~okay I'll mark the tests as broken ~ I've commented out ORCA12 from the tests because it was easier than marking every test as broken

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 24, 2026

I think this is ready for review now. @simone-silvestri do you think I should reduce the stop time for the example?

Comment thread examples/orca2.jl Outdated
# Now we are ready to build the coupled ocean--sea ice model and bring everything
# together into a `simulation`.

# With Runge-Kutta 3rd order time-stepping we can safely use a timestep of 20 minutes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# With Runge-Kutta 3rd order time-stepping we can safely use a timestep of 20 minutes.
# With Runge-Kutta 3rd order time-stepping we can safely use a timestep of 90 minutes.

@jagoosw jagoosw changed the title Adds ORCA2TripolarGrid and changed ORCAGrid to ORCATripolarGrid Adds ORCA2 tripolar grid and changed ORCAGrid to ORCATripolarGrid Apr 24, 2026
Comment thread examples/orca2.jl Outdated
Comment thread examples/orca2.jl
Comment on lines +59 to +62
vertical_mixing = CATKEVerticalDiffusivity(VerticallyImplicitTimeDiscretization();
maximum_tracer_diffusivity = 1,
maximum_tke_diffusivity = 1,
maximum_viscosity = 1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we cannot use the default_ocean_closure?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think I was getting instability when I didn't have it capped, but I'll rerun and check

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we should have any examples that don't use the default --- we should fix the default instead.

Comment thread examples/orca2.jl Outdated
Comment thread examples/orca2.jl Outdated
tracer_advection = WENO(order=5)

dates = DateTime(1993, 1, 1) : Month(1) : DateTime(1993, 11, 1)
mask = LinearlyTaperedPolarMask(southern=(-80, -70), northern=(70, 90), z=(-100, 0))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need to restore under sea ice?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not sure, should I try without the mask?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah I think so.

@test size(bathy) == (Nx0, Ny0)
@test maximum(bathy) > 5000 # Deep ocean
end
end No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
end
end

jagoosw and others added 2 commits April 27, 2026 15:17
Co-authored-by: Simone Silvestri <silvestri.simone0@gmail.com>
@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 27, 2026

I think I've resolved the test conflicts but because I've renamed the test file it didn't show me the diffs automatically, is it just the new bit to predownload the datasets?

@simone-silvestri
Copy link
Copy Markdown
Member

simone-silvestri commented Apr 29, 2026

I think the last bit before merging is to add these to the CATKE defaults:

maximum_tracer_diffusivity = 1
maximum_tke_diffusivity = 1
maximum_viscosity = 1

(If they are truly needed). I don't think it will damage the accuracy of the simulation, given that 1 $m^2/s$ is already quite a large diffusivity but I defer to @glwagner to assess if this is a correct move.

@simone-silvestri
Copy link
Copy Markdown
Member

I think I've resolved the test conflicts but because I've renamed the test file it didn't show me the diffs automatically, is it just the new bit to predownload the datasets?

you mean for test_orca_grid? I think so but you can confirm by diffing what it is main now

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 29, 2026

I just checked and when I run without the limits I got NaNs. If I recall correctly, when I originally investigated this it was coming from a storm. I think maybe its a problem that is manifesting on coarse grids because if e.g. we interpolate the atmosphere fields and the coarse point happens to be near a very high wind speed point then that high wind speed is applied over the whole cell injecting a lot more momentum than on a more refined grid that resolves the variability in the atmosphere. I don't know if there are other strategies for downscaling the atmosphere some kind of averaging that people use?

@glwagner
Copy link
Copy Markdown
Member

My main concern is that the limiters are unphysical. A diffusivity that large can occur for winds of 33 m/s and a 1 m mixing length, which seems possible in extreme conditions for sure.

The question is why 1 m^2 / s lead to blow up.

@jagoosw
Copy link
Copy Markdown
Collaborator Author

jagoosw commented Apr 29, 2026

My main concern is that the limiters are unphysical. A diffusivity that large can occur for winds of 33 m/s and a 1 m mixing length, which seems possible in extreme conditions for sure.

The question is why 1 m^2 / s lead to blow up.

1m^2/s was an arbitrary choice, I can try running with it higher to see what the stable maximum is. I'm not sure exactly how the instability is arising, I think there can be a feedback with the bulk formula fluxs if the fluxs become large which could happen if theres a deep mixing event and e.g. the SST suddenly drops?

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.

5 participants