On entry, | , |
or | , |
or | , |
or | or for some and , |
or | for some , |
or | or for some and , |
or | or or for some , |
or | or , |
or | or for some if , |
or | , |
or | . |
Open in the MATLAB editor: d06ca_example
function d06ca_example fprintf('d06ca example results\n\n'); imax = 20; jmax = 20; delta = 87; nv = imax*jmax; hx = 1/(imax-1); hy = 1/(jmax-1); rad = 0.01*delta*min(hx,hy)/2; % Initialise the seed for the random number generator seed = [int64(1762541)]; % genid and subid identify the base generator genid = int64(1); subid = int64(1); % Initialise the generator to a repeatable sequence [state, ifail] = g05kf(genid, subid, seed); % Generate two sets of uniform random variates [state, x1, ifail] = g05sq(int64(nv), 0, rad, state); [state, x2, ifail] = g05sq(int64(nv), 0, 2*pi, state); % Generate a simple uniform mesh and then distort it % randomly within the distortion neighbourhood of each node. coor = zeros(2, nv); conn = zeros(3, 2*nv-1, 'int64'); k = 0; ind = 0; for j = 1:jmax for i = 1:imax k = k + 1; r = x1(k); theta = x2(k); if (i==1 || i==imax || j==1 || j==jmax) r = 0; end coor(1,k) = (i-1)*hx + r*cos(theta); coor(2,k) = (j-1)*hy + r*sin(theta); if (i<imax && j<jmax) ind = ind + 1; conn(1,ind) = k; conn(2,ind) = k + 1; conn(3,ind) = k + imax + 1; ind = ind + 1; conn(1,ind) = k; conn(2,ind) = k + imax + 1; conn(3,ind) = k + imax; end end end nelt = ind; % Boundary edges nedge = 0; edge = zeros(3, 100, 'int64'); for i = 1:imax - 1 nedge = nedge + 1; edge(1,nedge) = i; edge(2,nedge) = i + 1; edge(3,nedge) = 0; end for i = 1:jmax - 1 nedge = nedge + 1; edge(1,nedge) = i*imax; edge(2,nedge) = (i+1)*imax; edge(3,nedge) = 0; end for i = 1:imax - 1 nedge = nedge + 1; edge(1,nedge) = imax*jmax - i + 1; edge(2,nedge) = imax*jmax - i; edge(3,nedge) = 0; end for i = 1:jmax - 1 nedge = nedge + 1; edge(1,nedge) = (jmax-i)*imax + 1; edge(2,nedge) = (jmax-i-1)*imax + 1; edge(3,nedge) = 0; end numfix = zeros(0, 0, 'int64'); itrace = int64(1); nqint = int64(10); % Plot original mesh fig1 = figure; subplot(1,2,1); triplot(transpose(double(conn(:,1:nelt))), coor(1,:), coor(2,:)); title ('Original Mesh'); [coor, ifail] = d06ca(coor, edge(:, 1:nedge), conn(:, 1:nelt), ... numfix, itrace, nqint); fprintf('\nComplete smooth mesh characteristics:\n'); fprintf(' nv = %d\n', nv); fprintf(' nelt = %d\n', nelt); % Plot smoothed mesh subplot(1,2,2); triplot(transpose(double(conn(:,1:nelt))), coor(1,:), coor(2,:)); title ('Smoothed Mesh');
d06ca example results BEFORE SMOOTHING Minimum smoothness measure: 1.0060557 Maximum smoothness measure: 45.7310387 Distribution interval Number of elements 1.0060557 - 5.4785540 715 5.4785540 - 9.9510523 4 9.9510523 - 14.4235506 1 14.4235506 - 18.8960489 0 18.8960489 - 23.3685472 0 23.3685472 - 27.8410455 0 27.8410455 - 32.3135438 0 32.3135438 - 36.7860421 0 36.7860421 - 41.2585404 0 41.2585404 - 45.7310387 1 AFTER SMOOTHING Minimum smoothness measure: 1.3377832 Maximum smoothness measure: 1.4445226 Distribution interval Number of elements 1.3377832 - 1.3484572 0 1.3484572 - 1.3591311 13 1.3591311 - 1.3698050 42 1.3698050 - 1.3804790 104 1.3804790 - 1.3911529 162 1.3911529 - 1.4018268 159 1.4018268 - 1.4125008 122 1.4125008 - 1.4231747 74 1.4231747 - 1.4338486 31 1.4338486 - 1.4445226 14 Complete smooth mesh characteristics: nv = 400 nelt = 722