Skip to content

Adapt advection order does not work as intendedΒ #5097

@simone-silvestri

Description

@simone-silvestri

It is not enough to limit the advection scheme in one direction since the same scheme (only for momentum advection) is used to reconstruct the advecting velocity in the tangential direction, leading to an out-of-bounds access: for example, if the grid is 4, 2, 4 and we limit advection in y to Upwind(3), still we will have [Upwind(7) -> Center(6) for advective velocities] in x that needs to compute the advecting velocity
(for example u for v advection) using an 6-point stencil, thus leading to an out-of-bounds error.

For this reason we should limit to the minimum order in all three direction, or at least add a kwarg to be able to change the advecting velocity scheme (also for Centered).

To check that this is the case, take

model = NonhydrostaticModel(grid=small_grid, advection=UpwindBiased(; order = 9))
@test model.advection isa FluxFormAdvection
@test required_halo_size_x(model.advection) == 4
@test required_halo_size_y(model.advection) == 2
@test required_halo_size_z(model.advection) == 4

and add a time_step!(model, 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞Even a perfect program still has bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions