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

Test for incompressibility in hydrostatic and non-hydrostatic models #1934

Closed
navidcy opened this issue Aug 11, 2021 · 3 comments
Closed

Test for incompressibility in hydrostatic and non-hydrostatic models #1934

navidcy opened this issue Aug 11, 2021 · 3 comments
Labels
testing 🧪 Tests get priority in case of emergency evacuation

Comments

@navidcy
Copy link
Collaborator

navidcy commented Aug 11, 2021

This follows from the discussions after the bug fix in #1932.

cc: @kburns, @sandreza, @francispoulin

@navidcy navidcy added the testing 🧪 Tests get priority in case of emergency evacuation label Aug 11, 2021
@glwagner
Copy link
Member

We test that NonhydrostaticModel maintains incompressibility on both fully regular and vertically-stretched grids:

@testset "Incompressibility" begin
for FT in float_types, arch in archs
Nx, Ny, Nz = 32, 32, 32
regular_grid = RegularRectilinearGrid(FT, size=(Nx, Ny, Nz), x=(0, 1), y=(0, 1), z=(-1, 1))
S = 1.3 # Stretching factor
hyperbolically_spaced_nodes(k) = tanh(S * (2 * (k - 1) / Nz - 1)) / tanh(S)
hyperbolic_vs_grid = VerticallyStretchedRectilinearGrid(FT,
architecture = arch,
size = (Nx, Ny, Nz),
x = (0, 1),
y = (0, 1),
z_faces = hyperbolically_spaced_nodes)
regular_vs_grid = VerticallyStretchedRectilinearGrid(FT,
architecture = arch,
size = (Nx, Ny, Nz),
x = (0, 1),
y = (0, 1),
z_faces = collect(range(0, stop=1, length=Nz+1)))
for grid in (regular_grid, hyperbolic_vs_grid, regular_vs_grid)
@info " Testing incompressibility [$FT, $(typeof(grid).name.wrapper)]..."
for Nt in [1, 10, 100], timestepper in timesteppers
@test incompressible_in_time(arch, grid, Nt, timestepper)
end
end
end
end

We don't have tests for the hydrostatic model however.

A similar but possibly slightly simpler test might test that compute_w_from_continuity! correctly calculates a vertical velocity field given some horizontally divergent horizontal velocity field.

@francispoulin
Copy link
Collaborator

Since like a good idea

@glwagner
Copy link
Member

So, we do have tests for incompressibilty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing 🧪 Tests get priority in case of emergency evacuation
Projects
None yet
Development

No branches or pull requests

3 participants