In this segment, we'll start looking at the homework coding template for homework four. All right, and that will be the 3-D linear elasticity problem, the steady state problem. Okay, so let's come over here to the code and we'll look first at the main.cc file. And as you can see, almost nothing has changed from the previous homework assignment. I, of course, changed the name of the include file but it's still 3D passing in the mesh size. This is, for example, 10 x 10 x 10 element mesh. Okay, create our object and then go through the same steps as before. All right, so we can go straight over to our header file. And we have our same header files here. But now, in this homework assignment, we are going to be using DL2's quadrature rules. We'll be using DL2's basis functions. And so that will make things a lot easier on the coding end of things, but then it does change the structure of our code a little bit. So we'll be looking at those changes here. First off, I'm going to declare order and quadRule as global variables. Actually not variables, they're constants. I've designated that here, that they are both constant integers. And I've defined them here, because I use both of these numbers in the constructor of some of our class objects, okay. So, let's scroll down and look at the declaration of objects in our class. Declaration of objects and functions. We have, of course, the same class constructor and destructor. Here I have a function called C, this is our elasticity tenser. Now, DL2 actually does have the capability of creating a fourth order tenser, which the elasticity tenser is. I've set that up here as a function where the inputs are just the four indexes, and then it outputs that component of the tenser. Okay? So you can use that when you're creating k local. The solution steps themselves are all the same as well as these first three class objects, but now we have, again, the DL2 quadrature rules. We have two quadrature rules, a quadrature formula for volume integrals and a quadrature formula for surface integrals, which is the face quadrature formula. We'll be showing you how to use those later on. Other than that, the k, d, and f matrices and vectors are the same. Slight change here, I've changed this object for the table. Instead of no location, it is dof location, or the location of the degrees of freedom. The reason I've done that change is because since this is 3D elasticity, we now have three degrees of freedom per node. And so, there are three times as many degrees of freedom in the system as there are nodes, okay. And, this table gives you the location of each degree of freedom. So, what that means is degree of freedom, zero, one and two, which all correspond to the same node, would have the same location. But they each have their own row within this table DOF location. Okay, course bound, you guys, map is the same. I'll scroll down to the construction destructor. Here in the constructor, again we're, we call the constructor for FEM dof_handler, but I'm also calling the constructor for quadrature_formula and face_quadrature_formula. All right, because they need to know what the quadrature rule is. And so that's what you've defined up at the top. The default value is quadRule of 2. Leave it at 2 when you turn in your homework. But if you want to you can easily change that to 3, 4, whatever, DL2 would automatically take care of that here. Also, you'll notice that I left order as a variable that can be defined. Again, I have defined it as one at the top, leave it as one when you turn in your homework. However, feel free to, on your own, to change it to a higher order of basis functions if you would like, d02 automatically takes care of that. Okay? But again, when you turn it in leave it at order equals one and quadRule equals two. Okay? So those are the small changes in our constructor again. Small change here with the names of the output vectors, because again it's a vector field instead of a scaler field. Let's scroll down and look at this function C, which is the elasticity tensor. This is the first part that you actually have to add that something. And it's simply to input the values for the Young's modulus and the Poisson's ratio. From those values, I can reconstruct the Lame parameters, lambda and mu. And with lambda and mu, I use the formula that you saw in the class, in the lectures, to create, define the particular component of the elasticity tensor. Now if you recall. C = lambda times your second order isotropic tensor, tensor product with, again, the second order isotropic tensor plus one-half mu times the the fourth order isotropic tensor. Okay? And what that means in indicial notation, is that we have Cijkl equal to lambda times delta ij times delta kl. Of course, delta here is the Kronecker delta, where if i equals j. Oh, let me write that down here. Delta ij is equal to 1 if i equals j and 0 if i does not equal j. Okay. Sorry, slight mistake up there, it should be 2 times mu instead of one-half. Okay, so we have 2 mu, and then here we have one-half times delta I K, delta J L plus delta I L, delta J K. Okay? Of course those can cancel out. And that's what you see in the code here. You notice I'm using these conditional statements here. If i equals j, if k equals l. If i equals j, then the condition is true and so it returns one. If i is not equal to j, then the condition is false or returns 0. So it's acting the same as a chronic or delta. All right, so it's a little bit cleaner or quicker than typing in an if statement, but it serves the same purpose in this case. All right? If we look at generate mesh this is exactly the same as our 3D heat conduction problem. We simply have to define our, the limits of our domain. And that creates a mesh for us. All right, for define boundary conditions, again this is something you'll fill in for yourself, and it will be very straightforward, similar to the previous assignments. Again, a slight difference here is that we're using DUF location instead of node location, but that's a small change. Another element that gets introduced here, though, is the fact that you may have different Dirichlet boundaries for each degree of freedom, for each nodal degree of freedom. And by that, I mean you may want to fix on a certain phase, the displacements and the extraction, but not fixed the displacements in the y or z direction. If that's the case, then your if statement, you would check not only the location of the degree of freedom, but you'd also have to find out what's the nodule, the corresponding nodule degree of freedom. In other words, is that degree of freedom a Dirichlet placement in the x, y or z direction? And so I've explained that a little bit here, in the notes, in the template. However, you don't have to worry about that in this assignment because our only Dirichlet boundary condition is to fix all degrees of freedom on the face where z equals zero. So all have to do is check is the z component of DOF location equal to zero? If it is, set that degree free equal to zero, whether it's in the x, y, or z direction, okay? But in the future, if you want to, you actually can distinguish between displacements in the x, y, or z direction when you're playing Dirichlet boundary conditions, okay? Let's quickly look at setup system. There's actually no difference here, other than the fact that we're creating dofLocation as a table rather than no location, but nothing that you have to change. Okay, so we'll stop this segment here, and in the next segment, we'll look at the single system, which again, will be the meat of this template.