Out of memory error

4 views (last 30 days)
Luis Alberto Toro Carvajal
Answered: Divyanshu on 1 Mar 2024
When I run the following code
dynamicalmodel = createpde('structural','transient-solid');
gm = multicuboid(11.98,1.63,[7.5 12.5 15],'ZOffset',[0 7.5 20]);
VertexID = addVertex(gm,'Coordinates',[0,-0.815,17.5]);
dynamicalmodel.Geometry = gm;
figure(1)
pdegplot(dynamicalmodel,'VertexLabels','on')
figure(2)
pdegplot(dynamicalmodel,'FaceLabels','on','FaceAlpha',0.5);
figure(3)
pdegplot(dynamicalmodel,'EdgeLabels','on','FaceAlpha',0.5);
generateMesh(dynamicalmodel,'Hmax',1);
figure(4)
pdeplot3D(dynamicalmodel);
structuralProperties(dynamicalmodel,'YoungsModulus',23277.9444,'PoissonsRatio',0.3, 'MassDensity',1250E-09);
structuralBC(dynamicalmodel,'Edge',[1 3 2 4 21 22 23 24 25],'Constraint','Fixed');
structuralBC(dynamicalmodel,'Vertex',[1 2 3 4 9 13 14 15 16],'XDisplacement',0);
structuralBC(dynamicalmodel,'Vertex',[1 2 3 4 9 13 14 15 16],'YDisplacement',0);
structuralBC(dynamicalmodel,'Vertex',[1 2 3 4 9 13 14 15 16],'ZDisplacement',0);
structuralBoundaryLoad(dynamicalmodel,'Vertex',[5 6 9 10],'Force',[0;-0.054*17.5/4;0]);
structuralIC(dynamicalmodel,'Displacement',[0;0;0],'Velocity',[0;0;0]);
structuralresults = solve(dynamicalmodel,0:0.1:1);
loadedNd = findNodes(dynamicalmodel.Mesh,'region','Vertex',VertexID);
figure(5)
plot(structuralresults.SolutionTimes,structuralresults.Displacement.uy(loadedNd,:))
title('Desplazamiento en Y nodo central')
the following error appears
Out of memory.
Error in ode15s (line 832)
dif3d = cat(3,dif3d, zeros(neq,maxk+2,chunk));
Error in pde.EquationModel/solveTimeDependent (line 101)
sol=ode15s(fcn,tlist,uu0,odeoptions);
Error in pde.StructuralModel/solve (line 332)
[u,dudt,dudt2] = self.solveTimeDependent(coefstruct, u0, ut0, tlist,true);
Error in probeta (line 70)
structuralresults = solve(dynamicalmodel,0:0.1:1);Out of memory.
Error in ode15s (line 832)
dif3d = cat(3,dif3d, zeros(neq,maxk+2,chunk));
Error in pde.EquationModel/solveTimeDependent (line 101)
sol=ode15s(fcn,tlist,uu0,odeoptions);
Error in pde.StructuralModel/solve (line 332)
[u,dudt,dudt2] = self.solveTimeDependent(coefstruct, u0, ut0, tlist,true);
Error in probeta (line 70)
structuralresults = solve(dynamicalmodel,0:0.1:1);
How I can solve this problem?

Answers (1)

Divyanshu
Divyanshu on 1 Mar 2024
Hi Luis,
According to the stack track generated, it seems like there is a problem with the function 'cat' which you are using for concatenation. Although it is difficult to reproduce the issue without the '.m' file, you can check the following things->
  • You can check the arguments of 'zeros' function as you are creating a 3-d Matrix. Ensure that none of the arguments is too large in size which might consume lot of memory.
  • Another possible cause of memory consumption, is multiple figures being called in the code. For this you can try to use 'subplot' or 'Tiledlayout' functions to display multiple information on the same figure object.

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!