Skip to content

Commit 2c50fb3

Browse files
authored
Improve tests stability (#62)
* improve tests stability * update Sleipnir version
1 parent 1b5618b commit 2c50fb3

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Plots = "1"
3737
ProgressMeter = "1"
3838
Reexport = "1"
3939
Revise = "3"
40-
Sleipnir = "0.7.0"
40+
Sleipnir = "0.7.1"
4141
Tullio = "0.3"
4242
julia = "1.7"
4343

test/PDE_UDE_solve.jl

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@ function pde_solve_test(; rtol::F, atol::F, save_refs::Bool=false, MB::Bool=fals
55
println("PDE solving with MB = $MB")
66
working_dir = joinpath(homedir(), "OGGM/Huginn_tests")
77

8+
## Retrieving gdirs and climate for the following glaciers
9+
## Fast version includes less glacier to reduce the amount of downloaded files and computation time on GitHub CI
10+
if fast
11+
rgi_ids = ["RGI60-11.03638", "RGI60-11.01450"] #, "RGI60-08.00213", "RGI60-04.04351", "RGI60-01.02170"]
12+
else
13+
rgi_ids = ["RGI60-11.03638", "RGI60-11.01450", "RGI60-08.00213", "RGI60-04.04351", "RGI60-01.02170",
14+
"RGI60-02.05098", "RGI60-01.01104", "RGI60-01.09162", "RGI60-01.00570", "RGI60-04.07051",
15+
"RGI60-07.00274", "RGI60-07.01323", "RGI60-01.17316"]
16+
end
17+
818
rgi_paths = get_rgi_paths()
19+
# Filter out glaciers that are not used to avoid having references that depend on all the glaciers processed in Gungnir
20+
rgi_paths = Dict(k => rgi_paths[k] for k in rgi_ids)
921

1022
params = Huginn.Parameters(simulation = SimulationParameters(use_MB=MB,
1123
velocities=false,
@@ -16,16 +28,6 @@ function pde_solve_test(; rtol::F, atol::F, save_refs::Bool=false, MB::Bool=fals
1628
solver = SolverParameters(reltol=1e-12)
1729
)
1830

19-
## Retrieving gdirs and climate for the following glaciers
20-
## Fast version includes less glacier to reduce the amount of downloaded files and computation time on GitHub CI
21-
if fast
22-
rgi_ids = ["RGI60-11.03638", "RGI60-11.01450"] #, "RGI60-08.00213", "RGI60-04.04351", "RGI60-01.02170"]
23-
else
24-
rgi_ids = ["RGI60-11.03638", "RGI60-11.01450", "RGI60-08.00213", "RGI60-04.04351", "RGI60-01.02170",
25-
"RGI60-02.05098", "RGI60-01.01104", "RGI60-01.09162", "RGI60-01.00570", "RGI60-04.07051",
26-
"RGI60-07.00274", "RGI60-07.01323", "RGI60-01.17316"]
27-
end
28-
2931
if MB
3032
model = Huginn.Model(iceflow = SIA2Dmodel(params), mass_balance = TImodel1(params))
3133
else
@@ -95,7 +97,11 @@ function TI_run_test!(save_refs::Bool = false; rtol::F, atol::F) where {F <: Abs
9597

9698
working_dir = joinpath(homedir(), "OGGM/Huginn_tests")
9799

100+
rgi_ids = ["RGI60-11.03638"]
101+
98102
rgi_paths = get_rgi_paths()
103+
# Filter out glaciers that are not used to avoid having references that depend on all the glaciers processed in Gungnir
104+
rgi_paths = Dict(k => rgi_paths[k] for k in rgi_ids)
99105

100106
params = Huginn.Parameters(simulation = SimulationParameters(use_MB=true,
101107
velocities=false,
@@ -106,7 +112,6 @@ function TI_run_test!(save_refs::Bool = false; rtol::F, atol::F) where {F <: Abs
106112
solver = SolverParameters(reltol=1e-8)
107113
)
108114
model = Huginn.Model(iceflow = SIA2Dmodel(params), mass_balance = TImodel1(params))
109-
rgi_ids = ["RGI60-11.03638"]
110115

111116
glacier = initialize_glaciers(rgi_ids, params)[1]
112117
initialize_iceflow_model!(model.iceflow, 1, glacier, params)

test/halfar.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@ Arguments
1919
"""
2020
function unit_halfar_test(; A, n, t₀, t₁, Δx, Δy, nx, ny, h₀, r₀, rtol=0.02, atol=1.0, distance_to_border=3, save_plot=false, inplace=true)
2121

22-
rgi_paths = get_rgi_paths()
23-
2422
# Get parameters for a simulation
2523
parameters = Huginn.Parameters(simulation=SimulationParameters(tspan=(t₀, t₁),
2624
multiprocessing=false,
2725
use_MB=false,
2826
use_iceflow=true,
29-
working_dir=Huginn.root_dir,
30-
rgi_paths=rgi_paths),
27+
working_dir=Huginn.root_dir),
3128
physical=PhysicalParameters(),
3229
solver=SolverParameters(reltol=1e-12))
3330

test/mass_conservation.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@ Arguments
2323
"""
2424
function unit_mass_test(; H₀, B, A, n, t_sim, Δx, Δy, rtol=0.02, save_plot=false)
2525

26-
rgi_paths = get_rgi_paths()
27-
28-
# Get parameters for a simulation
26+
# Get parameters for a simulation
2927
parameters = Huginn.Parameters(simulation=SimulationParameters(tspan=(0.0, t_sim),
3028
use_MB=false,
31-
use_iceflow=true,
32-
rgi_paths=rgi_paths),
29+
use_iceflow=true),
3330
physical=PhysicalParameters(),
3431
solver=SolverParameters(reltol=1e-12))
3532

@@ -45,7 +42,7 @@ function unit_mass_test(; H₀, B, A, n, t_sim, Δx, Δy, rtol=0.02, save_plot=f
4542
glaciers = Vector{Sleipnir.AbstractGlacier}([glacier])
4643

4744
prediction = Prediction(model, glaciers, parameters)
48-
run!(prediction)
45+
run!(prediction)
4946

5047
# Final solution
5148
H₁_pred = prediction.results[1].H[end]

0 commit comments

Comments
 (0)