From e8f4b336a49d48275a83d5c1ffe101935c62cd6c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 19 Feb 2014 15:36:28 -0500 Subject: [PATCH] Add a FEM.R1 example (should be moved into the tree after being cleaned up). --- examples/fem1.hs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 examples/fem1.hs 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' -- 2.43.2