Giter Site home page Giter Site logo

sciml / diffeqproblemlibrary.jl Goto Github PK

View Code? Open in Web Editor NEW
54.0 8.0 34.0 729 KB

A library of premade problems for examples and testing differential equation solvers and other SciML scientific machine learning tools

License: Other

Julia 100.00%
differentialequations differential-equations ode dae dde sde stochastic-differential-equations neural-ode neural-differential-equations sciml

diffeqproblemlibrary.jl's Introduction

DiffEqProblemLibrary.jl

Build Status SciML Code Style

DiffEqProblemLibrary.jl is a component package in the DifferentialEquations ecosystem. It contains premade problems for the differential equations solvers. These can either be used as tests or as examples to show how to use the the solvers. Check out the problems in the src directory. Users interested in using this functionality should check out DifferentialEquations.jl.

diffeqproblemlibrary.jl's People

Contributors

anandijain avatar arnostrouwen avatar asinghvi17 avatar avik-pal avatar chrisrackauckas avatar christopher-dg avatar dependabot[bot] avatar devmotion avatar edelmanjonathan avatar erikqqy avatar femtocleaner[bot] avatar frankschae avatar gaurav-arya avatar github-actions[bot] avatar hellmrf avatar isaacsas avatar juliatagbot avatar kanav99 avatar lilithhafner avatar mforets avatar miguelraz avatar mseeker1340 avatar nathanaelbosch avatar ranocha avatar scottpjones avatar staticfloat avatar thazhemadam avatar xtalax avatar yingboma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

diffeqproblemlibrary.jl's Issues

Switch to JLD2

