2d simulation with variable grid spacings #2516
-
Hello everyone, I am trying to perform 2d simulation with variable grid spacings in
How can this be fixed? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 20 replies
-
Variable horizontal grid spacing isn't supported by |
Beta Was this translation helpful? Give feedback.
-
using Oceananigans, Statistics, Printf
Nx, Ny = 512, 512;
Lx, Ly = 2π, 2π;
chebychev_spaced_x_faces(i) = Lx/2 - Lx/2 * cos(π * (i - 1) / Nx);
chebychev_spaced_y_faces(j) = Ly/2 - Ly/2 * cos(π * (j - 1) / Ny);
grid = RectilinearGrid(size = (Nx, Ny, 1),
topology=(Bounded, Bounded, Bounded),
# topology=(Periodic, Periodic, Bounded),
x = chebychev_spaced_x_faces,
y = chebychev_spaced_y_faces,
z = (0, 1))
model = HydrostaticFreeSurfaceModel(; grid,
momentum_advection = UpwindBiasedFifthOrder(),
buoyancy = nothing,
tracers = nothing,
free_surface = ImplicitFreeSurface(gravitational_acceleration=10), # c = sqrt(10)
closure = ScalarDiffusivity(ν=1e-3))
ϵ(x, y, z) = 2rand() - 1
set!(model, u=ϵ, v=ϵ)
simulation = Simulation(model, Δt=0.01, stop_time=10)
run!(simulation) might work |
Beta Was this translation helpful? Give feedback.
-
I agree that if it's doubly periodic then using a cheb grid might not be very efficient I would think that |
Beta Was this translation helpful? Give feedback.
Variable horizontal grid spacing isn't supported by
NonhydrostaticModel
, because the only pressure solvers that are implemented are fully FFT based (for regular in all directions) and a combined FFT + tridiagonal solve (for regular in horizontal directions, stretched in the vertical).