From: Michael Orlitzky Date: Wed, 19 Feb 2014 20:36:28 +0000 (-0500) Subject: Add a FEM.R1 example (should be moved into the tree after being cleaned up). X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=e8f4b336a49d48275a83d5c1ffe101935c62cd6c;p=numerical-analysis.git Add a FEM.R1 example (should be moved into the tree after being cleaned up). --- diff --git a/examples/fem1.hs b/examples/fem1.hs new file mode 100644 index 0000000..59d48bb --- /dev/null +++ b/examples/fem1.hs @@ -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'