 Hey guys, I want to get back to making some videos And I thought what better way to do that than to make one about something that I really enjoy and that's Funny element analysis, and I get the feeling that a lot of the viewers on this channel aren't Aren't real engineers, and they may not know what that even is and don't worry I'll get into all that but this video is just meant to be an extremely stripped-down Like no fluff version of a of a college or even probably a graduate level course on the topic So if you watch the full video, and you still can't figure out all this stuff, then just one of us is really dumb It's probably me. I'm not a good teacher, and I accept that So I love funny elements because it's the perfect pure amalgamation fusion of simple mathematics like numerical methods Material science a little bit physics, and you can reduce a complicated system down to a mesh of much simpler elements and then you can predict with very very high accuracy believe it or not how these structures will deform and deflect under different load cases and boundary conditions and You can evaluate the material conditions You know in each part to say hey is this element going to break under this loading and if so what changes Can I make to prevent that? You know, how does the geometry have to be modified and a lot of the time when we Myself included we hear funny elements We think about these complicated advanced and very very expensive like tens of thousands of dollars like software suites But a lot of the time the simple mechanics can be coded up in a hundred lines of MATLAB code and you can reuse that code Literally forever, and you know I'll show an example of that kind of code at the end of the video And we just can't let the simplicity of this get away from us, you know You don't need a trillion cubic elements nonlinear analysis to model up a bike frame or even like a wind turbine blade I drew here on the right You know and so but in the video you'll be able to implement a full 3d frame final element analysis and You'll be able to simulate Anything you can imagine that consists of these slender members One last thing before I begin and again if you're already lost in the vocab don't worry I'm going to explain everything, you know legit from square one But this video covers the basics of funny element analysis for one-dimensional frames But ultimately implementation of a 2d shell element or a 3d brick element or whatever is basically identical It's like 95% the same exact stuff You may have a little bit different service matrix, but it's ultimately exactly the same So without further ado the the pre-rex for this you have to know some stuff already You should know a little bit about linear algebra matrix inverses Matrix multiplication is a very important row times column and know how that works in you know very very well Simple derivatives simple integrals. We're talking about polynomials and stuff very easy stuff Maybe there's a sign down in there. I don't remember It's very very basic stuff Springs you have to know hoax law for springs. This is f equals kx It just relates the force and the displacement on a spring in a linear fashion So a spring has like a material or maybe a geometric or both Coefficient called the spring stiffness coefficient, you know this constant K. Let's say it was a hundred You know pounds per inch if you wanted to move the spring Five inches it would take you 500 pounds, right? It's all it is now you're an expert in spring. Congratulations Corner systems you should know kind of what 3d space looks like the right hand rule the axes, you know translations Rotations even transformations. I'll talk about that a little bit in the video You have to know basic very very basic Static, it's not even hard like you should be able to you know, decipher what my free Body diagram drawings are showing you what that even is you have to know what a force is a moment Which is just a torque, right? That kind of stuff and it would help you to know what these three things are stress strain modulus stuff like that You don't have to know that already technically speaking. I'm gonna explain that, you know I have a little bit of a slide on that But if after I explain it you still don't know really what those things are You should look it up go to Bing comm type of men figure it out It's not really that hard, but I can't spend that much time. That's a course in itself We know what these things are so you have to kind of know that kind of beforehand. It's very simple though really So some vocab words, I'm gonna use these every other breath So this is you know important to know what these things mean a degree of freedom a doff is a way in which something can Move or be moved so I have examples here from a theme park a roller coaster is a one doff system one degree of freedom system Why because I could tell where every car on that roller coaster is just by measuring its distance along the track It's a hundred meters long a track 200 meters on the track one variable is enough to tell me exactly where everything is, right? Now at the teacup ride. What is that? That's the ride where you have those spinning cups on the spinning platform There's two doffs there right because there's two ways for you to spin so two doffs bumper cars bumper cars is interesting because you can drive forward and back, right? You can drive left and right, but you can also turn right obviously left and right forward and back so You know you can rotate around the vertical axis there So this is actually three doffs For bumper cars when you drive over cars on a plane like that. So yeah, very cool Now what is displacement displacement is how much something moves or rotates along a degree of freedom? We're just in general potentially so Here I drew a spring, you know very very carefully as you can tell the spring stretches how much it stretches u sub x in the x direction You know you sub x very very advanced stuff here, okay? So what is finite elements? It's just some terminology Fine elements is a method of discretizing a system you discretize it into finite elements, so You can do this for any kind of system you use a bunch of different differential equations you can solve with my elements We're focusing on the structural ones obviously, so we have these elements here that are one-dimensional like linear elements And they connect these nodes in blue and on the nodes. We're applying forces Those are called nodal forces and we're trying to compute the nodal displacements, right? So we're gonna buy boundary conditions and all my forces and we're gonna assemble this kind of a set of equations, right? So you have a nodal force vector With all the nodal forces even all the zero ones that say you're not applying a force here Well, you put a zero for that. All right, you say you're not applying a force here Well, you put a zero for that So this is normal forces and it's being related to those placements That's how much the node moves is the node move this way doesn't move this way as they're rotated on this axis all that stuff That's a displacement, right? And the way in which it relates is by this that this matrix K K is the entire point of this video We're gonna spend the bulk of this video just figure out how we can, you know Model this system with you know a very accurate Simist matrix K and if you remember from hundreds above I talked about, you know, F equals K X for springs This is the same thing F equals K you but ultimately you and X is the same thing that is displacement of a spring Here's the placement of a node. So this is very simple to springs. That's why I brought it up Now what is a 3d frame element or frame element? We actually call this an aerospace we call it a beam element all the time I don't know why But in reality, it's a frame element. It's an element that has every single degree of freedom being measured and kept track of at at all the nodes, so The element has two nodes right and at each node you can move in the x direction move in the y direction move in the z direction You know unless otherwise constrained and you can rotate about the x axis about the y axis about the z axis So there is six degrees of freedom per node There's two nodes per element. Therefore we're at 12 degrees of freedom per element simple stuff Now here's the constitutive law that I had just to refresh what stress strain Modulates all that are so I'm left you can begin with hooks law So hooks law was what I said was what relates the force and displacement on a spring and that's what it is So let's say K was a hundred pounds per inch You wanted to move this a foot You'd have to have twelve hundred pounds right That's what this linear thing is and that's all constitutive laws are they're just a linear relationship In our case that helps us relate Quantity of interests to compute things that we think are important as engineers. So stress What is stress stress is a force Over an area. It's a kind of way to not really non-dimensionalize a force but to generalize a force to a cross section So it's a normal force. That's a force perpendicular to an area here Simple stuff. It's a pressure. Basically, you know like PSI or Pascal's. That's what that is What is strange strain is a change in length over a Full length. It's actually the derivative, right? But ultimately if you have a linear section like this It's just how much longer it's getting over the original length So if the original length was one meter and you stretched it, you know two centimeters That would be a two percent strain and usually it's measured as a percent But also you can measure it in like micro strain or those kind of things No worries on that. So Just like f and x can be related by this spring constant K You can also relate stress and strain By the modulus E. It's called an elastic modulus and it's exactly the same format as this You can see we have like, you know, this is the non sort of the dimensionalized force thing This is a kind of the normalized dimensionalized strain thing and this is sort of material geometrically, you know normalized sickness thing So that's all what that is Yeah, this is just a material Value so these things have all the geometric data encoded into them, right? This is per area. This is per length. E is a material constant So for example aluminum has a modulus of 70 gigapascals give or take and let's say it yields at point two percent strain You can plug in those numbers, right? So point two percent strain is the green one 70 gigs is the blue one. You compute the yield stress as just, you know, modulus times the strain 140 megapascals Right, simple stuff. Now torsion is a bit different not much but a little bit different and I would say a little bit harder So in this case, we're not measuring things along the axis like a normal force, a normal displacement We're actually measuring like a Tangential force and tangential displacement, a shear basically, so in the case of the stress again, it's a tangential Force over an area, but it's still the same thing. It's a pressure. It's, you know, Pascal's or psi and Shear strain that's just basically delta S over L how much we're moving, you know in the opposite direction and not the long that length axis but sort of You know 10 or normal to that axis and so In the case of members like this, you know, we're like the round or whatever you can just, you know Equate this as the angle times the radius right this this s the sector length is just, you know The the angle times the radius at that location and let me divide it by L to normalize this in terms of length So the the max shear strain would just be Theta, that's the rotation that you're applying Times the full radius R the maximum radius R over the length of the member L So just like f and x related by k for springs Shear stress and shear strain are related by the shear modulus g Same as above and the thing is you can actually plug in numbers here and do like a moment equilibrium I'll do that right now just to explain this so basically if you apply a torque on this member about its central axis You can take this so basically what what are the internal forces internal stresses They have to be equal to each other and they have to also equal the applied moment And so you kind of look at this sort of free bi diagram here. It's very complicated, but Ultimately, you can plug in stuff moving us around you can pull out this geometric quantity here This is the polar moment of inertia j we will use that in the video and also, you know The moment relates to the max shear force Times j over R you kind of plug in all these things and you can evaluate this for those that, you know, no structural You know engineering this is already something that most people have memorized Maybe memorize this one I don't I don't really know we both And so Yeah, actually this for those that know already like this is already a synthesis matrix term And we'll see that in the video that that's gonna, you know appear All right, that's the basics of that's like, you know the first two years engineering Congratulations, you know master that So fea is just a bunch of springs. That's why I brought up springs because it's entirely springs So let's see how the system here on the left you have four nodes those one two three and four attached by Springs one two and three now nodes one two and three are fixed in space That's what these hashes mean, but those four isn't and so We're applying the force there with the x and y component and In general all the nodes here have x and y degrees of freedom but Obviously one two and three are fixed in space and so those are all going to be zero Whereas node four it has two true degrees of freedom. That's You know ux at node four and you y at node four So it can move in both those directions it can move in this direction basically and By the way, this four is not an exponent It's just talking about what node we're we're talking about so you'll know the difference between an exponent and you know Just a super script here It'll become very obvious and also these springs have their own spring stiffness Obviously k1 for spring one k2 for spring two and k3 for spring three. Okay, now if you look only at spring number two You know you cut off springs one and three right here and you look at how this thing works What do we know? We know the fx. That's the horizontal component Does not stretch the spring but f y does f y is along the axis of spring And therefore it is stretching the spring and so how does it how much does it stretch? Well based off of this hook's law right f in the y direction equals k for that spring times This needs been in that direction and you can plug that into this matrix in an equation here with the f sum of left the u's on the right and the Matrix in the middle and so this is the spring two element Let's hit this matrix and you can see that that we know row times column nothing to do with fx and then for f y Only the u y is multiplied by the Constant just says in the equation. Okay simple stuff Okay, now on spring one and spring three It's kind of the opposite right so for spring one and spring three those are the horizontal springs Fy does not stretch either spring right, but fx does so fx compresses the left spring and it charges the right spring The certain amount how much well by this equation and this equation So the left spring is is stretched Per the spring set this constant k1 And by this equation here, so why is there negative sign? Well, it's because fx is to the left whereas we're measuring u4x to the right Therefore a positive force has to give us or has to result in a negative displacement Now similarly on the right-hand side, you know for this right spring It's also negative because again a negative force in the extraction, you know, or yeah A positive force is to the left whereas we're measuring displacement here to the right So negative sign and you can put this into the equation now in this case f y wrote 2 times column 1 Has no nothing because no f y in the equation, but fx does have a you know a value there Long story short you can take those those those terms that had them together What does this mean? Well, this means that the force has to be distributed across all of the elements per their Now stiffness coefficients k right and so you can add these together You can undistribute the degrees of freedom and pull out in this matrix equation here So two equations two unknowns in general these two variables here these are the unknowns You'll usually know the forces because you're applying forces on the system and you're curious about how much it moves So if you knew fx and f y you could compute Ux and you why right? So all you have to do is take this equation right the original equation and Premultiply both sides by the inverse of k and you get that this placements is k inverse times f now It's not always possible to enter with this matrix because if you have you know a 10 million degree of freedom system You know this inverse operation will take a lot of operations Probably too many so there are ways to create a matrix without taking its direct inverse right you can evaluate this in different ways with iteration, but We won't mention those in this video. We will have very small systems that we can evaluate this with the inverse Okay, and all of finite elements is just an extension of that example really you may have More degrees of freedom per node and that in that example We only had one degree of freedom or sorry two degrees of freedom per every node x and y Obviously as I mentioned before frame elements have six doffs per node, right? But you can also have voltage and temperature and that kind of stuff too So you have many degrees of freedom here now. What are the different stiffnesses? So you may not always just have k's for springs. You may have these material and geometric Components to your stiffness and we'll get into that in a second. You will also have different kinds of elements you may not have just linear elements like the lines you may have shells and hexahedrons heterohedrons that kind of stuff that can all change and You may have non linearity So the astute among you may have the notice that hey well FX it does actually stretch this spring, you know After you know after you move the spring a little bit in the x-reaction It's like this and at that point FX is kind of pulling the spring more in this direction Right as as you go more and more to the left and that's just a long linearity. So That's saying that you know if we were to break up the force into pieces So it was a hundred pound force. We took it as in ten pound increments They would have incremental effects on the spring locations and this node location we could constantly be reevaluating these matrices with with signs and cosines and that kind of stuff and We can reevaluate them on the air deep, you know every iteration, right? That would be a geometric on the Deity There's also what we call material on linearities. That's if this constant is not actually constant What if it varied as a function of the spring length? What if it wasn't a linear spring? What if it was, you know a Different kind of spring. So yeah, that's all built in here So all of you it's just a simple extension of this example really it really is so simple to extend it So what is a frame element? Now? This is a bulk of the video You're all like the the The front matter is gone. This is the actual meat of the video So frame element has two nodes node A and node B and as I mentioned before there's six degrees of freedom at each of the nodes Now the x-axis is a long element. So from node A to node B and obviously All the other, you know the y and the z-axis are just outwards right and obviously you have to you know Keep the right hand rule satisfied. So x and y cross those to get z besides that It's whatever you want to define you can define whatever way you want and our objective in the video is to come up at least right now With a 12 by 12 Step this matrix because there's 12 degrees of freedom per element. We're trying to relate the 12 nodal forces in moments to the 12 nodal, you know Displacements and rotations Okay, and so let's say we were to fill this row here. This row would just tell us how F in the y direction at node A is Distributed across all of these degrees of freedom. You may have some zeros in here In fact, you will have some zeros in here And so we'll talk about how that all works in the kind of coming slides But that's all this is you know long story short all we're doing is we're basically saying how does this force? distribute across these degrees of freedom and How it does we'll put numbers in this little box and these numbers are going to be like five and twelve. They're going to be geometric and material quantities that govern this relationship and we're trying to derive what those proportionalities are okay so the easiest one is axial stiffness so axial stiffness is just the Sickness of the bar along its axis so extension, right? So we have no day node B and the x axis goes from a to b Length L for the bar and we have a cross sectional area a So now we're measuring fx and ux Had a you know to the right here, you know along the axis and then an FB goes outwards from the element and so if we pull this Modulus equation from before you know equals stress over the strain We can compute both stress and strain and plug and chug these numbers in and compute the the sickness terms So what is the stress? The stress is just the force over the cross-sectional area now remember Statics right these forces have to be equal and opposite if they're not equal opposite this bar is going to fly off into space So f a in the x-direction and be in the x-direction they have to be Equal magnitude Opposite in sign they have to be you know, it's a requirement and so one of these has to be negative and one of these has to be positive Right, so what we would be to find this is that tension is a positive stress that's the definition you could change it if you'd like and Compression is a negative stress. So what does that mean? Well, that means let's say you were to fix node a in space hold it there still and then pull node be with the force fx B That would cause this bar to get longer. That would be a tensile Stress, it's 10 tension. So positive sign on that one All right, and then if you were to fix node a or sorry fix node B and Apply a positive force, you know at a that would be a compressive stress or negative That's why there's negative sign in there Now what about the strain so strange just that you know changing that over the length so That's just this quantity Minus this quantity, right? So you be X minus you a X over the L Simple enough we plug in both these values here at node a and node B into this equation for the modulus We can solve for the force and in this way We can basically pull out how this force distributes across these degrees of freedom So if you can see it's pretty much the same thing for both of them Just the sign is different. So positive force at a causes a positive motion Right, this is a positive sign here at the you know, UX today Whereas a positive force of B causes a positive displacement at B Right and negative at the other one. So as you can see FX at a and at B are only related to UX today and B and nothing else. There's no rotations There's nothing in those z direction nothing of that all the other terms are zero So we look at the matrix. This is how those two equations fit into the formulation, right? So you can see we have the first and the seventh rows as well as the first and seventh columns by the way This is a symmetric system so So what's the first row the first row tells us how force in the x direction at node a that is where is that? That's this one How that relates to well, hold on that's how this force relates to this degree of freedom and this degree of freedom as well as all the other ones too, but those are all zeros, right? It only relates to this one and this one in a non-zero way And the second row tells us how this force relates to this degree of freedom and this degree of freedom and the rest of them too, but those are all zeros, right? So that is the that this matrix elements and you know in extension now. What about in torsion? This is a bit harder, but you know not all that much harder so The best way to visualize this is to imagine you're ringing out a towel, you know full of water you're ringing it out You're we're getting this in this direction and this in this direction And kind of imagine how that works. So you're basically applying a torque You're applying a negative moment, you know here a positive moment here And you're rotating this this towel, you know by some degrees at a and some degrees at b along the x-axis and in the end we can pull out this This shear modulus and stress and strain relationship here and we can solve for you know The four side of this equation basically the first thing to do is to just take in the equation from above You know previously in the presentation You know plug in these numbers here for the moment And then look at the sign so In this case we're defining a positive torsion as one that kind of rotates positively around this axis here So um In that case if you were to hold node a in space Apply this kind of a force this kind of moment. I should say That would cause a positive rotation about theta at b So this is a positive sign here Whereas if you were to apply a positive moment on this side That would relate into you know if we're ordered for it to make sense You know if you were to fix this one here apply that positive moment here This would cause a negative um a negative torsion right because you're spinning in the opposite direction on this side relative right so Because this force causes this kind of a reaction here in order for the reaction to be torsion not just rotation of the part And so yeah, that's how that works. That's why there's a negative sign here a positive sign there Now if you look at the strain the strains is Are pretty similar again instead of being length just the total angular change So instead of it being ux minus ux. It's theta x minus theta x So theta b minus theta a times r over l now if you look these both have an r However, when you plug them in To this expression here And take the stress over the strain the r is cancelled out And you can solve for the moments pull out the degrees of freedom And you get this kind of a strip here. This just shows that the moments, you know mx at a and at b are only related to these two rotations By what way by these? proportionalities here and all other stiffness coefficients are zero So just like before we can fill out the fourth and the tenth rows and columns and explain how these moments You know this moment and uh this moment Relate to all the degrees of freedom. However, pretty much all those are zero except for this one And this one Simple enough, right But now we get onto the hard one and that's why I left it for last That's the bending stiffness. Why is it so hard? Why is transverse bending so hard? Well, it's because before Everything was, you know, very simple. You had moments in x causing rotations at x you had Extensions at x being caused by forces at x, you know in x in this case We're all coupled up and screwed around right so like You know for bending this beam, you know this way And this way we're bending it concave up that can be caused in two ways Well, first off by a by a force we're going to be piling up positive force You know in this direction that would cause bending but also A moment right moments cause bending around that same axis So we're looking at moments about the z coupling with forces in the y direction And so this all gets very very Complicated and so this again has length l. I didn't draw it in but also it has um What's called an area moment every inertia will derive what this is But just know this is the equation for it We'll get into what that means later and we'll actually pull this out of the of the integration And so yeah, that's how this looks now What you have to realize is that for a beam that you're bending The bottom of the beam gets longer and the top of the beam gets shorter. So the bottom beam is intention right In the bottom of the beam means under or so the top is under compression right compression It's getting smaller and at some point in the middle of the member is what's called the neutral axis That's where there's no length change. That's a straight line here And so this x is along the neutral axis as I've drawn it And so what's important to also realize is that in bending that that extension affects the axial strain that's You know that well, I just show you with you know tension here compression here That is axial strain If this gets shorter, that's an axial strain component. So basically how you can look at that is saying well um What is the slope so the slope that you've caused here is actually the amount which you've compressed this system and um If you multiply it by by the distance from this neutral axis y you can actually compute How much you're actually moving in Throughout the thickness right and so if let's say this was a two inch thick part You know at y equals one you would have a negative whatever the slope is That's your your axial displacement here Where if you put in you know negative one that would be a positive displacement right obviously because this is to the right And this is the left So what is strain well, I mentioned before that strain was a was just the change in length of the length Well, in other words, that's just the derivative and you know a lot of these textbooks and teachers will say Oh, well, you know, actually you have to take the partial derivatives and everything Yeah, yeah, yeah, but ultimately that's all going to be zeros and although we care about in this You know system here is the the x component right, so You know in this case the derivative of this with respect to x Is just you know negative y d squared u dx squared and what is the stress? Well, first is just e times the strain. I'm just an e out front. Okay, simple enough Now keep that in mind for later. We'll use that later. Um So stress is just how forces of moments are carried through the element and so a stress represents an internal moment In this case about the z-axis and so if we plug this in right so the the applied moment we'll call it m z Has to cause this stress Right, or I mean it's it's it's causing an opposed by the stress. Whatever you want to think about It's it's related to the stress distribution here So if you integrate this um So basically a stress is a force of an area right so force of our area Times the displacement How far you are from the neutral axis here? Um in the y direction times the area right this gives you a force This gives you a moment arm. So this is your you know Moment that opposes your applied force in this case is your applied torque m z And so you can just plug in this expression here for your stress Integrate and here is where that moment of inertia comes We have um, you know We can pull out integral over a of y squared da and um That's just i z Other than that all we have is is this and this is not, you know, very with the area So we don't really care about that too much. So but this equation matters a lot This is the moment equals e i d squared u y dx squared. This is equation people have memorized um That's how that's where it comes from now What is shear force shear force is a transverse load Through an element and the load carries everywhere and this is what they call like, you know Differential beam element or whatever they're they're taking a cut in the part I'm not going to get into all that right now, but because we're only applying forces at the nodes, right? The the shear force that carries through this element It can't change right? I mean the if the force here is you know 15 Newtons and the force here is for the newtons. I mean the shearing force Everywhere is 15 newtons, right? That's what v is everywhere and because it doesn't change over the length because we're not applying any forces inside Yeah, we're not applying any distributed loads here or anything. I'm not applying, you know anything in the middle We're only applying nodal forces. What's that mean? Well, that means that dv dx is zero There's no way that v can change over the length x of this number That's equation number two Now equation number three So because the shear force naturally accumulates An internal moment because it's applied over a distance from a node We can compute basically that for an incremental distance So basically v times an incremental distance dx would cause an incremental moment Dm and you can solve for v. That's dm over dx. That's equation number three Very simple stuff and now we'll put those equations together. So equation one substitute in You know m z for m take the derivative. This is what pops out, right? We're just taking another derivative of this And the signs don't worry about the signs the signs. I'll explain later. We'll we'll get into all what all that means later um In a very clear way and then we plug in an equation This equation here into equation two pull that out. That's e i The fourth derivative equals zero All right so now the objective here now is to figure out a um an equation that we can use to capture this so There's no it's nice and easy simple equation that we can you know write that satisfies all of our degrees Of freedom. All right, there's no like magical one. We have to come up with one and so That's the objective here. We have to solve this equation this differential equation so that it it satisfies a couple of you know Very important boundary conditions at nodes a and nodes b in in our part And so we have to satisfy these four degrees of freedom um, that is u y and theta z of both nodes And take note with that expression that equation we need there's four of them. We need a cubic function, right? um a A line can pass through two points um A quadratic can pass through three points Satisfy three conditions, but a cubic is required to satisfy four conditions So we need four parameters here p three two one and zero And you have to solve for the p coefficients just that all of our degrees of freedom Are satisfied by you know in in this equation here Right when we when we compute this out Okay, so we're trying to solve basically for this equation here We're trying to plug in different values for p until we Trying to solve the values of p that satisfy these things For this now one that we have to remember Is this assumption and this assumption only holds true for very small rotations But in general um as long as the linear analysis is valid this assumption holds true. So Um for small rotations the theta about the z axis Is I mean if you look at the exact, you know equation here, you know, that would be just the the tangent, right? Tangent of this over this is this angle here Right, so our inverse tangent whatever you want to say and so The small angle approximation basically says well, well, basically tangent of the angle is itself. So Theta z is approximately equal to The derivative in the x direction. So what does that mean? That means that we can basically We can plug in this Here and this here And you know plug in zero and l and everything to solve for these p's At you know this equation or I mean and we can take the derivative of this know you U y x you know derivative of that with respects to you know, it's back to x dx That equals the rotations I know approximately the rotations and then we can just derivative of this and solve for these two In this equation and then you know pull out the p's so Yeah, that's what that is. Um It's reasonable. You'll see what I mean in the next couple of slides. So Here's the original equation for the displacements in the y direction Here's for you know, it's derivative of that for the rotations. So if we were to plug in x equals zero for node a right In solve, you know, this is this is what the displacement is at zero. It's u a in the y direction And then the rotation You know is theta z at at node a right so These are all you know zero zero zero cube zero square and zero right we're plugging in zero for x So only p zero and p one are you know come out of that? So you can solve for p zero and p one like that now at node b x equals l You plug in these values for p zero and p one like this And again, you're plugging in degrees of freedom at l which is the displacement and the rotation at node b And then you can do math and you can solve for p three and p two Simple enough Now we can substitute those p's back in the equation. You have this long equation You can pull out the degrees of freedom now. So here we can see how these degrees of freedom are Controlling this And by the way, if you were to um plug in You know x equals zero in this equation What would you get if you plug in if you put if you're at node a And you plug in zero in this equation, which is x equals zero What does that mean? Well, that means that this is this is u at u y at zero. That is just this Right, and if you plug in l just this and you'll see that if you plug in you'll actually see that that comes true And if you put in this equation if you plug in Um zero and l you'll get this and this That means that our you know Expressions here Work and these are what's called like they're called hermetic shape functions or something. Don't worry about that That just shows how these values Can be interpolated in a cubic way Through the element Right cubic because you know, it's cubed um Yeah, so between zero and l I mean at zero and l you have this and this but between zero and l You have values that are different, right and you could plug in, you know l over two and you can see what that would look like if you wanted to Okay So these cubic functions can help describe the relevant areas of freedom and help interpolate between them if necessary now I computed these two Actually derivatives here. They just show, you know, this this is like the first derivative But here the second and third we'll need these for later and you can see actually at the third derivative Everything is constant and you know, the student monkey will start to see, you know See this matrix terms coming out, but we'll get to that in the next minute or so Okay, so now back to equation number one Um, the sign again, I'm not sure it doesn't really matter what the sign is We'll talk about what the sign has to be in a second But m z equals e i d squared u i d x squared at node a You know x equals zero you can plug all that in True all of these, you know, we plug in Uh zero for x, right? This is d squared u i we plug that into this equation You plug in all these zeros what comes out. Well, these things come out And um, you have these Basically multipliers for the reserve freedom Um, that's how you distribute this moment across the reserve freedom is these multipliers here at node b it's very similar the only difference is that um Your x equals l so you're plugging in l l l l A lot of these things will cancel out. Um, it's it's always, you know You can subtract and add these numbers together because it's they're both over l squared at this point And you get a similar proportionality between the moment and the this and the reserve freedom here now the sign People always talk about conventions and concavity and positive negative and all this stuff I don't know any of that stuff. It's too hard for me. All I care about is does it make sense, right? So ultimately Um, we want to know that a positive moment Causes a positive rotation at that node So if we're applying a positive moment at node b In the z direction that causes a positive rotation About z It has to right if we're if we're spinning this way By golly this ought to spin this way too. Otherwise something is severely screwed up And so basically that means that this sign Has to match this sign And it does if it didn't match you put a negative sign here Who needs definitions and concavity and all this garbage and keeping track? Just just make it make sense on the left hand side. You need the moment at a to be positive And the the displacement in a rotation at a to be positive If not you put a good sign in front and here here we here we had to right and so that's why this comes out So I don't keep track of negative signs. It's too hard. It's everything messes up You know, you make mistakes. Don't bother with that stuff. It's it's a waste of time So these terms here I'll show you in a minute. These are the stiffness matrix coefficients In this row and these are in this row right Okay Equation three now we pull that down That's just dm dx. So this is actually the third derivative All right, so we plug in You know our x equals zero x equals l in the third derivative equation By the way, there's no x in that equation, right? It's all constants. So it doesn't matter what you plug in but um Yeah, so basically your shear force v is your shear applied forcing Um f in the y direction and then the signs again will pull out the signs that make sense So in this case we want a positive force to move the the node up All right, so at node a you have to both match. So again, there's no negative sign here But for this one A positive force and b has to cause a positive displacement at b And that case we need a negative sign. So in this case, this is how the stiffness matrix terms Um for f in the y direction at node a and node b look So we can grab these things these these these eight ones and these eight ones and throw them in the stiffness matrix And we're almost done almost done. So that was bending about the z axis or in the y direction But now we have to do the other one we have to do bending about the y axis and this one is I see here. It's basically the same thing except the right hand rule betrays us Which it does and I hate this and for some reason no one Talks about this like I'm looking through these textbooks and this just like it's like a secret I don't know like no one wants to talk about it. It's like and for obvious reasons. This is this. It's not obvious dude I couldn't figure it out Okay, so in this case the only difference is if you don't have um You know the the z moment of inertia we have the the y one and so that's instead of being y squared da It's z squared da Right and so here's how the right hand rule betrays us So before if you remember we took this assumption this small angle assumption that theta z Was approximately equal to dy dx right? That's that this angle here Is approximately equal to the slope Right, and that's just a small angle like an assumption going on Right, and that that's that's valid for small angles. However, if you now look at that data in the y direction this this you know Slope and this angle z axis is down, dude So this slope is actually negative the z dx not positive and that's where the difference comes That's the only difference That's the literally the only difference between bending in the y direction and bending in the z direction. It's just this And so I you know very carefully took me many hours to go through this You know equations and and change all these things I changed all the y's to z's and all the z's to y's and put some negative signs for all the angles Right So here you can see that the angles became negative angles became negative Blah blah blah long story short derivatives keep going now. We're down to the equations, right? So now we're plugging in You know zero and l for x a node a node b and Everything here is basically the same exact things before the only difference is where I put these little astroces These things change sign And these things change sign so So This is the um series matrix terms for you know, my day and my at b It's almost the same thing Obviously these degrees of freedom are now about the z and these are about the y as before they were, you know, switched around But Everything here is the same, you know, the same number is the same derivation. Everything here is then I call We just changed some negative signs in front of the of the angles And then for the shear force again, it's the same thing except for these terms changed right and so Take those numbers plug them all in and we have this completed 3d frame element stiffness matrix formulation that's a mouthful And it's fully symmetric. Everything here is very nicely organized and like a little Thatched pattern very like very nice. It's like a fence site Very grid like very cool And this shows how degrees of freedom are related to applied forces. That's that's literally altering That's the takeaway from this video is just this matrix relates a given force to all those placements, right? Okay now for I hit the maximum number of vertical pixels in this in this uh file. So, uh, let me open the second file So that's how you make a single Element matrix. The question is how do you assemble? Remember in in in the in the beginning and we go back We had that that spring example and to assemble all we did was add it together, right? Where is this spring example? Here we add this together, right? That made sense because there was only two degrees of freedom, right? The problem is when you have a lot of degrees of freedom a lot of nodes, right? The matrix is very big and you have to know where to put these Terms in right? It's not going to be so easy as just lining things up with these equations You have to be able to do it awkwardly or else you're not going to you're going to be there all day Basically trying to put these things in so here's how this Matrix breaks down into quadrants So the upward left six by six is how forces at no day Relate to displacements at no day Whereas the upper right contra is how those same forces Causes basements at node b, right? So these Go on this side and these go on this side And uh these on the bottom are the same thing but for these these forces So how did node b forces Cause displacement at node a that's this side And how do these forces causes that node b that's this side, right? If you can if you understand that Everything else is so it's so simple. I mean all you're doing Imagine that we had like a bunch of other degrees of freedom in here a bunch of other ones that we don't care about You know Say we had a node that was in the middle here that we didn't care about that would just mean that we had a bunch of zeros you know Along this direction and this direction you actually would have six Rows and columns of zeros in between all of this I'll expand that in more detail right now. So let's say you had this Structure here with four elements one two three and four and four nodes one two three and four element one Looks like this element one Um, so here is basically a bunch of I broke it. It's all down into each degree of freedom here. So there's Six nodes. I'm sorry. I'm not saying there's four nodes and there's six degrees of freedom And so each one of these things is you know, six by one because there's six degrees of freedom per node So this total length is six times n n equals four. So it's You know, what is six times four open calculators And simply on the right here six by ones and there's four of them six times four That's how many you know elements are here and now so element one connects node one and node four so Basically, that means that all we care about is what's in the one one slot the one four slot The four one slot and the four four slot So we take the elements did this matrix this little guy or I should say hold on This little guy we saw it down horizontally here and vertically here We snag this corner This corner this corner this corner all separately And we throw them in here Bam Bam Bam Bam Then element number two comes along element two Is nodes one and nodes two. So in that case, we're putting those four quadrants Here here here and here And you'll see that for these ones we just fill in the zeroes, but here we actually added it together so we we've added the The sickness basically has to be distributed the force is distributed across both Elements, you know if this element is made of reinforced titanium this one's rubber Obviously more the force is going to be invested in deforming this than this If they have this place in the same degree of freedom So you have to add them together right then element three we're plugging in this one this one this one in this one And then element four we're plugging in this one this one this one and this one see how that works We just slotted in the degrees of freedom into the corresponding rows and columns based off the nodes that were involved So if we needed nodes one and four We slotted it into Sorry, those one and four you put it into row one and four column one and four right So it's extremely simple. I mean this is you know First grade spongebob Okay now There's one more thing about this matrix that I didn't mention It's that when we're applying forces and stuff and looking at the spacements We don't want them to be in the local frame and also if you want this to make sense These all have to be in the same frame. You can't be adding You know if if one of these elements has x in this direction like element one does and one is in this direction Like this one does this is all screwed up. I mean x has to line up The you you you can't add the you one degree of freedom Unless it matches right you if you want this way for this element It has to be this way for this element It has to match up or you can't just add like this and you could go and you could you say oh Well, well, this is why and why is x and everything and do this all kind of intuitively Or you can make just some simple math, right? So and this gets really hard once you have like 3d rotations and stuff It's very difficult to keep track of all these things without having a nice Transformation matrix like this. So we have to go from like global global system to the local system And so we we ultimately want to have this equation here This is our our goal of the video is having all of the forces in a global frame Equal some global threat matrix, which we don't know that's something that we don't know right now And we and we want to compute these degrees of freedom in the global frame And so we don't have this k g, but we do have the Local ones. We do have the forces locally, right? Or we at least we have this we have the symmetric locally That's what we just defined over the past half hour was this no this crap So we have to be able to figure out how this works So what we're doing is we're defining this matrix t which relates from the global to the local Both for displacements And for rotations What am I saying? Both for displacements and for forces. I'm getting loopy right now. This is too long a video So we can plug in these two things here tu and tf Into this equation here and kind of we can pull out that the global service matrix is just the transformation matrix inverse Times the local service matrix Times again the transformation matrix So that's all we're going to do. We're just going to compute this Compute a t matrix and then Mod and then you know pre multiply this by the inverse of t then post multiply it by t And then slot it in this matrix like this and we're done. That's how this whole system works out So this is how the transformation matrix looks. It's mostly zeros All we're doing is we have these three by three blocks that we're trying to create and these three by three blocks Basically relates the local or should say the global x y and z To the local x y and z right And so people talk about like oh direction cosines and caternions and all this stuff But those don't make any sense and they're make beliefs So we're going to do the old-fashioned way with dot products like like got intended And so each of these little three by threes is the same and i'm going to call them gamma that's what this is gamma right and The way that works is we just have to be able to quantify the the axes In the other system So you can think about this in a couple different ways But I think the easiest way is to say that this this row here is the local x axis Call this one the one aligned with you know the beam element from node a node b that We're going to quantify that in the global x global y and the global z axis aka This is a unit vector, you know in the x axis direction It's it's a unit vector in the global system for the x axis So the first row is very easy That's just x to the four the unit vector from node a to node b and so you compute the length By the way, you need the length for everything else and it's you know, you know This matrix has land everywhere. You kind of need this anyway So we'll already have this but you will need this for this as well And what is the unit vector? It's basically just the Node b minus node a over l both for x y and z So this is the x l unit vector in the global system And now you have to compute the y and the z unit vectors And this is where you get to kind of pick what you want to happen Now The question is how do you define the local Y and the z axis because if this is your x axis this, you know Like blue one here is y going to be up And if y is up, I guess z is to the right But is what can y be this way or is y this way and then z this way But what's what's what are you going to do like if the pick and so the way that you pick Is arbitrary But um, there's a couple options and again it matters right it matters which way is y and z because y has to align I mean usually like for an i beam, right? This is an i beam this structure is much stiffer in the in the You know in this direction bending in this direction than it is bending in this direction That's just a geometric property because the material is further from the neutral axis And so the way boomers do it and we've seen these textbooks is they define a point not everybody but what I've seen a lot Is that they define a reference node Somewhere in the local x y plane x y plane is basically this plane here They define a point oops The kind of point in this plane and they basically say okay Well, this vector v goes from node a to that point And then if you take the cross product of vector v with the x axis Or I should say with x sorry you hit the cross product with x with the with the with the v You get the z axis, right? That's true, right? If you use the right hand rule on this you put your index finger here your Middle finger this way This would be where your thumb would point, right? So that's the right hand rule So this is z local. So z local we've defined by this reference node c And then what you do is for the y local is you've um You take the z and the x and you hit the cross product of z with x and you get y and in this case B cross z with x your y is in this direction, right? That's fine and dandy, but the problem is it's so much work to do this I mean you to think about in general I mean this is going to be a three space. You're going to have x y z for this You're gonna have x y z for this You're gonna have to figure out where this node is in space somewhere on you know this plane It could be rotated some off angle It's really hard a lot of time and it it's much easier to come up with a just the vector by itself And that's what I'm going to do here So we're just going to find a vector and this is easier because A lot of the time, you know, this is already going to be in an axis, right? There's going to always be an axis in this direction like, um I have to draw something let's say you had a beam that was like this and this was your x x direction and y direction and z was out of the plane well You know, this was an i beam. It doesn't matter because If you put the v equals You know 0 1 0, you know the positive y axis That would also prescribe vector v You know, you don't need to put a point there and then calculate all the stuff You could just put in 0 1 0 and this would all fall out properly Okay, remember you have to normalize these things though. You can't just use You know like Regular your regular vector. It has to be a unit vector That's very important and I'll talk about why right now that's because A cool bug fact because the rows of this gamma are perpendicular and unit length both Gamma and that t matrix are both orthonormal which means the inverse of the transpose So I mentioned before that we had to take the inverse of this matrix You know inverse of t times k times t. Well in reality, this is just t transpose Which makes this a heck of a lot easier to evaluate especially because you have to do this for every single element so t transpose k t is what is the global matrix Or it should say the The global reference frame Of the element matrix Does that make sense? It's the it's the it's the matrix in the global frame. Okay So, um, yeah, that's all that Okay, last thing this is the really the last thing we're like, you know talking about today That's boundary conditions So there's two kinds of boundary conditions You can specify a force or a moment or You can specify a displacement, right? So going back to let me see that bike Um, you can apply a force or you can say hey, I'm gonna turn the handlebar, you know This many degrees this many inches or we're gonna push the seat down this and watch it We're gonna Whatever you want you can apply actual degrees of freedom or you can apply Like for example, this this your freedom here is set to zero both, you know The the spacements are all zeros and the rotations are all zero So you have six degrees of freedom that are all zero at this node here All right, so there's two things that you can do I mean forces and the spacements and they're both pretty straightforward So to apply a force all you do is you put in the value in the force matrix Okay, you know, it's a it's a a huge breakthrough there, right? I mean It's all zeros to begin with and you just plug in the forces that you're applying Into the proper slots. So if if you're applying a force at you know No No degree of freedom number three It would go here if you're applying a moment at degree of freedom number was this Five it would go here. Okay Simple stuff Now for displacements, it gets a little bit more challenging. So I made some examples here, right? So this is a this is an example where we had this is not a frame element This is only six by six just a shell But you know, let's say we had you know row three and row five are going to be applied forces And let's say rows one two Four and six are going to be specified displacements. So The degree of freedom u one is u bar u two is u two bar You know u four is they're sorry theta four is theta four bar this is theta six bar all that stuff So To kind of make this work what you do is think about how this sets up in the equation, right? So this is just those matrix you have to make this make sense, right? So row one You know u one bar has to equal to u one I mean that this this in this term k one one has to be zero And u two that has to be one it has to be one This has to be one this has to be one because you have to make the displacements match up with the prescriptions So we're prescribing it to be u one bar That you know u one has to equal u one bar, right? Same with u two has to equal u two bar all this stuff now For the force force rows where we have these forces being applied um So we had a bunch of zeros here, basically this was a zero this is a zero all these zeros We we don't care about the other ways of freedom It's all we care about in this first row is defining u one second row is defining u two fourth row is defining theta four Sixth row is defining theta six, right? But at rows three and those five We we did we're not not just setting these values. We have to actually compute these things I mean that's the whole point of this, you know Method is that we're computing these values and so you have these full sets of degrees of freedom here, however the difference being that you can actually Kind of secretly plug in The prescribed degrees of freedom because remember this column was u one This column is u two this column is u three this column is theta four theta five theta six You can because you're prescribing you want to be u bar at one you can just plug in u bar You'd have to have u one there just have a u bar have a value there Same thing with u two and theta four theta six plug in the bar versions of of this um of these values And then because we always want to have the no one's on the left hand side and the undone on the right hand side Here's how that matrix would take shape So you can see this is like the takeaway. Um, wherever we had a prescribed degree of freedom So this matrix is just One and a bunch of zeros So actually what you would what you do to this is that you basically make this matrix in the beginning Just just without any boundary conditions and then you say okay Well, we're prescribing you one What are you prescribing? Well prescribing you want to be u one bar? And then you say okay. Well, let's get rid of this get rid of this this this this These are all going to be non-zero. They're going to be you know E a over l you know g j over l all this stuff's going to be in here You say screw all that garbage make them all zeros make these all zeros So this means that these are all zeros and these are all zeros And this is not you know You know 12 e i l cube whatever this is just one Similarly for this second row you set this to be one and then all everything else to be zeros in that row and column And then you plug in you two bar here Then for you know same with data for you make all these zeros All these zeros and this is one And then data six again. These are all zeros. These are all zeros and this is one And then for the forces We have to bring all this stuff, you know This one this one this one and this one and this one this one this one and this one To the fourth side because they're known values. They're not unknowns anymore So we're you know, here's how you do it You subtract them all to this side and you put them over here now This gets a heck of a lot easier When you're prescribing is zero when you go back to this and you say oh Well, these are all going to be zeros here and all zeros here and all zeros here and all zeros here You don't care what the numbers are anymore. You know, this is zero, right? This is zero This is zero. This is zero and guess what all of these are zeros At that point You get something super super easy to evaluate you have just you know zero zero f zero m zero and then this I mean, this is super simple to evaluate, right? So it gets a very very easy So medications are extremely easy to implement And here's how that looks if you want to just just reduce that you don't have to do this, but Some people like to do this You kind of can take out all the known values or freedom on you know different equations set here So you want is you one bar you two you two bar data four data six They're all in their own set of equations and then you pull out all these garbage rows and columns that you don't need anymore All right boom boom boom boom as well as on this side What am I doing and then this side as well boom boom boom Get rid of all those garbage things and uh, you keep what's important and you can solve for this So here is the summary of the process okay First thing you do is you initialize first out You count the number of nodes you have and degrees of freedom and all that and you initialize these vectors f u and matrix k So you this is basically just a matrix. That's you know six n by six n This is six n by one six n by one, okay Then you loop through all the elements and you compute their local elements to this matrix that is This right and this is purely geometric and material Right and there's also the vector v we talked about right You have to know that as well, but you're computing this local l matrix. It's a very straightforward thing To do All right, you're just plugging in numbers in this 12 by 12 Then what you do is you convert that local stiffness matrix Into the global frame you take this 12 by 12 and you pre multiply it by uh This t transpose post multiply by by by regular t and you get this so it's it's some weird version of this It's gonna look a little bit different. There's going to be different spots But yeah, it's going to be basically this But just rotate it a little bit differently Then you drop you cut that in half you you saw this down here So this down here and you drop the quadrants of this Transformed matrix this k g Into the full matrix right So you slot those in just like we did up here, you know, you put those in like this All those things then what you do is um You apply the magnitions. That's this stuff here. Again, it's super easy You just literally crossing out rows and columns of your matrix that you just spent so long to to make you just cross out all this garbage You put ones and zeros everywhere and then You you solve the the system you take k inverse Of your reduced system or this system whatever you want This is actually easier to do most of the time. You don't have to work with all this, you know Getting rid of these rows and columns. Um, yeah, you just solve a system And you uh, you're done now you you have you and you have what you need And this point is where you say well, what do I need now? Do I just care about how much the bike is going to deflect with when uh When a fat guy sits on the on the seat do I care like oh, it's you know You know 200 pounds the bike's going to sink by you know one inch man all these shocks and stuff Or do I care about the strains and if you care about the strains and stuff You have the post process and we have functions for this Remember the the strain the tensile strain the it's the axial strain Um, just do attention alone is remember it's this it's the um If you if you have your element like this the u at b minus the u at a That's the length change divided by l so you can compute the strain Just by taking these values right just take these two values subtract them divided by l what you know And then multiply it by you you get the stress if you want I mean If if if you care about the stress of the strain you can compute both Towards the same thing you plug in the values to the degrees of freedom that you solve for just now very carefully And you know you know r and l you know g you can solve for both the sheer Oops, the sheer strait sheer strain on the sheer stress if that matters to you, right? And then axial stress. I mean Remember axial stress is not just um, you know tension But you also have to add in the bending components and so you have all this stuff I mean you have you know these functions you have these shape functions that you can evaluate Anywhere along the part you want to plug in x equals l over 2 you want to plug in x equals l over 3 l over 4 You can plug in anything you want these shape functions And you can compute these derivatives and plug into these equations and get the stress in the strain very very easily Right and remember you have to do both both y and the z right So it's all very simple. So i'm going to get into that that's for you to learn and then on your own But it's very easy to take these these us and compute relevant quantities of interest that you might need All right, last thing I want to talk about really quickly Is a full example and so I've got this um Ladder here and basically this ladder I'm just showing the the overall process and we're going to talk about um, what looks into coding this up. So You have a ladder and it's made from let's say wood That's you know one and a half by three and a half inches for these rails on the top On the left and on the right And there's a one inch diameter Rungs and everything here is made from pine wood And these are the approximate properties for pine wood that we're assuming. You know, it's isotropic We're going to assume that not not in reality, but we're going to assume that it's isotropic just for this quick analysis so Um, we're applying some forces We're having we have some guy here on the top 200 pounds And we have some guy here pushing the ladder in just to hold it steady You know he's helping out. He's been a nice friend And the ladder has some dimensions. It's two feet wide Each of these rungs is one foot up except for the top rung. That's one foot from the the top of the of the bar there um, so yeah very uh straightforward structure here One cool thing though. I put it at the slight angle here so it kind of can can take into account some um Some other axes and the bottom two, you know, legs here are fixed And the top is up against the wall and so we're We are constraining these series of realness one is you know fixed in place But this one can just not move in this direction obviously it's against the wall It can still move in this direction, right? But it can't move in this direction okay That's all of that now Some questions to answer so what are the different cross sections that we have um, we have a cylindrical cross section And a rectangular one and so we can compute You know these um these polar moment venercius and the area moment venercius Based off the expressions that we come up with previously because we need these for our Matrix right this these are values that we care about dearly for Going into here. We need to know i y we need to know i zero you need to know You know And obviously a and all these things and j It's all have to be known you have to compute all those things And so that's the the process here in all that stuff. I'm not going to go through all this. Um, there's actually You know textbooks you can just like you know preference sheets and textbooks on this topic You can just look up. What is the moment of inertia for us a circle? What is the more inertia for a rectangle and you'll get these things one cool takeaway though is that um That I didn't really know until recently is that I didn't really think about this But the pulled moment inertia is just the y and the z Area moment inertia is added together very cool. I didn't realize that but that's always the case interesting And also we're going to be using the global vector zero one zero As our vector v vector v being here we go again. I scroll up a vector v being um Yeah, this vector here because um That will that will basically be in the plane in the x y plane for all of our cross sections Um, you know this vector here Oops, let me draw a line This vector here will be in the cross section In in the in the x y plane locally for all of our um elements here because this element, you know, this is this is the You know the the y axis for the element that's as I drew here And this can be in that plane. This is not perpendicular to that plane. So yeah, that's all that Um now comes to the question is what different kinds of elements do we have besides just the cross sections? Well, we have elements that are, you know cylinders and for cylinder elements. We have elements that are um Two feet long or two and four inches long. So that would be all of these elements here Where's my pen? So this element this element this element element element Those are all two foot wide elements and you see I'm I label all the nodes nodes are labeled one through 19 I put one node here where the guy's standing Because you have to put a node there you can't apply a force without having a node So I put a node where the guy's standing and the guy the guy that's pushing over here at node five I put a node there for wait node five yet node five Um, you know just because he's pushing there. We have to have a node there And so nodes one through 19 and then elements You know one two three four all the way down, you know And then down the rungs and then down the right side all the way to 24 And so as I said before in terms of cylinder elements, we have Six of them that are one two three four five six of them that are two foot long We have two that are two inches long. That's nine and ten And we have a bunch of elements that are rectangular and what foot long that's all of these elements And all of these elements And then we have elements that are rectangular, but half a foot long. That's number one in 17. Okay And so if you wanted to you can compute the simplest matrix just, you know, manually, you could just go over here Okay, well, I'll plug in these values, you know l l is, you know Six inches for this one and 24 for this one and the the eyes and the ease and stuff Well, the ease are all the same. They're all from wood and the g's are all the same And the eyes and the j's they come from this and you could do it all manually, but Um, it's easy just to code it up. And so now what the boundary conditions? What are they? So in this case, um What are we applying? So f z At node five we're applying the guy pushing right. He's pushing with 100 pounds and that is in the negative z direction That's I've drawn it here. So 100 pounds negative z, right Then we have, uh, 200 pounds in the negative y at node 10. That's no 10. That's this way So 200 pounds downwards, correct. Y is up 200 pounds is negative Um, then we have at node nine and 19. It's fixed. So these were all fixed. Remember fixed in space And then uh nodes one and 11 are fixed in that they can't move in the z direction So remember the z direction is this way. So this degree of freedom was set to zero um For nodes, what is it nodes one and 11 they can't move in the z direction So u z zero for both nodes one and 11 And now we're we're done. You just go on the computer and you You program this up. So how does this work? Well, let's take a look So I have some some um, uh functions here. Let me zoom in I have a This is the you know, the overall function. Hold on. Um So yeah, here's my ladder function basically at the top of this I'm defining the nodes. So this is the x y and z location of every node in this ladder, right x y and z location of every node so You know just node one node two three four five six and actually I parametrized the angle out So you could directly change the angle or whatever. What is this garbage? Oh, I paste something in oops Okay, so this is all the nodes. There's what nine nine nineteen nodes I think and then here are the elements. So the elements is just me saying, okay, well element one that's the first row has node one and node two and the element type Is something else. I'll get to that later. So basically we have um 24 elements and the elements include all these nodes. So element 24 has node 18 and 19. Let me just go prove to you that's the case 24 18 19 and the element type is was it type two? Yeah, so here's the element types So what this is just encodes all the information in a single row of a matrix. So we're including material properties e and g and then geometric properties a i y i z j and then the the vector v um As well in one one root one one row of this matrix And so we have one row for the you can see the circular ones have a pie in them And the rectangular ones don't have a pie And so yeah, this is just telling you You know this two means it's a cylinder only that's it's a rectangle and this one means it's a cylinder element That's all that means that's the definitions Now at that point what you do is you again like I said before the first step of this was to Interest these vectors f and u and matrix k. So all we're doing is I'm I'm computing the number of degrees of freedom I'm multiplying this You know, this is a six times the number of nodes number elements is just you know a number of elements in this Vector here in this matrix here number of rows And then we're initializing f and k We don't care about initializing u because you were solving for and so we don't have to initialize that one We're initializing, you know, an six n by one F vector and a six n by six n To this matrix and then we're assembling um the local So this matrices into a global one and so for that we have to look at this function here frame element matrix transformed And we're just looking through all the elements and we're we're calling this So what does that do? This is just a function that outputs that you know the tk t thing that the t transpose times k Where is that this one and all it does is it literally um It takes in the element it computes it gets it grabs those global variables for the nodes and everything I don't want to pass in these these things, you know, that's a lot of stuff to be passing around I'll just take a global value And we're taking nodes a node b the element type all that computing the l We're pulling out the e's and the g's and all these from the element type row, right? And then We just initialize local matrix 12 by 12. We plug in all these values. These are all the non-zero terms This is all this stuff You know very simply plug it all in it's a lot of stuff, but you just make sure it's all correct then we're computing these um These local unit vectors in the global frame that's this right That's the game i matrix or wasn't yeah, um And we're computing t And then we're just solving for t transpose k t and then and then outputting that as the output of this function so um Yeah, at that point all we're doing is um, but this time we're breaking it up Where this is where we're songing it in half in both directions and we're we're slotting it in that's uh That's this part up here Come on Yeah, this part here where we're breaking up the um The 12 by 12 into 6 by 60s and putting where it needs to go That's what this set is doing here and then um Now we have the better conditions So we're just here i'm applying a this is at the proper degree of freedom because we you know Don't worry about this math. You can figure it out yourself. This just means that we're applying Uh a negative hundred pounds in the proper row of the f matrix And then we're applying 200 pounds negative in the proper row of the f You know vector here for this is the guy standing and then here we're applying all the zero degree of freedom So these are all the degrees of freedom. Don't worry about what all these things mean It just means that this is a list of all the degrees of freedom that we're fixing to be zero So that is all of these These ones these ones and these ones all fixed to zero and then what this this um For loop does here is it loops through all these degrees of freedom that we look set to zero And it just does what we did before it it sets all the rows and columns To match up with this so everything you know here is zero everything here is zero everything here is one That's all it's doing um in this for loop, right? That's the um, you know the rows and the columns to be zeros and then the that diagonal term to be one And then last thing we just solve the system very simple one line to solve for the degrees of freedom And then I have a function here that prints out the degrees of freedom very nicely Don't worry about that just helps it helps us see what's going on And then I have a functioning that draws the mesh Here so what this does is it takes some nodes and elements You and this is a magnification factor. We'll use that later. Um, Basically, it just it just plots the undeformed mesh Then it plots the deformed mesh you can see it applies, uh, you know It adds the displacements to the element, you know, node locations as well And also has this management factor So if you want you can multiply the displacements by a factor If you can't see them very well with with factor of one you could put in a factor of 10 And you can see a 10x magnification of what the degrees of freedom are doing Okay So, um, if I run this octave Ladder not m So let me just show this side first Actually, let me show the side first We'll show the side first. Um, so this is basically the The ladder so this is the ladder Um, you can see here is where that guy is pushing and here's where the guy is standing and you can see there's almost no effect Right, there's almost no effect of this guy Um standing here and pushing here and actually this would be symmetric if the guy wasn't pushing, right? Um, but you can see how this guy's bending the top wrong a little bit with his weight This guy is kind of bending the the left hand two by four a little bit with his force And and all that so that's what's happening with the with the degrees of freedom that you can see But I want to show you, um This so here are the nodes and the degrees of freedom plotted out So if you remember we we said that, um, nodes nine and node 19 We're having zero degrees of freedom and so you can see where is it that that prescription holds true Right nodes nine and nodes 19 everything in the rear freedom is set to 0.000000, right? That's all zeros and then you can see at node 11 The z component and node node node one the z component opposed to the zero That is this node one is zero And node 11 at z is zero So that's all that and then I guess if you really cared you can kind of look at, um, was it node five and node 10 So at node five we're applying a force in the y direction. No a z direction, right? Yeah z direction you can see that's the most z deformation that you have is at that node and then at at node. Um, what was it? No, no 10 or applying a y-force You can see that this is the y displacement at no 10. That's a pretty massive deflection. That's a 0.4 inches downwards But now let me actually go back into that um ladder function and let's Change the factor from a one to a 50 just to get a better idea of of what the displacement is actually doing So I can rerun all this Pull this open and I usually try to see that stuff is kind of um looks a little bit wonky, right? So the guy on the left the guy was pushing the the bar the the ladder into the wall He's not really helping out anymore. If you if you magnify the factor by it by a 50 Let me go back and let me turn that off. Let me turn off his force. So I go into the ladder Function I can turn off that guy that guy you've you've served your purpose. Let's make you uh go away Without that guy you can see it's much more symmetric and you can kind of see this very cool. Um deformation going on so Again, you can see the top of the ladder the it's it's constrained that it can't move Into the wall, right? But the angle can change right the angle can change It's kind of gotten a little bit more of an acute angle there the bottom ones the angle is fixed See that can't move but the top ones can and you can see with this linear analysis because we took one time step And we will put it by a factor of of like 50 you can see kind of it's a little bit wonky here right this I mean the guy stepping down. Why is this um This location moving out in the z direction like this Well, that's that's because it's a combination of a rotation and a displacement Like this This node here is rotating right what's what those are nodes one and one of those nodes That was node um one and eleven so the one eleven. What is the displacement there? Let me um Let me close this really quick. Um The rotation about the z-axis That is yeah, here you can see it's non-zero. It's rotated by this many radians um about the z-axis for node one and node um No, eleven so yeah, that's all that um, so now if I just run this again really quick to show you um If you took a time step and you were to you know iterate this over time, you know This would not be coming down at an angle. It would you know reevaluate itself to becoming rate down vertically That's what i'm trying to say And then lastly a question that you might have is a why is this wrong snapped in half man? This wrong should not be snapped in half. This should be a nice You know if I go back into function and I and I change This to you know back to a one You know it looks better, but even still there's a problem. You know, it's it's a linear assumption, right? We're assuming that it's aligned but in reality. Here's the thing in in reality Um, you know, we're not I'm just plotting the nodes and a line between them in reality What you have is you have a A curve right and that curve is actually defined by those shape functions that I mentioned before In in in the bending direction and so you could actually go through and you could plug in an exact You know function that you know matches the slopes and matches everything at all these points using the shape functions that we talked about And plot all these things but ultimately, you know for this simple example, I didn't want to do that But yeah, that's how this works Um, so you can see just how really how straightforward it is to implement this It's it's super simple. This video is an hour and a half long And we covered literally everything from the basics of structural mechanics All the way to the full implementation of funny element analysis and Yeah, it's hard to do that man. I mean it it It's hard to do that but ultimately it's it's not a challenge to implement this It's everything is very straightforward. And if you don't care about the math behind it I mean programming this up. I mean literally I mean what was it? It's like 200 lines of matlab code and half of that is just stupid node definitions and the element definitions, right? It's just these um You know, just this stuff up here, you know, this is half of the function is just all this You know, the the meat the meat of it is this and this and this and then you're done I mean, it's like 25 lines if that So it's extremely simple There's no reason to go through these like, you know, extremely high fidelity software If you don't need to a lot of these problems you can just solve It's with a very easy code. And so I don't want to get away from us, you know As as a society as humanity, you know, this stuff is very easy to implement. We shouldn't let it um Let these software packages devour us and and drain our wallets So anyway, I hope you enjoyed the video if you do leave a nice comment and uh, those really motivate me to make more videos So anyway, thanks. Have a nice day