Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High-order advection stencils, overhaul of boundary treatment, and bugfix in advection reconstruction #2603

Merged
merged 183 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from 159 commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
98e26f3
added test
simone-silvestri Jun 8, 2022
b8a6236
introducing weno 3 for boundaries
simone-silvestri Jun 13, 2022
bf90b06
export WENO3
simone-silvestri Jun 13, 2022
4379d9e
testing WENO3
simone-silvestri Jun 13, 2022
190a997
child advection schemes
simone-silvestri Jun 13, 2022
7d19c4f
fixing boundary fluxes
simone-silvestri Jun 13, 2022
5f2b87b
fixing boundary fluxes
simone-silvestri Jun 13, 2022
324159d
fixed topologically conditional interpolation
simone-silvestri Jun 13, 2022
8456876
ready to test
simone-silvestri Jun 13, 2022
e6eb255
fallback for low order
simone-silvestri Jun 13, 2022
dfbf956
correct weno order coefficients
simone-silvestri Jun 13, 2022
d5e7233
upwind for vector_invariant downgrading
simone-silvestri Jun 13, 2022
bb029a8
small bugfix in stretched weno construction
simone-silvestri Jun 13, 2022
853c406
taking care of stretched smoothness
simone-silvestri Jun 13, 2022
03cadfe
some details
simone-silvestri Jun 13, 2022
7430936
allow both stencils
simone-silvestri Jun 13, 2022
bd1f2d3
my commits
simone-silvestri Jun 13, 2022
b9bc07d
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jun 13, 2022
b81eeb8
weno3 need 2 boundary points
simone-silvestri Jun 13, 2022
f4415ab
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jun 13, 2022
0d98f0c
finally correct boundary treatment
simone-silvestri Jun 14, 2022
0a155f3
changed name
simone-silvestri Jun 14, 2022
7d831f1
renaming
simone-silvestri Jun 14, 2022
60b52a8
fixed horizontal boundaries
simone-silvestri Jun 14, 2022
fefacb5
final touches
simone-silvestri Jun 14, 2022
c226081
correct manifest
simone-silvestri Jun 14, 2022
0b83437
fixed real boundaries stencils
simone-silvestri Jun 14, 2022
3f57c3e
Merge remote-tracking branch 'origin/main' into ss/advection_refactor
simone-silvestri Jun 14, 2022
0cfd090
changed real boundaries fluxes
simone-silvestri Jun 14, 2022
d595c31
new changes
simone-silvestri Jun 15, 2022
f2a88cc
operators where not specified
simone-silvestri Jun 15, 2022
2496c8e
fixed conditional derivatives
simone-silvestri Jun 15, 2022
6ca0e9a
adding test
simone-silvestri Jun 15, 2022
b6c5c9e
merged
simone-silvestri Jun 15, 2022
d6176af
reverted manifest and project
simone-silvestri Jun 15, 2022
f0c58c5
bugfix in immersed cell
simone-silvestri Jun 15, 2022
418768c
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jun 15, 2022
4b53e0e
weno nth order
simone-silvestri Jun 16, 2022
66f57fa
adding WENO n
simone-silvestri Jun 16, 2022
6cf2fdd
weno-n works
simone-silvestri Jun 17, 2022
cd9d158
removing old wenos
simone-silvestri Jun 17, 2022
fd4f553
removed weno5
simone-silvestri Jun 17, 2022
84c56fb
no more vorticity on the boundary
simone-silvestri Jun 17, 2022
c2b5ece
small bugfix
simone-silvestri Jun 17, 2022
b4048ec
another bugfix
simone-silvestri Jun 17, 2022
fc25272
another bugfix
simone-silvestri Jun 17, 2022
8aead19
small beautification
simone-silvestri Jun 17, 2022
2847003
fixed stretched coefficients'
simone-silvestri Jun 20, 2022
9d7e9b0
reverted tomls
simone-silvestri Jun 20, 2022
9bb0a8b
another solution for the Face problem
simone-silvestri Jun 20, 2022
2a17eee
some updates...
simone-silvestri Jun 20, 2022
6eee0aa
Update src/Advection/weno_nth_order.jl
simone-silvestri Jun 21, 2022
393e1ab
a whole lot of change
simone-silvestri Jun 21, 2022
a4972c3
a whole lot of change
simone-silvestri Jun 21, 2022
2a58bea
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jun 21, 2022
a29161e
hotfix
simone-silvestri Jun 21, 2022
ce0bb6e
hotfix
simone-silvestri Jun 21, 2022
13f6825
last for now
simone-silvestri Jun 21, 2022
40c9ebf
disambiguation
simone-silvestri Jun 21, 2022
93bbb24
small test
simone-silvestri Jun 21, 2022
248109c
small test
simone-silvestri Jun 21, 2022
ee500d8
hotfix
simone-silvestri Jun 21, 2022
304bb25
hotfix
simone-silvestri Jun 21, 2022
b54188a
some info
simone-silvestri Jun 21, 2022
76c2e22
fixed all tests?
simone-silvestri Jun 21, 2022
b1ab80d
another large change
simone-silvestri Jun 21, 2022
0b65dd9
removed insanely long test
simone-silvestri Jun 21, 2022
535bbae
removed insanely long test
simone-silvestri Jun 21, 2022
934280f
added advection test
simone-silvestri Jun 21, 2022
ae1b56d
fixed new tests
simone-silvestri Jun 21, 2022
f073fec
fixed new tests
simone-silvestri Jun 21, 2022
790d4fc
fixed new tests
simone-silvestri Jun 21, 2022
33b10c1
fixed new tests
simone-silvestri Jun 21, 2022
26d6da6
fixed new tests
simone-silvestri Jun 21, 2022
d3fe847
removed temporary file
simone-silvestri Jun 21, 2022
c86c485
improved aliases
simone-silvestri Jun 22, 2022
ccffcbc
centered till 12th and upwind will 11th order
simone-silvestri Jun 22, 2022
9603cec
small fix
simone-silvestri Jun 22, 2022
fa4b112
add WENO docstring
navidcy Jun 22, 2022
70e479a
bump minor version
navidcy Jun 22, 2022
707387b
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jun 22, 2022
adc4222
changed new test
simone-silvestri Jun 22, 2022
bf8e0cb
small mistake
simone-silvestri Jun 22, 2022
b3a27d9
add docstring for calc_reconstruction_stencil
navidcy Jun 22, 2022
7149213
delete extra spaces in show methods
navidcy Jun 22, 2022
8c1042a
add doctest for stretched z-grid
navidcy Jun 22, 2022
b8242af
Update src/Advection/reconstruction_coefficients.jl
simone-silvestri Jun 22, 2022
4a8b3b6
small changes
simone-silvestri Jun 23, 2022
cdef367
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jun 23, 2022
7620fae
add multi dimensional advection
simone-silvestri Jun 24, 2022
64e7dd6
multidimensional vector invariant
simone-silvestri Jun 24, 2022
36e8d95
Merge branch 'main' into ss/advection_refactor
navidcy Jun 26, 2022
a5a1928
updates
simone-silvestri Jun 27, 2022
9fae4fa
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jun 27, 2022
284a106
bugfix
simone-silvestri Jun 28, 2022
67b040f
it does have a definition
simone-silvestri Jun 28, 2022
9d3d846
reversing the stencil
simone-silvestri Jun 29, 2022
9601df4
new changes
simone-silvestri Jun 29, 2022
e333a92
new changes
simone-silvestri Jun 29, 2022
ddf0532
correct stencil
simone-silvestri Jun 29, 2022
7356bbf
bugfix
simone-silvestri Jun 29, 2022
2008f2e
capping the centered scheme
simone-silvestri Jun 29, 2022
6f049e3
finally correct smoothness?
simone-silvestri Jun 29, 2022
3b7bf2d
small changes
simone-silvestri Jun 29, 2022
eca4a9f
fixed test
simone-silvestri Jun 30, 2022
11c8e4c
stretched to inner
simone-silvestri Jun 30, 2022
81b2e92
the right combination
simone-silvestri Jun 30, 2022
063680d
whooops
simone-silvestri Jun 30, 2022
dabdd76
cleaning up a bit
simone-silvestri Jun 30, 2022
b41272d
fix immersed boundary bug
simone-silvestri Jun 30, 2022
915cfc4
bugfix
simone-silvestri Jun 30, 2022
11cd264
added 2D convergence test
simone-silvestri Jun 30, 2022
81b0cb6
adapting swh
simone-silvestri Jun 30, 2022
cc66bc6
slighly more elegant
simone-silvestri Jun 30, 2022
2db39ed
disambiguation
simone-silvestri Jun 30, 2022
a3a94d6
small changes
simone-silvestri Jul 1, 2022
e99649c
bugfixes...
simone-silvestri Jul 1, 2022
541e659
testing multidimensional reconstruction
simone-silvestri Jul 1, 2022
b7d61fd
bugfix
simone-silvestri Jul 1, 2022
4d5374f
introducing non linear tests
simone-silvestri Jul 1, 2022
8327206
ready to split the PRs
simone-silvestri Jul 5, 2022
b972b10
cleaned multidimensional
simone-silvestri Jul 5, 2022
3627aea
cleaned vector invariant
simone-silvestri Jul 5, 2022
1a01c22
reverted manifest and project
simone-silvestri Jul 5, 2022
428a5f1
cleaned advection
simone-silvestri Jul 5, 2022
f6e8adc
a little more cleaning
simone-silvestri Jul 5, 2022
36d4201
modified shallow water near global
simone-silvestri Jul 5, 2022
bc09eed
changed bathymetry
simone-silvestri Jul 5, 2022
d87a1b3
small changes
simone-silvestri Jul 5, 2022
40f1096
@inbounds + some comments
simone-silvestri Jul 5, 2022
6a3c566
merge main
tomchor Jul 6, 2022
472495a
small bugfix
simone-silvestri Jul 6, 2022
f84d522
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jul 6, 2022
ea7d470
bugfix for partialcell
simone-silvestri Jul 6, 2022
8cbe3ba
fixed docs?
simone-silvestri Jul 6, 2022
7cf4348
now fixed docs?
simone-silvestri Jul 6, 2022
b5583d0
cleared all tests
simone-silvestri Jul 7, 2022
529d3c3
bump version
simone-silvestri Jul 7, 2022
c1f065a
revamp of 2.8 degree simulation
simone-silvestri Jul 7, 2022
b029fce
added derivative for constants (constant_salinity)
simone-silvestri Jul 7, 2022
6378004
Update src/Advection/upwind_biased_reconstruction.jl
simone-silvestri Jul 7, 2022
b37bf29
Update src/Advection/weno_reconstruction.jl
simone-silvestri Jul 7, 2022
b1435d1
Update src/Models/ShallowWaterModels/shallow_water_model.jl
simone-silvestri Jul 7, 2022
28c3b3e
Update src/Models/ShallowWaterModels/shallow_water_model.jl
simone-silvestri Jul 7, 2022
cc469dc
back to shallow
simone-silvestri Jul 7, 2022
10dfd5f
documented the skipping
simone-silvestri Jul 7, 2022
948fa99
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jul 7, 2022
6a16ea5
merged main
simone-silvestri Jul 12, 2022
2a553a4
Merge branch 'main' into ss/advection_refactor
navidcy Jul 13, 2022
b437435
merge main
navidcy Jul 13, 2022
6bbbe76
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
navidcy Jul 13, 2022
15d0897
changes
simone-silvestri Jul 13, 2022
391081b
Update src/Advection/weno_reconstruction.jl
simone-silvestri Jul 13, 2022
93ef350
Update src/Advection/weno_reconstruction.jl
simone-silvestri Jul 13, 2022
8f0903d
new fixes
simone-silvestri Jul 15, 2022
3f9645b
Merge branch 'ss/advection_refactor' of github.com:CliMA/Oceananigans…
simone-silvestri Jul 15, 2022
9a2966c
other fixes...
simone-silvestri Jul 15, 2022
c9dfd0d
fixes
simone-silvestri Jul 15, 2022
91dfb11
fixed tests
simone-silvestri Jul 15, 2022
1fca811
`@inbounds` on coeff retrieval
simone-silvestri Jul 15, 2022
1494ff4
merged main
simone-silvestri Jul 15, 2022
4cd0c23
reverted manifest and project
simone-silvestri Jul 15, 2022
66337e8
more check inbounds
simone-silvestri Jul 15, 2022
0529cb6
still not inbounding?
simone-silvestri Jul 15, 2022
138cf0e
giving up inbounding?
simone-silvestri Jul 16, 2022
615e6f6
revert back
simone-silvestri Jul 16, 2022
6d20035
manifest-project temporary update
simone-silvestri Jul 19, 2022
8e861eb
reverted manifest and project
simone-silvestri Jul 20, 2022
8b4be4f
whoops some tests were off
simone-silvestri Jul 20, 2022
262d6d0
correct the halos in test
simone-silvestri Jul 21, 2022
527c00e
merged main
simone-silvestri Jul 21, 2022
40d424e
small mistake
simone-silvestri Jul 21, 2022
c42faed
correct halos
simone-silvestri Jul 21, 2022
8bbd4dc
Merge remote-tracking branch 'origin/main' into ss/advection_refactor
simone-silvestri Jul 22, 2022
9a9be24
small bugfix
simone-silvestri Jul 22, 2022
70c62d0
larger halos for immersedboundary (and VI weno)
simone-silvestri Jul 22, 2022
23e50de
fixed tests
simone-silvestri Jul 22, 2022
439e561
Change formatting in weno_interpolants.jl
glwagner Jul 25, 2022
e887be8
Consistent variable naming
glwagner Jul 25, 2022
c9a10b4
Use non-short-circuiting logic in topologically_conditional_interpola…
glwagner Jul 25, 2022
e5ed154
Improve comment in weno_interpolants
glwagner Jul 25, 2022
987691a
Update src/Advection/topologically_conditional_interpolation.jl
simone-silvestri Jul 25, 2022
7292dbc
name changes
simone-silvestri Jul 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Oceananigans"
uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
authors = ["Climate Modeling Alliance and contributors"]
version = "0.76.7"
version = "0.77.0"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Let's run a two-dimensional, horizontally-periodic simulation of turbulence usin
```julia
using Oceananigans
grid = RectilinearGrid(CPU(), size=(128, 128), x=(0, 2π), y=(0, 2π), topology=(Periodic, Periodic, Flat))
model = NonhydrostaticModel(; grid, advection=WENO5())
model = NonhydrostaticModel(; grid, advection=WENO())
ϵ(x, y, z) = 2rand() - 1
set!(model, u=ϵ, v=ϵ)
simulation = Simulation(model; Δt=0.01, stop_time=4)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_advection_schemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end
# Benchmark parameters

Architectures = has_cuda() ? [CPU, GPU] : [CPU]
Schemes = (CenteredSecondOrder, CenteredFourthOrder, UpwindBiasedThirdOrder, UpwindBiasedFifthOrder, WENO5)
Schemes = (CenteredSecondOrder, CenteredFourthOrder, UpwindBiasedThirdOrder, UpwindBiasedFifthOrder, WENO)

# Run and summarize benchmarks

Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_multi_GPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function run_solid_body_rotation(; architecture = CPU(),
free_surface = free_surface,
coriolis = coriolis,
tracers = (:T, :b),
tracer_advection = WENO5(),
tracer_advection = WENO(),
buoyancy = BuoyancyTracer(),
closure = closure)

Expand Down
4 changes: 2 additions & 2 deletions docs/src/appendix/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ format the benchmark results.
## Shallow Water Model

This benchmark tests the performance of the shallow water model run in a doubly periodic domain (`topology = (Periodic, Periodic, Flat)`)
on a CPU versus a GPU. We find that with the `WENO5` advection scheme we get a maximum speedup of more than 400 times on a `16384^2` grid.
on a CPU versus a GPU. We find that with the `WENO` advection scheme we get a maximum speedup of more than 400 times on a `16384^2` grid.

```
Oceananigans v0.58.1
Expand Down Expand Up @@ -86,7 +86,7 @@ The time graph below shows that execution times on GPU are negligebly small up u

