]> gitweb.michael.orlitzky.com - numerical-analysis.git/commitdiff
Add a FEM.R1 example (should be moved into the tree after being cleaned up).
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 19 Feb 2014 20:36:28 +0000 (15:36 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 19 Feb 2014 20:36:28 +0000 (15:36 -0500)
examples/fem1.hs [new file with mode: 0644]

diff --git a/examples/fem1.hs b/examples/fem1.hs
new file mode 100644 (file)
index 0000000..59d48bb
--- /dev/null
@@ -0,0 +1,39 @@
+module Main
+where
+
+import FEM.R1
+import Linear.Matrix hiding ((*))
+import Naturals
+import Piecewise
+
+big_A' :: Double -> Double
+big_A' = const 1
+
+c' :: Double -> Double
+c' x = sin x
+
+f' :: Double -> Double
+f' x = x*(sin x)
+
+bdy' :: BoundaryConditions Double
+bdy' = Left (Dirichlet (0,1))
+
+
+pde' :: PDE Double
+pde' = PDE big_A' c' f' bdy'
+
+mesh' :: Col4 (Double,Double)
+mesh' = fromList [[(0.0,1/3)],
+                  [(1/3,2/3)],
+                  [(2/3,4/5)],
+                  [(4/5,1.0)]]
+
+pvec' :: Col4 Int
+pvec' = fromList [[2],[3],[2],[1]]
+
+params' :: Params N4 N3 N7 Double
+params' = Params mesh' pvec'
+
+
+soln :: Piecewise Double
+soln = solution pde' params'