On entry, | , |
or | , |
or | or |
or | or for some and , , |
or | or or for some . |
Open in the MATLAB editor: d06cb_example
function d06cb_example fprintf('d06cb example results\n\n'); edge = zeros(3, 100, 'int64'); coor = zeros(2, 250); % Define boundaries ncirc = 3; % 3 circles nvertices = [40, 30, 30]; radii = [1, 0.49, 0.15]; centres = [0, 0; -0.5, 0; -0.5, 0.65]; % First circle is outer circle csign = 1; i1 = 0; nvb = 0; for icirc = 1:ncirc for i = 0:nvertices(icirc)-1 i1 = i1+1; theta = 2*pi*i/nvertices(icirc); coor(1,i1) = radii(icirc)*cos(theta) + centres(icirc, 1); coor(2,i1) = csign*radii(icirc)*sin(theta) + centres(icirc, 2); edge(1,i1) = i1; edge(2,i1) = i1 + 1; edge(3,i1) = 1; end edge(2,i1) = nvb + 1; nvb = nvb + nvertices(icirc); % Subsequent circles are inner circles csign = -1; end nedge = nvb; % Initialise mesh control parameters bspace = zeros(1, 100); bspace(1:nvb) = 0.05; smooth = true; itrace = int64(0); nnzmax = int64(3000); % Mesh geometry [nv, nelt, coor, conn, ifail] = d06aa(edge, coor, bspace, smooth, itrace); % Compute the sparsity of the FE matrix from the input geometry [nz, irow, icol, ifail] = d06cb(nv, nnzmax, conn, 'nelt', nelt); fprintf('\nNumber of non-zero entries in input mesh: %d\n', nz); % Plot sparsity of input mesh fig1 = figure; plot(irow(1:double(nz)), icol(1:double(nz)), '.'); title ('Input Mesh'); set(gca,'YDir','reverse'); % Call the renumbering routine and get the new sparsity [nz, coor, edge, conn, irow, icol, ifail] = ... d06cc(nnzmax, coor, edge, conn, itrace, 'nelt', nelt); fprintf('Number of non-zero entries in output mesh: %d\n', nz); % Plot smoothed mesh fig2 = figure; plot(irow(1:double(nz)), icol(1:double(nz)), '.'); title ('Output Mesh'); set(gca,'YDir','reverse');
d06cb example results Number of non-zero entries in input mesh: 1556 Number of non-zero entries in output mesh: 1556