Skip to content

Commit

Permalink
Test tolerances updated (#45)
Browse files Browse the repository at this point in the history
* Tolerance fixed for tests
  • Loading branch information
JordiBolibar committed Dec 18, 2023
1 parent b7b42cc commit 1444828
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions test/PDE_UDE_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function pde_solve_test(; rtol::F, atol::F, save_refs::Bool=false, MB::Bool=fals
working_dir = Huginn.root_dir,
workers=4,
multiprocessing=true),
solver = SolverParameters(reltol=1e-8)
solver = SolverParameters(reltol=1e-12)
)

## Retrieving gdirs and climate for the following glaciers
Expand Down Expand Up @@ -93,7 +93,7 @@ function pde_solve_test(; rtol::F, atol::F, save_refs::Bool=false, MB::Bool=fals
end
end

function TI_run_test!(save_refs::Bool = false)
function TI_run_test!(save_refs::Bool = false; rtol::F, atol::F) where {F <: AbstractFloat}

working_dir = joinpath(homedir(), "OGGM/Huginn_tests")
params = Parameters(OGGM = OGGMparameters(working_dir=working_dir,
Expand Down Expand Up @@ -125,7 +125,7 @@ function TI_run_test!(save_refs::Bool = false)
MB_ref = load(joinpath(Huginn.root_dir, "test/data/PDE/MB_ref.jld2"))["MB"]
H_w_MB_ref = load(joinpath(Huginn.root_dir, "test/data/PDE/H_w_MB_ref.jld2"))["H"]

@test all(MB_ref .== model.iceflow.MB)
@test all(H_w_MB_ref .== model.iceflow.H)
@test all(isapprox.(MB_ref, model.iceflow.MB, rtol=rtol, atol=atol))
@test all(isapprox.(H_w_MB_ref, model.iceflow.H, rtol=rtol, atol=atol))

end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ENV["GKSwstype"]="nul"

@testset "PDE solving integration tests w/ MB" pde_solve_test(; rtol=0.01, atol=0.01, save_refs=false, MB=true, fast=true)

@testset "Run TI models in place" TI_run_test!(false)
@testset "Run TI models in place" TI_run_test!(false; rtol=1e-5, atol=1e-5)

@testset "Conservation of Mass - Flat Bed" unit_mass_flatbed_test(; rtol=1.0e-7)

Expand Down

0 comments on commit 1444828

Please sign in to comment.