Giter Club home page Giter Club logo

Comments (11)

mateuszbaran avatar mateuszbaran commented on June 19, 2024 2

test_integration group has the test for BoundaryValueDiffEq but currently the example I've pasted above is the only use case we have for BVP and we don't have any plans to add new functionality relying on BVP. Adding the test case I've posted above should be enough IMO.

from boundaryvaluediffeq.jl.

ChrisRackauckas avatar ChrisRackauckas commented on June 19, 2024

I could write an MWE but at this point I think our use case should be just added to your test suite? It keeps failing so often and it's not too complex.

That would be good yes. It sounds like we're missing something.

from boundaryvaluediffeq.jl.

mateuszbaran avatar mateuszbaran commented on June 19, 2024

Here is a full independent example:

using BoundaryValueDiffEq

struct EmbeddedTorus
    R::Float64
    r::Float64
end

function affine_connection!(M::EmbeddedTorus, Zc, i, a, Xc, Yc)
    θ = a[1] .+ i[1]
    sinθ, cosθ = sincos(θ)
    Γ¹₂₂ = (M.R + M.r * cosθ) * sinθ / M.r
    Γ²₁₂ = -M.r * sinθ / (M.R + M.r * cosθ)

    Zc[1] = Xc[2] * Γ¹₂₂ * Yc[2]
    Zc[2] = Γ²₁₂ * (Xc[1] * Yc[2] + Xc[2] * Yc[1])
    return Zc
end

M = EmbeddedTorus(3, 2)
a1 = [0.5, -1.2]
a2 = [-0.5, 0.3]
i = (0, 0)
solver=MIRK4()
dt=0.05
tspan = (0.0, 1.0)
function bc1!(residual, u, p, t)
    mid = div(length(u[1]), 2)
    residual[1:mid] = u[1][1:mid] - a1
    return residual[(mid + 1):end] = u[end][1:mid] - a2
end
function chart_log_problem!(du, u, params, t)
    M, i = params
    mid = div(length(u), 2)
    a = u[1:mid]
    dx = u[(mid + 1):end]
    ddx = similar(dx)
    affine_connection!(M, ddx, i, a, dx, dx)
    ddx .*= -1
    du[1:mid] .= dx
    du[(mid + 1):end] .= ddx
    return du
end
u0 = [vcat(a1, zero(a1)), vcat(a2, zero(a1))]
bvp1 = BVProblem(chart_log_problem!, bc1!, u0, tspan, (M, i))
sol1 = solve(bvp1, solver, dt=dt)

I get the error locally with

  [4fba245c] ArrayInterface v7.6.1
  [764a87c0] BoundaryValueDiffEq v5.5.0
  [2b5f629d] DiffEqBase v6.143.0
  [459566f4] DiffEqCallbacks v2.35.0
⌃ [1dea7af3] OrdinaryDiffEq v6.59.3
⌅ [731186ca] RecursiveArrayTools v2.38.10

from boundaryvaluediffeq.jl.

avik-pal avatar avik-pal commented on June 19, 2024

@mateuszbaran I will add this in our test suite. What is ddx supposed to be in affine_connection!(M, ddx, i, a, dx, dx)?

from boundaryvaluediffeq.jl.

mateuszbaran avatar mateuszbaran commented on June 19, 2024

Thanks! This is essentially the geodesic equation on a torus in R^3, see https://en.wikipedia.org/wiki/Geodesic#Affine_geodesics . ddx is the second derivative in that equation. I'm using BoundaryValueDiffEq.jl to find the shortest geodesic between two points.

from boundaryvaluediffeq.jl.

avik-pal avatar avik-pal commented on June 19, 2024

I meant is ddx = zeros(2)? it is missing in the code

from boundaryvaluediffeq.jl.

mateuszbaran avatar mateuszbaran commented on June 19, 2024

ddx is filled by affine_connection!(M::EmbeddedTorus, Zc, i, a, Xc, Yc), where it's called Zc.

from boundaryvaluediffeq.jl.

mateuszbaran avatar mateuszbaran commented on June 19, 2024

Ah, sorry, I understand now what you mean. It was supposed to be ddx = similar(dx). I've fixed that and tried re-running the example and now I get

Arrays with non-number element types, such as
`Array{Array{Float64}}`, are not supported by the
solvers.

which I guess is a breaking change introduced at some point recently without making a breaking release?

from boundaryvaluediffeq.jl.

avik-pal avatar avik-pal commented on June 19, 2024

I am fixing that. Basically the order of fixes will be:

  1. Upper Bound DiffEqBase and Patch a few failures in #152
  2. Then we release #152. The new way for initial guess will be VectorOfArray(...)

from boundaryvaluediffeq.jl.

mateuszbaran avatar mateuszbaran commented on June 19, 2024

I see, thanks!

from boundaryvaluediffeq.jl.

avik-pal avatar avik-pal commented on June 19, 2024

@mateuszbaran I will also add a downstream test on Manifolds.jl. Is there a particular group I should test https://github.com/JuliaManifolds/Manifolds.jl/blob/b2d83b337e214158f64d22a39776b9a80ffd2981/test/utils.jl#L4 for boundaryvaluediffeq?

from boundaryvaluediffeq.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.