How should I set boundary conditions of velocity for 2D channel flow? #4324
-
Hi all, using Oceananigans
using Oceananigans.Units: minutes, hour, hours, day
using Oceananigans.BoundaryConditions: NoFluxBoundaryCondition
Nx = 64
Ny = 64
x_min = 0
x_max = 1
z_min = -1
z_max = 1
grid = RectilinearGrid(size=(Nx, Ny), x=(x_min, x_max), z=(z_min, z_max), topology=(Bounded, Flat, Bounded))
const dx = (x_max - x_min) / Nx
const dz = (z_max - z_min) / Ny
############################## Initial conditions ##############################
U0 = BackgroundField((x, z, t) -> 1-z^2)
W0 = BackgroundField((x, z, t) -> 0.0)
############################## Boundary conditions ##############################
# u
u_bcs = FieldBoundaryConditions(
west = ValueBoundaryCondition((x, z, t) -> 1 - z^2),
east = NoFluxBoundaryCondition(),
bottom = ValueBoundaryCondition(0.0),
top = ValueBoundaryCondition(0.0)
)
# w
w_bcs = FieldBoundaryConditions(
west = ValueBoundaryCondition(0.0),
east = NoFluxBoundaryCondition(),
bottom = ValueBoundaryCondition(0.0),
top = ValueBoundaryCondition(0.0)
)
# ############################## Model ##############################
const Re = 10000
ν = 1/Re
closure = ScalarDiffusivity(ν = ν)
model = NonhydrostaticModel(
grid = grid,
advection = WENO(),
timestepper = :RungeKutta3,
closure = closure,
buoyancy = nothing,
boundary_conditions = (u = u_bcs, w = w_bcs),
background_fields = (u = U0, w = W0)
)
# Check model
println(model) I got error: ERROR: ArgumentError: Cannot specify east boundary condition FluxBoundaryCondition: Nothing on a field at Face()! Ideally, an uniform flow of U0 = 1-z^2 comes in at west boundary and comes out at east boundary. Top and bottom boundaries are walls so non-slip conditon should apply there. I am looking forward to your response and appreciate your support. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Open boundaries are a bit tricky. You either need to use |
Beta Was this translation helpful? Give feedback.
Open boundaries are a bit tricky. You either need to use
OpenBoundaryCondition
or try with Periodic topology and use a sponger layer. Try searching PRs and issues to find more information about open boundaries. It's experimental so there is no official documentation.