diff --git a/.travis.yml b/.travis.yml index 32929c0d00..6e760e1992 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,9 @@ git: ## uncomment the following lines to override the default test script #script: -# - julia -e 'Pkg.clone(pwd()); Pkg.build("SciCompDSL"); Pkg.test("SciCompDSL"; coverage=true)' +# - julia -e 'Pkg.clone(pwd()); Pkg.build("ModelingToolkit"); Pkg.test("ModelingToolkit"; coverage=true)' after_success: # push coverage results to Coveralls - - julia -e 'cd(Pkg.dir("SciCompDSL")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' + - julia -e 'cd(Pkg.dir("ModelingToolkit")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' # push coverage results to Codecov - - julia -e 'cd(Pkg.dir("SciCompDSL")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' + - julia -e 'cd(Pkg.dir("ModelingToolkit")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' diff --git a/LICENSE.md b/LICENSE.md index a29010a26d..30798c950d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -The SciCompDSL.jl package is licensed under the MIT "Expat" License: +The ModelingToolkit.jl package is licensed under the MIT "Expat" License: > Copyright (c) 2018: Christopher Rackauckas. > diff --git a/README.md b/README.md index 5f67f7da02..d76e0e61d1 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# SciCompDSL.jl +# ModelingToolkit.jl -[![Build Status](https://travis-ci.org/JuliaDiffEq/SciCompDSL.jl.svg?branch=master)](https://travis-ci.org/JuliaDiffEq/SciCompDSL.jl) -[![Coverage Status](https://coveralls.io/repos/JuliaDiffEq/SciCompDSL.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/JuliaDiffEq/SciCompDSL.jl?branch=master) -[![codecov.io](http://codecov.io/github/JuliaDiffEq/SciCompDSL.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaDiffEq/SciCompDSL.jl?branch=master) +[![Build Status](https://travis-ci.org/JuliaDiffEq/ModelingToolkit.jl.svg?branch=master)](https://travis-ci.org/JuliaDiffEq/ModelingToolkit.jl) +[![Coverage Status](https://coveralls.io/repos/JuliaDiffEq/ModelingToolkit.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/JuliaDiffEq/ModelingToolkit.jl?branch=master) +[![codecov.io](http://codecov.io/github/JuliaDiffEq/ModelingToolkit.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaDiffEq/ModelingToolkit.jl?branch=master) -SciCompDSL.jl is an intermediate representation (IR) of computational graphs +ModelingToolkit.jl is an intermediate representation (IR) of computational graphs for scientific computing problems. Its purpose is to be a common target for modeling DSLs in order to allow for a common platform for model inspection and transformation. It uses a tagged variable IR in order to allow specification of @@ -25,7 +25,7 @@ system, we need to differentiate between our dependent variables, independent variables, and parameters. Therefore we label them as follows: ```julia -using SciCompDSL +using ModelingToolkit # Define some variables @IVar t @@ -57,7 +57,7 @@ This can then generate the function. For example, we can see the generated code via: ```julia -SciCompDSL.generate_ode_function(de) +ModelingToolkit.generate_ode_function(de) ## Which returns: :((du, u, p, t)->begin @@ -100,14 +100,14 @@ eqs = [0 ~ σ*(y-x), 0 ~ x*(ρ-z)-y, 0 ~ x*y - β*z] ns = NonlinearSystem(eqs) -nlsys_func = SciCompDSL.generate_nlsys_function(ns) +nlsys_func = ModelingToolkit.generate_nlsys_function(ns) ``` which generates: ```julia -(du, u, p)->begin # C:\Users\Chris\.julia\v0.6\SciCompDSL\src\systems.jl, line 51: - begin # C:\Users\Chris\.julia\v0.6\SciCompDSL\src\utils.jl, line 2: +(du, u, p)->begin # C:\Users\Chris\.julia\v0.6\ModelingToolkit\src\systems.jl, line 51: + begin # C:\Users\Chris\.julia\v0.6\ModelingToolkit\src\utils.jl, line 2: y = u[1] x = u[2] z = u[3] @@ -131,7 +131,7 @@ f2 = (du,u) -> f(du,u,(10.0,26.0,2.33)) ## Core Principles -The core idea behind SciCompDSL.jl is that mathematical equations require +The core idea behind ModelingToolkit.jl is that mathematical equations require context, and thus any symbolic manipulations and full model specifications requires the ability to handle such context. When writing DSLs, this fact comes to light very quickly. Every DSL seems to lower to some intermediate @@ -255,7 +255,7 @@ to better scale to larger systems. You can define derivatives for your own function via the dispatch: ```julia -SciCompDSL.Derivative(::typeof(my_function),args,::Type{Val{i}}) +ModelingToolkit.Derivative(::typeof(my_function),args,::Type{Val{i}}) ``` where `i` means that it's the derivative of the `i`th argument. `args` is the @@ -265,7 +265,7 @@ You should return an `Operation` for the derivative of your function. For example, `sin(t)`'s derivative (by `t`) is given by the following: ```julia -SciCompDSL.Derivative(::typeof(sin),args,::Type{Val{1}}) = cos(args[1]) +ModelingToolkit.Derivative(::typeof(sin),args,::Type{Val{1}}) = cos(args[1]) ``` ### Macro-free Usage @@ -306,14 +306,14 @@ eqs = [a ~ y-x, 0 ~ x*(ρ-z)-y, 0 ~ x*y - β*z] ns = NonlinearSystem(eqs,[x,y,z],[σ,ρ,β]) -nlsys_func = SciCompDSL.generate_nlsys_function(ns) +nlsys_func = ModelingToolkit.generate_nlsys_function(ns) ``` expands to: ```julia -:((du, u, p)->begin # C:\Users\Chris\.julia\v0.6\SciCompDSL\src\systems.jl, line 85: - begin # C:\Users\Chris\.julia\v0.6\SciCompDSL\src\utils.jl, line 2: +:((du, u, p)->begin # C:\Users\Chris\.julia\v0.6\ModelingToolkit\src\systems.jl, line 85: + begin # C:\Users\Chris\.julia\v0.6\ModelingToolkit\src\utils.jl, line 2: x = u[1] y = u[2] z = u[3] diff --git a/appveyor.yml b/appveyor.yml index 0e4bd57e9d..df71c9bf54 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,7 +41,7 @@ build_script: # Need to convert from shallow to complete for Pkg.clone to work - IF EXIST .git\shallow (git fetch --unshallow) - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"SciCompDSL\"); Pkg.build(\"SciCompDSL\")" + Pkg.clone(pwd(), \"ModelingToolkit\"); Pkg.build(\"ModelingToolkit\")" test_script: - - C:\projects\julia\bin\julia -e "Pkg.test(\"SciCompDSL\")" + - C:\projects\julia\bin\julia -e "Pkg.test(\"ModelingToolkit\")" diff --git a/src/SciCompDSL.jl b/src/ModelingToolkit.jl similarity index 97% rename from src/SciCompDSL.jl rename to src/ModelingToolkit.jl index fe0c581072..a26d04563a 100644 --- a/src/SciCompDSL.jl +++ b/src/ModelingToolkit.jl @@ -1,4 +1,4 @@ -module SciCompDSL +module ModelingToolkit using DiffEqBase import MacroTools: splitdef, combinedef diff --git a/test/ambiguity.jl b/test/ambiguity.jl index 24572bd1b0..e640fcdab7 100644 --- a/test/ambiguity.jl +++ b/test/ambiguity.jl @@ -1,4 +1,4 @@ -using SciCompDSL +using ModelingToolkit using Base.Test @IVar t diff --git a/test/basic_variables_and_operations.jl b/test/basic_variables_and_operations.jl index e246514847..e505fbf1a0 100644 --- a/test/basic_variables_and_operations.jl +++ b/test/basic_variables_and_operations.jl @@ -1,4 +1,4 @@ -using SciCompDSL +using ModelingToolkit using Base.Test @IVar t diff --git a/test/derivatives.jl b/test/derivatives.jl index dfb96dc02d..13f584bf1d 100644 --- a/test/derivatives.jl +++ b/test/derivatives.jl @@ -1,4 +1,4 @@ -using SciCompDSL +using ModelingToolkit using Base.Test # Derivatives @@ -30,7 +30,7 @@ eqs = [0 ~ σ*(y-x), 0 ~ x*(ρ-z)-y, 0 ~ x*y - β*z] sys = NonlinearSystem(eqs,[x,y,z],[σ,ρ,β]) -jac = SciCompDSL.calculate_jacobian(sys) +jac = ModelingToolkit.calculate_jacobian(sys) @test jac[1,1] == σ*-1 @test jac[1,2] == σ @test jac[1,3] == 0 diff --git a/test/internal.jl b/test/internal.jl index 36c3392870..0dcf296f94 100644 --- a/test/internal.jl +++ b/test/internal.jl @@ -1,4 +1,4 @@ -using SciCompDSL +using ModelingToolkit using Base.Test # `Expr`, `Number` -> `Operation` diff --git a/test/runtests.jl b/test/runtests.jl index 1d0cd114c8..51cc072cc0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using SciCompDSL, Base.Test +using ModelingToolkit, Base.Test @testset "Parsing Test" begin include("variable_parsing.jl") end @testset "Basic Variables and Operations" begin include("basic_variables_and_operations.jl") end diff --git a/test/system_construction.jl b/test/system_construction.jl index a330abdded..be196eeb4b 100644 --- a/test/system_construction.jl +++ b/test/system_construction.jl @@ -1,4 +1,4 @@ -using SciCompDSL +using ModelingToolkit using Base.Test # Define some variables @@ -14,9 +14,9 @@ eqs = [D*x ~ σ*(y-x), D*y ~ x*(ρ-z)-y, D*z ~ x*y - β*z] de = DiffEqSystem(eqs,[t],[x,y,z],Variable[],[σ,ρ,β]) -SciCompDSL.generate_ode_function(de) -jac_expr = SciCompDSL.generate_ode_jacobian(de) -jac = SciCompDSL.calculate_jacobian(de) +ModelingToolkit.generate_ode_function(de) +jac_expr = ModelingToolkit.generate_ode_jacobian(de) +jac = ModelingToolkit.calculate_jacobian(de) f = DiffEqFunction(de) W = I - jac simplify_constants.(inv(W)) @@ -65,8 +65,8 @@ eqs = [a ~ y-x, D*y ~ x*(ρ-z)-y, D*z ~ x*y - β*z] de = DiffEqSystem(eqs,[t],[x,y,z],[a],[σ,ρ,β]) -SciCompDSL.generate_ode_function(de) -jac = SciCompDSL.calculate_jacobian(de) +ModelingToolkit.generate_ode_function(de) +jac = ModelingToolkit.calculate_jacobian(de) f = DiffEqFunction(de) # Define a nonlinear system @@ -81,7 +81,7 @@ for el in (:vs, :ps) @test names2 == names end -SciCompDSL.generate_nlsys_function(ns) +ModelingToolkit.generate_nlsys_function(ns) # Now nonlinear system with only variables @Var x y z @@ -92,8 +92,8 @@ eqs = [0 ~ σ*(y-x), 0 ~ x*(ρ-z)-y, 0 ~ x*y - β*z] ns = NonlinearSystem(eqs) -nlsys_func = SciCompDSL.generate_nlsys_function(ns) -jac = SciCompDSL.generate_nlsys_jacobian(ns) +nlsys_func = ModelingToolkit.generate_nlsys_function(ns) +jac = ModelingToolkit.generate_nlsys_jacobian(ns) f = @eval eval(nlsys_func) # Intermediate calculations @@ -103,6 +103,6 @@ eqs = [a ~ y-x, 0 ~ x*(ρ-z)-y, 0 ~ x*y - β*z] ns = NonlinearSystem(eqs,[x,y,z],[σ,ρ,β]) -nlsys_func = SciCompDSL.generate_nlsys_function(ns) -jac = SciCompDSL.calculate_jacobian(ns) -jac = SciCompDSL.generate_nlsys_jacobian(ns) +nlsys_func = ModelingToolkit.generate_nlsys_function(ns) +jac = ModelingToolkit.calculate_jacobian(ns) +jac = ModelingToolkit.generate_nlsys_jacobian(ns) diff --git a/test/variable_parsing.jl b/test/variable_parsing.jl index 1e8617c28b..c94a2926be 100644 --- a/test/variable_parsing.jl +++ b/test/variable_parsing.jl @@ -1,4 +1,4 @@ -using SciCompDSL +using ModelingToolkit using Base.Test @Var a=1.0 b