Skip to content

Commit 43d4164

Browse files
authored
(0.96.29) Add adapt structure for BuoyancyForce (#4543)
* adapt structure for BuoyancyForce * Update Project.toml
1 parent e28d1ec commit 43d4164

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Oceananigans"
22
uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
33
authors = ["Climate Modeling Alliance and contributors"]
4-
version = "0.96.28"
4+
version = "0.96.29"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/BuoyancyFormulations/buoyancy_force.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
using Oceananigans.Grids: NegativeZDirection, validate_unit_vector
2+
using Adapt
23

34
struct BuoyancyForce{M, G}
45
formulation :: M
56
gravity_unit_vector :: G
67
end
78

9+
Adapt.adapt_structure(to, bf::BuoyancyForce) =
10+
BuoyancyForce(adapt(to, bf.formulation),
11+
adapt(to, bf.gravity_unit_vector))
12+
813
"""
914
BuoyancyForce(formulation; gravity_unit_vector=NegativeZDirection())
1015
@@ -44,7 +49,6 @@ function BuoyancyForce(formulation; gravity_unit_vector=NegativeZDirection())
4449
return BuoyancyForce(formulation, gravity_unit_vector)
4550
end
4651

47-
4852
@inline ĝ_x(bf) = @inbounds - bf.gravity_unit_vector[1]
4953
@inline ĝ_y(bf) = @inbounds - bf.gravity_unit_vector[2]
5054
@inline ĝ_z(bf) = @inbounds - bf.gravity_unit_vector[3]

0 commit comments

Comments
 (0)