compare_fire_area.m also diffs ros
[wrf-fire-matlab.git] / quicwind / wind2flux_trans_test.m
blob2a1f7a15dcec5e649744156199409132af891f10
1 function err=wind2flux_trans_test
2 nx=50; ny=30; nz=10;
3 h=rand(1,3);
4 X = regular_mesh([nx,ny,nz],h,1.2);
5 X = add_terrain_to_mesh(X,'hill','squash',0.1);
7 % random test winds
8 U = grad3z(rand(size(X{1})-1),[1 1 1]); 
9 V = grad3z(rand(size(X{1})-1),[1 1 1]);
11 % Test that <Mu,v>=<u,M^Tv>
12 rhs = aprod3(wind2flux(U,X),V);
13 lhs = aprod3(U,wind2flux_trans(V,X));
14 err = big(rhs-lhs);
15 end
17 function a=aprod(x,y)
18     a = dot(x(:),y(:));
19 end
21 function a=aprod3(x,y)
22     a = aprod(x{1},y{1})+aprod(x{2},y{2})+aprod(x{3},y{3});
23 end