Skip to content

Commit ff9fdc0

Browse files
authored
Merge branch 'main' into xk/ows-papa
2 parents f39d2a6 + 2e9bdf3 commit ff9fdc0

File tree

13 files changed

+140
-204
lines changed

13 files changed

+140
-204
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ env:
3131
CDSAPI_URL: "https://cds.climate.copernicus.eu/api"
3232
CDSAPI_KEY: ${{ secrets.CDSAPI_KEY }}
3333
DATADEPS_ALWAYS_ACCEPT: true
34+
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: 'eager'
3435

3536
#####
3637
##### CPU tests (GitHub-hosted runners)
@@ -98,6 +99,9 @@ jobs:
9899
container:
99100
image: ghcr.io/numericalearth/numerical-earth-docker-images:test-julia_1.12.5
100101
options: --gpus=all
102+
volumes:
103+
# Mount host `/usr/local` so that we can delete some stuff afterwards
104+
- /usr/local:/host-usr-local
101105
timeout-minutes: 120
102106
strategy:
103107
fail-fast: false
@@ -117,6 +121,23 @@ jobs:
117121
run: git config --global --add safe.directory ${PWD}
118122
- name: Copy LocalPreferences
119123
run: cp -v /usr/local/share/julia/environments/numericalearth/LocalPreferences.toml test/.
124+
- name: df before cleanup
125+
run: |
126+
df -hT
127+
- name: Clean up old CUDA toolkits
128+
# Save storage by deleting old CUDA toolkits, we'll use v13
129+
run: |
130+
rm -rf /host-usr-local/cuda-12.*
131+
- name: df after cleanup
132+
run: |
133+
df -hT
134+
- name: Update registry
135+
shell: julia --color=yes {0}
136+
run: |
137+
using Pkg
138+
Pkg.Registry.rm("General")
139+
Pkg.Registry.add("General")
140+
Pkg.Registry.update()
120141
- name: Run tests
121142
run: |
122143
earlyoom -m 3 -s 100 -r 300 --prefer 'julia' &

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ NumericalEarthWOAExt = "WorldOceanAtlasTools"
5252

5353
[compat]
5454
Adapt = "4"
55-
Breeze = "0.4"
55+
Breeze = "0.4.4"
5656
CDSAPI = "2.2.1"
5757
CFTime = "0.1, 0.2"
5858
ClimaSeaIce = "0.4.4, 0.5"
@@ -69,7 +69,7 @@ JLD2 = "0.4, 0.5, 0.6"
6969
KernelAbstractions = "0.9"
7070
MeshArrays = "0.3, 0.4, 0.5"
7171
NCDatasets = "0.12, 0.13, 0.14"
72-
Oceananigans = "0.104.2, 0.105, 0.106"
72+
Oceananigans = "0.106.3"
7373
OffsetArrays = "1.14"
7474
PrecompileTools = "1"
7575
PythonCall = "0.9.28"

ext/NumericalEarthReactantExt.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using Oceananigans.DistributedComputations: Distributed
77
using NumericalEarth: EarthSystemModel
88

99
import Oceananigans
10-
import Oceananigans.Models: initialization_update_state!
10+
import Oceananigans.TimeSteppers: reconcile_state!
1111

1212
const OceananigansReactantExt = Base.get_extension(
1313
Oceananigans, :OceananigansReactantExt
@@ -18,6 +18,6 @@ const ReactantOSIM{I, A, O, F, C} = Union{
1818
EarthSystemModel{I, A, O, F, C, <:Distributed{ReactantState}},
1919
}
2020

21-
initialization_update_state!(model::ReactantOSIM) = nothing
21+
reconcile_state!(model::ReactantOSIM) = nothing
2222

2323
end # module NumericalEarthReactantExt

src/Bathymetry/orca_grid.jl

Lines changed: 88 additions & 181 deletions
Large diffs are not rendered by default.

src/EarthSystemModels/EarthSystemModels.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ import Thermodynamics as AtmosphericThermodynamics
4747
import Oceananigans: fields, prognostic_fields, prognostic_state, restore_prognostic_state!
4848
import Oceananigans.Architectures: architecture
4949
import Oceananigans.Fields: set!
50-
import Oceananigans.Models: NaNChecker, default_nan_checker, initialization_update_state!
50+
import Oceananigans.Models: NaNChecker, default_nan_checker
5151
import Oceananigans.OutputWriters: default_included_properties
5252
import Oceananigans.Simulations: timestepper, reset!, initialize!, iteration
53-
import Oceananigans.TimeSteppers: time_step!, update_state!, time
53+
import Oceananigans.TimeSteppers: time_step!, update_state!, time, reconcile_state!
5454
import Oceananigans.Utils: prettytime
5555

5656
include("components.jl")

src/EarthSystemModels/InterfaceComputations/sea_ice_ocean_fluxes.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,8 @@ end
202202
liquidus, ocean_properties, ℰ, u★)
203203

