Supporting non-zero or time-dependent wall-normal velocities #1156
Labels
bug 🐞
Even a perfect program still has bugs
numerics 🧮
So things don't blow up and boil the lobsters alive
Wall-normal velocities can depend on
model_fields
:Oceananigans.jl/src/BoundaryConditions/fill_halo_regions_normal_flow.jl
Lines 15 to 18 in 5aafe8e
and wall-normal velocities are updated after an RK3 substep, but before the pressure solve:
Oceananigans.jl/src/TimeSteppers/pressure_correction.jl
Lines 6 to 10 in 5aafe8e
Thus for some problems the wall-normal velocity fields are updated based on the predictor model fields (both the predictor velocity and the updated tracer fields) that result from an RK3 substep.
This devious bug can be avoided simply by not updating wall-normal velocity components on the boundary in the RK3 substep by changing the indexing in the rk3 substep as well as the worksize here:
Oceananigans.jl/src/TimeSteppers/runge_kutta_3.jl
Line 124 in 5aafe8e
Then we don't have to fill halo regions before performing the pressure correction. The resulting algorithm is both more correct and computationally less expensive.
Note that doing this could require a bit of gymnastics to get the indexing right in the rk3 substep kernel:
Oceananigans.jl/src/TimeSteppers/runge_kutta_3.jl
Lines 178 to 186 in 5aafe8e
The text was updated successfully, but these errors were encountered: