Truss Analysis software weird solutions
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm using the Truss Analysis software https://uk.mathworks.com/matlabcentral/fileexchange/14313-truss-analysis and followed all the appropriate steps when coding the initial 2D bridge, a simple flat beam with an arch made of truses overhead, and it runs without any bugs however when I try to use the ST.m program to find forces in the members it just shows NaM for all results and I haven't a clue what is going wrong.
1 Kommentar
Antworten (1)
John D'Errico
am 10 Nov. 2018
Bearbeitet: John D'Errico
am 10 Nov. 2018
It is usually best to contact the author of submitted code on the FEX when you have problems with their code. In this case, only the data file had any documentation at all, and I'm sorry, but the code you found does not seem to me to be the most trustworthy code I've ever seen. Personally, I'd recommend it is a better idea to write it yourself, than to use a completely uncommented mess of code like that. You would learn more in the process, getting way more out of it. This is homework after all. The intention is for you to learn, not to complete a homework assignment. Yeah, I know. You are a student, so your intention was mainly to get the homework done. Sigh.
Having said that ... I have a funny feeling either your connectivity matrix is wrong, or your nodal coordinates are not what you wanted then to be. (The two are just subtly different ways of making the same mistake in creating a truss like this.)
The most important thing to do whenever you have a problem with ANYTHING in MATLAB is to plot what you are doing. In fact, PLOT EVERYTHING, even before you see a problem. Since that requires one line of code, I'm not sure why you would not do that, except that it may not have been obvious how to write that line to a relative novice at MATLAB. This should suffice:
plot(Coord(Con',1),Coord(Con',2),'o-')

And I'll admit that it may not be obvious why I did it that way. But now, look carefully at your truss. To me, it looks as if you have one member that seems to be essentially collinear and overlapping with two other truss members. And, had you plotted the truss yourself, you too would/should have seen that fact. My guess is one of those truss members was hooked to the wrong node, since the truss is seen to be asymmetrical when plotted.
Now, when happens when you have such a situation occur? The problem may become unsolvable, since the stresses and strains inside those collinear & overlapping truss members may become unresolvable. There is no unique solution. That causes a singular matrix. And THAT results in NaNs.
Did I have an expectation that this MIGHT have been the problem? Well, yes. That you got NaNs out, implies that you probably had a singular matrix. That can arise from one of several ways.
1. Your truss was incorrectly described, or...
2. There were too few degrees of freedom fixed on the truss, or ...
2. There is an error in the computations.
#1 was easy to test by a simple plot. You need to fix that first before you go on.
#2 would imply that you did not sufficiently constrain the truss in space, by fixing one point of the truss. That would allow the truss to have exactly the same deformed shape, but be translated in some direction, for example. It might also be that you did not restrict the truss from freely rotating around some point. In either case, the truss would be insufficiently constrained, in a way that does not impact the stored potential energy of deformation you are implicitly trying to minimize in an FEM analysis.
I have not carefully checked to see if case 2 is an issue, because it appears as if #1 is already problematic.
#3 is unverifiable by me, since I simply won't make the effort to debug completely undocumented spaghetti code. (Look carefully at the ST and TP functions. Sorry, but crap code if I ever saw it.) Anyway, it has been a long time since I did any serious FEM. That would be your job here.
Could #3 also be a problem? That is also possibly true, since the singular matrix report comes from one line in the function ST. There, I see:
U(f)=S(f,f)\D.Load(f);
Then, looking at S(f,f), I see this:
spy(~S(f,f))

The blue dots show identically zero elements. See that the last row AND the last column of S(f,f) are identically zero. To me, this seems an indication of a truss that has probably not been sufficiently constrained in space, so there exists a deformation mode of that truss that allows the truss to freely move around, at no cost in potential energy.
As such, that either indicates the code is crap, and S(f,f) was not created correctly, or it might be indicative of a problem on your part. Either or both could still be true. But who am I to say which applies? ;-)
As I said, you would be better off writing it yourself than grabbing code from a random untrustable source. But then, that is me. No matter what, there is never any excuse for not plotting everything. So, first, fix the truss. Then look into the question of whether your truss was correctly anchored in space.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Structural Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!