www.gusucode.com > pde 案例源码 matlab代码程序 > pde/ResultsFromCreatePDEResultsExample.m
%% Results from createPDEResults % Obtain a |StationaryResults| object from a legacy solver together with % |createPDEResults|. %% % Create a PDE model for a system of three equations. Import the geometry % of a bracket and plot the face labels. model = createpde(3); importGeometry(model,'BracketWithHole.stl'); figure pdegplot(model,'FaceLabels','on') view(30,30) title('Bracket with Face Labels') figure pdegplot(model,'FaceLabels','on') view(-134,-32) title('Bracket with Face Labels, Rear View') %% % Set boundary conditions such that |F4| is immobile, and |F8| has a force % in the negative |z| direction. applyBoundaryCondition(model,'dirichlet','Face',4,'u',[0,0,0]); applyBoundaryCondition(model,'neumann','Face',8,'g',[0,0,-1e4]); %% % Set coefficients for a legacy solver that represent the equations of % linear elasticity. See % <matlab:helpview(fullfile(docroot,'toolbox','pde','helptargets.map'),'pde_3Dlinear_elasticity'); % 3-D Linear Elasticity Equations in Toolbox Form>. E = 200e9; nu = 0.3; c = elasticityC3D(E,nu); a = 0; f = [0;0;0]; %% % Create a mesh. generateMesh(model,'Hmax',1e-2); %% % Solve the problem using a legacy solver. u = assempde(model,c,a,f); %% % Create a |StationaryResults| object from the solution. results = createPDEResults(model,u) %% % Access the solution at the nodal locations. u = results.NodalSolution; %% % Plot the solution for the |z|-component, which is component 3. pdeplot3D(model,'ColorMapData',u(:,3))