From 56c51c7476beeab5f1b701da8339f9bc1422cd52 Mon Sep 17 00:00:00 2001 From: Dominic Steinitz Date: Sun, 8 Apr 2018 10:38:59 +0100 Subject: Tidy and add picture --- packages/sundials/hmatrix-sundials.cabal | 9 +++++---- packages/sundials/src/Main.hs | 12 ++++++------ packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs | 18 ++---------------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/packages/sundials/hmatrix-sundials.cabal b/packages/sundials/hmatrix-sundials.cabal index 53afa58..5aa4373 100644 --- a/packages/sundials/hmatrix-sundials.cabal +++ b/packages/sundials/hmatrix-sundials.cabal @@ -1,16 +1,17 @@ name: hmatrix-sundials version: 0.1.0.0 --- synopsis: --- description: +synopsis: hmatrix interface to sundials +description: Foo bar baz homepage: https://github.com/idontgetoutmuch/hmatrix/tree/sundials license: BSD3 license-file: LICENSE author: Dominic Steinitz maintainer: dominic@steinitz.org --- copyright: +copyright: Dominic Steinitz 2018, Novadiscovery 2018 category: Math build-type: Simple -extra-source-files: ChangeLog.md +extra-source-files: ChangeLog.md, README.md, diagrams/*.png +extra-doc-files: diagrams/*.png cabal-version: >=1.10 diff --git a/packages/sundials/src/Main.hs b/packages/sundials/src/Main.hs index 6d6a397..ac19e7f 100644 --- a/packages/sundials/src/Main.hs +++ b/packages/sundials/src/Main.hs @@ -133,17 +133,17 @@ main = do -- putStrLn $ show res -- putStrLn $ butcherTableauTex res - let res1 = odeSolve' (SDIRK_5_3_4 brussJac) brusselator [1.2, 3.1, 3.0] (fromList [0.0, 0.1 .. 10.0]) + let res1 = odeSolve brusselator [1.2, 3.1, 3.0] (fromList [0.0, 0.1 .. 10.0]) renderRasterific "diagrams/brusselator.png" (D.dims2D 500.0 500.0) (renderAxis $ lSaxis $ [0.0, 0.1 .. 10.0]:(toLists $ tr res1)) - let res1a = odeSolve' (SDIRK_5_3_4') brusselator [1.2, 3.1, 3.0] (fromList [0.0, 0.1 .. 10.0]) + let res1a = odeSolve brusselator [1.2, 3.1, 3.0] (fromList [0.0, 0.1 .. 10.0]) renderRasterific "diagrams/brusselatorA.png" (D.dims2D 500.0 500.0) (renderAxis $ lSaxis $ [0.0, 0.1 .. 10.0]:(toLists $ tr res1a)) - let res2 = odeSolve' (SDIRK_5_3_4 stiffJac) stiffish [0.0] (fromList [0.0, 0.1 .. 10.0]) + let res2 = odeSolve stiffish [0.0] (fromList [0.0, 0.1 .. 10.0]) putStrLn $ show res2 renderRasterific "diagrams/stiffish.png" (D.dims2D 500.0 500.0) @@ -153,17 +153,17 @@ main = do putStrLn "Lower tolerances" putStrLn $ show res2a - let res3 = odeSolve' (SDIRK_5_3_4 lorenzJac) lorenz [-5.0, -5.0, 1.0] (fromList [0.0, 0.01 .. 10.0]) + let res3 = odeSolve lorenz [-5.0, -5.0, 1.0] (fromList [0.0, 0.01 .. 10.0]) putStrLn $ show $ last ((toLists $ tr res3)!!0) - let res3 = odeSolve' (SDIRK_5_3_4') lorenz [-5.0, -5.0, 1.0] (fromList [0.0, 0.01 .. 10.0]) + let res3 = odeSolve lorenz [-5.0, -5.0, 1.0] (fromList [0.0, 0.01 .. 10.0]) putStrLn $ show $ last ((toLists $ tr res3)!!0) renderRasterific "diagrams/lorenz.png" (D.dims2D 500.0 500.0) (renderAxis $ kSaxis $ zip ((toLists $ tr res3)!!0) ((toLists $ tr res3)!!1)) - let res3a = odeSolve' (SDIRK_5_3_4') lorenz [-5.0, -5.0, 1.0] (fromList [0.0, 0.01 .. 10.0]) + let res3a = odeSolve lorenz [-5.0, -5.0, 1.0] (fromList [0.0, 0.01 .. 10.0]) renderRasterific "diagrams/lorenzA.png" (D.dims2D 500.0 500.0) (renderAxis $ kSaxis $ zip ((toLists $ tr res3)!!0) ((toLists $ tr res3a)!!1)) diff --git a/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs b/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs index 8f83fe7..2577b8e 100644 --- a/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs +++ b/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs @@ -35,6 +35,8 @@ -- main = mplot (ts : toColumns sol) -- @ -- +-- <> +-- -- KVAERNO_4_2_3 -- -- \[ @@ -70,7 +72,6 @@ module Numeric.Sundials.ARKode.ODE ( odeSolve , odeSolveV , odeSolveVWith - , odeSolve' , getButcherTable , getBT , btGet @@ -244,21 +245,6 @@ odeSolve f y0 ts = nC = length y0 g t x0 = V.fromList $ f t (V.toList x0) -odeSolve' :: ODEMethod - -> (Double -> [Double] -> [Double]) -- ^ The RHS of the system \(\dot{y} = f(t,y)\) - -> [Double] -- ^ initial conditions - -> Vector Double -- ^ desired solution times - -> Matrix Double -- ^ solution -odeSolve' method f y0 ts = - case odeSolveVWith method (XX' 1.0e-6 1.0e-10 1 1) g (V.fromList y0) (V.fromList $ toList ts) of - Left c -> error $ show c -- FIXME - Right (v, d) -> trace (show d) $ (nR >< nC) (V.toList v) - where - us = toList ts - nR = length us - nC = length y0 - g t x0 = V.fromList $ f t (V.toList x0) - odeSolveVWith :: ODEMethod -> StepControl -- cgit v1.2.3