SciML / SciMLBase.jl

The Base interface of the SciML ecosystem
https://docs.sciml.ai/SciMLBase/stable
MIT License
118 stars 91 forks source link

Add SecondOrderBVProblem #666

Closed ErikQQY closed 2 months ago

ErikQQY commented 2 months ago

Add a new problem type SecondOrderBVProblem, for those BVPs have the form:

$$ y''(t)=f(t,y(t), y'(t)) $$

with bc:

$$ g(y(a), y(b), y'(a), y'(b))=0 $$

In this case we should define a SecondOrderBVProblem by:

function test(ddu, du, u, p, t)
    ϵ = 0.1
    ddu[1] = u[2]
    ddu[2] = (-u[1]*du[2] - u[3]*du[3])/ϵ
    ddu[3] = (du[1]*u[3] - u[1]*du[3])/ϵ
end

function bc(res, du, u, p, t)
    res[1] = u[1][1]
    res[2] = u[end][1]
    res[3] = u[1][3] + 1
    res[4] = u[end][3] - 1
    res[5] = du[1][1]
    res[6] = du[end][1]
end
u0 = [1.0, 1.0, 1.0]
tspan = (0.0, 1.0)
prob = SecondOrderBVProblem(test, bc, u0, tspan)

also implemented the (MIRKN)Mono-Implicit Runge-Kutta Nystrom method for this kind of problem, will send a PR once this gets merged.

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 44.21053% with 53 lines in your changes are missing coverage. Please review.

Project coverage is 31.55%. Comparing base (7fbd1cf) to head (139522d).

Files Patch % Lines
src/scimlfunctions.jl 50.60% 41 Missing :warning:
src/problems/bvp_problems.jl 0.00% 12 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #666 +/- ## ========================================== + Coverage 31.29% 31.55% +0.26% ========================================== Files 55 55 Lines 4358 4452 +94 ========================================== + Hits 1364 1405 +41 - Misses 2994 3047 +53 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ErikQQY commented 2 months ago

Seems there are still some errors need to be fixed