-
Notifications
You must be signed in to change notification settings - Fork 274
Closed
Description
I found that T_forcing and S_forcing do not receive the expected values. The minimal code to reproduce the issue is as follows:
using Printf
using Oceananigans
using Oceananigans.Units
grid = RectilinearGrid(
CPU(),
size=(5, 5, 2),
x=(0, 100kilometers),
y=(0, 100kilometers),
z=(-100meters.0, 0),
halo=(4,4,4),
topology=(Bounded, Bounded, Bounded),
)
@inline function heat_source(x, y, z, t, T, p)
@printf("T(x=%f, y=%f, z=%f, t=%f) = %f\n", x, y, z, t, T)
return - T / p.τ_T
end
@inline function salt_source(x, y, z, t, S, p)
@printf("S(x=%f, y=%f, z=%f, t=%f) = %f\n", x, y, z, t, S)
return - S / p.τ_S
end
T_forcing = Forcing(heat_source, parameters=(;τ_T=86400.0*30), field_dependencies=:T)
S_forcing = Forcing(salt_source, parameters=(;τ_S=86400.0*360), field_dependencies=:S)
model = HydrostaticFreeSurfaceModel(
grid;
buoyancy = SeawaterBuoyancy(),
tracers = (:T, :S),
momentum_advection = WENO(),
tracer_advection = WENO(),
forcing=(T=T_forcing, S=S_forcing),
)
set!(model, T=30.0, S=28.5)
simulation = Simulation(model; Δt=100seconds, stop_iteration=10)
run!(simulation)
It prints that T is assigned zeros and S is assigned values of T=30!
T(x=10000.000000, y=10000.000000, z=-75.000000, t=0.000000) = 0.000000
T(x=30000.000000, y=10000.000000, z=-75.000000, t=0.000000) = 0.000000
...
S(x=10000.000000, y=10000.000000, z=-75.000000, t=0.000000) = 30.000000
S(x=30000.000000, y=10000.000000, z=-75.000000, t=0.000000) = 30.000000
...
Here is the version info
julia> versioninfo()
Julia Version 1.12.4
Commit 01a2eadb047 (2026-01-06 16:56 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 128 × AMD EPYC 9354 32-Core Processor
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, znver4)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 128 virtual cores)
For Oceananigans
julia> pkgversion(Oceananigans)
v"0.104.3"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels