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

fill_halo_regions! for velocities in implicit free surface correctly #3629

Merged
merged 5 commits into from
Jun 23, 2024

Conversation

glwagner
Copy link
Member

@tomchor
Copy link
Collaborator

tomchor commented Jun 19, 2024

Thanks, @glwagner. I can confirm that if I run the following MWE things work as expected in this branch:

using Oceananigans
grid = RectilinearGrid(topology = (Bounded, Flat, Bounded), size = (4, 4), extent = (1, 1))

u₀ = 1
@inline u_func(z, t) = u₀

u_bcs = FieldBoundaryConditions(east = OpenBoundaryCondition(u_func), west = OpenBoundaryCondition(u_func))

model = HydrostaticFreeSurfaceModel(; grid, boundary_conditions = (; u = u_bcs,))
set!(model, u = u₀)

simulation = Simulation(model, Δt = 0.2*(minimum_xspacing(grid) / u₀), stop_time = 100)
run!(simulation)

And the end result is also what we would expect: a barotropic flow with u velocity u₀ = 1 everywhere:

julia> model.velocities.u
5×1×4 Field{Face, Center, Center} on RectilinearGrid on CPU
├── grid: 4×1×4 RectilinearGrid{Float64, Bounded, Flat, Bounded} on CPU with 3×0×3 halo
├── boundary conditions: FieldBoundaryConditions
│   └── west: Open, east: Open, south: Nothing, north: Nothing, bottom: ZeroFlux, top: ZeroFlux, immersed: ZeroFlux
└── data: 11×1×10 OffsetArray(::Array{Float64, 3}, -2:8, 1:1, -2:7) with eltype Float64 with indices -2:8×1:1×-2:7
    └── max=1.0, min=1.0, mean=1.0

Although I understand that this does not mean results will be correct for non-trivial open boundary conditions.

@tomchor
Copy link
Collaborator

tomchor commented Jun 21, 2024

@glwagner merge?

@navidcy navidcy added the bug 🐞 Even a perfect program still has bugs label Jun 22, 2024
@navidcy
Copy link
Collaborator

navidcy commented Jun 22, 2024

@tomchor if tests pass feel free to merge ;)

@navidcy
Copy link
Collaborator

navidcy commented Jun 22, 2024

@tomchor is this related to #3628? we should link the issue..

@navidcy navidcy merged commit 96fa286 into main Jun 23, 2024
46 checks passed
@navidcy navidcy deleted the glwagner-patch-3 branch June 23, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Even a perfect program still has bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants