Skip to content

Commit

Permalink
Added PDS-based test and fixed bug checking for tide_system in PDS data
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyarndley committed Apr 29, 2024
1 parent 7f276ad commit badd14b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ git-tree-sha1 = "08d3017c167477b4c13de8239cbe7ecee07a60c9"
[[XGM2016.download]]
sha256 = "00c9117447d18f365e4b8030e9312ca73eed0d07d11534e06fd95b900f49418c"
url = "https://gist.github.com/andreapasquale94/8692fcaa1e61afd600d29d53b55b4d78/raw/08d3017c167477b4c13de8239cbe7ecee07a60c9.tar.gz"

[JGL100K]
git-tree-sha1 = "dad6db77e6d222bdc7836804868d3e25518fe163"

[[JGL100K.download]]
sha256 = "62c1114551fb4ba553b9d534d85833ecea754b52fdf94d6e4d11c53546b181af"
url = "https://gist.github.com/jackyarndley/2a890c30600a79e3f64ebbb4014ac741/raw/dad6db77e6d222bdc7836804868d3e25518fe163.tar.gz"
2 changes: 1 addition & 1 deletion src/Gravity/harmonics/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function parse_model(
)
end

if !(data.tide_system == :zero_tide)
if (typeof(data) == GravityHarmonicsICGEMData) && !(data.tide_system == :zero_tide)
throw(
NotImplementedError("tide system '$(d.tide_system)' not supported")
)
Expand Down
47 changes: 46 additions & 1 deletion test/Gravity/harmonics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,53 @@ end

end

end


@testset "PDS based, static model" verbose=true begin

PATH_PDS = artifact"JGL100K"
DATA_PDS = parse_data(
Float64, GravityHarmonicsPDSData, joinpath(PATH_PDS, "jgl100k1.sha");
maxdegree=51
)

@testset "Accelerations" verbose=true begin

@testset "zonal terms" verbose=true begin
degree = 10
mz = parse_model(Float64, GravityHarmonics, DATA_PDS, degree, true)

for _ in 1:1000
pos = rand(3)
pos /= norm(pos)
radius = 1
μ = 1

fd = ForwardDiff.gradient(x->compute_potential(mz, x, μ, radius), pos)
an = compute_acceleration(mz, pos, μ, radius)

@test maximum(abs.(fd-an)) 1e-14
end
end

@testset "all terms" verbose=true begin
degree = 10
m = parse_model(Float64, GravityHarmonics, DATA_PDS, degree, false)

for _ in 1:1000
pos = rand(3)
pos /= norm(pos)
radius = 1
μ = 1

fd = ForwardDiff.gradient(x->compute_potential(m, x, μ, radius), pos)
an = compute_acceleration(m, pos, μ, radius)

@test maximum(abs.(fd-an)) 1e-14
end
end

end

end

0 comments on commit badd14b

Please # to comment.