Skip to content

Commit 7f501fa

Browse files
authored
revert harmonic mean fix, release 1.2.1 (#1575)
1 parent b2b46cb commit 7f501fa

File tree

8 files changed

+22
-13
lines changed

8 files changed

+22
-13
lines changed

.buildkite/Manifest-v1.11.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ version = "0.3.0"
505505
deps = ["ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "Dates", "DocStringExtensions", "Insolation", "Interpolations", "LazyArtifacts", "LazyBroadcast", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"]
506506
path = ".."
507507
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
508-
version = "1.2.0"
508+
version = "1.2.1"
509509
weakdeps = ["BSON", "CSV", "CairoMakie", "ClimaAnalysis", "DataFrames", "DelimitedFiles", "Flux", "GeoMakie", "HTTP", "Printf", "StatsBase"]
510510

511511
[deps.ClimaLand.extensions]

.buildkite/Manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ version = "0.3.0"
502502
deps = ["ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "Dates", "DocStringExtensions", "Insolation", "Interpolations", "LazyArtifacts", "LazyBroadcast", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"]
503503
path = ".."
504504
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
505-
version = "1.2.0"
505+
version = "1.2.1"
506506
weakdeps = ["BSON", "CSV", "CairoMakie", "ClimaAnalysis", "DataFrames", "DelimitedFiles", "Flux", "GeoMakie", "HTTP", "Printf", "StatsBase"]
507507

508508
[deps.ClimaLand.extensions]

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ ClimaLand.jl Release Notes
44
main
55
------
66

7+
v1.2.1
8+
-------
9+
- Previous bug fix to harmonic mean formula produces instability; revert until we can solve the issues fixing it causes [#1575](https://github.com/CliMA/ClimaLand.jl/pull/1575)
10+
711
v1.2.0
812
-------
913
- Make soil organic carbon and soil O2 prognostic; remove prescribed Soil Organic Carbon driver [#1545](https://github.com/CliMA/ClimaLand.jl/pull/1545)

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClimaLand"
22
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
33
authors = ["Clima Land Team"]
4-
version = "1.2.0"
4+
version = "1.2.1"
55

66
[deps]
77
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"

docs/Manifest-v1.11.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ version = "0.3.0"
439439
deps = ["ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "Dates", "DocStringExtensions", "Insolation", "Interpolations", "LazyArtifacts", "LazyBroadcast", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"]
440440
path = ".."
441441
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
442-
version = "1.2.0"
442+
version = "1.2.1"
443443
weakdeps = ["BSON", "CSV", "CairoMakie", "ClimaAnalysis", "DataFrames", "DelimitedFiles", "Flux", "GeoMakie", "HTTP", "Printf", "StatsBase"]
444444

445445
[deps.ClimaLand.extensions]

docs/Manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ version = "0.3.0"
436436
deps = ["ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "Dates", "DocStringExtensions", "Insolation", "Interpolations", "LazyArtifacts", "LazyBroadcast", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"]
437437
path = ".."
438438
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
439-
version = "1.2.0"
439+
version = "1.2.1"
440440
weakdeps = ["BSON", "CSV", "CairoMakie", "ClimaAnalysis", "DataFrames", "DelimitedFiles", "Flux", "GeoMakie", "HTTP", "Printf", "StatsBase"]
441441

442442
[deps.ClimaLand.extensions]

src/standalone/Vegetation/PlantHydraulics.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,10 @@ end
251251
"""
252252
harmonic_mean(x::FT,y::FT) where {FT}
253253
254-
Computes the harmonic mean of x >=0 and y >=0; returns zero if both
255-
x and y are zero.
256-
254+
Computes the harmonic mean of x >=0 and y >=0; returns zero if either
255+
x or y are zero.
257256
"""
258-
harmonic_mean(x::FT, y::FT) where {FT} = 2 * x * y / max(x + y, eps(FT))
257+
harmonic_mean(x::FT, y::FT) where {FT} = x * y / max(x + y, eps(FT))
259258

260259
"""
261260
water_flux(

test/standalone/Vegetation/plant_hydraulics_test.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ for FT in (Float32, Float64)
226226
),
227227
)
228228
# Set system to hydrostatic equilibrium
229-
AI = (; leaf = LAI(1.0), root = RAI, stem = SAI)
229+
AI = (; leaf = FT(LAI(1.0)), root = RAI, stem = SAI)
230230
T0A = FT(1e-8) * AI[:leaf]
231231
function initial_compute_exp_tendency!(F, Y)
232232
for i in 1:(n_leaf + n_stem)
@@ -245,7 +245,10 @@ for FT in (Float32, Float64)
245245
conductivity_model,
246246
Y[i],
247247
),
248-
) .* AI[:stem]
248+
) .* ClimaLand.Canopy.PlantHydraulics.harmonic_mean(
249+
AI[:stem],
250+
AI[:root],
251+
)
249252
else
250253
fa =
251254
water_flux(
@@ -261,7 +264,10 @@ for FT in (Float32, Float64)
261264
conductivity_model,
262265
Y[i],
263266
),
264-
) * AI[plant_hydraulics.compartment_labels[i]]
267+
) * ClimaLand.Canopy.PlantHydraulics.harmonic_mean(
268+
AI[plant_hydraulics.compartment_labels[i - 1]],
269+
AI[plant_hydraulics.compartment_labels[i]],
270+
)
265271
end
266272
F[i] = fa - T0A
267273
end
@@ -272,7 +278,7 @@ for FT in (Float32, Float64)
272278
tendecy of the model also results in a steady state. This check is repeated using
273279
the plant hydraulics model directly.
274280
=======================#
275-
ftol = FT(T0A * 1e-4) # 0.01% error in the solution
281+
ftol = FT(T0A * 1e-4)
276282
soln = nlsolve(
277283
initial_compute_exp_tendency!,
278284
Vector{FT}(-3.0:-3:-33);

0 commit comments

Comments
 (0)