www.gusucode.com > 基于多边形网格的流动问题拓扑优化设计元代码 > PolyScript.m
%------------------------------ PolyTop ----------------------------------% % Ref: A Pereira, C Talischi, GH Paulino, IFM Menezes, MS Carvalho % % "Fluid Flow Topology Optimization in PolyTop: Stability and % % Computational Implementation", Struct Multidisc Optim, % % DOI 10.1007/s00158-014-1182-z % %-------------------------------------------------------------------------% %% ------------------------------------------ CREATE 'fem' STRUCT dx = 1/80; dy = 1/80; [X,Y] = meshgrid(dx/2:dx:1,dy/2:dy:1); seed = [X(:),Y(:)]; [Node,Element,NodeBC] = PolyMesher(@DiffuserDomain,3000,30); fem = struct(... 'NNode',size(Node,1),... % Number of nodes 'NElem',size(Element,1),... % Number of elements 'Node',Node,... % [NNode x 2] array of nodes 'Element',{Element},... % [NElement x Var] cell array of elements 'NodeBC',NodeBC,... % Array of velocity boundary conditions 'mu0',1,... % Dynamic viscosity 'Reg',0 ... % Tag for regular meshes ); %% ------------------------------------------ CREATE 'opt' STRUCT R = -1; % P is set to identity when R<0 VolFrac = 0.460847363744793; m = @(y)MatIntFnc(y,[fem.mu0 0.01]); P = PolyFilter(fem,R); zIni = VolFrac*ones(size(P,2),1); opt = struct(... 'zMin',0.0,... % Lower bound for design variables 'zMax',1.0,... % Upper bound for design variables 'zIni',zIni,... % Initial design variables 'MatIntFnc',m,... % Handle to material interpolation fnc. 'P',P,... % Matrix that maps design to element vars. 'VolFrac',VolFrac,... % Specified volume fraction cosntraint 'Tol',0.01,... % Convergence tolerance on design vars. 'MaxIter',150,... % Max. number of optimization iterations 'OCMove',0.2,... % Allowable move step in OC update scheme 'OCEta',0.5 ... % Exponent used in OC update scheme ); %% ------------------------------------------------- RUN 'PolyTop' figure; for q = 10.^(-6:1:0) % Continuation on the penalty parameter disp(['current q: ', num2str(q)]); opt.MatIntFnc = @(y)MatIntFnc(y,[fem.mu0 q]); [opt.zIni,V,fem] = PolyTop(fem,opt); end %%-------------------------------------------------------------------------