## Nonhydrostatic Model

Similar to to shallow water model, the nonhydrostatic model benchmark tests for its performance on both a CPU and a GPU. It was also benchmarked with the `WENO5` advection scheme. The nonhydrostatic model is 3-dimensional unlike the 2-dimensional shallow water model. Total number of grid points is Ns cubed.
Similar to to shallow water model, the nonhydrostatic model benchmark tests for its performance on both a CPU and a GPU. It was also benchmarked with the `WENO` advection scheme. The nonhydrostatic model is 3-dimensional unlike the 2-dimensional shallow water model. Total number of grid points is Ns cubed.

```
Oceananigans v0.58.8
Expand Down
6 changes: 3 additions & 3 deletions docs/src/model_setup/forcing_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ w_sediment = 2/9 * Δb / ν_molecular * r_sediment^2 # m s⁻¹
sinking = AdvectiveForcing(UpwindBiasedFifthOrder(), w=w_sediment)

# output
AdvectiveForcing with the UpwindBiasedFifthOrder scheme:
AdvectiveForcing with the UpwindBiased scheme:
├── u: ZeroField{Int64}
├── v: ZeroField{Int64}
└── w: ConstantField(-0.00352102)
Expand All @@ -328,10 +328,10 @@ slip_bcs = FieldBoundaryConditions(grid, (Center, Center, Face),
top=no_penetration, bottom=no_penetration)

w_slip = ZFaceField(grid, boundary_conditions=slip_bcs)
sinking = AdvectiveForcing(WENO5(; grid), w=w_slip)
sinking = AdvectiveForcing(WENO(; grid), w=w_slip)

# output
AdvectiveForcing with the WENO5 scheme:
AdvectiveForcing with the WENO scheme:
├── u: ZeroField{Int64}
├── v: ZeroField{Int64}
└── w: 32×32×33 Field{Center, Center, Face} on RectilinearGrid on CPU
Expand Down
4 changes: 2 additions & 2 deletions docs/src/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This code:
using Oceananigans

grid = RectilinearGrid(size=(128, 128), x=(0, 2π), y=(0, 2π), topology=(Periodic, Periodic, Flat))
model = NonhydrostaticModel(; grid, advection=WENO5())
model = NonhydrostaticModel(; grid, advection=WENO())

ϵ(x, y, z) = 2rand() - 1
set!(model, u=ϵ, v=ϵ)
Expand Down Expand Up @@ -50,7 +50,7 @@ Fine, we'll re-run this code on the GPU then:
using Oceananigans

grid = RectilinearGrid(GPU(), size=(128, 128), x=(0, 2π), y=(0, 2π), topology=(Periodic, Periodic, Flat))
model = NonhydrostaticModel(; grid, advection=WENO5())
model = NonhydrostaticModel(; grid, advection=WENO())

ϵ(x, y, z) = 2rand() - 1
set!(model, u=ϵ, v=ϵ)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/simulation_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ For large simulations on the GPU, careful management of memory allocation may be

- Try to use higher-order advection schemes. In general when you use a higher-order scheme you need
fewer grid points to achieve the same accuracy that you would with a lower-order one. Oceananigans
provides two high-order advection schemes: 5th-order WENO method (WENO5) and 3rd-order upwind.
provides two high-order advection schemes: 5th-order WENO method (WENO) and 3rd-order upwind.

- Manually define scratch space to be reused in diagnostics. By default, every time a user-defined
diagnostic is calculated the compiler reserves a new chunk of memory for that calculation, usually
Expand Down
4 changes: 2 additions & 2 deletions examples/baroclinic_adjustment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ model = HydrostaticFreeSurfaceModel(; grid,
buoyancy = BuoyancyTracer(),
tracers = :b,
closure = (vertical_diffusive_closure, horizontal_diffusive_closure),
momentum_advection = WENO5(),
tracer_advection = WENO5(),
momentum_advection = WENO(),
tracer_advection = WENO(),
free_surface = ImplicitFreeSurface())

# We want to initialize our model with a baroclinically unstable front plus some small-amplitude
Expand Down
2 changes: 1 addition & 1 deletion examples/horizontal_convection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ nothing # hide
# Runge-Kutta time-stepping scheme, and a `BuoyancyTracer`.

model = NonhydrostaticModel(; grid,
advection = WENO5(),
advection = WENO(),
tomchor marked this conversation as resolved.
Show resolved Hide resolved
timestepper = :RungeKutta3,
tracers = :b,
buoyancy = BuoyancyTracer(),
Expand Down
2 changes: 1 addition & 1 deletion examples/langmuir_turbulence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ coriolis = FPlane(f=1e-4) # s⁻¹
# we use `UniformStokesDrift`, which expects Stokes drift functions of ``z, t`` only.

model = NonhydrostaticModel(; grid, coriolis,
advection = WENO5(),
advection = WENO(),
timestepper = :RungeKutta3,
tracers = :b,
buoyancy = BuoyancyTracer(),
Expand Down
4 changes: 2 additions & 2 deletions examples/shallow_water_Bickley_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ grid = RectilinearGrid(size = (Nx, Ny),

# ## Building a `ShallowWaterModel`
#
# We build a `ShallowWaterModel` with the `WENO5` advection scheme,
# We build a `ShallowWaterModel` with the `WENO` advection scheme,
# 3rd-order Runge-Kutta time-stepping, non-dimensional Coriolis and
# gravitational acceleration

Expand All @@ -49,7 +49,7 @@ coriolis = FPlane(f=1)

model = ShallowWaterModel(; grid, coriolis, gravitational_acceleration,
timestepper = :RungeKutta3,
momentum_advection = WENO5())
momentum_advection = WENO())

# Use `architecture = GPU()` to run this problem on a GPU.

Expand Down
42 changes: 25 additions & 17 deletions src/Advection/Advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,49 @@ export
advective_tracer_flux_y,
advective_tracer_flux_z,

CenteredSecondOrder,
UpwindBiasedFirstOrder,
UpwindBiasedThirdOrder,
UpwindBiasedFifthOrder,
CenteredFourthOrder,
WENO5,
AdvectionScheme,
Centered, CenteredSecondOrder, CenteredFourthOrder,
UpwindBiased, UpwindBiasedFirstOrder, UpwindBiasedThirdOrder, UpwindBiasedFifthOrder,
WENO, WENOThirdOrder, WENOFifthOrder,
VectorInvariant,
EnergyConservingScheme,
EnstrophyConservingScheme

using DocStringExtensions

using Base: @propagate_inbounds
using Adapt
using OffsetArrays
using KernelAbstractions.Extras.LoopInfo: @unroll

using Oceananigans.Grids
using Oceananigans.Grids: with_halo, return_metrics
using Oceananigans.Architectures: arch_array, architecture, CPU

using Oceananigans.Operators

import Base: show, summary
import Oceananigans.Grids: required_halo_size

abstract type AbstractAdvectionScheme{Buffer} end
abstract type AbstractCenteredAdvectionScheme{Buffer} <: AbstractAdvectionScheme{Buffer} end
abstract type AbstractUpwindBiasedAdvectionScheme{Buffer} <: AbstractAdvectionScheme{Buffer} end
abstract type AbstractAdvectionScheme{Buffer, FT} end
abstract type AbstractCenteredAdvectionScheme{Buffer, FT} <: AbstractAdvectionScheme{Buffer, FT} end
abstract type AbstractUpwindBiasedAdvectionScheme{Buffer, FT} <: AbstractAdvectionScheme{Buffer, FT} end

required_halo_size(scheme::AbstractAdvectionScheme{Buffer}) where Buffer = Buffer + 1
@inline boundary_buffer(::AbstractAdvectionScheme{N}) where N = N
@inline required_halo_size(scheme::AbstractAdvectionScheme{Buffer}) where Buffer = Buffer

include("centered_advective_fluxes.jl")
include("upwind_biased_advective_fluxes.jl")
include("flat_advective_fluxes.jl")

include("upwind_biased_first_order.jl")
include("centered_second_order.jl")
include("upwind_biased_third_order.jl")
include("centered_fourth_order.jl")
include("upwind_biased_fifth_order.jl")
include("weno_fifth_order.jl")
include("vector_invariant_advection.jl")
include("reconstruction_coefficients.jl")
include("centered_reconstruction.jl")
include("upwind_biased_reconstruction.jl")
include("weno_reconstruction.jl")
include("weno_interpolants.jl")
include("stretched_weno_smoothness.jl")

include("vector_invariant_advection.jl")
include("topologically_conditional_interpolation.jl")

include("momentum_advection_operators.jl")
Expand Down
26 changes: 13 additions & 13 deletions src/Advection/centered_advective_fluxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
##### See topologically_conditional_interpolation.jl for an explanation of the underscore-prepended functions _symmetric_interpolate_*.
#####

const Centered = AbstractCenteredAdvectionScheme
const CenteredScheme = AbstractCenteredAdvectionScheme

#####
##### Advective momentum flux operators
#####
##### Note the convention "advective_momentum_flux_Ua" corresponds to the advection _of_ a _by_ U.
#####

@inline advective_momentum_flux_Uu(i, j, k, grid, scheme::Centered, U, u) = Axᶜᶜᶜ(i, j, k, grid) * _symmetric_interpolate_xᶜᵃᵃ(i, j, k, grid, scheme, U) * _symmetric_interpolate_xᶜᵃᵃ(i, j, k, grid, scheme, u)
@inline advective_momentum_flux_Vu(i, j, k, grid, scheme::Centered, V, u) = Ayᶠᶠᶜ(i, j, k, grid) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, V) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, u)
@inline advective_momentum_flux_Wu(i, j, k, grid, scheme::Centered, W, u) = Azᶠᶜᶠ(i, j, k, grid) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, W) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, u)
@inline advective_momentum_flux_Uu(i, j, k, grid, scheme::CenteredScheme, U, u) = @inbounds Axᶜᶜᶜ(i, j, k, grid) * _symmetric_interpolate_xᶜᵃᵃ(i, j, k, grid, scheme, U) * _symmetric_interpolate_xᶜᵃᵃ(i, j, k, grid, scheme, u)
@inline advective_momentum_flux_Vu(i, j, k, grid, scheme::CenteredScheme, V, u) = @inbounds Ayᶠᶠᶜ(i, j, k, grid) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, V) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, u)
@inline advective_momentum_flux_Wu(i, j, k, grid, scheme::CenteredScheme, W, u) = @inbounds Azᶠᶜᶠ(i, j, k, grid) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, W) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, u)

@inline advective_momentum_flux_Uv(i, j, k, grid, scheme::Centered, U, v) = Axᶠᶠᶜ(i, j, k, grid) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, U) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, v)
@inline advective_momentum_flux_Vv(i, j, k, grid, scheme::Centered, V, v) = Ayᶜᶜᶜ(i, j, k, grid) * _symmetric_interpolate_yᵃᶜᵃ(i, j, k, grid, scheme, V) * _symmetric_interpolate_yᵃᶜᵃ(i, j, k, grid, scheme, v)
@inline advective_momentum_flux_Wv(i, j, k, grid, scheme::Centered, W, v) = Azᶜᶠᶠ(i, j, k, grid) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, W) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, v)
@inline advective_momentum_flux_Uv(i, j, k, grid, scheme::CenteredScheme, U, v) = @inbounds Axᶠᶠᶜ(i, j, k, grid) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, U) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, v)
@inline advective_momentum_flux_Vv(i, j, k, grid, scheme::CenteredScheme, V, v) = @inbounds Ayᶜᶜᶜ(i, j, k, grid) * _symmetric_interpolate_yᵃᶜᵃ(i, j, k, grid, scheme, V) * _symmetric_interpolate_yᵃᶜᵃ(i, j, k, grid, scheme, v)
@inline advective_momentum_flux_Wv(i, j, k, grid, scheme::CenteredScheme, W, v) = @inbounds Azᶜᶠᶠ(i, j, k, grid) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, W) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, v)

@inline advective_momentum_flux_Uw(i, j, k, grid, scheme::Centered, U, w) = Axᶠᶜᶠ(i, j, k, grid) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, U) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, w)
@inline advective_momentum_flux_Vw(i, j, k, grid, scheme::Centered, V, w) = Ayᶜᶠᶠ(i, j, k, grid) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, V) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, w)
@inline advective_momentum_flux_Ww(i, j, k, grid, scheme::Centered, W, w) = Azᶜᶜᶜ(i, j, k, grid) * _symmetric_interpolate_zᵃᵃᶜ(i, j, k, grid, scheme, W) * _symmetric_interpolate_zᵃᵃᶜ(i, j, k, grid, scheme, w)
@inline advective_momentum_flux_Uw(i, j, k, grid, scheme::CenteredScheme, U, w) = @inbounds Axᶠᶜᶠ(i, j, k, grid) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, U) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, w)
@inline advective_momentum_flux_Vw(i, j, k, grid, scheme::CenteredScheme, V, w) = @inbounds Ayᶜᶠᶠ(i, j, k, grid) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, V) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, w)
@inline advective_momentum_flux_Ww(i, j, k, grid, scheme::CenteredScheme, W, w) = @inbounds Azᶜᶜᶜ(i, j, k, grid) * _symmetric_interpolate_zᵃᵃᶜ(i, j, k, grid, scheme, W) * _symmetric_interpolate_zᵃᵃᶜ(i, j, k, grid, scheme, w)

#####
##### Advective tracer flux operators
#####

@inline advective_tracer_flux_x(i, j, k, grid, scheme::Centered, U, c) = @inbounds Ax_qᶠᶜᶜ(i, j, k, grid, U) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, c)
@inline advective_tracer_flux_y(i, j, k, grid, scheme::Centered, V, c) = @inbounds Ay_qᶜᶠᶜ(i, j, k, grid, V) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, c)
@inline advective_tracer_flux_z(i, j, k, grid, scheme::Centered, W, c) = @inbounds Az_qᶜᶜᶠ(i, j, k, grid, W) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, c)
@inline advective_tracer_flux_x(i, j, k, grid, scheme::CenteredScheme, U, c) = @inbounds Ax_qᶠᶜᶜ(i, j, k, grid, U) * _symmetric_interpolate_xᶠᵃᵃ(i, j, k, grid, scheme, c)
@inline advective_tracer_flux_y(i, j, k, grid, scheme::CenteredScheme, V, c) = @inbounds Ay_qᶜᶠᶜ(i, j, k, grid, V) * _symmetric_interpolate_yᵃᶠᵃ(i, j, k, grid, scheme, c)
@inline advective_tracer_flux_z(i, j, k, grid, scheme::CenteredScheme, W, c) = @inbounds Az_qᶜᶜᶠ(i, j, k, grid, W) * _symmetric_interpolate_zᵃᵃᶠ(i, j, k, grid, scheme, c)
33 changes: 0 additions & 33 deletions src/Advection/centered_fourth_order.jl

This file was deleted.

Loading