Skip to content

Commit aa7a61d

Browse files
authored
figure changes and freezing point depression (#963)
1 parent cd785c8 commit aa7a61d

File tree

5 files changed

+30
-23
lines changed

5 files changed

+30
-23
lines changed

docs/tutorials/standalone/Soil/freezing_front.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ hydrology_cm = vanGenuchten{FT}(; α = vg_α, n = vg_n);
104104
#c = FT(0.43)
105105
#hcm = BrooksCorey(;ψb = ψb, c = c);
106106
θ_r = FT(0.05)
107-
ν_ss_om = FT(0.3)
108-
ν_ss_quartz = FT(0.7)
107+
ν_ss_om = FT(0.4)
108+
ν_ss_quartz = FT(0.6)
109109
ν_ss_gravel = FT(0.0)
110110
params = Soil.EnergyHydrologyParameters(
111111
FT;

docs/tutorials/standalone/Soil/phase_change_analytic.jl

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ ode_algo = CTS.IMEXAlgorithm(
180180
timestepper,
181181
CTS.NewtonsMethod(
182182
max_iters = 3,
183-
update_j = CTS.UpdateEvery(CTS.NewTimeStep),
183+
update_j = CTS.UpdateEvery(CTS.NewNewtonIteration),
184184
),
185185
);
186186

@@ -212,17 +212,12 @@ sol = SciMLBase.solve(
212212
sol_T = parent(sv.saveval[end].soil.T)[:]
213213

214214
fig = Figure(size = (300, 300))
215-
ax1 = Axis(
216-
fig[1, 1],
217-
title = "Neumann Solution",
218-
xlabel = L"T (K)",
219-
ylabel = "Soil depth (m)",
220-
)
215+
ax1 = Axis(fig[1, 1], title = "", xlabel = L"T (K)", ylabel = "Soil depth (m)")
221216
limits!(ax1, 262, 276, -3, 0.0)
222217

223218
z = parent(coords.subsurface.z)[:];
224219

225-
lines!(ax1, sol_T, z, label = "Model", color = :green)
220+
lines!(ax1, sol_T, z, label = "Simulation", color = :green)
226221

227222
# # Analytic Solution of Neumann
228223
# All details here are taken from [DallAmico2011](@cite) (see also [CarslawJaeger](@cite)), and the reader is referred to that
@@ -309,7 +304,7 @@ function implicit(ζ)
309304
return (term1 + term2 + term3)
310305
end
311306
ζ = find_zero(implicit, (0.25, 0.27), Bisection())
312-
depth = abs.(reverse(z))
307+
depth = Array(0:0.01:3)
313308
t = sol.t[end]
314309
zf = 2.0 * ζ * sqrt(d1 * t)
315310
analytic_unfrozen_profile(depth, zf) =
@@ -319,14 +314,14 @@ mask_unfrozen = depth .>= zf
319314
mask_frozen = depth .<= zf
320315
T_frozen = Ts .+ (0.0 - Ts) .* analytic_frozen_profile.(depth, zf) .+ 273.15
321316
T_unfrozen = Ti .- (Ti - 0.0) .* analytic_unfrozen_profile.(depth, zf) .+ 273.15
322-
scatter!(
317+
lines!(
323318
ax1,
324319
T_frozen[mask_frozen],
325320
-1 .* depth[mask_frozen],
326-
label = "Analytic",
321+
label = "Analytic Solution",
327322
color = "purple",
328323
)
329-
scatter!(
324+
lines!(
330325
ax1,
331326
T_unfrozen[mask_unfrozen],
332327
-1 .* depth[mask_unfrozen],

lib/ClimaLandSimulations/src/Fluxnet/fluxnet_sites/US-MOz/US-MOz_simulation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function ozark_default_args(;
3535
h_stem = FT(9),
3636
h_leaf = FT(9.5),
3737
t0 = Float64(120 * 3600 * 24),
38-
dt = Float64(900),
38+
dt = Float64(450),
3939
n = 15,
4040
)
4141
return (

src/standalone/Soil/soil_heat_parameterizations.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ function phase_change_source(
6565
θtot = min(_ρ_i / _ρ_l * θ_i + θ_l, ν)
6666
# This is consistent with Equation (22) of Dall'Amico
6767
ψw0 = matric_potential(hydrology_cm, effective_saturation(ν, θtot, θ_r))
68+
Tf_depressed = _T_freeze * exp(_grav * ψw0 / _LH_f0)
6869

69-
ψT = _LH_f0 / _T_freeze / _grav * (T - _T_freeze) * heaviside(_T_freeze - T)
70+
ψT = _LH_f0 / _grav * log(T / Tf_depressed) * heaviside(Tf_depressed - T)
7071
# Equation (23) of Dall'Amico
7172
θstar = inverse_matric_potential(hydrology_cm, ψw0 + ψT) *- θ_r) + θ_r
7273

test/standalone/Soil/soil_parameterizations.jl

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,13 @@ for FT in (Float32, Float64)
332332
@test τ == parameters.ρc_ds * Δz^2 / parameters.κ_dry
333333
θ_l = FT.([0.11, 0.15, ν])
334334
θ_i = FT(0.0)
335-
T = FT(273)
335+
T = FT(270)
336336
θtot = @.(_ρ_i / _ρ_l * θ_i + θ_l)
337337
ψ0 = @. matric_potential(hcm, Soil.effective_saturation(ν, θtot, θ_r))
338-
ψT = @.(_LH_f0 / _T_freeze / _grav * (T - _T_freeze))
338+
Tf_depressed = _T_freeze * exp.(_grav * ψ0 / _LH_f0)
339+
ψT = @. _LH_f0 / _grav *
340+
log(T / Tf_depressed) *
341+
ClimaLand.heaviside(Tf_depressed - T)
339342
θ_star = @. inverse_matric_potential(hcm, ψ0 + ψT) *- θ_r) + θ_r
340343
ρc_s = volumetric_heat_capacity.(θ_l, θ_i, parameters.ρc_ds, param_set)
341344
τ = thermal_time.(ρc_s, Δz, parameters.κ_dry)
@@ -361,14 +364,16 @@ for FT in (Float32, Float64)
361364
hydrology_earth_params,
362365
) .> 0.0,
363366
) == 3
364-
# try θ_l = 0.1
365367

366368
θ_l = FT.([0.11, 0.15, ν])
367369
θ_i = FT(0.0)
368370
T = FT(274)
369371
θtot = @.(_ρ_i / _ρ_l * θ_i + θ_l)
370372
ψ0 = @. matric_potential(hcm, Soil.effective_saturation(ν, θtot, θ_r))
371-
ψT = FT(0.0)
373+
Tf_depressed = _T_freeze * exp.(_grav * ψ0 / _LH_f0)
374+
ψT = @. _LH_f0 / _grav *
375+
log(T / Tf_depressed) *
376+
ClimaLand.heaviside(Tf_depressed - T)
372377
θ_star = @. inverse_matric_potential(hcm, ψ0 + ψT) *- θ_r) + θ_r
373378
ρc_s = volumetric_heat_capacity.(θ_l, θ_i, parameters.ρc_ds, param_set)
374379
τ = thermal_time.(ρc_s, Δz, parameters.κ_dry)
@@ -386,12 +391,15 @@ for FT in (Float32, Float64)
386391
@test (θ_star θ_l)
387392

388393

389-
θ_l = FT(0.01)
394+
θ_l = FT(0.11)
390395
θ_i = FT.([0.05, 0.08])
391396
T = FT(274)
392397
θtot = @.(_ρ_i / _ρ_l * θ_i + θ_l)
393398
ψ0 = @. matric_potential(hcm, Soil.effective_saturation(ν, θtot, θ_r))
394-
ψT = FT(0.0)
399+
Tf_depressed = _T_freeze * exp.(_grav * ψ0 / _LH_f0)
400+
ψT = @. _LH_f0 / _grav *
401+
log(T / Tf_depressed) *
402+
ClimaLand.heaviside(Tf_depressed - T)
395403
θ_star = @. inverse_matric_potential(hcm, ψ0 + ψT) *- θ_r) + θ_r
396404
ρc_s = volumetric_heat_capacity.(θ_l, θ_i, parameters.ρc_ds, param_set)
397405
τ = thermal_time.(ρc_s, Δz, parameters.κ_dry)
@@ -424,7 +432,10 @@ for FT in (Float32, Float64)
424432
T = FT(260)
425433
θtot = @.(_ρ_i / _ρ_l * θ_i + θ_l)
426434
ψ0 = @. matric_potential(hcm, Soil.effective_saturation(ν, θtot, θ_r))
427-
ψT = @.(_LH_f0 / _T_freeze / _grav * (T - _T_freeze))
435+
Tf_depressed = _T_freeze * exp.(_grav * ψ0 / _LH_f0)
436+
ψT = @. _LH_f0 / _grav *
437+
log(T / Tf_depressed) *
438+
ClimaLand.heaviside(Tf_depressed - T)
428439
θ_star = @. inverse_matric_potential(hcm, ψ0 + ψT) *- θ_r) + θ_r
429440
ρc_s = volumetric_heat_capacity.(θ_l, θ_i, parameters.ρc_ds, param_set)
430441
τ = thermal_time.(ρc_s, Δz, parameters.κ_dry)

0 commit comments

Comments
 (0)