1 -- 2 -- Patricia Fasel 3 -- Los Alamos National Laboratory 4 -- 1990 August 5 -- 6 module ElecField (elecField) where 7 8 import PicType 9 import Consts 10 import Array--1.3 11 12 -- Phase III: Calculate electric fields 13 -- the x and y components of the electric field are approximated 14 -- by the first partial difference in each dimension 15 16 elecField :: Phi -> Electric 17 elecField phi = 18 (array ((0,0), (n,n)) 19 ([((i,j) , (phi!(i-1,j) - phi!(i,j))) 20 | i <- [1..n], j <- [0..n]]++ 21 [((0,j) , (phi!(n,j) - phi!(0,j))) 22 | j <- [0..n]]), 23 24 array ((0,0), (n,n)) 25 ([((i,j) , (phi!(i,j+1) - phi!(i,j))) 26 | i <- [0..n], j <- [0..(n-1)]]++ 27 [((i,n) , (phi!(i,0) - phi!(i,n)) ) 28 | i <- [0..n]])) 29 where 30 n = nCell-1