Skip to content

Conversation

simone-silvestri
Copy link
Collaborator

This is an exploratory PR to use ClimaOcean to force a veros setup.

This exercise is also usefull to make sure that ClimaOcean does not necessarily assume that the ocean model comes from Oceananigans but it is flexible enough to handle different ocean configurations.

@simone-silvestri simone-silvestri changed the title Use the Veros ocean model as the ocean component in ClimaOcean Add the possibility to use the Veros ocean model as the ocean component in ClimaOcean Aug 22, 2025
@simone-silvestri simone-silvestri marked this pull request as ready for review August 22, 2025 10:08
@simone-silvestri
Copy link
Collaborator Author

I think this is ready on the ClimaOcean side of things, I'm not sure whether to add tests or not since it might create issues with CI.
The only thing I need to sort out before merging is this function

function fill_net_fluxes!(ocean::VerosOceanSimulation, net_ocean_fluxes)
nx = pyconvert(Int, ocean.setup.state.settings.nx) + 4
ny = pyconvert(Int, ocean.setup.state.settings.ny) + 4
t1 = view(parent(net_ocean_fluxes.u), 1:nx, 1:ny, 1)
t2 = view(parent(net_ocean_fluxes.v), 1:nx, 1:ny, 1)
# TODO: Remove this when they fix veros to
# be able to force with an array instead of Climatology
ta = zeros(size(t1)..., 12)
tb = zeros(size(t2)..., 12)
for t in 1:12
ta[:, :, t] .= t1
tb[:, :, t] .= t2
end
set!(ocean.state.variables, "taux", ta)
set!(ocean.state.variables, "tauy", tb)
# TODO: Add heat flux and salinity flux when they
# fix veros to be able to force with prescribed boundary
# conditions rather than restoring
# t1 = view(parent(net_ocean_fluxes.T), 1:nx, 2:ny+1, 1)
# t2 = view(parent(net_ocean_fluxes.S), 1:nx, 2:ny+1, 1)
# set!(ocean, "temp_flux", t1)
# set!(ocean, "salt_flux", t2)
return nothing
end

which we are sorting out on the veros side today.

@simone-silvestri
Copy link
Collaborator Author

I think this is ready to merge. We probably have to tweak the extension again after https://github.com/nutrik/veros/tree/atm_coupling is merged into main, and we have space where to fill in salt and temperature flux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants