Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on running the example in Youtube video. #68

Closed
LongWeiZJU opened this issue Aug 4, 2023 · 4 comments
Closed

Error on running the example in Youtube video. #68

LongWeiZJU opened this issue Aug 4, 2023 · 4 comments

Comments

@LongWeiZJU
Copy link

LongWeiZJU commented Aug 4, 2023

I am running the example code in Youtube video: (https://www.youtube.com/watch?v=OO0Nz3uWDc8), and my code looks like:
1

And after I run this code , the error info is:
1691111538091

What is the reason?

@weymouth
Copy link
Collaborator

weymouth commented Aug 4, 2023

That should work fine. What version of WaterLily are you using?

@weymouth
Copy link
Collaborator

weymouth commented Aug 4, 2023

Actually, I can tell from the error that you are using a pre-1.0 version. Use
] update WaterLily
and try again.

@LongWeiZJU
Copy link
Author

LongWeiZJU commented Aug 5, 2023

Thank you!
I update to version 1.0.2, and the error is gone.

@weymouth weymouth closed this as completed Aug 5, 2023
@LongWeiZJU
Copy link
Author

Still, I met another problem.

The current code is:

using WaterLily
using StaticArrays
using GLMakie
norm(x) = √sum(abs2, x)   #√(x', x)

function make_sim(n=2^6, U=1, Re=1000)
    R = n / 2
    function sdf(xyz, t)
        x, y, z = xyz
        r = norm((y,z));
        norm((x, r - min(r, R))) - 1.5

    end
    map(xyz, t) = xyz - SA[2n/3, 0, 0]

    # Return  Simulation
    return Simulation(
        (2*n, n, n), (U, 0, 0), R;
        ν=U*R/Re, body=AutoBody(sdf, map)
    )
end

include("ThreeD_Plots.jl")
sim = make_sim()
sim_step!(sim, 0.2)  
# GLMakie.mesh(body_mesh(sim), color=:green)
data = flow_λ₂(sim)

After I run this code, an error is shown in the last line of code:

ERROR: Only hermitian matrices are diagonalizable by *StaticArrays*. Non-Hermitian matrices should be converted to `Array` first.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] #eigvals#509
    @ ~/.julia/packages/StaticArrays/9KYrc/src/eigen.jl:12 [inlined]
  [3] eigvals
    @ ~/.julia/packages/StaticArrays/9KYrc/src/eigen.jl:6 [inlined]
  [4] λ₂(I::CartesianIndex{3}, u::Array{Float32, 4})
    @ WaterLily ~/.julia/packages/WaterLily/aHsHt/src/Metrics.jl:43
  [5] macro expansion
    @ ~/.julia/packages/WaterLily/aHsHt/src/util.jl:97 [inlined]
  [6] cpu_
    @ ~/.julia/packages/KernelAbstractions/cWlFz/src/macros.jl:276 [inlined]
  [7] (::var"#cpu_##kern#477#400")(__ctx__::KernelAbstractions.CompilerMetadata{KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.NoDynamicCheck, CartesianIndex{3}, CartesianIndices{3, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}, Base.OneTo{Int64}}}, KernelAbstractions.NDIteration.NDRange{3, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(64, 1, 1)}, CartesianIndices{3, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}, Base.OneTo{Int64}}}, Nothing}}, a::Array{Float32, 3}, u::Array{Float32, 4}, L::Float64, U::Float64, I0::CartesianIndex{3})
    @ Main ./none:0
  [8] __thread_run(tid::Int64, len::Int64, rem::Int64, obj::KernelAbstractions.Kernel{KernelAbstractions.CPU, KernelAbstractions.NDIteration.StaticSize{(64,)}, KernelAbstractions.NDIteration.DynamicSize, var"#cpu_##kern#477#400"}, ndrange::Tuple{Int64, Int64, Int64}, iterspace::KernelAbstractions.NDIteration.NDRange{3, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(64, 1, 1)}, CartesianIndices{3, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}, Base.OneTo{Int64}}}, Nothing}, args::Tuple{Array{Float32, 3}, Array{Float32, 4}, Float64, Float64, CartesianIndex{3}}, dynamic::KernelAbstractions.NDIteration.NoDynamicCheck)
    @ KernelAbstractions ~/.julia/packages/KernelAbstractions/cWlFz/src/cpu.jl:115
  [9] __run(obj::KernelAbstractions.Kernel{KernelAbstractions.CPU, KernelAbstractions.NDIteration.StaticSize{(64,)}, KernelAbstractions.NDIteration.DynamicSize, var"#cpu_##kern#477#400"}, ndrange::Tuple{Int64, Int64, Int64}, iterspace::KernelAbstractions.NDIteration.NDRange{3, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(64, 1, 1)}, CartesianIndices{3, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}, Base.OneTo{Int64}}}, Nothing}, args::Tuple{Array{Float32, 3}, Array{Float32, 4}, Float64, Float64, CartesianIndex{3}}, dynamic::KernelAbstractions.NDIteration.NoDynamicCheck, static_threads::Bool)
    @ KernelAbstractions ~/.julia/packages/KernelAbstractions/cWlFz/src/cpu.jl:82
 [10] (::KernelAbstractions.Kernel{KernelAbstractions.CPU, KernelAbstractions.NDIteration.StaticSize{(64,)}, KernelAbstractions.NDIteration.DynamicSize, var"#cpu_##kern#477#400"})(::Array{Float32, 3}, ::Vararg{Any}; ndrange::Tuple{Int64, Int64, Int64}, workgroupsize::Nothing)
    @ KernelAbstractions ~/.julia/packages/KernelAbstractions/cWlFz/src/cpu.jl:44
 [11] macro expansion
    @ ~/.julia/packages/WaterLily/aHsHt/src/util.jl:99 [inlined]
 [12] flow_λ₂!(dat::Array{Float32, 3}, sim::Simulation)
    @ Main ~/Work/research/WaterLily.jl/examples/ThreeD_Plots.jl:47
 [13] flow_λ₂(sim::Simulation)
    @ Main ~/Work/research/WaterLily.jl/examples/ThreeD_Plots.jl:52
 [14] top-level scope
    @ ~/Work/research/WaterLily.jl/examples/3D_demo.jl:27

But the body of a quater of disc could be displayed if I remove the last line and only run the following line:

GLMakie.mesh(body_mesh(sim), color=:green)

PS:
My laptop is mac M2. Julia version is 1.9.2. And Version of packages is as follows:
(WaterLily.jl) pkg> status

Status `~/Work/research/WaterLily.jl/Project.toml`
  [e9467ef8] GLMakie v0.8.7
  [5c1252a2] GeometryBasics v0.4.9
  [e6723b4c] Meshing v0.6.0
⌃ [dde4c033] Metal v0.3.0
  [91a5bcdd] Plots v1.38.17
  [90137ffa] StaticArrays v1.6.2
  [ed894a53] WaterLily v1.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants