Difference between UpwindBiasedFifthOrder
and WENO5
schemes
#2054
Replies: 4 comments 20 replies
-
Can you post the plotting code. I can try to reduce this to something more minimal. That'll help us. E.g., do you even need non-flat |
Beta Was this translation helpful? Give feedback.
-
When using My best guess is that the behavior observed when using |
Beta Was this translation helpful? Give feedback.
-
As a side note, if indeed |
Beta Was this translation helpful? Give feedback.
-
OK, I can reproduce this. But my question is why one is more correct than the other? I have no reason to believe that either is more correct than the other. They are indeed different, but should they be same? That's why I'd feel that if we don't have a sense of how the solution should be then why go after chasing a bug in either of the two? @tomchor you seem certain that a bug, if any, should be in WENO5. Perhaps you have more intel. But just from these two exps I'm not sure why it's not the UpwindBiasedFifthOrder scheme that is at fault. Both the animations show buoyancy with limits using Oceananigans
using Oceananigans.Units
advection_scemes = (WENO5(), UpwindBiasedFifthOrder())
for advection_sceme in advection_scemes
if advection_sceme == WENO5()
filename = "test_tomas_WENO5"
elseif advection_sceme == UpwindBiasedFifthOrder()
filename = "test_tomas_Upwind5"
end
params = (Δb = 5e-2, # m/s²
Δz = 40, # m
Lx = 8e3,
Lz = 300,
Nx = 2^7,
Nz = 2^3,
)
arch = CPU()
topo = (Bounded, Flat, Bounded)
grid = RegularRectilinearGrid(topology=topo,
size=(params.Nx, params.Nz),
x=(0, params.Lx), z=(0, params.Lz),
halo=(3,3))
logistic(φ) = 1 / (1 + exp(-φ))
b_west_value_func(y, z, t, p) = - p.Δb * (1 - logistic((z - p.Δz)/3))
b_west_value = ValueBoundaryCondition(b_west_value_func, parameters=(Δz=params.Δz,
Δb=params.Δb,
))
b_bcs = FieldBoundaryConditions(west = b_west_value,)
bcs = (b=b_bcs,)
model = NonhydrostaticModel(grid = grid, timestepper = :RungeKutta3,
architecture = arch,
advection = advection_sceme,
buoyancy = BuoyancyTracer(),
coriolis = nothing,
tracers = :b,
closure = IsotropicDiffusivity(ν=1e-1, κ=1e-1),
boundary_conditions = bcs)
simulation = Simulation(model, Δt=5, stop_time=1days)
u, v, w = model.velocities
b = model.tracers.b
outputs = (u=u, v=v, w=w, b=b,)
simulation.output_writers[:fields] = JLD2OutputWriter(model, outputs,
schedule = TimeInterval(20minutes),
prefix = filename,
field_slicer = nothing,
verbose = false,
force = true)
@info "Starting simulation"
run!(simulation, pickup=false)
using GLMakie
filepath = filename * ".jld2"
bt = FieldTimeSeries(filepath, "b")
x, y, z = nodes((Center, Center, Center), grid)
times = bt.times
Nt = length(times)
bn(n) = interior(bt[n])[:, 1, :]
n = Node(1)
b = @lift bn($n)
fig = Figure()
ax = Axis(fig[1, 1], title="buoyancy")
hm = heatmap!(ax, x, z, b, colorrange=(-1e-3, 1e-3), colormap=:balance)
display(fig)
record(fig, filename * ".mp4", 1:Nt, framerate=8) do i
@info "Plotting frame $i of $Nt"
n[] = i
end
end (tomas_debug) pkg> st
Status `~/Research/tomas_debug/Project.toml`
[e9467ef8] GLMakie v0.4.7
[9e8cae18] Oceananigans v0.65.0 WENO5 test_tomas_WENO5.mp4UpWind5 test_tomas_Upwind5.mp4 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is related to a message I sent originally on Slack. Let me start by apologizing for the example being kinda long. I spent a considerable amount of time on this and I have not been able to locate the issue or come up with a shorter example. The issue also seems to be related to the part of parameter space I'm in, and related to resolution, making it hard to figure out what's happening.
Btw, I figured I'd start a discussion instead of an issue because I'm not sure it's a bug. This may be simply a numerical limitation of the schemes, or I may be missing something. Any help is appreciated regardless.
In the following example I'm simulating a 2D non-rotating domain. The whole domain is initially unstrafified but buoyancy is an active tracer. The only non-standard BC is a
ValueBoundaryCondition
at the west wall, which imposes aΔb
(b
being buoyancy) which is supposed to lead to a gravity current of sorts. The value of Δb is negative close to the bottom and zero above.Here's the code:
Now, using the Upwind scheme, this is what the solution looks like for the buoyancy
b
:b_upw5.mp4
Now, because I was using this for many tests it's pretty under-resolved, which is probably what's making the circulation kinda weird, but at least I see a circulation develop, which is what I expected. (Although I don't know why there's apparently both "heating" above and "cooling" below, since Δb is non-positive...)
If I run the exact same example with a
WENO5
advection scheme, this is what I get:b_weno5.mp4
In order words: I get no circulation at all. As if all BCs were no flux.
This happened originally with a code of mine that's more complicated and which is better resolved, but the gist is the same. Am I missing something?
CC @glwagner @navidcy
Beta Was this translation helpful? Give feedback.
All reactions