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

Implements Robin boundary condition for implicit free surface in the nonhydrostatic model #4166

Open
wants to merge 1 commit into
base: glw/nh-free-surface
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Models/NonhydrostaticModels/NonhydrostaticModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ function nonhydrostatic_pressure_solver(::Distributed, local_grid::GridWithFouri
return DistributedFourierTridiagonalPoissonSolver(global_grid, local_grid)
end

nonhydrostatic_pressure_solver(arch, grid::XYZRegularRG) = FFTBasedPoissonSolver(grid)
#nonhydrostatic_pressure_solver(arch, grid::XYZRegularRG) = FFTBasedPoissonSolver(grid)
nonhydrostatic_pressure_solver(arch, grid::XYZRegularRG) =
FourierTridiagonalPoissonSolver(grid)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

nonhydrostatic_pressure_solver(arch, grid::GridWithFourierTridiagonalSolver) =
FourierTridiagonalPoissonSolver(grid)

Expand Down
10 changes: 5 additions & 5 deletions src/Models/NonhydrostaticModels/pressure_correction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Calculate the (nonhydrostatic) pressure correction associated `tendencies`, `vel
"""
function calculate_pressure_correction!(model::NonhydrostaticModel, Δt)

if !isnothing(model.free_surface)
step_free_surface!(model.free_surface, model, model.timestepper, Δt)
# "First" barotropic pressure correction
pressure_correct_velocities!(model, model.free_surface, Δt)
end
# if !isnothing(model.free_surface)
# step_free_surface!(model.free_surface, model, model.timestepper, Δt)
# # "First" barotropic pressure correction
# pressure_correct_velocities!(model, model.free_surface, Δt)
# end

# Mask immersed velocities
foreach(mask_immersed_field!, model.velocities)
Expand Down
2 changes: 1 addition & 1 deletion src/Solvers/fourier_tridiagonal_poisson_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ end
Nz = size(grid, 3)

# Using a homogeneous Neumann (zero Gradient) boundary condition:
@inbounds D[i, j, 1] = -1 / Δzᵃᵃᶠ(i, j, 2, grid) - Δzᵃᵃᶜ(i, j, 1, grid) * (λx[i] + λy[j])
@inbounds D[i, j, 1] = -1 / Δzᵃᵃᶠ(i, j, 2, grid) - Δzᵃᵃᶜ(i, j, 1, grid) * (λx[i] + λy[j]) + (1 / (g * Δt^2))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. You'll have to hard code your g and Δt here since they aren't available. When we adapt this code to be merged into main we will design an interface that allows this to be input upon model construction. We will also have to forbid adaptive time-stepping, or better yet implement a way to update the pressure solver if the time-step changes.

for k in 2:Nz-1
@inbounds D[i, j, k] = - (1 / Δzᵃᵃᶠ(i, j, k+1, grid) + 1 / Δzᵃᵃᶠ(i, j, k, grid)) - Δzᵃᵃᶜ(i, j, k, grid) * (λx[i] + λy[j])
end
Expand Down