1 %test for vertical_sweeps
4 % test for vertical_sweeps
15 X = regular_mesh(nel,h,expand);
16 % X = add_terrain_to_mesh(X, 'hill', 'shift', 0.1)
17 X = add_terrain_to_mesh(X, 'hill', 'squash', 0.1) % more thorough testing
21 % assemble sparse system matrix
22 [K,F,~] = sparse_assembly(A,X,u0,lambda,params);
28 K_1=nd_assembly(A,X,lambda,params);
29 [n1,n2,n3,m1,m2,m3]=size(K_1);
30 K27 = reshape(K_1,n1,n2,n3,m1*m2*m3); % make to n x 27 nd format
31 K14 = ndt_convert(K27,14);
33 % test same results for ndt_mult from matlab and fortran
34 if exist('fortran/sweeps_test.exe')
35 disp('testing if same result in fortran')
36 err=sweeps_fortran(K,K14,n1,n2,n3,F,X,x)
38 fprintf('error %g OK\n',err)
40 error(sprintf('error %g too large',err))
43 warning('fortran/sweeps_test.exe not available')