On entry, | , |
or | , |
or | , |
or | , |
or | or , for some and , |
or | , for some , |
or | if , , for some ; |
or | , |
or | . |
Open in the MATLAB editor: d06ac_example
function d06ac_example fprintf('d06ac example results\n\n'); % The characteristic points of the boundary mesh coorch = [0, 1, -3, 6, 0.8, 1.8, 1.5, 1.5; 0, 0, 0, 0, -0.3, -0.3, 4.5, -4.5]; coorus = zeros(2,100); % The lines of the boundary mesh blines = [int64(21), 21, 11, 11, 21, 21, 11, 11; 2, 1, 3, 4, 6, 5, 7, 8; 1, 2, 8, 7, 5, 6, 3, 4; 1, 2, 3, 3, 4, 5, 3, 3]; rate = ones(8,1); % The number of connected components to the boundary ncomp = int64(3); % Number and direction of lines per contour nlcomp = [int64(-2), 4, -2]; % List of line numbers lcomp = [int64(1), 2, 3, 8, 4, 7, 5, 6]; user = struct('x0', 1.5, 'y0', 0, 'radius', 4.5, 'x1', 0.8, 'y1', -0.3); nvmax = int64(2000); nedmx = int64(200); itrace = int64(0); [nvb, coor, nedge, edge, user, ifail] = ... d06ba( ... coorch, blines, @fbnd, coorus, rate, nlcomp, lcomp, nvmax, ... nedmx, itrace, 'user', user); fprintf('\nBoundary mesh characteristics:\n'); fprintf(' nvb = %d\n', nvb); fprintf(' nedge = %d\n', nedge); % Generation of interior vertices for the wake of the first naca nvint = 40; nvint2 = 20; dnvint = 5/(nvint2+1); weight = ones(nvint,1)/nvint2; for i=1:nvint2 coor(1, nvb+i) = 1+i*dnvint; end % ... for the wake of the second naca for i = nvint2+1:nvint coor(1, double(nvb)+i) = 1.8 + (i-nvint2)*dnvint; coor(2, double(nvb)+i) = -0.3; end % Call the 2D advancing front mesh generator. Note only pass relevant % portion of edge [nv, nelt, coor, conn, ifail] = ... d06ac( ... nvb, edge(:,1:nedge), coor, weight, itrace); fprintf('\nComplete mesh characteristics:\n'); fprintf(' nv = %d\n', nv); fprintf(' nelt = %d\n', nelt); % Plot mesh fig1 = figure; triplot(transpose(double(conn(:,1:nelt))), coor(1,:), coor(2,:)); function [result, user] = fbnd(i, x, y, user) result = 0; c = 1.008930411365; p4 = @(x) 0.6*( 0.2969*sqrt(c*x) - 0.126*c*x - 0.3516*(c*x)^2 + ... 0.2843*(c*x)^3 - 0.1015*(c*x)^4 ); if (i==1) % upper naca0012 wing beginning at the origin result = p4(x) -c*y; elseif (i==2) % lower naca0012 wing beginning at the origin result = p4(x) + c*y; elseif (i==3) result = (x-user.x0)^2 + (y-user.y0)^2 - user.radius^2; elseif (i==4) % upper naca0012 wing beginning at (user.x1;user.y1) result = p4(x-user.x1) - c*(y-user.y1); elseif (i==5) % lower naca0012 wing beginning at (user.x1;user.y1) result = p4(x-user.x1) + c*(y-user.y1); end
d06ac example results Boundary mesh characteristics: nvb = 120 nedge = 120 Complete mesh characteristics: nv = 1894 nelt = 3664