www.gusucode.com > pde 案例源码 matlab代码程序 > pde/NonlinearProblemWith3DGeometryExample.m

    %% Nonlinear Problem with 3-D Geometry
% Solve a nonlinear 3-D problem with nontrivial geometry.
%%
% Import the geometry from the |BracketWithHole.stl| file. Plot the
% geometry and face labels.
model = createpde();
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 a Dirichlet boundary condition with value 1000 on the back face,
% which is face 4. Set the large faces 1 and 7, and also the circular face
% 11, to have Neumann boundary conditions with value |g = -10|. Do not set
% boundary conditions on the other faces. Those faces default to Neumann
% boundary conditions with value |g = 0|.
applyBoundaryCondition(model,'Face',4,'u',1000);
applyBoundaryCondition(model,'Face',[1,7,11],'g',-10);
%%
% Set the |c| coefficient to 1, |f| to 0.1, and |a| to the nonlinear value
% |'0.1 + 0.001*u.^2'|.
c = 1;
f = 0.1;
a = '0.1 + 0.001*u.^2';
%%
% Generate the mesh and solve the PDE. Start from the initial guess |u0 =
% 1000|, which matches the value you set on face 4. Turn on the |Report|
% option to observe the convergence during the solution.
generateMesh(model);
u = pdenonlin(model,c,a,f,'U0',1000,'Report','on');
%%
% Plot the solution on the geometry boundary.
pdeplot3D(model,'ColorMapData',u)