Skip to content

Commit

Permalink
fix toleance test
Browse files Browse the repository at this point in the history
  • Loading branch information
jguterl committed Dec 9, 2024
1 parent 566d588 commit 13c9b0e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 32 deletions.
20 changes: 10 additions & 10 deletions test/metric_tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ g̅̅ = MetricTensor(𝐮)
r_ = 3.0
g = g̅̅(r_, 5.0, 8.0)

@test g.r.r == 1.0 && g.θ.θ == r_^2 && g.z.z == 1.0
@test g.r.r == 1.0 && g.θ.θ r_^2 && g.z.z == 1.0


𝐞̂ = UnitBasisVectors(CartesianCS)
@variables r Ψ θ
𝐑 = r * cos(Ψ) * sin(θ) * 𝐞̂.x + r * sin(Ψ) * sin(θ) * 𝐞̂.y + r * cos(θ) * 𝐞̂.z
𝐮 = BasisVectors{SphericalCS}(𝐑, [r, θ, Ψ])
g̅̅ = MetricTensor(𝐮)
simplify(g̅̅)
r_ = 3.0
θ_ = π / 3
g = g̅̅(r_, θ_, 8.0)
@test g.r.r == 1.0 && g.θ.θ == r_^2 && g.Ψ.Ψ == r_^2 * sin(θ_)^2
@variables r Ψ θ
𝐑 = r * cos(Ψ) * sin(θ) * 𝐞̂.x + r * sin(Ψ) * sin(θ) * 𝐞̂.y + r * cos(θ) * 𝐞̂.z
𝐮 = BasisVectors{SphericalCS}(𝐑, [r, θ, Ψ])
g̅̅ = MetricTensor(𝐮)
simplify(g̅̅)
r_ = 3.0
θ_ = π / 3
g = g̅̅(r_, θ_, 8.0)
@test g.r.r == 1.0 && g.θ.θ == r_^2 && g.Ψ.Ψ == r_^2 * sin(θ_)^2


17 changes: 5 additions & 12 deletions test/operators/cross_product.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#=
Author: Jerome Guterl ([email protected])
Company: General Atomics
dot_product.jl (c) 2024=#
a, b, c, e, f, g = rand(6)
𝐯 = PVector{CartesianCS}(a, b, c)
𝐰 = PVector{CartesianCS}(e, f, g)
𝐓 = 𝐯 × 𝐰
@test 𝐓.x == b * g - c * f && +𝐓.y == -a * g + c * e && 𝐓.z == a * f - b * e


a, b, c, e, f, g = rand(6)
𝐯 = PVector{CartesianCS}(a, b, c)
𝐰 = PVector{CartesianCS}(e, f, g)
𝐓 = 𝐯 × 𝐰
@test 𝐓.x == b * g - c * f && +𝐓.y == -a * g + c * e && 𝐓.z == a * f - b * e

@test 𝐓.x == a * e + b * f + c * g && 𝐓.y == a * h + b * i + c * j && 𝐓.z == a * k + b * l + c * m
19 changes: 9 additions & 10 deletions test/operators/dot_product.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ Author: Jerome Guterl ([email protected])
dot_product.jl (c) 2024=#


a, b, c, e, f, g = rand(6)
𝐯 = PVector{CartesianCS}(a, b, c)
𝐰 = PVector{CartesianCS}(e, f, g)
T = 𝐯 𝐰
@test T == a*e + b*f + c* g
a, b, c, e, f, g = rand(6)
𝐯 = PVector{CartesianCS}(a, b, c)
𝐰 = PVector{CartesianCS}(e, f, g)
T = 𝐯 𝐰
@test T == a * e + b * f + c * g



a, b, c, e, f, g, h, i,j,k,l,m = rand(12)
𝐯 = PVector{CartesianCS}(a, b, c)
𝐰 = PTensor{CartesianCS}(e, f, g, h,i,j ,k ,l,m)
𝐓 = 𝐰𝐯
a, b, c, e, f, g, h, i, j, k, l, m = rand(12)
𝐯 = PVector{CartesianCS}(a, b, c)
𝐰 = PTensor{CartesianCS}(e, f, g, h, i, j, k, l, m)
𝐓 = 𝐰 𝐯
@test 𝐓.x == a * e + b * f + c * g && 𝐓.y == a * h + b * i + c * j && 𝐓.z == a * k + b * l + c * m

0 comments on commit 13c9b0e

Please sign in to comment.