www.gusucode.com > pde 案例源码 matlab代码程序 > pde/ViewBoundaryConditionsExample.m
%% View Boundary Conditions % A PDE model stores boundary conditions in its |BoundaryConditions| % property. To obtain the boundary conditions stored in the PDE model % called |pdem|, use this syntax: % % BCs = pdem.BoundaryConditions; % % To see the active boundary condition assignment for a region, call the % |findBoundaryConditions| function. %% % For example, create a model and view the geometry. model = createpde(3); importGeometry(model,'Block.stl'); pdegplot(model,'FaceLabels','on','FaceAlpha',0.5) %% % Set zero Dirichlet conditions for all equations and all regions in the % model. applyBoundaryCondition(model,'dirichlet','Face',1:6,'u',[0,0,0]); %% % On face 3, set the Neumann boundary condition for equation 1 and % Dirichlet boundary condition for equations 2 and 3. h = [0 0 0;0 1 0;0 0 1]; r = [0;3;3]; q = [1 0 0;0 0 0;0 0 0]; g = [10;0;0]; applyBoundaryCondition(model,'mixed','Face',3,'h',h,'r',r,'g',g,'q',q); %% % View the boundary condition assignment for face 3. The result shows that % the active boundary condition is the last assignment. BCs = model.BoundaryConditions; findBoundaryConditions(BCs,'Face',3) %% % View the boundary conditions assignment for face 1. findBoundaryConditions(BCs,'Face',1) %% % The active boundary conditions assignment for face 1 includes all six % faces, though this assignment is no longer active for face 3.