Skip to content

Travel time calculation fails in 3-D spherical coordinates #8

Description

@seishorihori

Thank you for sharing this Julia code set. It’s very helpful to me.

When I tried to calculate travel time using EikonalSolvers.jl with a 3-D spherical grid, I encountered the following error:

ERROR: LoadError: UndefVarError: `gridspac` not defined
Stacktrace:
  [1] findenclosingbox(grd::Grid3DSphere, xyzsrc::Vector{Float64})
    @ EikonalSolvers ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:1140
  [2] createfinegrid(grd::Grid3DSphere, xyzsrc::Vector{Float64}, vel::Array{Float64, 3}, grdrefpars::GridRefinementPars)
    @ EikonalSolvers ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:976
  [3] runrefinementaroundsrc!(fmmvars::EikonalSolvers.FMMVars3D, vel::Array{Float64, 3}, xyzsrc::Vector{Float64}, grd::Grid3DSphere, adjvars::Nothing, extrapars::ExtraParams)
    @ EikonalSolvers ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:350
  [4] ttFMM_hiord!(fmmvars::EikonalSolvers.FMMVars3D, vel::Array{Float64, 3}, src::Vector{Float64}, grd::Grid3DSphere, adjvars::Nothing, extrapars::ExtraParams)
    @ EikonalSolvers ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:290
  [5] ttFMM_hiord!
    @ ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:224 [inlined]
  [6] ttforwsomesrc(vel::Array{Float64, 3}, coordsrc::Matrix{Float64}, coordrec::Vector{Matrix{Float64}}, grd::Grid3DSphere, extrapars::ExtraParams; returntt::Bool)
    @ EikonalSolvers ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:180
  [7] ttforwsomesrc
    @ ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:152 [inlined]
  [8] eiktraveltime(vel::Array{Float64, 3}, grd::Grid3DSphere, coordsrc::Matrix{Float64}, coordrec::Vector{Matrix{Float64}}; returntt::Bool, extraparams::Nothing)
    @ EikonalSolvers ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:129
  [9] eiktraveltime
    @ ~/.julia/packages/EikonalSolvers/S5c5B/src/EikSolv/eikmainfwd.jl:33 [inlined]
 [10] main()
~/EikonalSolvers/3Dspherical_toy.jl:72
 [11] top-level scope
    @ ~/EikonalSolvers/3Dspherical_toy.jl:83

At line 1140, the code is
xyzres[d],remainder[d] = divrem(xyzsrc[d]-xyzinit[d],gridspac[d])
Here "gridspac" is required.

From what I understand, "gridspac" is defined inside an if-block on lines 1122–1131 of eikmainfwd.jl.
However, this if-block does not handle the case where typeof(grd)==Grid3DSphere
I believe that this is a cause of the error.

I'm using EikonalSolvers.jl v0.15.3 and Julia 1.10.10 on macOS 15.7.3.
Thank you in advance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions