1 function errmax=wind2flux_test
6 X = uniform_mesh([nx,ny,nz],hh);
8 Usize = grad3z(zeros(size(X{1})-1),h,1);
13 Uconst{i} = 0*Usize{i}+c(i);
18 fprintf('mesh size %g %g %g max error %g\n',nx,ny,nz,errmax)
20 function testing_wind(U)
24 disp('divergence zero except at the bottom')
27 maxh = max(X{3}(:))-hh(3);
29 disp('terrain slope in x direction')
30 disp('divergence zero except at the bottom')
31 thx = 0.1*hh(1)*[0:nx]'*ones(1,ny+1);
32 thx = thx/max(thx(:))*maxh;
35 disp('terrain slope in y direction')
36 disp('divergence zero except at the bottom')
37 thy = 0.1*hh(2)*ones(nx+1,1)*[0:ny];
38 thy = thy/max(thy(:))*maxh;
41 disp('terrain slope in random constant direction')
42 thxy = rand*thx + rand*thy;
43 thxy = thxy/max(thxy(:))*maxh;
46 disp('roof slope in x direction')
48 xs=hh(1)*[0:half,half-1:-1:2*half-nx];
54 disp('roof slope in y direction')
57 ys=hh(2)*[0:half,half-1:-1:2*half-ny];
59 th = th/max(th(:))*maxh;
62 disp('pyramid roof slope')
65 [ii,jj]=ndgrid(xs,ys);
66 th = nx+ny-abs(ii-nx/2)-abs(jj-ny/2);
67 th = th/max(th(:))*maxh;
70 disp('random terrain')
71 th = min(hh)*0.1*rand(size(X{1}(:,:,1)));
72 th = th/max(th(:))*maxh;
75 function test_terrain(t)
76 XX=add_terrain_to_mesh(X, t, 'shift');
78 XX=add_terrain_to_mesh(X, t, 'compress');
81 function test_divergence
84 disp('divergence zero except at the bottom')
85 err=big(d(:,:,2:end));
86 fprintf('err=%g\n',err)
87 errmax=max(errmax,err)