Create solution object
The original (R2015b) version of
only one syntax, and created a
Beginning with R2016a, you generally do not need to use
return solution objects. Furthermore,
an object of a newer type than
PDEResults. If you
open an existing
PDEResults object, it is converted
If you use one of the older solvers such as
then you can use
createPDEResults to obtain a
solution object. Stationary and time-dependent solution objects have
gradients available, whereas
PDEResults did not
Results From an Elliptic Problem
StationaryResults object from the solution to an elliptic system.
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: face 3 is immobile, and there is a force in the negative
z direction on face 6.
Set coefficients that represent the equations of linear elasticity.
E = 200e9; nu = 0.3; c = elasticityC3D(E,nu); a = 0; f = [0;0;0];
Create a mesh and solve the problem.
generateMesh(model,"Hmax",1e-2); u = assempde(model,c,a,f);
StationaryResults object from the solution.
results = createPDEResults(model,u)
results = StationaryResults with properties: NodalSolution: [14002x3 double] XGradients: [14002x3 double] YGradients: [14002x3 double] ZGradients: [14002x3 double] Mesh: [1x1 FEMesh]
Plot the solution for the
z-component, which is component 3.
Results from a Time-Dependent Problem
Obtain a solution from a parabolic problem.
The problem models heat flow in a solid.
model = createpde(); importGeometry(model,"Tetrahedron.stl"); pdegplot(model,"FaceLabels","on","FaceAlpha",0.5) view(45,45)
Set the temperature on face 2 to 100. Leave the other boundary conditions at their default values (insulating).
Set the coefficients to model a parabolic problem with 0 initial temperature.
d = 1; c = 1; a = 0; f = 0; u0 = 0;
Create a mesh and solve the PDE for times from 0 through 200 in steps of 10.
tlist = 0:10:200; generateMesh(model); u = parabolic(u0,tlist,model,c,a,f,d);
168 successful steps 0 failed attempts 326 function evaluations 1 partial derivatives 28 LU decompositions 325 solutions of linear systems
TimeDependentResults object from the solution.
results = createPDEResults(model,u,tlist,"time-dependent");
Plot the solution on the surface of the geometry at time 100.
Results from an Eigenvalue Problem
EigenResults object from the solution to an eigenvalue problem.
Create the geometry and mesh for the L-shaped membrane. Apply Dirichlet boundary conditions to all edges.
model = createpde; geometryFromEdges(model,@lshapeg); generateMesh(model,"Hmax",0.05,"GeometricOrder","linear"); applyBoundaryCondition(model,"dirichlet", ... "Edge",1:model.Geometry.NumEdges, ... "u",0);
Solve the eigenvalue problem for coefficients
c = 1,
a = 0, and
d = 1. Obtain solutions for eigenvalues from 0 through 100.
c = 1; a = 0; d = 1; r = [0,100]; [eigenvectors,eigenvalues] = pdeeig(model,c,a,d,r);
Basis= 10, Time= 0.06, New conv eig= 0 Basis= 14, Time= 0.09, New conv eig= 0 Basis= 18, Time= 0.09, New conv eig= 1 Basis= 22, Time= 0.10, New conv eig= 2 Basis= 26, Time= 0.11, New conv eig= 3 Basis= 30, Time= 0.12, New conv eig= 5 Basis= 34, Time= 0.12, New conv eig= 5 Basis= 38, Time= 0.14, New conv eig= 7 Basis= 42, Time= 0.15, New conv eig= 8 Basis= 46, Time= 0.15, New conv eig= 11 Basis= 50, Time= 0.16, New conv eig= 12 Basis= 54, Time= 0.18, New conv eig= 14 Basis= 58, Time= 0.22, New conv eig= 14 Basis= 62, Time= 0.23, New conv eig= 16 Basis= 66, Time= 0.25, New conv eig= 18 End of sweep: Basis= 66, Time= 0.26, New conv eig= 17 Basis= 27, Time= 0.28, New conv eig= 0 Basis= 31, Time= 0.29, New conv eig= 0 Basis= 35, Time= 0.32, New conv eig= 0 End of sweep: Basis= 35, Time= 0.32, New conv eig= 0
EigenResults object from the solution.
results = createPDEResults(model,eigenvectors,eigenvalues,"eigen")
results = EigenResults with properties: Eigenvectors: [1440x17 double] Eigenvalues: [17x1 double] Mesh: [1x1 FEMesh]
Plot the solution for mode 10.
u — PDE solution
vector | matrix
PDE solution, specified as a vector or matrix.
u = assempde(model,c,a,f);
utimes — Times for a PDE solution
Times for a PDE solution, specified as a monotone vector. These
times should be the same as the
tlist times that
you specified for the solution by the
utimes = 0:0.2:5;
eigenvectors — Eigenvector solution
Eigenvector solution, specified as a matrix. Suppose
Npis the number of mesh nodes
Nis the number of equations
evis the number of eigenvalues specified in
eigenvectors has size
Each column of
eigenvectors corresponds to the
eigenvectors of one eigenvalue. In each column, the first
correspond to the eigenvector of equation 1 evaluated at the mesh
nodes, the next
Np elements correspond to equation
2, and so on.
eigenvalues — Eigenvalue solution
Eigenvalue solution, specified as a vector.
Dimensions of the returned solutions and gradients are the same as those returned by
solvepdeeig. For details, see Dimensions of Solutions, Gradients, and Fluxes.
The procedure for evaluating gradients at nodal locations is as follows:
Calculate the gradients at the Gauss points located inside each element.
Extrapolate the gradients at the nodal locations.
Average the value of the gradient from all elements that meet at the nodal point. This step is needed because of the inter-element discontinuity of gradients. The elements that connect at the same nodal point give different extrapolated values of the gradient for the point.
createPDEResultsperforms area-weighted averaging for 2-D meshes and volume-weighted averaging for 3-D meshes.
Version HistoryIntroduced in R2015b
R2016a: No longer creates an object of type
createPDEResults no longer creates an object of type
PDEResults. The syntax of
has changed to accommodate creating the new result types for time-dependent and
To create the
TimeDependentResultsobject for a time-dependent problem, use the syntax
utimesis a vector of solution times.
To create the
EigenResultsobject for an eigenvalue problem, use the syntax
EigenResults has different property names than
PDEResults. Update any eigenvalue scripts that use
PDEResults property names.