×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Coding by finite element method a truss

 Forum Search FAQs Links MVPs

## Coding by finite element method a truss

(OP)
Hello,
I am coding the truss problem by finite element (figure below).I found difficulties at the level of the assembly of the stiffness matrices . Since the beams do not have the same materials, we will not have the same stiffness matrices. In the program , how to do the loop of assembly ? Any ideas please ?

### RE: Coding by finite element method a truss

why should different material create problems ? E is just one property of the truss member stiffness (L/EA) ...
each element has L/EA as a stiffness
then at each node assemble the member stiffness in global co-ords

suggest you start with a very simple one first, one you can hand calc.

another day in paradise, or is paradise one day closer ?

### RE: Coding by finite element method a truss

Element (ii) stiffness in local coordinates is given by

You need to transform the element stiffnesses from local coordinates to global and then assemble in global stiffness matrix K.

E(ii)= Element Young's modulus
A(ii)=element area
L(ii)=element length

### RE: Coding by finite element method a truss

(OP)
rb1957 , goutam_freelance : Thank you for the replies. Here as you can see I have 17 beams and each beam has it's matrix, so my problem is : how should write each matrix as they are different , I can't use iteration so should I write each 17 lines for each Ke of a single beam ??!!!!
PS: goutam_freelance , I won't neglevt flexion in this example, so the matrix still like the one you showed me ?

### RE: Coding by finite element method a truss

ok, start with a simple example. You can model beams (with bending), just more complicated (axial and bending stiffness, two internal loads).

you are asking very basic questions, so get some texts ... there are plenty on-line.

you assemble the global matrix from the grids/nodes/points.

another day in paradise, or is paradise one day closer ?

### RE: Coding by finite element method a truss

(OP)
Thank you. I saw some examples and I did simple problems. If you see the picture of my problem you will notice that it's not the same thing , as we don't have same materials , same angle of the beams ... We will have different stiffness matrix that's why I'm asking

### RE: Coding by finite element method a truss

It shouldn’t be a problem to loop through all elements, create their local stiffness matrices and assemble them into global stiffness matrix. Which programming language do you use ?

### RE: Coding by finite element method a truss

(OP)
That's my problem... It's in the creation of the Ke and the assemly .... It's not similar... I'm using python

### RE: Coding by finite element method a truss

if you can build a simple truss, then you should be able to do a more complicated truss. each truss element has it's own stiffness matrix (in local co-ordinates). assembling into the global matrix is "just" combining the elements based on which nodes they affect and what angle between the local axis and the global axis.

different material is "only" an impact to local stiffness.

another day in paradise, or is paradise one day closer ?

### RE: Coding by finite element method a truss

(OP)
Ok I will see. Thank you brother

### RE: Coding by finite element method a truss

or anything in between ...

another day in paradise, or is paradise one day closer ?

### RE: Coding by finite element method a truss

#### Quote (Amine A)

That's my problem... It's in the creation of the Ke and the assemly .... It's not similar... I'm using python

Once you have seen and understood the basic procedure for combining the beam matrices into a global stiffness matrix your question will be answered, including why the beams having different lengths, angles and material properties is not a problem.

Regardless of the language you intend using in the end, I suggest setting up a simple problem on a spreadsheet and getting that to work.

The link below has links to a series of blog posts that work through that exercise, ending up with VBA and compiled code. The 3rd post addresses your question in this thread, but it is worth looking at the first two as well.

https://newtonexcelbach.com/2014/01/22/frame-analy...

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

### RE: Coding by finite element method a truss

(OP)
Thank you so much

### RE: Coding by finite element method a truss

(OP)
Hello,
Can you please tell me what is the size of stifness matrix of an inclined element if we consider traction , compression and flexion ? is it 4*4 or 6*6 ?
I have never saw a truss considering flexion problem....

### RE: Coding by finite element method a truss

#### Quote (Can you please tell me what is the size of stifness matrix of an inclined element if we consider traction , compression and flexion ? is it 4*4 or 6*6 ?)

I assume when you use the term "truss", you are using the standard interpretation that all members carry axial forces only, no shear forces or moments; hence node displacements are translations only, no rotations. (2 DOF per node in a 2D model, 3 DOF per node for a 3D model)

