Skip to content

Commit

Permalink
passing tests?
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasia-popova committed Feb 23, 2024
1 parent 33649b7 commit 364643d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 68 deletions.
2 changes: 1 addition & 1 deletion src/P3Scheme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import CloudMicrophysics.Parameters as CMP

const PSP3 = CMP.ParametersP3

export thresholds, p3_mass, distribution_parameter_solver
export thresholds, distribution_parameter_solver

"""
α_va_si(p3)
Expand Down
67 changes: 0 additions & 67 deletions test/p3_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,71 +85,6 @@ function test_p3_thresholds(FT)
end
end

#= function test_p3_mass(FT)
p3 = CMP.ParametersP3(FT)
TT.@testset "p3 mass_ functions" begin
# Initialize test values
Ds = (FT(1e-5), FT(1e-4), FT(1e-3))
ρs = (FT(400), FT(600), FT(800))
F_rs = (FT(0.0), FT(0.5), FT(0.8))
# Test to see that the mass_ functions give positive, not NaN values
for D in Ds
for ρ in ρs
for F_r in F_rs
TT.@test P3.mass_s(D, ρ) >= 0
TT.@test P3.mass_nl(p3, D) >= 0
TT.@test P3.mass_r(p3, D, F_r) >= 0
end
end
end
end
# Test to see that p3_mass gives correct mass
TT.@testset "p3_mass() accurate values" begin
# Initialize test values
Ds = (FT(1e-5), FT(1e-4), FT(1e-3))
ρs = (FT(400), FT(600), FT(800))
F_rs = (FT(0.0), FT(0.5), FT(0.8))
eps = FT(1e-3) #TODO - this is very large for eps
for ρ in ρs
for F_r in F_rs
D_th = P3.D_th_helper(p3)
D1 = D_th / 2
th = P3.thresholds(p3, ρ, F_r)
if (F_r > 0)
th = P3.thresholds(p3, ρ, F_r)
D2 = (th.D_gr + D_th) / 2
D3 = (th.D_cr + th.D_gr) / 2
D4 = th.D_cr + eps
TT.@test P3.p3_mass(p3, D1, F_r, th) ==
P3.mass_s(D1, p3.ρ_i)
TT.@test P3.p3_mass(p3, D2, F_r, th) == P3.mass_nl(p3, D2)
TT.@test P3.p3_mass(p3, D3, F_r, th) ==
P3.mass_s(D3, th.ρ_g)
TT.@test P3.p3_mass(p3, D4, F_r, th) ==
P3.mass_r(p3, D4, F_r)
else
D2 = D1 + eps
TT.@test P3.p3_mass(p3, D1, F_r, th) ==
P3.mass_s(D1, p3.ρ_i)
TT.@test P3.p3_mass(p3, D2, F_r, th) == P3.mass_nl(p3, D2)
end
end
end
end
end =#

function test_p3_shape_solver(FT)

p3 = CMP.ParametersP3(FT)
Expand Down Expand Up @@ -200,12 +135,10 @@ end

println("Testing Float32")
test_p3_thresholds(Float32)
#test_p3_mass(Float32)
#TODO - only works for Float64 now. We should switch the units inside the solver
# from SI base to something more managable
test_p3_shape_solver(Float32)

println("Testing Float64")
test_p3_thresholds(Float64)
#test_p3_mass(Float64)
test_p3_shape_solver(Float64)

0 comments on commit 364643d

Please sign in to comment.