204204
# Store interface values and heat flux
205-
@inbounds T★[i, j, 1] = Tᵦ
206-
@inbounds S★[i, j, 1] = Sᵦ
207205
@inbounds 𝒬ⁱⁿᵗ[i, j, 1] = 𝒬ⁱᵒ
206+
store_interface_state!(flux_formulation, T★, S★, i, j, Tᵦ, Sᵦ)
208207

209208
# =============================================
210209
# Part 4: Salt flux

src/EarthSystemModels/InterfaceComputations/sea_ice_ocean_heat_flux_formulations.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,14 @@ const ConductiveFluxTEF{FT} = ThreeEquationHeatFlux{<:ConductiveFlux, <:Abstract
207207
@inline extract_internal_temperature(::IceBathHeatFlux{FT}, i, j) where FT = zero(FT)
208208
@inline extract_internal_temperature(flux::ConductiveFluxTEF, i, j) = @inbounds flux.internal_temperature[i, j, 1]
209209

210+
# For IceBathHeatFlux, T★ and S★ are views into ocean surface fields so we skip writing.
211+
# For ThreeEquationHeatFlux, T★ and S★ are dedicated interface fields.
212+
@inline store_interface_state!(::IceBathHeatFlux, T★, S★, i, j, Tᵦ, Sᵦ) = nothing
213+
@inline function store_interface_state!(::ThreeEquationHeatFlux, T★, S★, i, j, Tᵦ, Sᵦ)
214+
@inbounds T★[i, j, 1] = Tᵦ
215+
@inbounds S★[i, j, 1] = Sᵦ
216+
end
217+
210218
"""
211219
compute_interface_heat_flux(flux::ThreeEquationHeatFlux, ocean_state, ice_state, liquidus, ocean_properties, ℰ, u★)
212220

src/EarthSystemModels/earth_system_model.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,14 @@ function reset!(model::ESM)
6161
end
6262

6363
# Make sure to initialize the exchanger here
64-
function initialization_update_state!(model::ESM)
64+
function initialize!(model::ESM)
6565
initialize!(model.interfaces.exchanger, model)
66-
update_state!(model)
6766
return nothing
6867
end
6968

70-
function initialize!(model::ESM)
71-
# initialize!(model.ocean)
69+
function reconcile_state!(model::ESM)
7270
initialize!(model.interfaces.exchanger, model)
71+
update_state!(model)
7372
return nothing
7473
end
7574

@@ -209,7 +208,7 @@ function EarthSystemModel(atmosphere, ocean, sea_ice;
209208
# Make sure the initial temperature of the ocean
210209
# is not below freezing and above melting near the surface
211210
above_freezing_ocean_temperature!(ocean, interfaces.exchanger.grid, sea_ice)
212-
initialization_update_state!(earth_system_model)
211+
reconcile_state!(earth_system_model)
213212

214213
return earth_system_model
215214
end

src/EarthSystemModels/time_step_earth_system_model.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ using .InterfaceComputations:
22
compute_atmosphere_ocean_fluxes!,
33
compute_sea_ice_ocean_fluxes!
44

5+
using Oceananigans.TimeSteppers: maybe_prepare_first_time_step!
56
using ClimaSeaIce: SeaIceModel, SeaIceThermodynamics
67
using Oceananigans.Grids: φnode
78
using Printf
89

910
function time_step!(coupled_model::EarthSystemModel, Δt; callbacks=[])
11+
maybe_prepare_first_time_step!(coupled_model, callbacks)
12+
1013
ocean = coupled_model.ocean
1114
sea_ice = coupled_model.sea_ice
1215
atmosphere = coupled_model.atmosphere
@@ -30,7 +33,7 @@ function time_step!(coupled_model::EarthSystemModel, Δt; callbacks=[])
3033
return nothing
3134
end
3235

33-
function update_state!(coupled_model::EarthSystemModel)
36+
function update_state!(coupled_model::EarthSystemModel, callbacks=[])
3437

3538
# The three components
3639
ocean = coupled_model.ocean

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ JLD2 = "0.4, 0.5, 0.6"
4545
KernelAbstractions = "0.9"
4646
MPI = "0.20"
4747
NCDatasets = "0.12, 0.13, 0.14"
48-
Oceananigans = "0.104.2, 0.105"
48+
Oceananigans = "0.106"
4949
PythonCall = "0.9.28"
5050
Reactant = "0.2.235"
5151
Scratch = "1"

0 commit comments

Comments
 (0)