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

    %% View Initial Conditions
% A PDE model stores initial conditions in its |InitialConditions|
% property. Suppose |model| is the name of your model. Obtain the initial
% conditions:
%
%  inits = model.InitialConditions;
%
% To see the active initial conditions assignment for a region, call the
% |findInitialConditions| function. For example, create a model and view
% the geometry.
model = createpde();
geometryFromEdges(model,@lshapeg);
pdegplot(model,'FaceLabels','on')
ylim([-1.1,1.1])
axis equal
%%
% Specify constant initial conditions over all the regions in the model.
setInitialConditions(model,2);
%%
% Specify a different initial condition on each subregion.
setInitialConditions(model,3,'Face',2);
setInitialConditions(model,4,'Face',3);
%%
% View the initial condition assignment for region 2.
ics = model.InitialConditions;
findInitialConditions(ics,'Face',2)
%%
% This shows the "last assignment wins" characteristic.
%
% View the initial conditions assignment for region 1.
findInitialConditions(ics,'Face',1)
%%
% The active initial conditions assignment for region 1 includes all three
% regions, though this assignment is no longer active for regions 2 and 3.