1 {- 2 Diffusion matrix 3 4 XZ, 24/10/91 5 -} 6 7 {- 8 Modified to adopt S_array 9 10 The way in which the matrix is constructed has been 11 changed. 12 13 XZ, 19/2/92 14 -} 15 16 module S_matrix ( s_mat ) where 17 18 import Defs 19 import S_Array -- not needed w/ proper module handling 20 import Norm -- ditto 21 22 ----------------------------------------------------------- 23 -- Diffusion matrix. -- 24 -- Used in assembling rh1. -- 25 -- Parameters: -- 26 -- gdij : jth entry of ith element factor component -- 27 ----------------------------------------------------------- 28 29 s_mat 30 :: My_Array Int (((Frac_type,Frac_type,Frac_type), 31 (Frac_type,Frac_type,Frac_type)) -> [Frac_type]) 32 s_mat = 33 s_listArray (1,v_nodel) 34 [ 35 \u -> cons u [f11,f12,f13,f0,f15,f16], 36 \u -> cons u [f12,f22,f23,f24,f0,f16], 37 \u -> cons u [f13,f23,f33,f24,f15,f0], 38 \u -> cons u [f0,f24,f24,f44,f45,f46], 39 \u -> cons u [f15,f0,f15,f45,f55,f56], 40 \u -> cons u [f16,f16,f0,f46,f56,f66] 41 ] 42 where 43 s1 = \(x,_,_) -> x 44 s2 = \(_,y,_) -> y 45 s3 = \(_,_,z) -> z 46 ff1 = \x y u v -> x*y+u*v 47 ff2 = \x y u v -> (ff2' x y) + (ff2' u v) 48 where ff2' = \x y -> x*(x+y)+y*y 49 ff3 = \x y z u v w -> (ff3' x y z) + (ff3' u v w) 50 where ff3' = \x y z -> x*y+(x+z)*(y+z) 51 cons = \u -> map (\f->f u) 52 f0 = \x -> 0 53 f11 (x,y) = 3 * ( ff1 c1 c1 c2 c2 ) 54 where 55 c1 = s1 x 56 c2 = s1 y 57 f12 = \(x,y) -> - ( ff1 (s1 x) (s2 x) (s1 y) (s2 y) ) 58 f13 = \(x,y) -> - ( ff1 (s1 x) (s3 x) (s1 y) (s3 y) ) 59 f15 = \x -> (-4) * (f13 x) 60 f16 = \x -> (-4) * (f12 x) 61 f22 (x,y) = 3 * ( ff1 c1 c1 c2 c2 ) 62 where 63 c1 = s2 x 64 c2 = s2 y 65 f23 = \(x,y) -> - ( ff1 (s2 x) (s3 x) (s2 y) (s3 y) ) 66 f24 = \x -> (-4) * (f23 x) 67 f33 (x,y) = 3 * ( ff1 c1 c1 c2 c2 ) 68 where 69 c1 = s3 x 70 c2 = s3 y 71 f44 = \(x,y) -> 8 * ( ff2 (s2 x) (s3 x) (s2 y) (s3 y) ) 72 f45 = \(x,y)->4*(ff3 (s1 x) (s2 x) (s3 x) (s1 y) (s2 y) (s3 y)) 73 f46 = \(x,y)->4*(ff3 (s1 x) (s3 x) (s2 x) (s1 y) (s3 y) (s2 y)) 74 f55 = \(x,y) -> 8 * ( ff2 (s1 x) (s3 x) (s1 y) (s3 y) ) 75 f56 = \(x,y)->4*(ff3 (s2 x) (s3 x) (s1 x) (s2 y) (s3 y) (s1 y)) 76 f66 = \(x,y) -> 8 * ( ff2 (s1 x) (s2 x) (s1 y) (s2 y) )