Lately it was difficult to test DelayDiffEq on Windows 32bit, since we often got HDF5 build errors (see SciML/DelayDiffEq.jl#17 (comment)). At least for DelayDiffEq, the dependency on HDF5 originates from DiffEqProblemLibrary, and in particular from its requirement JLD. Maybe it would be a good idea to switch to JLD2 which does not depend on the HDF5 C library?

Incremental compilation may be fatally broken for this module

I don't know how the current version of DiffEqProblemLibrary should be used in my package. If I run

using TestImports

for the following MWE

module TestImports

using DiffEqProblemLibrary.DDEProblemLibrary

DDEProblemLibrary.importddeproblems()

@show DDEProblemLibrary.prob_dde_constant_1delay_ip

end # module

with DiffEqProblemLibrary as only dependency, I get a lot of

  ** incremental compilation may be fatally broken for this module ** 

warnings, finally resulting in a segfault:

signal (11): Segmentation fault
in expression starting at REPL[3]:1
unknown function (ip: 0x7f6bafeb964f)
jl_deserialize_datatype at /buildworker/worker/package_linux64/build/src/dump.c:1343 [inlined]
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2160
jl_deserialize_value_svec at /buildworker/worker/package_linux64/build/src/dump.c:1479 [inlined]
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2008
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:1456
jl_deserialize_value_svec at /buildworker/worker/package_linux64/build/src/dump.c:1479 [inlined]
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2008
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:1456
jl_deserialize_value_any at /buildworker/worker/package_linux64/build/src/dump.c:1932 [inlined]
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2163
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:1784
jl_deserialize_value_array at /buildworker/worker/package_linux64/build/src/dump.c:1544
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2029
_jl_restore_incremental at /buildworker/worker/package_linux64/build/src/dump.c:3159
jl_restore_incremental at /buildworker/worker/package_linux64/build/src/dump.c:3218
_include_from_serialized at ./loading.jl:669
_require_from_serialized at ./loading.jl:736
_require at ./loading.jl:1023
require at ./loading.jl:911
require at ./loading.jl:906
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1614 [inlined]
call_require at /buildworker/worker/package_linux64/build/src/toplevel.c:399 [inlined]
eval_import_path at /buildworker/worker/package_linux64/build/src/toplevel.c:436
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:656
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:764
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:844
eval at ./boot.jl:330
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2191
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:86
run_backend at /home/david/.julia/packages/Revise/JCJHO/src/Revise.jl:953
#77 at ./task.jl:268
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1614 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:596
unknown function (ip: 0xffffffffffffffff)
Allocations: 12720233 (Pool: 12717515; Big: 2718); GC: 26
zsh: segmentation fault (core dumped)  $HOME/opt/julia-1.2.0/bin/julia

After replacing module DDEProblemLibrary... end with

export importddeproblems
function importddeproblems()
  include(joinpath(@__DIR__, "dde/dde_premade_problems.jl"))
  nothing
end

and wrapping everything in dde_premade_problems.jl inside of a module DDEProblemLibrary + removing the deprecations in that file, and using

module TestImports

using DiffEqProblemLibrary

importddeproblems()

using DiffEqProblemLibrary.DDEProblemLibrary

@show DDEProblemLibrary.prob_dde_constant_1delay_ip

end # module

I can successfully run

julia> using TestImports                                                       
DDEProblemLibrary.prob_dde_constant_1delay_ip = DDEProblem with uType Array{Float64,1} and tType Float64. In-place: true
timespan: (0.0, 10.0)           
u0: [1.0]                                                                                                                           

However, unfortunately that's not a general solution since the same changes do not work for ODEProblemLibrary due to some evaluations of ModelingToolkit.

So I started to believe that the cleanest solution might actually be to break this package up into different packages such as (DiffEq)ODEProblemLibrary, (DiffEq)DDEProblemLibrary, and so on. Then there's no need for any optional evaluations anymore and (hopefully) everything should work as intended. Also, it would probably reduce the amount and interactions of dependencies which might sometimes be an issue, as we saw in the case of HomotopyContinuation in DiffEqBase.

Split into subpackages?

Would it be possible to move the submodules into separate packages, possibly in this repo? I still manage to hit pre-compilation/module loading issues with the current setup (a while ago: #51), and the current setup with importodeproblems() etc. that cause evaluation into the submodules is arguably a bit ugly. Personally I think it would be much nicer to be able to just write using DDEProblemLibrary instead of

using DiffEqProblemLibrary.DDEProblemLibrary
DDEProblemLibrary.importddeproblems()

Typo in the `vanstiff` docstring

The ODEs in the docstrings of prob_ode_vanderpol and prob_ode_vanstiff are not the same, even though both use the same van function.

If the problem is correctly defined, then line 83

\\frac{dy}{dt} = μ(1-x^2)y -x

should be changed to be the same as line 67
\\frac{dy}{dt} = μ((1-x^2)y -x)

I'll open a PR right away.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Vectorized Bruss

 kernel_u! = let N=N, xyd=xyd_brusselator, dx=step(xyd_brusselator)
    @inline function (du, u, A, B, α, II, I, t)
      i, j = Tuple(I)
      x = xyd[I[1]]
      y = xyd[I[2]]
      ip1 = limit(i+1, N); im1 = limit(i-1, N)
      jp1 = limit(j+1, N); jm1 = limit(j-1, N)
      du[II[i,j,1]] = α[II[i,j,1]]*(u[II[im1,j,1]] + u[II[ip1,j,1]] + u[II[i,jp1,1]] + u[II[i,jm1,1]] - 4u[II[i,j,1]])/dx^2 +
      B[II[i,j,1]] + u[II[i,j,1]]^2*u[II[i,j,2]] - (A[II[i,j,1]] + 1)*u[II[i,j,1]] + brusselator_f(x, y, t)
    end
  end
  kernel_v! = let N=N, xyd=xyd_brusselator, dx=step(xyd_brusselator)
    @inline function (du, u, A, B, α, II, I, t)
      i, j = Tuple(I)
      ip1 = limit(i+1, N)
      im1 = limit(i-1, N)
      jp1 = limit(j+1, N)
      jm1 = limit(j-1, N)
      du[II[i,j,2]] = α[II[i,j,2]]*(u[II[im1,j,2]] + u[II[ip1,j,2]] + u[II[i,jp1,2]] + u[II[i,jm1,2]] - 4u[II[i,j,2]])/dx^2 +
      A[II[i,j,1]]*u[II[i,j,1]] - u[II[i,j,1]]^2*u[II[i,j,2]]
    end
  end
  brusselator_2d = let N=N, xyd=xyd_brusselator, dx=step(xyd_brusselator)
    function (du, u, p, t)
      @inbounds begin
        ii1 = N^2
        ii2 = ii1+N^2
        ii3 = ii2+2(N^2)
        A = @view p[1:ii1]
        B = @view p[ii1+1:ii2]
        α = @view p[ii2+1:ii3]
        II = LinearIndices((N, N, 2))
        kernel_u!.(Ref(du), Ref(u), Ref(A), Ref(B), Ref(α), Ref(II), CartesianIndices((N, N)), t)
        kernel_v!.(Ref(du), Ref(u), Ref(A), Ref(B), Ref(α), Ref(II), CartesianIndices((N, N)), t)
        return nothing
      end
    end
  end

Submodules

It would be best to put the different types of problems in submodules, that way we can cut down on the test times.

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.