Skip to content

Commit 3a2b846

Browse files
authored
Merge pull request #173 from tomchor/compathelper/new_version/2024-05-07-01-11-20-059-03601478240
CompatHelper: bump compat for Oceananigans to 0.91, (keep existing compat)
2 parents d95f4eb + 1a845ec commit 3a2b846

File tree

4 files changed

+56
-59
lines changed

4 files changed

+56
-59
lines changed

Manifest.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.10.2"
44
manifest_format = "2.0"
5-
project_hash = "e3a05f195706f357ab2c52ae9b323b49607798e4"
5+
project_hash = "e19f51c46fc9161a1a3899ab99209f39adde0868"
66

77
[[deps.AbstractFFTs]]
88
deps = ["LinearAlgebra"]
@@ -153,9 +153,9 @@ version = "0.3.6"
153153

154154
[[deps.Compat]]
155155
deps = ["TOML", "UUIDs"]
156-
git-tree-sha1 = "c955881e3c981181362ae4088b35995446298b80"
156+
git-tree-sha1 = "b1c55339b7c6c350ee89f2c1604299660525b248"
157157
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
158-
version = "4.14.0"
158+
version = "4.15.0"
159159
weakdeps = ["Dates", "LinearAlgebra"]
160160

161161
[deps.Compat.extensions]
@@ -558,9 +558,9 @@ version = "0.20.16"
558558

559559
[[deps.MPICH_jll]]
560560
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML"]
561-
git-tree-sha1 = "d8a7bf80c88326ebc98b7d38437208c3a0f20725"
561+
git-tree-sha1 = "4099bb6809ac109bfc17d521dad33763bcf026b7"
562562
uuid = "7cb0a576-ebde-5e09-9194-50597f1243b4"
563-
version = "4.2.1+0"
563+
version = "4.2.1+1"
564564

565565
[[deps.MPIPreferences]]
566566
deps = ["Libdl", "Preferences"]
@@ -570,9 +570,9 @@ version = "0.1.11"
570570

571571
[[deps.MPItrampoline_jll]]
572572
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML"]
573-
git-tree-sha1 = "3f884417b47a96d87e7c6219f8f7b30ce67f4f2c"
573+
git-tree-sha1 = "ce0ca3dd147c43de175c5aff161315a424f4b8ac"
574574
uuid = "f1f71cc9-e9ae-5b93-9b94-4fe0e1ad3748"
575-
version = "5.3.3+0"
575+
version = "5.3.3+1"
576576

577577
[[deps.MacroTools]]
578578
deps = ["Markdown", "Random"]
@@ -644,9 +644,9 @@ version = "1.2.0"
644644

645645
[[deps.Oceananigans]]
646646
deps = ["Adapt", "CUDA", "Crayons", "CubedSphere", "Dates", "Distances", "DocStringExtensions", "FFTW", "Glob", "IncompleteLU", "InteractiveUtils", "IterativeSolvers", "JLD2", "KernelAbstractions", "LinearAlgebra", "Logging", "MPI", "NCDatasets", "OffsetArrays", "OrderedCollections", "PencilArrays", "PencilFFTs", "Pkg", "Printf", "Random", "Rotations", "SeawaterPolynomials", "SparseArrays", "Statistics", "StructArrays"]
647-
git-tree-sha1 = "3a5d2b1d9a237731f886a657e72e4a52a7f6fb2b"
647+
git-tree-sha1 = "6aa48ccf34ac89fbd8db20cafa5f25c0d4aaa55a"
648648
uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
649-
version = "0.90.14"
649+
version = "0.91.0"
650650

651651
[deps.Oceananigans.extensions]
652652
OceananigansEnzymeExt = "Enzyme"
@@ -1041,9 +1041,9 @@ uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
10411041
version = "0.5.23"
10421042

10431043
[[deps.TranscodingStreams]]
1044-
git-tree-sha1 = "71509f04d045ec714c4748c785a59045c3736349"
1044+
git-tree-sha1 = "5d54d076465da49d6746c647022f3b3674e64156"
10451045
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
1046-
version = "0.10.7"
1046+
version = "0.10.8"
10471047
weakdeps = ["Random", "Test"]
10481048

10491049
[deps.TranscodingStreams.extensions]

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Oceanostics"
22
uuid = "d0ccf422-c8fb-49b5-a76d-74acdde946ac"
33
authors = ["tomchor <[email protected]>"]
4-
version = "0.14.0"
4+
version = "0.14.1"
55

66
[deps]
77
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
@@ -11,7 +11,7 @@ SeawaterPolynomials = "d496a93d-167e-4197-9f49-d3af4ff8fe40"
1111

