-
Notifications
You must be signed in to change notification settings - Fork 210
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
Different advection schemes in different directions #3732
Merged
Merged
Changes from 13 commits
Commits
Show all changes
89 commits
Select commit
Hold shift + click to select a range
ea309b7
should be done
simone-silvestri 83f870e
add the dicussion
simone-silvestri ad1ae41
disambiguation
simone-silvestri 7843e0d
remove repeat code
simone-silvestri abecb28
precopmiles
simone-silvestri 9d87f01
keep these changes for later
simone-silvestri 03b0d28
correct the outside buffer
simone-silvestri 6a15de8
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 70d6475
fix tests
simone-silvestri 5b75542
Merge branch 'ss/different-advection-scheme' of github.com:CliMA/Ocea…
simone-silvestri 42b1f3a
change the show method
simone-silvestri 6181e01
back to previous buffer scheme
simone-silvestri 77873b3
allow for changes in the advection
simone-silvestri 9c7ff37
switch position of functions
simone-silvestri 9ca656e
better comment
simone-silvestri 4aabf62
better info
simone-silvestri 39a4ef8
bugfix
simone-silvestri 0ba24d6
better info
simone-silvestri 71dbde1
make sure N==1 -> nothing
simone-silvestri 817d058
Update src/Advection/momentum_advection_operators.jl
simone-silvestri 11355d6
add topologies
simone-silvestri bc212e3
add topology argument
simone-silvestri 680251d
Merge branch 'ss/different-advection-scheme' of github.com:CliMA/Ocea…
simone-silvestri d0d40be
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 261a31a
better adaptation
simone-silvestri cb7b090
Merge branch 'ss/different-advection-scheme' of github.com:CliMA/Ocea…
simone-silvestri bcdb2c6
formatting
simone-silvestri d73b3d9
whoops
simone-silvestri d46eb4c
remove topology and less metaprogramming
simone-silvestri 1b028f3
add advection
simone-silvestri 9456881
dont adapt nothing
simone-silvestri 3bc14be
retain same behavior as before
simone-silvestri ce30f43
fix multi region advection
simone-silvestri cd96911
bugfix scalar diffusivities parameter types
simone-silvestri 7191393
bugfix
simone-silvestri e6a489c
enzyme error
simone-silvestri 1a59a2d
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 3313d7c
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 2ce1537
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri e041ea6
make sure constructors are type-stable...
simone-silvestri a948955
force required_halo_size to be an integer
simone-silvestri 1ffe239
add better comment
simone-silvestri 39407f6
add a couple of unit tests
simone-silvestri b4f9e0f
test biharmonic diffusivity
simone-silvestri 4811293
fix enzyme tests
simone-silvestri 2e02dfe
correct adaptbetter explanation
simone-silvestri 4a45a95
add a test for adapt_advection
simone-silvestri 2e33b56
whoops wrong test
simone-silvestri ca876fa
revert changes
simone-silvestri b3a94d8
add couple more tests
simone-silvestri e1085a4
fix tests
simone-silvestri 4a78168
without the extra space
simone-silvestri f5b7789
fix enzyme test
simone-silvestri 98abf58
fix enzyme tests
simone-silvestri 9f35ebe
fix nonhydrostatic tests
simone-silvestri cc98d5e
rmove one newline
simone-silvestri ab0827e
simplify test
simone-silvestri 2eaf51e
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 9c2103a
Update src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surfa…
simone-silvestri 4b9aa61
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 2da6007
remove extra dispatches
simone-silvestri 9f27dc3
Merge branch 'ss/different-advection-scheme' of github.com:CliMA/Ocea…
simone-silvestri a91ca1c
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 4bed3f7
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri da88f62
relaunch the tests
simone-silvestri aa3d2cd
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 4cc6dfb
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 21015bb
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri a50157f
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 82d5ba7
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri 0d2e7bb
change comment
simone-silvestri c5709dd
Merge branch 'ss/different-advection-scheme' of github.com:CliMA/Ocea…
simone-silvestri b6d65e2
switch to B
simone-silvestri 1479884
new syntax for KernelParameters
simone-silvestri e741ce8
bugfix
simone-silvestri b03dc9d
another bugfix
simone-silvestri 7cc9149
make sure the range is correct
simone-silvestri d09f8aa
Merge branch 'main' into ss/different-advection-scheme
simone-silvestri c909344
Update src/Advection/adapt_advection_order.jl
simone-silvestri 5869952
Update src/Advection/adapt_advection_order.jl
simone-silvestri 13c21aa
Update src/Advection/adapt_advection_order.jl
simone-silvestri 96c5eda
remove comments
simone-silvestri d148896
Merge branch 'ss/different-advection-scheme' of github.com:CliMA/Ocea…
simone-silvestri da68014
this should be type stable for the moment
simone-silvestri 9f3fffc
bugfix
simone-silvestri 8bbaf03
bugfix
simone-silvestri 402d031
better comment
simone-silvestri 40e5dfa
fix the docs
simone-silvestri 9214110
whoops
simone-silvestri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
|
||
|
||
function adapt_advection_order_x(advection::Centered{H}, grid::AbstractGrid, N::Int) where H | ||
if N == 1 | ||
return nothing | ||
elseif N >= H | ||
return advection | ||
else | ||
return Centered(; order = N) | ||
end | ||
end | ||
|
||
function adapt_advection_order_x(advection::UpwindBiased{H}, grid::AbstractGrid, N::Int) where H | ||
if N == 1 | ||
return nothing | ||
elseif N >= H | ||
return advection | ||
else | ||
return UpwindBiased(; order = N) | ||
end | ||
end | ||
|
||
adapt_advection_order_y(advection, grid::AbstractGrid, N::Int) = adapt_advection_order_x(advection, grid, N) | ||
adapt_advection_order_z(advection, grid::AbstractGrid, N::Int) = adapt_advection_order_x(advection, grid, N) | ||
|
||
""" | ||
new_weno_scheme(grid, order, bounds, T) | ||
|
||
Constructs a new WENO scheme based on the given parameters. `T` is the type of the weno coefficients. | ||
A _non-stretched_ WENO scheme has `T` equal to `Nothing`. In case of a non-stretched WENO scheme, | ||
we rebuild the advection without passing the grid information, otherwise we use the grid to account for stretched directions. | ||
""" | ||
new_weno_scheme(grid, order, bounds, T) = ifelse(T == Nothing, WENO(; order, bounds), WENO(grid; order, bounds)) | ||
|
||
function adapt_advection_order_x(advection::WENO{H, FT, XT, YT, ZT}, grid::AbstractGrid) where {H, FT, XT, YT, ZT} | ||
|
||
if N == 1 | ||
return nothing | ||
elseif N >= H | ||
return advection | ||
else | ||
return new_weno_scheme(grid, N, advection.bounds, XT) | ||
end | ||
end | ||
|
||
function adapt_advection_order_y(advection::WENO{H, FT, XT, YT, ZT}, grid::AbstractGrid, N::Int) where {H, FT, XT, YT, ZT} | ||
|
||
if N > H | ||
return advection | ||
else | ||
return new_weno_scheme(grid, N, advection.bounds, YT) | ||
end | ||
end | ||
|
||
function adapt_advection_order_z(advection::WENO{H, FT, XT, YT, ZT}, grid::AbstractGrid, N::Int) where {H, FT, XT, YT, ZT} | ||
|
||
if N == 1 | ||
return nothing | ||
elseif N >= H | ||
return advection | ||
else | ||
return new_weno_scheme(grid, N, advection.bounds, XT) | ||
end | ||
end | ||
|
||
""" | ||
adapt_advection_order(advection, grid::AbstractGrid) | ||
|
||
Adapts the advection operator `advection` based on the grid `grid` by adjusting the order of advection in each direction. | ||
For example, if the grid has only one point in the x-direction, the advection operator in the x-direction is set to `nothing`. | ||
A high order advection sheme is reduced to a lower order advection scheme if the grid has fewer points in that direction. | ||
|
||
# Arguments | ||
- `advection`: The original advection scheme. | ||
- `grid::AbstractGrid`: The grid on which the advection scheme is applied. | ||
|
||
The adapted advection scheme with adjusted advection order returned by this function is a `FluxFormAdvection`. | ||
""" | ||
function adapt_advection_order(advection, grid::AbstractGrid) | ||
advection_x = adapt_advection_order_x(advection, grid, grid.Nx) | ||
advection_y = adapt_advection_order_y(advection, grid, grid.Ny) | ||
advection_z = adapt_advection_order_z(advection, grid, grid.Nz) | ||
|
||
# Check that we indeed changed the advection operator | ||
changed_x = advection_x != advection | ||
changed_y = advection_y != advection | ||
changed_z = advection_z != advection | ||
|
||
new_advection = FluxFormAdvection(advection_x, advection_y, advection_z) | ||
changed_advection = any((changed_x, changed_y, changed_z)) | ||
|
||
if changed_advection | ||
@info "User-defined advection scheme $(advection) reduced to $(new_advection) to comply with grid-size limitations." | ||
end | ||
|
||
return ifelse(changed_advection, new_advection, advection) | ||
end | ||
|
||
function adapt_advection_order(advection::FluxFormAdvection, grid::AbstractGrid) | ||
advection_x = adapt_advection_order_x(advection.x, grid, grid.Nx) | ||
advection_y = adapt_advection_order_y(advection.y, grid, grid.Ny) | ||
advection_z = adapt_advection_order_z(advection.z, grid, grid.Nz) | ||
simone-silvestri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Check that we indeed changed the advection operator | ||
changed_x = advection_x != advection.x | ||
changed_y = advection_y != advection.y | ||
changed_z = advection_z != advection.z | ||
|
||
new_advection = FluxFormAdvection(advection_x, advection_y, advection_z) | ||
changed_advection = any((changed_x, changed_y, changed_z)) | ||
|
||
if changed_advection | ||
@info "User-defined advection scheme $(advection) reduced to $(new_advection) to comply with grid-size limitations." | ||
end | ||
|
||
return ifelse(changed_advection, new_advection, advection) | ||
end | ||
|
||
# For the moment, we do not adapt the advection order for the VectorInvariant advection scheme | ||
adapt_advection_order(advection::VectorInvariant, grid::AbstractGrid) = advection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using Oceananigans.Operators: Vᶜᶜᶜ | ||
using Oceananigans.Fields: ZeroField | ||
|
||
struct FluxFormAdvection{N, FT, A, B, C} <: AbstractAdvectionScheme{N, FT} | ||
x :: A | ||
y :: B | ||
z :: C | ||
|
||
FluxFormAdvection{N, FT}(x::A, y::B, z::C) where {N, FT, A, B, C} = new{N, FT, A, B, C}(x, y, z) | ||
end | ||
|
||
""" | ||
function FluxFormAdvection(x, y, z) | ||
|
||
Builds a `FluxFormAdvection` type with reconstructions schemes `x`, `y`, and `z` to be applied in | ||
the x, y, and z direction, respectively. | ||
""" | ||
function FluxFormAdvection(x_advection, y_advection, z_advection) | ||
Hx = required_halo_size_x(x_advection) | ||
Hy = required_halo_size_y(y_advection) | ||
Hz = required_halo_size_z(z_advection) | ||
|
||
FT = eltype(x_advection) | ||
H = max(Hx, Hy, Hz) | ||
|
||
return FluxFormAdvection{H, FT}(x_advection, y_advection, z_advection) | ||
end | ||
|
||
Base.show(io::IO, scheme::FluxFormAdvection) = | ||
print(io, "FluxFormAdvection with reconstructions: ", " \n", | ||
" ├── x: ", summary(scheme.x), "\n", | ||
" ├── y: ", summary(scheme.y), "\n", | ||
" └── z: ", summary(scheme.z)) | ||
|
||
@inline required_halo_size_x(scheme::FluxFormAdvection) = required_halo_size_x(scheme.x) | ||
@inline required_halo_size_y(scheme::FluxFormAdvection) = required_halo_size_y(scheme.y) | ||
@inline required_halo_size_z(scheme::FluxFormAdvection) = required_halo_size_z(scheme.z) | ||
|
||
Adapt.adapt_structure(to, scheme::FluxFormAdvection{N, FT}) where {N, FT} = | ||
FluxFormAdvection{N, FT}(Adapt.adapt(to, scheme.x), | ||
Adapt.adapt(to, scheme.y), | ||
Adapt.adapt(to, scheme.z)) | ||
|
||
@inline _advective_tracer_flux_x(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_tracer_flux_x(i, j, k, grid, advection.x, args...) | ||
@inline _advective_tracer_flux_y(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_tracer_flux_y(i, j, k, grid, advection.y, args...) | ||
@inline _advective_tracer_flux_z(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_tracer_flux_z(i, j, k, grid, advection.z, args...) | ||
|
||
@inline _advective_momentum_flux_Uu(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Uu(i, j, k, grid, advection.x, args...) | ||
@inline _advective_momentum_flux_Vu(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Vu(i, j, k, grid, advection.y, args...) | ||
@inline _advective_momentum_flux_Wu(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Wu(i, j, k, grid, advection.z, args...) | ||
|
||
@inline _advective_momentum_flux_Uv(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Uv(i, j, k, grid, advection.x, args...) | ||
@inline _advective_momentum_flux_Vv(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Vv(i, j, k, grid, advection.y, args...) | ||
@inline _advective_momentum_flux_Wv(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Wv(i, j, k, grid, advection.z, args...) | ||
|
||
@inline _advective_momentum_flux_Uw(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Uw(i, j, k, grid, advection.x, args...) | ||
@inline _advective_momentum_flux_Vw(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Vw(i, j, k, grid, advection.y, args...) | ||
@inline _advective_momentum_flux_Ww(i, j, k, grid, advection::FluxFormAdvection, args...) = _advective_momentum_flux_Ww(i, j, k, grid, advection.z, args...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,24 @@ | ||
using Oceananigans.Operators: Vᶜᶜᶜ | ||
using Oceananigans.Fields: ZeroField | ||
|
||
struct TracerAdvection{N, FT, A, B, C} <: AbstractAdvectionScheme{N, FT} | ||
x :: A | ||
y :: B | ||
z :: C | ||
|
||
TracerAdvection{N, FT}(x::A, y::B, z::C) where {N, FT, A, B, C} = new{N, FT, A, B, C}(x, y, z) | ||
end | ||
|
||
""" | ||
function TracerAdvection(x, y, z) | ||
|
||
Builds a `TracerAdvection` type with reconstructions schemes `x`, `y`, and `z` to be applied in | ||
the x, y, and z direction, respectively. | ||
""" | ||
function TracerAdvection(x_advection, y_advection, z_advection) | ||
Hx = required_halo_size(x_advection) | ||
Hy = required_halo_size(y_advection) | ||
Hz = required_halo_size(z_advection) | ||
|
||
FT = eltype(x_advection) | ||
H = max(Hx, Hy, Hz) | ||
|
||
return TracerAdvection{H, FT}(x_advection, y_advection, z_advection) | ||
end | ||
|
||
Adapt.adapt_structure(to, scheme::TracerAdvection{N, FT}) where {N, FT} = | ||
TracerAdvection{N, FT}(Adapt.adapt(to, scheme.x), | ||
Adapt.adapt(to, scheme.y), | ||
Adapt.adapt(to, scheme.z)) | ||
|
||
@inline _advective_tracer_flux_x(args...) = advective_tracer_flux_x(args...) | ||
@inline _advective_tracer_flux_y(args...) = advective_tracer_flux_y(args...) | ||
@inline _advective_tracer_flux_z(args...) = advective_tracer_flux_z(args...) | ||
|
||
@inline _advective_tracer_flux_x(i, j, k, grid, advection::TracerAdvection, args...) = | ||
_advective_tracer_flux_x(i, j, k, grid, advection.x, args...) | ||
|
||
@inline _advective_tracer_flux_y(i, j, k, grid, advection::TracerAdvection, args...) = | ||
_advective_tracer_flux_y(i, j, k, grid, advection.y, args...) | ||
|
||
@inline _advective_tracer_flux_z(i, j, k, grid, advection::TracerAdvection, args...) = | ||
_advective_tracer_flux_z(i, j, k, grid, advection.z, args...) | ||
|
||
# Fallback for `nothing` advection | ||
@inline _advective_tracer_flux_x(i, j, k, grid, ::Nothing, args...) = zero(grid) | ||
@inline _advective_tracer_flux_y(i, j, k, grid, ::Nothing, args...) = zero(grid) | ||
@inline _advective_tracer_flux_z(i, j, k, grid, ::Nothing, args...) = zero(grid) | ||
|
||
# Fallback for `nothing` advection and `ZeroField` tracers and velocities | ||
@inline _advective_tracer_flux_x(i, j, k, grid, ::Nothing, ::ZeroField, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_y(i, j, k, grid, ::Nothing, ::ZeroField, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_z(i, j, k, grid, ::Nothing, ::ZeroField, ::ZeroField) = zero(grid) | ||
|
||
@inline _advective_tracer_flux_x(i, j, k, grid, ::Nothing, U, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_y(i, j, k, grid, ::Nothing, V, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_z(i, j, k, grid, ::Nothing, W, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_x(i, j, k, grid, ::Nothing, ::ZeroField, c) = zero(grid) | ||
@inline _advective_tracer_flux_y(i, j, k, grid, ::Nothing, ::ZeroField, c) = zero(grid) | ||
@inline _advective_tracer_flux_z(i, j, k, grid, ::Nothing, ::ZeroField, c) = zero(grid) | ||
|
||
# Fallback for `ZeroField` tracers and velocities | ||
@inline _advective_tracer_flux_x(i, j, k, grid, scheme, ::ZeroField, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_y(i, j, k, grid, scheme, ::ZeroField, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_z(i, j, k, grid, scheme, ::ZeroField, ::ZeroField) = zero(grid) | ||
|
||
# Fallback for `ZeroField` tracers | ||
@inline _advective_tracer_flux_x(i, j, k, grid, scheme, U, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_y(i, j, k, grid, scheme, V, ::ZeroField) = zero(grid) | ||
@inline _advective_tracer_flux_z(i, j, k, grid, scheme, W, ::ZeroField) = zero(grid) | ||
##### | ||
##### Fallback tracer fluxes! | ||
##### | ||
|
||
# Fallback for `ZeroField` velocities | ||
@inline _advective_tracer_flux_x(i, j, k, grid, scheme, ::ZeroField, c) = zero(grid) | ||
@inline _advective_tracer_flux_y(i, j, k, grid, scheme, ::ZeroField, c) = zero(grid) | ||
@inline _advective_tracer_flux_z(i, j, k, grid, scheme, ::ZeroField, c) = zero(grid) | ||
for flux_dir in (:x, :y, :z) | ||
advective_tracer_flux = Symbol(:_advective_tracer_flux_, flux_dir) | ||
|
||
@eval begin | ||
@inline $advective_tracer_flux(i, j, k, grid, ::Nothing, args...) = zero(grid) | ||
@inline $advective_tracer_flux(i, j, k, grid, ::Nothing, ::ZeroField, ::ZeroField) = zero(grid) | ||
@inline $advective_tracer_flux(i, j, k, grid, ::Nothing, U, ::ZeroField) = zero(grid) | ||
@inline $advective_tracer_flux(i, j, k, grid, scheme, ::ZeroField, ::ZeroField) = zero(grid) | ||
@inline $advective_tracer_flux(i, j, k, grid, scheme, U, ::ZeroField) = zero(grid) | ||
@inline $advective_tracer_flux(i, j, k, grid, scheme, ::ZeroField, c) = zero(grid) | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I preferred it as it was before without metaprogramming |
||
|
||
##### | ||
##### Tracer advection operator | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just be
validate_advection_scheme(scheme, grid)
. We often refer to this kind of thing as a "validation"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to think of a validation as a non-returning function, I think that is how we use it