1 % number of cells and spacing
4 fprintf('linear array of %ix%ix%i cells\n',n(1),n(2),n(3))
7 % number of dof per cell
11 X = regular_mesh(n,h,1);
12 X = add_terrain_to_mesh(X,'hill','squash',0.1);
14 xx = CX{1}; yy = CX{2}; zz = CX{3};
17 v0 = zeros(factor*prod(n),1);
19 s=(e-1)*factor+1:e*factor; % span of local dofs
24 % create continuity and ground flux conditions
27 % static cell matrices
30 0,0,0,0,.5,.5]; % matrix of interpolated winds at the center of the cells
31 D = ones(1,factor); % diverge operator
33 % moduli for penalization
35 % initialize resulting wind
36 Pf = sparse(factor*prod(n),factor*prod(n));
37 v = zeros(factor*prod(n),1);
38 % solve mass-consistent using 3D indexing
42 ind = sub2ind(n,i,j,k);
43 s=(ind-1)*factor+1:ind*factor;
44 [A,B] = cell_A_B(h(1),h(2),X{3},i,j,k,moduli);
45 Pf(s,s) = cell_P(A,B,D);