1212
[compat]
1313
DocStringExtensions = "0.9"
14-
Oceananigans = "0.90.14"
14+
Oceananigans = "0.91"
1515
SeawaterPolynomials = "0.3"
1616
julia = "1.9"
1717

src/TKEBudgetTerms.jl

Lines changed: 36 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -82,57 +82,45 @@ KineticEnergy(model; kwargs...) = KineticEnergy(model, model.velocities...; kwar
8282
#+++ Kinetic energy tendency
8383
@inline ψf(i, j, k, grid, ψ, f, args...) = @inbounds ψ[i, j, k] * f(i, j, k, grid, args...)
8484

85-
@inline function uᵢ∂ₜuᵢᶜᶜᶜ(i, j, k, grid, advection,
86-
coriolis,
87-
stokes_drift,
88-
closure,
89-
u_immersed_bc,
90-
v_immersed_bc,
91-
w_immersed_bc,
92-
buoyancy,
93-
background_fields,
94-
velocities,
95-
tracers,
96-
auxiliary_fields,
97-
diffusivity_fields,
98-
forcing,
99-
pHY′,
100-
clock)
101-
u∂ₜu = ℑxᶜᵃᵃ(i, j, k, grid, ψf, velocities.u, u_velocity_tendency, advection, coriolis, stokes_drift, closure, u_immersed_bc, buoyancy, background_fields,
102-
velocities,
103-
tracers,
104-
auxiliary_fields,
105-
diffusivity_fields,
106-
forcing,
107-
pHY′,
108-
clock)
109-
110-
v∂ₜv = ℑyᵃᶜᵃ(i, j, k, grid, ψf, velocities.v, v_velocity_tendency, advection, coriolis, stokes_drift, closure, v_immersed_bc, buoyancy, background_fields,
111-
velocities,
112-
tracers,
113-
auxiliary_fields,
114-
diffusivity_fields,
115-
forcing,
116-
pHY′,
117-
clock)
118-
119-
w∂ₜw = ℑzᵃᵃᶜ(i, j, k, grid, ψf, velocities.w, w_velocity_tendency, advection, coriolis, stokes_drift, closure, w_immersed_bc, buoyancy, background_fields,
120-
velocities,
121-
tracers,
122-
auxiliary_fields,
123-
diffusivity_fields,
124-
forcing,
125-
clock)
85+
@inline function uᵢGᵢᶜᶜᶜ(i, j, k, grid, advection,
86+
coriolis,
87+
stokes_drift,
88+
closure,
89+
u_immersed_bc,
90+
v_immersed_bc,
91+
w_immersed_bc,
92+
buoyancy,
93+
background_fields,
94+
velocities,
95+
args...)
96+
u∂ₜu = ℑxᶜᵃᵃ(i, j, k, grid, ψf, velocities.u, u_velocity_tendency, advection, coriolis, stokes_drift, closure, u_immersed_bc, buoyancy, background_fields, velocities, args...)
97+
v∂ₜv = ℑyᵃᶜᵃ(i, j, k, grid, ψf, velocities.v, v_velocity_tendency, advection, coriolis, stokes_drift, closure, v_immersed_bc, buoyancy, background_fields, velocities, args...)
98+
w∂ₜw = ℑzᵃᵃᶜ(i, j, k, grid, ψf, velocities.w, w_velocity_tendency, advection, coriolis, stokes_drift, closure, w_immersed_bc, buoyancy, background_fields, velocities, args...)
12699
return u∂ₜu + v∂ₜv + w∂ₜw
127100
end
128101

129102
"""
130103
$(SIGNATURES)
131104
132-
Return a `KernelFunctionOperation` that computes the tendency of the KE except for the nonhydrostatic
133-
pressure:
105+
Return a `KernelFunctionOperation` that computes the tendency uᵢGᵢ of the KE, excluding the nonhydrostatic
106+
pressure contribution:
107+
108+
KET = ½∂ₜuᵢ² = uᵢGᵢ - uᵢ∂ᵢpₙₕₛ
134109
135110
```julia
111+
julia> using Oceananigans
112+
113+
julia> grid = RectilinearGrid(size = (1, 1, 4), extent = (1,1,1));
114+
115+
julia> model = NonhydrostaticModel(grid=grid);
116+
117+
julia> using Oceanostics.TKEBudgetTerms: KineticEnergyTendency
118+
119+
julia> ke_tendency = KineticEnergyTendency(model)
120+
KernelFunctionOperation at (Center, Center, Center)
121+
├── grid: 1×1×4 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo
122+
├── kernel_function: uᵢ∂ₜuᵢᶜᶜᶜ (generic function with 1 method)
123+
└── arguments: ("Centered reconstruction order 2", "Nothing", "Nothing", "Nothing", "FluxBoundaryCondition: Nothing", "FluxBoundaryCondition: Nothing", "FluxBoundaryCondition: Nothing", "Nothing", "(velocities=(u=ZeroField{Int64}, v=ZeroField{Int64}, w=ZeroField{Int64}), tracers=NamedTuple())", "(u=1×1×4 Field{Face, Center, Center} on RectilinearGrid on CPU, v=1×1×4 Field{Center, Face, Center} on RectilinearGrid on CPU, w=1×1×5 Field{Center, Center, Face} on RectilinearGrid on CPU)", "NamedTuple()", "NamedTuple()", "Nothing", "(u=zeroforcing (generic function with 1 method), v=zeroforcing (generic function with 1 method), w=zeroforcing (generic function with 1 method))", "Nothing", "Clock(time=0 seconds, iteration=0, last_Δt=Inf days)")
136124
```
137125
"""
138126
function KineticEnergyTendency(model::NonhydrostaticModel; location = (Center, Center, Center))
@@ -153,7 +141,7 @@ function KineticEnergyTendency(model::NonhydrostaticModel; location = (Center, C
153141
model.forcing,
154142
model.pressures.pHY′,
155143
model.clock)
156-
return KernelFunctionOperation{Center, Center, Center}(uᵢ∂ₜuᵢᶜᶜᶜ, model.grid, dependencies...)
144+
return KernelFunctionOperation{Center, Center, Center}(uᵢGᵢᶜᶜᶜ, model.grid, dependencies...)
157145
end
158146
#---
159147

@@ -401,7 +389,7 @@ julia> ∇u⃗p = PressureRedistributionTerm(model)
401389
KernelFunctionOperation at (Center, Center, Center)
402390
├── grid: 1×1×4 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo
403391
├── kernel_function: uᵢ∂ᵢpᶜᶜᶜ (generic function with 1 method)
404-
└── arguments: ("(u=1×1×4 Field{Face, Center, Center} on RectilinearGrid on CPU, v=1×1×4 Field{Center, Face, Center} on RectilinearGrid on CPU, w=1×1×5 Field{Center, Center, Face} on RectilinearGrid on CPU)", "BinaryOperation at (Center, Center, Center)")
392+
└── arguments: ("(u=1×1×4 Field{Face, Center, Center} on RectilinearGrid on CPU, v=1×1×4 Field{Center, Face, Center} on RectilinearGrid on CPU, w=1×1×5 Field{Center, Center, Face} on RectilinearGrid on CPU)", "1×1×4 Field{Center, Center, Center} on RectilinearGrid on CPU")
405393
```
406394
407395
We can also pass `velocities` and `pressure` keywords to perform more specific calculations. The
@@ -416,7 +404,9 @@ KernelFunctionOperation at (Center, Center, Center)
416404
└── arguments: ("(u=1×1×4 Field{Face, Center, Center} on RectilinearGrid on CPU, v=1×1×4 Field{Center, Face, Center} on RectilinearGrid on CPU, w=1×1×5 Field{Center, Center, Face} on RectilinearGrid on CPU)", "1×1×4 Field{Center, Center, Center} on RectilinearGrid on CPU")
417405
```
418406
"""
419-
function PressureRedistributionTerm(model::NonhydrostaticModel; velocities = model.velocities, pressure = sum(model.pressures), location = (Center, Center, Center))
407+
function PressureRedistributionTerm(model::NonhydrostaticModel; velocities = model.velocities,
408+
pressure = model.pressures.pHY′ == nothing ? model.pressures.pNHS : sum(model.pressures),
409+
location = (Center, Center, Center))
420410
validate_location(location, "PressureRedistributionTerm")
421411
return KernelFunctionOperation{Center, Center, Center}(uᵢ∂ᵢpᶜᶜᶜ, model.grid, velocities, pressure)
422412
end

test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ function test_buoyancy_diagnostics(model)
175175
return nothing
176176
end
177177

178+
178179
function test_pressure_term(model)
179180
u⃗∇p = PressureRedistributionTerm(model)
180181
@test u⃗∇p isa AbstractOperation
@@ -184,6 +185,12 @@ function test_pressure_term(model)
184185
@test u⃗∇pNHS isa AbstractOperation
185186
@test compute!(Field(u⃗∇pNHS)) isa Field
186187

188+
# Test calculation with a hydrostatic pressure separation
189+
model2 = NonhydrostaticModel(grid=model.grid, hydrostatic_pressure_anomaly=CenterField(model.grid))
190+
u⃗∇p_from_model2 = PressureRedistributionTerm(model2)
191+
@test u⃗∇p_from_model2 isa AbstractOperation
192+
@test compute!(Field(u⃗∇p_from_model2)) isa Field
193+
187194
return nothing
188195
end
189196

0 commit comments

Comments
 (0)