Skip to content

Commit

Permalink
Add clock to the Reactant model
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Feb 8, 2025
1 parent f03a3a0 commit 02f2021
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion oceananigans-dynamical-core/super_simple_simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Reactant.Ops.DEBUG_MODE[] = true
# ENV["JULIA_DEBUG"] = "Reactant_jll"
# @show Reactant_jll.cuDriverGetVersion(dlopen("libcuda.so"))

# Try to automatically guess whether we have a GPU available
arch = isempty(find_library(["libcuda.so.1", "libcuda.so"])) ? CPU() : GPU()
r_arch = Oceananigans.ReactantState()
Nx, Ny, Nz = (360, 120, 100) # number of cells
Expand All @@ -16,9 +17,17 @@ grid = LatitudeLongitudeGrid(arch, size=(Nx, Ny, Nz), halo=(7, 7, 7),
r_grid = LatitudeLongitudeGrid(r_arch, size=(Nx, Ny, Nz), halo=(7, 7, 7),
longitude=(0, 360), latitude=(-60, 60), z=(-1000, 0))

FT = Float64
t = ConcreteRNumber(zero(FT))
iter = ConcreteRNumber(0)
stage = ConcreteRNumber(0)
last_Δt = ConcreteRNumber(zero(FT))
last_stage_Δt = ConcreteRNumber(zero(FT))
r_clock = Clock(; time=t, iteration=iter, stage, last_Δt, last_stage_Δt)

# One of the implest configurations we might consider:
model = HydrostaticFreeSurfaceModel(; grid, momentum_advection=WENO())
r_model = HydrostaticFreeSurfaceModel(; grid=r_grid, momentum_advection=WENO())
r_model = HydrostaticFreeSurfaceModel(; grid=r_grid, clock=r_clock, momentum_advection=WENO())

@assert model.free_surface isa SplitExplicitFreeSurface
@assert r_model.free_surface isa SplitExplicitFreeSurface
Expand Down

0 comments on commit 02f2021

Please sign in to comment.