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: [14314x3 double] XGradients: [14314x3 double] YGradients: [14314x3 double] ZGradients: [14314x3 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);
173 successful steps 1 failed attempts 337 function evaluations 1 partial derivatives 30 LU decompositions 336 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);
EigenResults object from the solution.
results = createPDEResults(model,eigenvectors,eigenvalues,"eigen")
results = EigenResults with properties: Eigenvectors: [1458x17 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.