"Frame" members can carry axial forces, shear force, and bending moments, and node displacements include translations and rotations. (3 DOF per node in a 2D model, 6 DOF per node for a 3D model)

Hence a 2D truss element has a 4x4 element stiffness matrix; while a 3D frame element has a 12x12 element stiffness matrix.

### RE: Coding by finite element method a truss

The clearest way to understand how to form the global stiffness matrix is to consider the freedoms at each node, and how they interact. For your example, and ignoring bending moments, each node has two freedoms, deflection in the x and y direction.

There are 6 unrestrained nodes, so you need to find the magnitude of 12 deflections, so your stiffness matrix will be 12 x 12.

Numbering the freedoms in alphabetical order you will have 1,2 at Node E through to 11,12 at Node J. Each freedom number represents a row and column in the stiffness matrix, so for instance row and column 1 and 2 will combine the stiffness values from end 2 of elements AE and BE and End 1 of EF and EH.

If you want to include bending moments (assuming the nodes are fixed rather than hinged) there will be an additional freedom at each node, so your stiffness matrix will be 18 x 18.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

### RE: Coding by finite element method a truss

(OP)
Yes , the problem is that in the exercice he didn't specify this... He said a structure composed of beams ( the figure I showed you on the first comment) and we will consider traction , compression and flexion. So I don't know with which case I will work based on that statement

### RE: Coding by finite element method a truss

(OP)
Yes , thank you, so if I include bending...each local (for an element of 2 nodes) stifness matrix will be 6*6 no ?

### RE: Coding by finite element method a truss

#### Quote:

Should I work with this matrix (figure below) in my case ? (considering traction / compression and flexion)

Yes, so you will have 17 matrices, each 6x6. Do you see how these are combined into a single 18x18 global matrix?

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

### RE: Coding by finite element method a truss

(OP)
Yes yes the global will be 30*30 and considering displacement on the 4 nodes it will be reduced to 18*18.
Thank you so much 😊

### RE: Coding by finite element method a truss

(OP)
Hello ,
Please ,should I find 17 or 18 forces in the postprocessing results ?

### RE: Coding by finite element method a truss

you've got 14 elements, no ? (AF and FD are single elements, no?

are your reaction points fixed or pinned ?

this is school work, no? please comply with site rules (about student posts).

another day in paradise, or is paradise one day closer ?

### RE: Coding by finite element method a truss

(OP)
I didn't pay attention to that sorry...okay I will( because when I did this account I was working with a company...).
I have 17 elements like shown in the picture I've put on the first comment. Yes AF and FD are elements so the total elements is 17. What is the difference between pinned and fixed ?
Like shown all displacement for A,B,C and D are 0

### RE: Coding by finite element method a truss

apologies, yes 17 elements (colour blind to the horizontal ones !)

do the supports (A thru D) react moment (fixed) or just axial load (pinned) ?

another day in paradise, or is paradise one day closer ?

### RE: Coding by finite element method a truss

(OP)
No colour blind and no horizentaol ones, it's 17 elements with AF and FD. The supports A thru D are all fixed

### RE: Coding by finite element method a truss

#### Quote:

Please ,should I find 17 or 18 forces in the postprocessing results ?

Why do you think there will only be 17 or 18 forces?

You have 17 members, each with 2 ends, and each end has two forces and a moment.

You also have 17 6x6 member stiffness matrices, and the deflections and rotations at each end of each member, so you can find the 17x2x3 member actions by matrix multiplication.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

### RE: Coding by finite element method a truss

there will be 17 axial loads (why would you think 18 ?). this is the complete solution for a simple pin ended truss.

with fixed ends you can anticipate that end member will have different loads at each end, different moments balanced by different shear forces.

sure in this specific case, you can invoke symmetry with your simple load.

another day in paradise, or is paradise one day closer ?

### RE: Coding by finite element method a truss

#### Quote (rb1957)

there will be 17 axial loads (why would you think 18 ?). this is the complete solution for a simple pin ended truss.

He's said several times that all the connections and supports are fixed rather than pinned.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

### RE: Coding by finite element method a truss

yes, I know ... which is why I went on with the other loads (my point was to show how much simpler a simple truss would've been).

another day in paradise, or is paradise one day closer ?

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login

#### Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!