Skip to content

Commit

Permalink
Revisions per reviewer comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
sriharshakandala committed Sep 29, 2021
1 parent 66c9bad commit b29581e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
2 changes: 1 addition & 1 deletion src/Geometry/Geometry.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Geometry

using ..RecursiveApply
using LinearAlgebra
import LinearAlgebra

import StaticArrays: SVector

Expand Down
47 changes: 0 additions & 47 deletions test/axistensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,50 +87,3 @@ end
Geometry.Covariant13Vector(2.0, 2.0) * Geometry.Cartesian1Vector(1.0)',
)
end




using ClimaCore.Geometry, StaticArrays, ForwardDiff, LinearAlgebra
FT = Float64
radius = 10.0
toler = 100 * eps(FT)
x1 = Geometry.Cartesian123Point(1 / sqrt(3), 1 / sqrt(3), 1 / sqrt(3)) * radius
x2 = Geometry.Cartesian123Point(1 / sqrt(3), -1 / sqrt(3), 1 / sqrt(3)) * radius
x3 = Geometry.Cartesian123Point(-1 / sqrt(3), 1 / sqrt(3), 1 / sqrt(3)) * radius
x4 =
Geometry.Cartesian123Point(-1 / sqrt(3), -1 / sqrt(3), 1 / sqrt(3)) * radius



function spherical_bilinear_interpolate((x1, x2, x3, x4), ξ1, ξ2)
r = norm(x1) # assume all are same radius
x = Geometry.interpolate((x1, x2, x3, x4), ξ1, ξ2)
x = x * (r / norm(x))
end


ξ = SVector(0.0, 1e-15)

x = spherical_bilinear_interpolate((x1, x2, x3, x4), ξ[1], ξ[2])
ll = Geometry.LatLongPoint(x)


∂x∂ξ = ForwardDiff.jacobian(ξ) do ξ
Geometry.components(
spherical_bilinear_interpolate((x1, x2, x3, x4), ξ[1], ξ[2]),
)
end

if abs(ll.lat) oftype(ll.lat, 90.0)
# at the pole: choose u to line with x1, v to line with x2
∂u∂ξ = ∂x∂ξ[SOneTo(2), :]
else
θ = ll.lat
λ = ll.long
F = @SMatrix [
-sind(λ) cosd(λ) 0
0 0 1/cosd(θ)
]
∂u∂ξ = F * ∂x∂ξ
end

0 comments on commit b29581e

Please sign in to comment.