Skip to content

Commit

Permalink
more allowscalars
Browse files Browse the repository at this point in the history
  • Loading branch information
simone-silvestri authored Jan 12, 2025
1 parent 7168b96 commit d8ee394
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions test/test_hydrostatic_free_surface_immersed_boundaries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ using Oceananigans.TurbulenceClosures
set!(model, u = 1, b = (x, y, z) -> 4z)

# Inside the bump
@test b[4, 4, 2] == 0
@test u[4, 4, 2] == 0
CUDA.@allowscalar @test b[4, 4, 2] == 0
CUDA.@allowscalar @test u[4, 4, 2] == 0

simulation = Simulation(model, Δt = 1e-3, stop_iteration=2)

run!(simulation)

# Inside the bump
@test b[4, 4, 2] == 0
@test u[4, 4, 2] == 0
CUDA.@allowscalar @test b[4, 4, 2] == 0
CUDA.@allowscalar @test u[4, 4, 2] == 0
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_implicit_free_surface_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function set_simple_divergent_velocity!(model)

# pick a surface cell at the middle of the domain
i, j, k = Int(floor(grid.Nx / 2)) + 1, Int(floor(grid.Ny / 2)) + 1, grid.Nz
inactive_cell(i, j, k, grid) && error("The nudged cell at ($i, $j, $k) is inactive.")
CUDA.@allowscalar inactive_cell(i, j, k, grid) && error("The nudged cell at ($i, $j, $k) is inactive.")

Δy = CUDA.@allowscalar Δyᶜᶠᶜ(i, j, k, grid)
Δz = CUDA.@allowscalar Δzᶜᶠᶜ(i, j, k, grid)
Expand Down
2 changes: 0 additions & 2 deletions test/test_jld2_output_writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ for arch in archs
filename = "sliced_func_fields_jld2_test",
overwrite_existing = true)



u₀ = CUDA.@allowscalar model.velocities.u[3, 3, 3]
v₀ = CUDA.@allowscalar model.velocities.v[3, 3, 3]
w₀ = CUDA.@allowscalar model.velocities.w[3, 3, 3]
Expand Down
6 changes: 3 additions & 3 deletions test/test_simulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function wall_time_step_wizard_tests(arch)
CFL = 0.45
u₀ = 7
Δt = 2.5
model.velocities.u[1, 1, 1] = u₀
CUDA.@allowscalar model.velocities.u[1, 1, 1] = u₀

wizard = TimeStepWizard(cfl=CFL, max_change=Inf, min_change=0)
Δt = new_time_step(Δt, wizard, model)
Expand All @@ -33,7 +33,7 @@ function wall_time_step_wizard_tests(arch)
Δt = new_time_step(Δt, wizard, model)
@test Δt 1.99

model.velocities.u[1, 1, 1] = u₀/100
CUDA.@allowscalar model.velocities.u[1, 1, 1] = u₀/100

wizard = TimeStepWizard(cfl=CFL, max_change=1.1, min_change=0)
Δt = new_time_step(1.0, wizard, model)
Expand Down Expand Up @@ -192,7 +192,7 @@ function run_nan_checker_test(arch; erroring)
grid = RectilinearGrid(arch, size=(4, 2, 1), extent=(1, 1, 1))
model = NonhydrostaticModel(grid=grid)
simulation = Simulation(model, Δt=1, stop_iteration=1)
model.velocities.u[1, 1, 1] = NaN
CUDA.@allowscalar model.velocities.u[1, 1, 1] = NaN
erroring && erroring_NaNChecker!(simulation)

if erroring
Expand Down
2 changes: 1 addition & 1 deletion test/test_vertical_vorticity_field.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using Oceananigans.Models.HydrostaticFreeSurfaceModels: VerticalVorticityField,

compute!(ζ)

@test all(isfinite.(ζ.data))
CUDA.@allowscalar @test all(isfinite.(ζ.data))
end
end
end

0 comments on commit d8ee394

Please sign in to comment.