+ All Categories
Home > Documents > Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Date post: 06-Feb-2022
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
129
SPRINGER BRIEFS IN APPLIED SCIENCES AND TECHNOLOGY COMPUTATIONAL MECHANICS Andreas Öchsner · Resam Makvandi Finite Elements for Truss and Frame Structures An Introduction Based on the Computer Algebra System Maxima
Transcript
Page 1: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

S P R I N G E R B R I E F S I N A P P L I E D S C I E N C E S A N D T E C H N O LO G Y CO M P U TAT I O N A L M E C H A N I C S

Andreas Öchsner · Resam Makvandi

Finite Elements for Truss and Frame StructuresAn Introduction Based on the Computer Algebra System Maxima

Page 2: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

SpringerBriefs in Applied Sciencesand Technology

Computational Mechanics

Series editors

Holm Altenbach, Otto von Guericke University Magdeburg, Magdeburg,Sachsen-Anhalt, GermanyLucas F. M. da Silva, Department of Mechanical Engineering, Faculty ofEngineering, University of Porto, Porto, PortugalAndreas Öchsner, Faculty of Mechanical Engineering, Esslingen University ofApplied Sciences, Esslingen am Neckar, Germany

Page 3: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

More information about this series at http://www.springer.com/series/8886

Page 4: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Andreas Öchsner • Resam Makvandi

Finite Elements for Trussand Frame StructuresAn Introduction Based on the ComputerAlgebra System Maxima

123

Page 5: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Andreas ÖchsnerFaculty of Mechanical EngineeringEsslingen University of Applied SciencesEsslingen am Neckar, Germany

Resam MakvandiInstitute of MechanicsOtto von Guericke University MagdeburgMagdeburg, Sachsen-Anhalt, Germany

ISSN 2191-530X ISSN 2191-5318 (electronic)SpringerBriefs in Applied Sciences and TechnologyISSN 2191-5342 ISSN 2191-5350 (electronic)SpringerBriefs in Computational MechanicsISBN 978-3-319-94940-6 ISBN 978-3-319-94941-3 (eBook)https://doi.org/10.1007/978-3-319-94941-3

Library of Congress Control Number: 2018946579

© The Author(s), under exclusive license to Springer International Publishing AG, part of SpringerNature 2019This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or partof the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmissionor information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilarmethodology now known or hereafter developed.The use of general descriptive names, registered names, trademarks, service marks, etc. in thispublication does not imply, even in the absence of a specific statement, that such names are exempt fromthe relevant protective laws and regulations and therefore free for general use.The publisher, the authors, and the editors are safe to assume that the advice and information in thisbook are believed to be true and accurate at the date of publication. Neither the publisher nor theauthors or the editors give a warranty, express or implied, with respect to the material contained herein orfor any errors or omissions that may have been made. The publisher remains neutral with regard tojurisdictional claims in published maps and institutional affiliations.

Printed on acid-free paper

This Springer imprint is published by the registered company Springer International Publishing AGpart of Springer NatureThe registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland

Page 6: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Only a generation of readers will spawn ageneration of writers.

Steven Spielberg

Page 7: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Preface

This book is intended as a study aid for the finite element method. Based on the freecomputer algebra system Maxima, we offer routines to symbolically or numericallysolve problems from the context of plane truss and frame structures. This allows tocheck classical ‘hand calculations’ on the one hand and to understand the computerimplementation of the method on the other hand. The mechanical theories focus onthe classical one-dimensional structural elements, i.e., bars, Euler–Bernoulli andTimoshenko beams as well as their combination of generalized beam elements.Focusing on one-dimensional elements reduces the complexity of the mathematicalframework, and the resulting matrix equations are still possible to be displayed withall components and not only in a symbolic representation. The use of a computeralgebra system and the incorporated functions, e.g., for equation solving, allows tofocus more on the methodology of the finite element method and not on standardprocedures. Some of the provided examples should be also solved in a classical‘hand calculations’ to better understand the computer implementation.

We look forward to receiving some comments and suggestions for the nextedition of this textbook.

Esslingen am Neckar, Germany Andreas ÖchsnerMagdeburg, Germany Resam MakvandiMay 2018

vii

Page 8: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Acknowledgements

We would like to express our sincere appreciation to the Springer Publisher,especially to Dr. Christoph Baumann, for giving us the opportunity to realize thisbook.

ix

Page 9: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Contents

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Maxima—A Computer Algebra System . . . . . . . . . . . . . . . . . . . . . . 3References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 Rods and Trusses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.1 Theory of Rod Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2 Theory of Truss Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.3 Maxima Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.3.1 Stiffness Matrix for Single Rod Elements . . . . . . . . . . . . . 263.3.2 Truss Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.4 Examples Based on Maxima . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

4 Euler–Bernoulli Beams and Frames . . . . . . . . . . . . . . . . . . . . . . . . . 434.1 Theory of Euler–Bernoulli Beam Elements . . . . . . . . . . . . . . . . . 43

4.1.1 Euler–Bernoulli Beam Elements . . . . . . . . . . . . . . . . . . . . 434.1.2 Rotation of Beam Elements . . . . . . . . . . . . . . . . . . . . . . . 45

4.2 Generalized Beam Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.3 Maxima Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

4.3.1 Stiffness Matrix for a Single Generalized BeamElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

4.3.2 Frame Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604.4 Examples Based on Maxima . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

5 Timoshenko Beams and Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735.1 Theory of Timoshenko Beam Elements . . . . . . . . . . . . . . . . . . . . 73

5.1.1 Timoshenko Beam Elements . . . . . . . . . . . . . . . . . . . . . . 735.1.2 Rotation of Beam Elements . . . . . . . . . . . . . . . . . . . . . . . 74

xi

Page 10: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.2 Generalized Beam Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775.3 Maxima Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785.4 Examples Based on Maxima . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

6 Maxima Source Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

xii Contents

Page 11: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Symbols and Abbreviations

Latin Symbols (Capital Letters)A Area, cross-sectional areaE YOUNG’s modulusEA Tensile stiffnessEI Bending stiffnessF ForceG Shear modulusGA Shear stiffnessI Second moment of areaK Global stiffness matrixKe Elemental stiffness matrixL Element lengthM MomentN Normal force (internal), interpolation functionN Column matrix of interpolationQ Shear force (internal)T Transformation matrixX Global Cartesian coordinateY Global Cartesian coordinateZ Global Cartesian coordinate

Latin Symbols (Small Letters)a Geometric dimensionf Global column matrix of nodal loadsf e Elemental column matrix of nodal loadsks Shear correction factorm Element numbern Node numberp Distributed load in x-direction

xiii

Page 12: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

q Distributed load in y-directionu Displacementu Global column matrix of nodal deformationsue Elemental column matrix of nodal deformationsx Cartesian coordinatey Cartesian coordinatez Cartesian coordinate

Greek Symbols (Small Letters)a Rotation angle, factorb Angle� Shear strain (engineering definition),e Strainj Curvaturem Poisson’s ratior Normal stress¿ Shear stress/ Rotation (Timoshenko beam)u Rotation (Bernoulli beam)

Mathematical Symbols� Multiplication sign (used where essential)A Assembly operator

Indices, Superscripted…e Element…R Reaction

Indices, Subscripted…p Point

Abbreviations1D One-dimensionalCAD Computer-aided designECA Element connectivity arrayEFA Element freedom arrayFEM Finite element method

xiv Symbols and Abbreviations

Page 13: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Chapter 1Introduction

Abstract This chapter shortly introduces the context of the finite element methodand common teaching approaches. Furthermore, we motivate our choice for a freecomputer algebra system.

The finite element method (FEM) can be considered as the mostimportant computer tool in structural mechanics. Despite the fact that there are othernumerical approximation techniques known in literature, e.g. the finite differencemethod or the boundary element method, the FEM is the most common tool inindustrial practice. The method itself has practically no limitations in regard to thephysical problem. However, the available computer hardware, i.e. working memoryand CPU, may impose some limitations on the size of the problems. A diversityof commercial finite element packages with different specializations is nowadaysavailable for the calculation engineer. Some finite element packages are even incor-porated in computer-aided design (CAD) programs. This facilitates the conversionof a geometry into a finite element mesh. However, a reliable application of this pow-erful tool requires an in-depth understanding of the underlying theory. The challengeis not to obtain from a commercial package some numbers or colorful pictures. Thechallenge and task of an engineer is to guarantee good results.

To study the finite element method is a challenging task and different approachesare available. This ranges from classical lectures and the corresponding textbooks[1–5] to the classical tutorials with ‘hand calculations’ [6]. In a more modern aca-demic context, so-called problem or project based approaches are also common insome countries [7]. It is also common that the more theoretical sessions are accom-panied by computer based laboratories where a commercial finite element packageis introduced [8]. As an alternative, a real programming language can be used toteach the computer implementation and to develop own routines [9, 10]. The scopeof this book is slightly different since we are going to use the functionality of afree computer algebra system. Doing so, we can avoid the need to program standardroutines and focus more on the methodology. The idea for this books partly stems

© The Author(s), under exclusive license to Springer International Publishing AG,part of Springer Nature 2019A. Öchsner and R. Makvandi, Finite Elements for Truss and Frame Structures,SpringerBriefs in Computational Mechanics, https://doi.org/10.1007/978-3-319-94941-3_1

1

Page 14: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

2 1 Introduction

from lecture notes which are based on the commercial computer algebra systemMathematica [11]. However, we decided to use the free computer algebra systemMaxima to avoid any license issues since the software can be freely downloaded forall common operating systems. Furthermore, different graphical user interfaces canbe used.

References

1. Bathe K-J (1996) Finite element procedures. Prentice-Hall, Upper Saddle River2. Zienkiewicz OC, Taylor RL (2000) The finite element method. Volume 1: the basis.

Butterworth-Heinemann, Oxford3. Zienkiewicz OC, Taylor RL (2000) The finite element method. Volume 2: solid mechanics.

Butterworth-Heinemann, Oxford4. Cook RD, Malkus DS, Plesha ME, Witt RJ (2002) Concepts and applications of finite element

analysis. Wiley, New York5. Öchsner A (2016) Computational statics and dynamics - an introduction based on the finite

element method. Springer, Singapore6. Javanbakht Z, Öchsner A (2018) Computational statics revision course. Springer, Cham7. Öchsner A (2018) A project-based introduction to computational statics. Springer, Cham8. Öchsner A, Öchsner M (2018) A first introduction to the finite element analysis programMSC

Marc/Mentat. Springer, Cham9. Javanbakht Z, Öchsner A (2017) Advanced finite element simulation with MSC Marc: appli-

cation of user subroutines. Springer, Cham10. TrappM, Öchsner A (2018) Computational plasticity for finite elements: a fortran-based intro-

duction. Springer, Cham11. Introduction to Finite Element Methods (ASEN 5007) (2017) Department of Aerospace Engi-

neering Sciences, University of Colorado at Boulder. https://www.colorado.edu/engineering/CAS/courses.d/IFEM.d/. Accessed 25 Mar 2018

Page 15: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Chapter 2Maxima—A Computer Algebra System

Abstract This chapter summarizes a few basic operations of the computer algebrasystem Maxima, as well as the internet links to download the software. The fewtopics covered are basic arithmetics, definition of variables and functions. For acomprehensive introduction, the reader is referred to the available literature.

The computer algebra system Maxima was originally developed in the late 1960sand earlier 1970s at MIT under the name ‘Macsyma’. The historical development isexcellently summarized in the article by Moses [1]. Compared to many commercialalternatives such as Maple, Matlab or Mathematica, Maxima is distributed underthe GNU General Public License (GPL) and thus a free software. In addition, it isrecommended to use in the following the wxMaxima graphical user interface (GUI),which is also distributed under the GNU GPL. The routines used in the followingchapters are optimized for this GUI. Both programs can be downloaded from thelinks in Table2.1.

A few basic operations in Maxima are explained in the following without anyattempt for completeness. The interested reader may find elsewhere further linksand examples in order to study the functionality of Maxima [2]. Particularly worthmentioning is the web page ‘Maxima by Example’ by Woollett [3]. Let us now startwith the basic arithmetic operations as outlined in the following listing.

© The Author(s), under exclusive license to Springer International Publishing AG,part of Springer Nature 2019A. Öchsner and R. Makvandi, Finite Elements for Truss and Frame Structures,SpringerBriefs in Computational Mechanics, https://doi.org/10.1007/978-3-319-94941-3_2

3

Page 16: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4 2 Maxima—A Computer Algebra System

Table 2.1 Links to downloadthe installation packages

Program Link

Maxima http://maxima.sourceforge.net/download.html

wxMaxima http://andrejv.github.io/wxmaxima/

Table 2.2 Some pre-definedfunctions in Maxima

Command Meaning Command Meaning

sqrt(...) Square root sin(...) Sine

exp(...) Exponential cos(...) Cosine

log(...) Naturallogarithm

tan(...) Tangent

abs(...) Absolutevalue

cot(...) Cotangent

Basic arithmetics: +, −, ∗, /(% i1) 1 + 2;(% o1) 3

(% i2) 1 - 2;(% o2) -1

(% i3) 1 * 2;(% o3) 2

(% i4) 1 / 2;(% o4) 1

2

We can see from the above example that all expressions entered into Maxima mustend with a semicolon ‘;’. Alternatively, the ‘$’ character can be used at the endof a statement to suppress the output of that line. Some pre-defined functions inMaxima are collected in Table2.2. It should be noted here that the arguments of thetrigonometric functions must be given in radians.

Another characteristic is that Maxima tries to provide symbolic results, whichinclude fractions, square roots etc. The function float(...) can be used to obtaina floating-point representation as shown in the following listing. The most recentresult can be recalled with the percentage operator (%).

Page 17: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

2 Maxima—A Computer Algebra System 5

(% i1) 1/2;(% o1) 1

2

(% i2) float(%);(% o2) 0.5

(% i3) float(1/2);(% o3) 0.5

The value of a variable is entered by the use of a colon ‘:’, see the following listing.To clear a value from an assigned variable, the command kill(...), or for all variableskill(all), is used.

Definition of variables and calculations:

(% i2) a: 3;b: 4;

(a) 3(b) 4

(% i3) c: a + b;

(c) 7

Some predefined constants in Maxima are ‘%e’ (i.e., the base of the natural loga-rithm; e = 2.718281...), ‘%pi’ (i.e., the ratio of the perimeter of a circle to its diameter;π = 3.141592...), and ‘%i’ (i.e., the imaginary unit;

√−1).

A function is defined by the use of a colon followed by the equal sign ‘:=’, seethe following listing. In regard to the naming of variables and functions, it shouldbe noted that the names must start with a letter and may contain numbers or even anunderscore. The following way of defining a function uses the general structure

f(x) := (expr1, expr2, ...., exprn) ,

where the value of exprn is returned by the function f (x).

Page 18: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 2 Maxima—A Computer Algebra System

Purpose: Calculates the sum of two numbers.Input(s): Values a and b.Output: Sum of a and b stored in variable c

(% i1) kill(all)$(% i1) summation(a,b) := a+b $(% i3) a:3 $

b:5 $(% i4) c : summation(a,b);

(c) 8

The following example shows the definition of a function under consideration of ablock structure. The block structure allows to make a return from some expressioninside the function, to return multiple values, and to introduce local variables.

Purpose: Calculates the length of a straight line between two points.Input(s): Coordinates of the end points.Output(s): Length of the line connecting the points.

−→ LineLength(ncoor):=block([x1,x2,y1,y2,x21,y21,L,LL],[[x1,y1],[x2,y2]] : ncoor,[x21,y21] : [x2-x1,y2-y1],LL : (x21ˆ2+y21ˆ2),L : sqrt(LL),return(L))$

−→ LineLength([[0,0],[1,1]]);

(% o2)√2

Let us mention at the end of this section the command ratsimp(...), which allows tosimplify algebraic expressions.1 The following listing illustrates the simplificationof the expressions

f1(x) = 2x2 + (x − 1)2 , (2.1)

f2(x) = x2 + 4x − 3x2 + 1

(x − 1)2 − 1 + 2x. (2.2)

1Further commands for the manipulation of algebraic expressions can be found in the referencesgiven on the web page [2].

Page 19: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

2 Maxima—A Computer Algebra System 7

Manipulation of algebraic expressions:

(% i2) f1: 2*xˆ2+(x-1)ˆ2$f2: (xˆ2+4*x-3*xˆ2+1)/((x-1)ˆ2-1+2*x)$

(% i3) ratsimp(f1);

(% o3) 3x2 − 2x + 1

(% i4) ratsimp(f2);

(% o4) − 2x2−4x−1x2

References

1. Moses J (2012) Macsyma: a personal history. J Symb Comput 47:123–1302. Maxima Dokumentation (2018). http://maxima.sourceforge.net/documentation.html. Accessed

23 Mar 20183. Woollett EL (2018) Maxima by example. http://web.csulb.edu/~woollett/. Accessed 23 Mar

2018

Page 20: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Chapter 3Rods and Trusses

Abstract This chapter briefly introduces to the theory of single rod elements andtheir arrangements as plane truss structures. Based on a comprehensive example, thesolution procedure is explained for a ‘hand calculation’ and corresponding commentson the computer implementation are provided. The chapter concludes with detailedMaxima examples which allow an easy transfer to other problems.

3.1 Theory of Rod Elements

The principal finite element equation for a single linear rod element of length L withconstant tensile stiffness E A can be stated as follows (see [1–3] for details of thederivation)

E A

L

[1 −1

−1 1

] [u1xu2x

]=[F1x

F2x

]+

L∫0

[N1

N2

]px (x) dx , (3.1)

or in abbreviated formK eue

p = f e , (3.2)

where K e is the elemental stiffness matrix, uep is the column matrix of nodal

unknowns, and f e is the column matrix of nodal loads. The interpolation func-tions N1(x) = 1 − x

L and N2(x) = xL in Eq. (3.1) are used to calculate the equivalent

nodal loads for a given distributed load px (x).Once the nodal displacements are known, e.g. based on ue

p = (K e)−1 f e, furtherquantities can be calculated based on this result (the so-called post-processing, seeTable3.1). Looking at Table3.1, it can be concluded that a linear rod element hasa linear displacement distribution between the nodes whereas the strain, stress andnormal force distribution is constant within an element. Higher-order elements withthree or evenmorenodes canbe easily derived to introduce anon-constant distributionof these field quantities, see [3].

© The Author(s), under exclusive license to Springer International Publishing AG,part of Springer Nature 2019A. Öchsner and R. Makvandi, Finite Elements for Truss and Frame Structures,SpringerBriefs in Computational Mechanics, https://doi.org/10.1007/978-3-319-94941-3_3

9

Page 21: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

10 3 Rods and Trusses

Table 3.1 Post-processing of nodal values for a linear rod element (defined by element length L ,cross-sectional area A, and Young’s modulus E). The distributions are given as being dependenton the nodal values as a function of the physical coordinate 0 ≤ x ≤ L

Axial displacement (elongation) uxuex (x) = [

1 − xL

]u1x + [ x

L

]u2x

Axial strain εx = duxdx

εex (x) = 1L (u2x − u1x )

Axial stress σx = Eεx = E duxdx

σ ex (x) = E

L (u2x − u1x )

Normal force Nx = E Aεx = E A duxdx

N ex (x) = E A

L (u2x − u1x )

Fig. 3.1 Rotationaltransformation of a rodelement: a X -Y plane and bX -Z plane

(a)

(b)

3.2 Theory of Truss Structures

The modeling of more realistic structures requires the arrangement of single rodelements in the three-dimensional space as a connecting mesh. For educational sim-plicity, we restrict ourselves to plane, i.e. two-dimensional, arrangements of trussstructures, see Fig. 3.1.

Page 22: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.2 Theory of Truss Structures 11

The displacements at each node can be transformed into components parallel to theglobal axes (X–Y or X–Z plane) based on the following transformation matrices

T XY =[cosα sin α 0 00 0 cosα sin α

], (3.3)

T XZ =[cosα − sin α 0 00 0 cosα − sin α

], (3.4)

where the matrix T XY relates to a transformation in the X–Y and the matrix T XZ

to a transformation in the X–Z plane. Application of the transformation matrix tothe elemental principal finite element equation (3.1) gives the following expressionof the elemental principal finite element equation of a linear rod element which isrotated by the rotation angle α in the X–Y plane:

E A

L

⎡⎢⎢⎣

cos2 α cosα sin α − cos2 α − cosα sin α

cosα sin α sin2 α − cosα sin α − sin2 α

− cos2 α − cosα sin α cos2 α cosα sin α

− cosα sin α − sin2 α cosα sin α sin2 α

⎤⎥⎥⎦

︸ ︷︷ ︸K e

XY

⎡⎢⎢⎣u1Xu1Yu2Xu2Y

⎤⎥⎥⎦

︸ ︷︷ ︸uXY

=

⎡⎢⎢⎣F1X

F1Y

F2X

F2Y

⎤⎥⎥⎦

︸ ︷︷ ︸f XY

.

(3.5)However, the implementation of Eq. (3.5) in a finite element code is not based on therotation angle α. Looking at Fig. 3.1a, one can express the sine and cosine functionsas well as the length L based on the nodal coordinates as follows:

sin αXY = Y2 − Y1L

, (3.6)

cosαXY = X2 − X1

L, (3.7)

L =√

(X2 − X1)2 + (Y2 − Y1)2 . (3.8)

Thus, the elemental stiffness matrix of a rod element in the X–Y plane can beexpressed based on the nodal coordinates as:

K eXY = E A

((X2 − X1)2 + (Y2 − Y1)2)32

×⎡⎢⎢⎣

(X2 − X1)2 (X2 − X1)(Y2 − Y1) −(X2 − X1)

2 −(X2 − X1)(Y2 − Y1)(X2 − X1)(Y2 − Y1) (Y2 − Y1)2 −(X2 − X1)(Y2 − Y1) −(Y2 − Y1)2

−(X2 − X1)2 −(X2 − X1)(Y2 − Y1) (X2 − X1)

2 (X2 − X1)(Y2 − Y1)−(X2 − X1)(Y2 − Y1) −(Y2 − Y1)2 (X2 − X1)(Y2 − Y1) (Y2 − Y1)2

⎤⎥⎥⎦ .

(3.9)

Page 23: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

12 3 Rods and Trusses

Based on the transformation matrix given in Eq. (3.4), the elemental principal finiteelement equation for a rod element, which is rotated in the X–Z plane by the angleα, is given by the following expression:

E A

L

⎡⎢⎢⎣

cos2 α − cosα sin α − cos2 α cosα sin α

− cosα sin α sin2 α cosα sin α − sin2 α

− cos2 α cosα sin α cos2 α − cosα sin α

cosα sin α − sin2 α − cosα sin α sin2 α

⎤⎥⎥⎦

︸ ︷︷ ︸K e

X Z

⎡⎢⎢⎣u1Xu1Zu2Xu2Z

⎤⎥⎥⎦

︸ ︷︷ ︸ueX Z

=

⎡⎢⎢⎣F1X

F1Z

F2X

F2Z

⎤⎥⎥⎦

︸ ︷︷ ︸f eX Z

.

(3.10)One can extract for the X–Z from Fig. 3.1b the following relationships, which relatethe rotation angle and the element length to the nodal coordinates:

sin αXZ = − Z2 − Z1

L, (3.11)

cosαXZ = X2 − X1

L, (3.12)

L =√

(X2 − X1)2 + (Z2 − Z1)2 . (3.13)

Thus, the transformed stiffness matrix of a linear rod element in the X–Z plane isfinally obtained based on the nodal coordinates as:

KeX Z = E A

((X2 − X1)2 + (Z2 − Z1)2)

32

×⎡⎢⎢⎢⎣

(X2 − X1)2 (X2 − X1)(Z2 − Z1) −(X2 − X1)

2 −(X2 − X1)(Z2 − Z1)(X2 − X1)(Z2 − Z1) (Z2 − Z1)

2 −(X2 − X1)(Z2 − Z1) −(Z2 − Z1)2

−(X2 − X1)2 −(X2 − X1)(Z2 − Z1) (X2 − X1)

2 (X2 − X1)(Z2 − Z1)−(X2 − X1)(Z2 − Z1) −(Z2 − Z1)

2 (X2 − X1)(Z2 − Z1) (Z2 − Z1)2

⎤⎥⎥⎥⎦ .

(3.14)

The transformations between elemental and global coordinate systems for the ele-mental stiffness matrix, column matrix of nodal unknowns and column matrix ofnodal forces is summarized in Table3.2.

Let us now illustrate the single steps of the finite element solution procedure witha concrete example. Consider in the following a two-dimensional truss structure asshown in Fig. 3.2 where the trusses are arranged in the form of an equilateral triangle(all internal angles β = 60◦). The three truss elements have the same length L , thesame Young’s modulus E , and the same cross-sectional area A. The structure isloaded by a vertical force F0 at node 2 and a prescribed horizontal displacement u0at node 2. The goal is to determine for this problem the global system of equations,the reduced system of equations, all nodal displacements, all reaction forces, and theforce in each rod.

Page 24: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.2 Theory of Truss Structures 13

Table 3.2 Transformation of matrices between the elemental (x, y) or (x, z) and global coordinate(X, Y ) or (X, Z) systems. The transformation matrices T are given in Eqs. (3.3) and (3.4)

X–Y Plane X–Z Plane

Stiffness Matrix: from local to global

K exy = T XY K e

XY TTXY , K e

xz = T XZ K eXZT

TXZ

Stiffness matrix: from global to local

K eXY = TT

XY KexyT XY , K e

XZ = TTXZ K

exzT XZ

Column matrix of nodal unknowns

uexy = T XY ueXY ueXY = TT

XY uexy uexz = T XZu

eXZ ueXZ = TT

XZuexz

Column matrix of external loads

f exy = T XY f eXY f eXY = TTXY f exy f exz = T XZ f eXZ f eXZ = TT

XZ f exz

Fig. 3.2 Truss structure inthe form of an equilateraltriangle

The first step of the solution procedure is to sketch the free-body diagram ofthe problem, including a global X–Y coordinate system, see Fig. 3.3. In addition,the structure should be subdivided into finite elements. Then, the node and elementnumbers (the user may choose any numbering order), local coordinate systems, andequivalent nodal loads must be indicated. We will follow the convention that Arabicnumbers relate to the node numberswhileRomannumbers relate to element numbers.The local coordinate axes xi are used to define for each member the correspondingrotation angles, see Table3.3.

Page 25: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

14 3 Rods and Trusses

Fig. 3.3 Free-body diagram of the truss structure shown in Fig. 3.2

Table 3.3 Angles of rotation αi and sine and cosine values for the problem shown in Fig. 3.2

Element Angle of rotation (◦) sine cosine

I 301

2

√3

2II 90 1 0

III 330 −1

2

√3

2

The next solution step is to write separately all elemental stiffness matricesexpressed in the global coordinate system. For this step, evaluate the general expres-sion given in Eq. (3.5). Then indicate for each element the nodal unknowns (degreesof freedom) on the right-hand side and over the matrix. In this step, the DOFs mustbe chosen according to the global coordinate system—conventionally, in the positivedirection.

KeI =

EA

u1X u1Y u2X u2Y

34

√34 − 3

4 −√34 u1X

√34

14 −

√34 − 1

4 u1Y

− 34 −

√34

34

√34 u2X

√34

14

√34

14 u2Y

⎡⎢⎢⎢⎢⎢⎢

⎤⎥⎥⎥⎥⎥⎥⎥

− −⎢⎣ ⎥⎦

,

(3.15)

Page 26: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.2 Theory of Truss Structures 15

K eII =

EA

u3X u3Y u2X u2Y

0 0 0 0 u3X

0 1 0 −1 u3Y

0 0 0 0 u2X

0 −1 0 1 u2Y

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ ,

(3.16)

KeIII =

EA

u1X u1Y u3X u3Y

34 −

√34 − 3

4

√34 u1X

−√34

14

√34 − 1

4 u1Y

− 34

√34

34 −

√34 u3X

√34 − 1

4 −√34

14 u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.17)The next step is to determine the dimensions of the global stiffness matrix and tosketch the structure of this matrix with global unknowns on the right-hand side andover the matrix, see Eq. (3.18). The dimensions of the matrix are equal to the totalnumber of degrees of freedom which can be determined by multiplying the numberof nodes by the number of degrees of freedom per node.

K =EA

u1X u1Y u2X u2Y u3X u3Y

34

34

34

34

34

34 u1X

34

34 u1Y

34

34 u2X

34

34 u2Y

34

34 u3X

34

34

34

34

34

34 u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

(3.18)As a result of the above procedures, each cell in the elemental stiffness matrices (seeEqs. (3.15)–(3.17)) and in the global stiffnessmatrix (3.18) has a unique index. Basedon this index, each element of an elemental matrix can be inserted step-by-step at itscorresponding place in the global matrix (3.18). The following Eq. (3.19) shows thelocation of elements of the elemental stiffness matrix I in the structure of the globalmatrix:

Page 27: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

16 3 Rods and Trusses

K =EA

u1X u1Y u2X u2Y u3X u3Y

34

√34 − 3

4 −√34

34 u1X

√34

14 −

√34 − 1

4 u1Y

− 34 −

√34

34

√34 u2X

−√34 − 1

4

√34

14 u2Y

34 u3X

34

34 u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.19)Inserting the elements of matrix II (indicated in blue color) into the global matrixresults in the representation of Eq. (3.20):

K =EA

u1X u1Y u2X u2Y u3X u3Y

34

√34 − 3

4 −√34

34 u1X

√34

14 −

√34 − 1

4 u1Y

− 34 −

√34

34+0

√34 +0 0 0 u2X

−√34 − 1

4

√34 +0 1

4+1 0 −1 u2Y

0 0 0 0 u3X

34 0 −1 0 3

41 u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.20)The final step to complete the global stiffness matrix is to add the elements of matrixIII (indicated in light green color) as outlined in the following Eq. (3.21):

K =EA

u1X u1Y u2X u2Y u3X u3Y

34+

34

√34 −

√34 − 3

4 −√34 − 3

4

√34 u1X

√34 −

√34

14+

14 −

√34 − 1

4

√34 − 1

4 u1Y

− 34 −

√34

34+0

√34 +0 0 0 u2X

−√34 − 1

4

√34 +0 1

4+1 0 −1 u2Y

− 34

√34 0 0 0+ 3

4 0−√34 u3X

√34 − 1

4 0 −1 0−√34 1+ 1

4 u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

,

(3.21)

Page 28: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.2 Theory of Truss Structures 17

or after simplifying some expressions as:

K =EA

u1X u1Y u2X u2Y u3X u3Y

32 0 − 3

4 −√34 − 3

4

√34 u1X

0 12 −

√34 − 1

4

√34 − 1

4 u1Y

− 34 −

√34

34

√34 0 0 u2X

−√34 − 1

4

√34

54 0 −1 u2Y

− 34

√34 0 0 3

4 −√34 u3X

√34 − 1

4 0 −1 −√34

54 u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.22)However, a real software implementation would follow a slightly different approach.Instead of indicating the nodal unknowns such as ui X and uiY , each degree of freedomwould simply receive a consecutive number as outlined in the following equation forthe global and elemental matrices:

K =EA

1 2 3 4 5 61

2

3

4

5

6

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

,

(3.23)

KeI =

EA

1 2 3 434

√34 − 3

4 −√34 1

√34

14 −

√34 − 1

4 2

− 34 −

√34

34

√34 3

−√34 − 1

4

√34

14 4

⎡⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎦

,

(3.24)

Page 29: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

18 3 Rods and Trusses

Table 3.4 Elementconnectivity and elementfreedom arrays for theproblem shown in Fig. 3.2

Element Connectivity array(ECA)

Element freedomarray (EFA)

I [1, 2] [1, 2, 3, 4]II [3, 2] [5, 6, 3, 4]III [1, 3] [1, 2, 5, 6]

KeII =

EA

5 6 3 40 0 0 0 50 1 0 −1 60 0 0 0 30 −1 0 1 4

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ ,

(3.25)

KeIII =

EA

1 2 5 634 −

√34 − 3

4

√34 1

−√34

14

√34 − 1

4 2

− 34

√34

34 −

√34 5

√34 − 1

4 −√34

14 6

⎡⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.26)This information is stored for each element in the so-called element freedom array(EFA), see Table3.4. This table contains in addition the element connectivity array(ECA), which stores the start and end node number of each element.

One can conclude from Table3.4 that the element connectivity (ECA) and ele-ment freedom arrays (EFA) can be generally expressed for a two-dimensional trussstructure as

ECA: [nst, nen] → EFA: [2nst − 1, 2nst, 2nen − 1, 2nen] , (3.27)

where nst is the number of the start node and nen is the number of the end node. Thegeneral rule to assemble the global stiffness matrix K can be expressed as

Kpq =Am

K em,i j , (3.28)

Page 30: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.2 Theory of Truss Structures 19

where A represents the assembly operator, which is applied to m single elements(in our specific example of three elements: m = I, . . . , III). The iteration indicestake the following values: i = 1, . . . , 4 and j = 1, . . . , 4 for two-dimensional trussstructures, i.e. two degrees of freedom per node. The mapping to the global matrix isthen obtained by p = EFAm(i) and q = EFAm( j). Based on Table3.4, the followingvalues of the EFA array can be identified for different values of an iteration index (ior j):

EFAI(1) = 1 , EFAII(1) = 5 , EFAIII(1) = 1 ,

EFAI(2) = 2 , EFAII(2) = 6 , EFAIII(2) = 2 ,

EFAI(3) = 3 , EFAII(3) = 3 , EFAIII(3) = 5 , (3.29)

EFAI(4) = 4 , EFAII(4) = 4 , EFAIII(4) = 6 .

This allows now to assign each element of an elemental stiffness matrix to the cor-responding cell Kpq in the global matrix.

For element m = I:

K eI,11 → K11 , K e

I,12 → K12 , K eI,13 → K13 , K e

I,14 → K14 ,

K eI,21 → K21 , K e

I,22 → K22 , K eI,23 → K23 , K e

I,24 → K24 ,

K eI,31 → K31 , K e

I,32 → K32 , K eI,33 → K33 , K e

I,34 → K34 , (3.30)

K eI,41 → K41 , K e

I,42 → K42 , K eI,43 → K43 , K e

I,44 → K44 .

For element m = II:

K eII,11 → K55 , K e

II,12 → K56 , K eII,13 → K53 , K e

II,14 → K54 ,

K eII,21 → K65 , K e

II,22 → K66 , K eII,23 → K63 , K e

II,24 → K64 ,

K eII,31 → K35 , K e

II,32 → K36 , K eII,33 → K33 , K e

II,34 → K34 , (3.31)

K eII,41 → K45 , K e

II,42 → K46 , K eII,43 → K43 , K e

II,44 → K44 .

For element m = III:

K eIII,11 → K11 , K e

III,12 → K12 , K eIII,13 → K15 , K e

III,14 → K16 ,

K eIII,21 → K21 , K e

III,22 → K22 , K eIII,23 → K25 , K e

III,24 → K26 ,

K eIII,31 → K51 , K e

III,32 → K52 , K eIII,33 → K55 , K e

III,34 → K56 , (3.32)

K eIII,41 → K61 , K e

III,42 → K62 , K eIII,43 → K65 , K e

III,44 → K66 .

Thus, we can finally assemble the global stiffness matrix as follows:

Page 31: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

20 3 Rods and Trusses

K =

1 2 3 4 5 6K11 K12 K13 K14 K15 K16 1K21 K22 K23 K24 K25 K26 2K31 K32 K33 K34 K35 K36 3K41 K42 K43 K44 K45 K46 4K51 K52 K53 K54 K55 K56 5K61 K62 K63 K64 K65 K66 6

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

1 2 3 4 5 6Ke

I,11 +KeIII,11 Ke

I,12 +KeIII,12 Ke

I,13 KeI,14 Ke

III,13 KeIII,14 1

KeI,21 +Ke

III,21 KeI,22 +Ke

III,22 KeI,23 Ke

I,24 KeIII,23 Ke

III,24 2

KeI,31 Ke

I,32 KeI,33 +Ke

II,33 KeI,34 +Ke

II,34 KeII,31 Ke

II,32 3

KeI,41 Ke

I,42 KeI,43 +Ke

II,43 KeI,44 +Ke

II,44 KeII,41 Ke

II,42 4

KeIII,31 Ke

III,32 KeII,13 Ke

II,14 KeII,11 +Ke

III,33 KeII,12 +Ke

III,34 5

KeIII,41 Ke

III,42 KeII,23 Ke

II,24 KeII,21 +Ke

III,43 KeII,22 +Ke

III,44 6

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.33)Inserting the correspondingvalues into the last equationgives the specific formulationof Eq. (3.22).

The next step of the solution procedure is to add the column matrix of unknownsand external loads to complete the global system of equations, see Eq. (3.34). Itshould be noted here that the column matrix of the external loads has been adjustedaccording to the free-body diagram, see Fig. 3.3.

EA

L

u1X u1Y u2X u2Y u3X u3Y

32 0 − 3

4 −√34 − 3

4

√34

0 12 −

√34 − 1

4

√34 − 1

4

− 34 −

√34

34

√34 0 0

−√34 − 1

4

√34

54 0 −1

− 34

√34 0 0 3

4 −√34

√34 − 1

4 0 −1 −√34

54

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

u1X

u1Y

u2X

u2Y

u3X

u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

FR1X

FR1Y

FR2X

F0

0

FR3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.34)This system of equations cannot be solved at this stage of the procedure. In order toproceed, the support conditions must be introduced. At node 1, there is no horizontaland vertical movement possible while the support at node 3 suppresses a verticalmovement. This means that the first and second as well as the last equation (repre-sented by their corresponding rows and columns) can be removed from the system

Page 32: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.2 Theory of Truss Structures 21

of equations, see Eq. (3.35).

EA

L

u1X u1Y u2X u2Y u3X u3Y

32 0 − 3

4 −√34 − 3

4

√34

0 12 −

√34 − 1

4

√34 − 1

4

− 34 −

√34

34

√34 0 0

−√34 − 1

4

√34

54 0 −1

− 34

√34 0 0 3

4 −√34

√34 − 1

4 0 −1 −√34

54

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

u1X

u1Y

u2X

u2Y

u3X

u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

FR1X

FR1Y

FR2X

F0

0

FR3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.35)As a result, we obtain a 3 × 3 system of equations, see Eq. (3.36):

EA

L

u2X u2Y u3X

34

√34 0

√34

54 0

0 0 34

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦

u2X

u2Y

u3X

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ =

FR2X

F0

0

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ .

(3.36)The consideration of the displacement boundary condition u2X = u0 at node 2 canbe done for a ‘hand calculations’ in the following way: Multiply the correspondingcolumn with the given displacement value u0. Then bring this entire column, whichcontains the known value u0, to the right-hand side of the system of equation, seeEq. (3.37):

EA

L

34×u0

√34 0

√34 ×u0

54 0

0×u0 0 34

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦

u2X

u2Y

u3X

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ =

FR2X

F0

0

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ .

(3.37)

Delete the corresponding row of the system, i.e.

Page 33: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

22 3 Rods and Trusses

EA

L

√34

340

54 0340

34

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦

u2X

u2Y

u3X

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ =

FR2X

F0

0

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ − EA

L

34 × u0

√34 × u0

0× u0

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ ,

(3.38)which results in a reduced 2 × 2 system of equations:

E A

L

[54 0

0 34

][u2Y

u3X

]=[F0 −

√3E Au04L

0

]. (3.39)

The solution of this system can be obtained, for example, by inverting the reducedstiffness matrix to give the reduced column matrix of the nodal displacements:⎡⎣u2Yu3X

⎤⎦ = L

E A× 1

54 × 3

4 − 0

⎡⎣ 3

4 0

0 54

⎤⎦⎡⎣F0 −

√3E Au04L

0

⎤⎦ = 4L

5E A

⎡⎣F0 −

√3E Au04L

0

⎤⎦ . (3.40)

A software implementation would follow again a slightly different approach to con-sider the support conditions. The approach itself would start also with the non-reduced global system of equations as given in Eq. (3.34), i.e.

EA

L

u1X u1Y u2X u2Y u3X u3Y

32 0 − 3

4 −√34 − 3

4

√34

0 12 −

√34 − 1

4

√34 − 1

4

− 34 −

√34

34

√34 0 0

−√34 − 1

4

√34

54 0 −1

− 34

√34 0 0 3

4 −√34

√34 − 1

4 0 −1 −√34

54

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

u1X

u1Y

u2X

u2Y

u3X

u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

FR1X

FR1Y

FR2X

F0

0

FR3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.41)However, the idea is now to remain the original dimensions of this systemof equations(in our case: 6 × 6). Thus, all the displacement boundary conditions ui = 0 areintroduced in the following way:

Page 34: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.2 Theory of Truss Structures 23

u1X u1Y u2X u2Y u3X u3Y

341 0 0 0 0 3

40

0 1 0 0 0 00 0 1 0 0 0

−√34 − 1

4

√34

54 0 −1

− 34

√34 0 0 3

4 −√34

340 0 0 0 0 3

41

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

u1X

u1Y

u2X

u2Y

u3X

u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=L

EA

0

0u0EA

L

F0

0

0

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.42)The disadvantage is now that the coefficient matrix is no more symmetric and thiswould effect the efficiency of the solution procedure. Thus, we can achieve againsymmetry by multiplying each column where a displacement boundary condition(ui = 0 or ui �= 0) is given with the imposed value, excluding the cell with the newentry ‘1’ (or any cell with a ‘0’):

u1X u1Y u2X u2Y u3X u3Y

341 0 0 0 0 3

40

0 1 0 0 0 00 0 1 0 0 0

−√34 ×0 − 1

4×0√34 ×u0

54 0 −1×0

− 34×0

√34 ×0 0 0 3

4 −√34 ×0

340 0 0 0 0 3

41

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

u1X

u1Y

u2X

u2Y

u3X

u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

0

0

u0

F0LEA

0

0

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.43)These multiplied cells will be moved to the right-hand side to obtain a symmetricstiffness matrix:

u1X u1Y u2X u2Y u3X u3Y

341 0 0 0 0 3

40

0 1 0 0 0 00 0 1 0 0 00 0 0 5

4 0 0

0 0 0 0 34 0

340 0 0 0 0 3

41

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

u1X

u1Y

u2X

u2Y

u3X

u3Y

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

0

0

u0

F0LEA

0

0

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

0

0

0√3u04

0

0

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(3.44)

Page 35: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

24 3 Rods and Trusses

The solution of this system can be obtained, for example, by inverting the modifiedstiffness matrix to give the column matrix of the nodal displacements:

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎣

u1Xu1Yu2Xu2Yu3Xu3Y

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

⎡⎢⎢⎢⎢⎢⎢⎢⎣

00u0

45

(F0LE A −

√3u04

)00

⎤⎥⎥⎥⎥⎥⎥⎥⎦

. (3.45)

This solution for the nodal displacements can be introduced into Eq. (3.34), i.e. thenon-modified global system of equations, to obtain the unknown reaction forces onthe right-hand side. For the given values on the right-hand side, i.e. F0 and 0 in thefourth and fifth row, the corresponding equations can be used to check the obtainednodal displacements. The evaluation of the six equations gives in detail:

Fe1X = −3E Au0

5L−

√3F0

5, (3.46)

Fe1Y = −

√3E Au05L

− F0

5, (3.47)

Fe2X = 3E Au0

5L+

√3F0

5, (3.48)

F0 = F0 , (3.49)

0 = 0 , (3.50)

Fe3Y =

√3E Au05L

− 4F0

5. (3.51)

It should be noted here that these reactions fulfill together with the external force theglobal horizontal and vertical force equilibrium, i.e.

∑FX = 0 and

∑FY = 0.

Based on the solution matrix of nodal displacements, one can calculate the ele-mental normal forces and stresses in a truss structure (see Table3.1):

N ex = E A

L(u2x − u1x ) , (3.52)

σ ex = E

L(u2x − u1x ) . (3.53)

The elemental nodal displacements (u1x , u2x ) can be obtained from the global nodaldisplacements (u1X , u1Y , u2X , u2Y ), see Table3.2:

Page 36: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.2 Theory of Truss Structures 25

[u1xu2x

]=[cosα sin α 0 00 0 cosα sin α

]⎡⎢⎢⎣u1Xu1Yu2Xu2Y

⎤⎥⎥⎦ (3.54)

=[cosα u1X + sin α u1Ycosα u2X + sin α u2Y

]. (3.55)

Thus, the nodal force and stress of a truss element (between the start node 1 and theend node 2) in the X–Y plane can be expressed as

N ex = E A

L(cosα [u2X − u1X ] + sin α [u2Y − u1Y ]) , (3.56)

σ ex = E

L(cosα [u2X − u1X ] + sin α [u2Y − u1Y ]) , (3.57)

where the sine, cosine and length L can be calculated from the nodal coordinatesin the global coordinate system according to (3.6)–(3.8). Similar equations can bederived for the X–Z plane:

N ex = E A

L(cosα [u2X − u1X ] − sin α [u2Z − u1Z ]) , (3.58)

σ ex = E

L(cosα [u2X − u1X ] − sin α [u2Z − u1Z ]) . (3.59)

Based on our example given in Fig. 3.2 and the nodal displacements in Eq. (3.45),the nodal forces are obtained as:

N eI = E A

L(cosαI [u2X − u1X ] + sin αI [u2Y − u1Y ]) , (3.60)

N eII = E A

L(cosαII [u2X − u3X ] + sin αII [u2Y − u3Y ]) , (3.61)

N eIII = E A

L(cosαIII [u3X − u1X ] + sin αIII [u3Y − u1Y ]) , (3.62)

or with the given values:

N eI = 2F0

5+ 2

√3E Au05L

, (3.63)

Page 37: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

26 3 Rods and Trusses

Fig. 3.4 Flowchart for thecalculation of the elementalstiffness matrix K e

XY of a rodelement in the X–Y plane

N eII = 4F0

5−

√3E Au04L

, (3.64)

N eIII = 0 . (3.65)

3.3 Maxima Modules

To automatize the solution procedure explained in the previous section, several Max-imamodules were written. The following sections explain a few elements. The entiresource code is provided in Chap. 6.

3.3.1 Stiffness Matrix for Single Rod Elements

The stiffness matrix of a single element is calculated with the moduleK_el_rod_xy(ncoor, Em, A), where the input parameters are the nodal coordinates(ncoor), the cross sectional area (A), and the Young’s modulus (E), see Fig. 3.4.

3.3.2 Truss Structures

The global stiffness matrix of a plane truss structure is calculated with the moduleK_gl_truss_xy(nodxy, elenod, elemat, elefab), where the input parameters are

Page 38: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.3 Maxima Modules 27

Fig. 3.5 Flowchart for thecalculation of the globalstiffness matrix K XY of atruss structure in the X–Yplane

the nodal coordinates (nodxy), the connectivities (elenod), the cross sectional areas(elefab), and the Young’s moduli (A), see Fig. 3.5.

Some details of the assembly process of the global stiffness matrix are illustratedin Fig. 3.6. This flow chart corresponds to the general rule given in Eq. (3.28).

The module for the calculation of the modified global stiffness and the forcematrices, i.e. consideration of the prescribed boundary conditions, is illustrated inFig. 3.7. The node freedom tags list defines if a displacement constraint is assignedat a node (value ‘1’) or not (value ‘0’). The node freedom values list contains theprescribed displacements where the freedom tags list has a value of ‘1’ or the valuesof external forces (with freedom tags list values of ‘0’).

The module PlaneTrussIntForces_xy(nodxy, elenod, elemat, elefab, nod-dis) calculates the elemental forces as defined in Eq. (3.56), i.e. based on the globalvalues of the nodal displacements, see Fig. 3.8.

All the single modules are combined in a ‘master’ module called PlaneTruss-Solution_xy(nodxy, elenod, elefab, elemat, nodtag, nodval), which allows toevaluate entire tr‘uss structures, see Fig. 3.9.

3.4 Examples Based on Maxima

The providedMaximamodules allow symbolic (i.e., based on variables) or numerical(i.e., based on numbers) solutions. For educational purposes, we present in the fol-lowing sections only symbolic calculations. All the examples require that the librarymy_funs.mac is pre-loaded (the source code is provided in Chap. 6). For best dis-play of results in wxMaxima, one should use Consolas (10) as the default and themath font (check the wxMaxima configuration window for details).

Page 39: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

28 3 Rods and Trusses

Fig. 3.6 Some details of theMaxima moduleK_gl_truss_xy to calculatethe global stiffness matrix ofa truss structure in the X–Yplane

3.1 Example: Simple Truss structure with two members

Given is a plane truss structure as shown in Fig. 3.10. Both members have a uniformcross-sectional area A and Young’s modulus E . The length of the members can becalculated from the given values (horizontal and vertical length a) in the figure. Thestructure is supported at its lower end and loaded by the single force F0 at the top ofthe structure.

Model the truss structure with two linear truss elements and determine

• the displacement of the free node,• the reaction forces at the supports, and

Page 40: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.4 Examples Based on Maxima 29

Fig. 3.7 Flowchart for thecalculation of the modifiedglobal stiffness matrix Kmod

XYand the modified forcematrix fmod of a trussstructure in the X–Y plane

Fig. 3.8 Flowchart for thecalculation of the elementalforces N e

x for a trussstructure in the X–Y plane

• the stress, and normal force in each element.

3.1 SolutionThe solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 3.11.

The next step is to generate the required nodal arrays (see Table3.5) and elementaldefinitions (see Table3.6) to facilitate the model definition in Maxima.

Page 41: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

30 3 Rods and Trusses

Fig. 3.9 Flowchart for thecomplete calculation of anentire truss structure in theX–Y plane

Fig. 3.10 Simple trussstructure composed of twostraight inclined members:overview

Fig. 3.11 Simple trussstructure composed of twostraight inclined members:free-body diagram with nodeand element numbering

Page 42: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.4 Examples Based on Maxima 31

Table 3.5 Different nodal arrays for the problem shown in Fig. 3.11

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value (nodval)

1 [0, 0] [1, 1] [0, 0]2 [a, a] [0, 0] [F0, 0]3 [2a, 0] [1, 1] [0, 0]

Table 3.6 Element definitions for the problem shown in Fig. 3.11

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [1, 2] A E

II [2, 3] A E

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Definition of Plane Truss Master Stiffness: Nodal Coordinates "nodxy", Element endnodes "elenod", Element material properties "elemat", Element fabricationproper-ties "elefab", freedom tags list "nodtag", freedom values list "nodval"

−→ fpprintprec : 3$assume(a>0)$

nodxy : matrix([0,0],[a,a],[2*a,0])$elenod: matrix([1,2],[2,3])$

numnod : length(nodxy)$numele : length(elenod)$

elemat : makelist(Em,numele)$elefab : makelist(A,numele)$

nodtag : makelist([0,0],numnod)$nodval : makelist([0,0],numnod)$nodval[2] : [F0,0]$nodtag[1] : [1,1]$ /* fixed node 1*/nodtag[2] : [0,0]$ /* node 2*/nodtag[3] : [1,1]$ /* fixed node 3*/

Page 43: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

32 3 Rods and Trusses

Maxima Calculations and Output

−→ [noddis, nodfor, elefor, elesig] :PlaneTrussSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nodval)$print(" ")$print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneTrussElementDataSymb(elenod, elemat, elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneTrussFreedomActivitySymb(nodtag, nodval))$

print(" ")$print("Computed Nodal Displacements:")$print(" ",PrintPlaneTrussNodeDisplacementsSymb(noddis))$

print(" ")$print("Nodal Forces:")$print(" ",PrintPlaneTrussNodeForcesSymb(nodfor))$

print(" ")$print("Element Axial Forces and Stresses:")$print(" ",PrintPlaneElemForcesAndStressesSymb(elefor,elesig))$

Nodal Coordinates: ⎡⎢⎢⎣node x-coor y-coor1 0 02 a a3 2a 0

⎤⎥⎥⎦

Element Data: ⎡⎣elem nodes modulus area

1 [1, 2] Em A2 [2, 3] Em A

⎤⎦

DOF Activity: ⎡⎢⎢⎣node x-tag y-tag x-value y-value1 1 1 0 02 0 0 F0 03 1 1 0 0

⎤⎥⎥⎦

Computed Nodal Displacements:

⎡⎢⎢⎣node x-displ y-displ1 0 0

2√2F0aA Em 0

3 0 0

⎤⎥⎥⎦

Page 44: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.4 Examples Based on Maxima 33

Nodal Forces: ⎡⎢⎢⎣node x-force y-force1 −0.5F0 −0.5F02 F0 0.03 −0.5F0 0.5F0

⎤⎥⎥⎦

Element Axial Forces and Stresses:⎡⎢⎣elem axial force axial stress1 F0√

2F0√2A

2 − F0√2

− F0√2A

⎤⎥⎦

3.2 Example: Truss Structure Arranged as an Equilateral TriangleGiven is the two-dimensional truss structure as shown in Fig. 3.12 where the trussesare arranged in the form of an equilateral triangle (all internal angles β = 60◦). Thethree trusses have the same length L , the same Young’s modulus E , and the samecross-sectional area A. The structure is loaded by a vertical force F0 and a prescribedhorizontal displacement u0 at the upper joint.

Consider three equal truss elements and determine

• all nodal displacements,• all reaction forces,• the force in each rod.

Fig. 3.12 Truss structure inthe form of an equilateraltriangle: overview

Page 45: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

34 3 Rods and Trusses

Fig. 3.13 Truss structure in the form of an equilateral triangle: free-body diagram with node andelement numbering

Table 3.7 Different nodal arrays for the problem shown in Fig. 3.13

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value(nodval)

1 [0, 0] [1, 1] [0, 0]2 [

√3L2 , L

2 ] [1, 0] [u0, F0]3 [

√3L2 ,− L

2 ] [0, 1] [0, 0]

Table 3.8 Element definitions for the problem shown in Fig. 3.13

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [1, 2] A E

II [3, 1] A E

III [1, 3] A E

3.2 SolutionThe solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 3.13.

The next step is to generate the required nodal arrays (see Table3.7) and elementaldefinitions (see Table3.8) to facilitate the model definition in Maxima.

Page 46: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.4 Examples Based on Maxima 35

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Definition of Plane Truss Master Stiffness: Nodal Coordinates "nodxy", Element endnodes "elenod", Element material properties "elemat", Element fabricationproper-ties "elefab", freedom tags list "nodtag", freedom values list "nodval"

−→ fpprintprec : 3$assume(L>0)$

sin30 : 1/2$ /* float(sin(30.0*%pi/180.0))$ */cos30 : sqrt(3)/2$/* float(cos(30.0*%pi/180.0))$ */

nodxy : matrix([0,0],[L*cos30,L*sin30],[L*cos30,-L*sin30])$elenod: matrix([1,2],[3,2],[1,3])$numnod : length(nodxy)$numele : length(elenod)$

elemat : makelist(Em,numele)$elefab : makelist(A,numele)$

nodtag : makelist([0,0],numnod)$nodval : makelist([0,0],numnod)$nodval[2] : [u0, F0]$nodtag[1] : [1,1]$ /* fixed node 1*/nodtag[2] : [1,0]$ /* node 2*/nodtag[3] : [0,1]$ /* hroller @ node 3*/

Page 47: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

36 3 Rods and Trusses

Maxima Calculations and Output

−→ [noddis, nodfor, elefor, elesig] :PlaneTrussSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nodval)$

print(" ")$print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneTrussElementDataSymb(elenod, elemat, elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneTrussFreedomActivitySymb(nodtag, nodval))$

print(" ")$print("Computed Nodal Displacements:")$print(" ",PrintPlaneTrussNodeDisplacementsSymb(noddis))$

print(" ")$print("Nodal Forces:")$print(" ",PrintPlaneTrussNodeForcesSymb(nodfor))$

print(" ")$print("Element Axial Forces and Stresses:")$print(" ",PrintPlaneElemForcesAndStressesSymb(elefor,elesig))$

Nodal coordinates:

⎡⎢⎢⎣node x-coor y-coor1 0 0

2√3L2

L2

3√3L2 − L

2

⎤⎥⎥⎦

Element Data:⎡⎢⎢⎣elem nodes modulus area1 [1, 2] Em A2 [3, 2] Em A3 [1, 3] Em A

⎤⎥⎥⎦

DOF Activity:⎡⎢⎢⎣node x-tag y-tag x-value y-value1 1 1 0 02 1 0 u0 F03 0 1 0 0

⎤⎥⎥⎦

Page 48: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.4 Examples Based on Maxima 37

Computed Nodal Displacements:⎡⎢⎢⎢⎣node x-displ y-displ1 0 0

2 u04L(F0−

√3A Em u04L

)5A Em

3 0 0

⎤⎥⎥⎥⎦

Nodal Forces:

⎡⎢⎢⎢⎣node x-force y-force1 −0.346

(F0 − 0.433A Em u0

L

)− 0.75A Em u0L −0.2

(F0 − 0.433A Em u0

L

)− 0.433A Em u0L

2 0.346(F0 − 0.433A Em u0

L

)+ 0.75A Em u0L F0

3 0.0 −0.8(F0 − 0.433A Em u0

L

)

⎤⎥⎥⎥⎦

Element Axial Forces and Stresses:⎡⎢⎢⎢⎢⎢⎢⎢⎣

elem axial force axial stress

1

A Em

⎛⎝ 2L2

(F0−

√3A Em u04L

)

5A Em +√3L u02

⎞⎠

L2

Em

⎛⎝ 2L2

(F0−

√3A Em u04L

)

5A Em +√3L u02

⎞⎠

L2

24(F0−

√3A Em u04L

)5

4(F0−

√3A Em u04L

)5A

3 0 0

⎤⎥⎥⎥⎥⎥⎥⎥⎦

3.3 Example: Approximation of a Solid Using a Truss StructureAssume an isotropic and homogeneous solid, which should be modeled with theplane truss structure shown in Fig. 3.14. The six truss members have a uniformcross-sectional area A and Young’s modulus E . The length of each member can betaken from the figure. The structure is supported at its left-hand side and the bottom.A uniform displacement u0 is applied at the top nodes in the vertical direction.

Determine:

• the displacements of the nodes,• the reaction forces at the supports and nodes where displacements are prescribed.

3.3 SolutionThe solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 3.15.

The next step is to generate the required nodal arrays (see Table3.9) and elementaldefinitions (see Table3.10) to facilitate the model definition in Maxima.

Page 49: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

38 3 Rods and Trusses

Fig. 3.14 Advanced trussstructure composed of sixstraight members: overview

Fig. 3.15 Advanced trussstructure composed of sixstraight members: free-bodydiagram with node andelement numbering

Table 3.9 Different nodal arrays for the problem shown in Fig. 3.15

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value(nodval)

1 [0, 0] [1, 1] [0, 0]2 [a, 0] [0, 1] [0, 0]3 [a, a] [0, 1] [0, u0]4 [0, a] [1, 1] [0, u0]

Page 50: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.4 Examples Based on Maxima 39

Table 3.10 Element definitions for the problem shown in Fig. 3.15

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [4, 1] A E

II [1, 2] A E

III [3, 2] A E

IV [4, 3] A E

V [4, 2] A E

VI [1, 3] A E

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Definition of Plane Truss Master Stiffness: Nodal Coordinates "nodxy", Element endnodes "elenod", Element material properties "elemat", Element fabricationproper-ties "elefab", freedom tags list "nodtag", freedom values list "nodval"

−→ fpprintprec : 3$assume(a>0)$

nodxy : matrix([0,0],[a,0],[a,a],[0,a])$elenod: matrix([4,1],[1,2],[3,2],[4,3],[4,2],[1,3])$

numnod : length(nodxy)$numele : length(elenod)$

elemat : makelist(Em,numele)$elefab : makelist(A,numele)$

nodtag : makelist([0,0],numnod)$nodval : makelist([0,0],numnod)$nodval[3] : [0,u0]$nodval[4] : [0,u0]$nodtag[1] : [1,1]$nodtag[2] : [0,1]$nodtag[3] : [0,1]$nodtag[4] : [1,1]$

Page 51: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

40 3 Rods and Trusses

Maxima Calculations and Output

−→ [noddis, nodfor, elefor, elesig] :PlaneTrussSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nodval)$

print(" ")$print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneTrussElementDataSymb(elenod, elemat, elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneTrussFreedomActivitySymb(nodtag, nodval))$

print(" ")$print("Computed Nodal Displacements:")$print(" ",PrintPlaneTrussNodeDisplacementsSymb(noddis))$

print(" ")$print("Nodal Forces:")$print(" ",PrintPlaneTrussNodeForcesSymb(nodfor))$

print(" ")$print("Element Axial Forces and Stresses:")$print(" ",PrintPlaneElemForcesAndStressesSymb(elefor,elesig))$

Nodal Coordinates:

⎡⎢⎢⎢⎣

node x-coor y-coor1 0 02 a 03 a a4 0 a

⎤⎥⎥⎥⎦

Element Data:

⎡⎢⎢⎢⎢⎢⎢⎢⎣

elem nodes modulus area1 [4, 1] Em A2 [1, 2] Em A3 [3, 2] Em A4 [4, 3] Em A5 [4, 2] Em A6 [1, 3] Em A

⎤⎥⎥⎥⎥⎥⎥⎥⎦

DOF Activity:

⎡⎢⎢⎢⎣

node x-tag y-tag x-value y-value1 1 1 0 02 0 1 0 03 0 1 0 u04 1 1 0 u0

⎤⎥⎥⎥⎦

Page 52: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

3.4 Examples Based on Maxima 41

Computed Nodal Displacements:

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

node x-displ y-displ1 0 02 − A Em u0

232

(A Em

232 a

+ A Ema

)a

0

3 − A Em u0

232

(A Em

232 a

+ A Ema

)a

u0

4 0 u0

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

Nodal Forces:

⎡⎢⎢⎢⎢⎢⎢⎢⎣

node x-force y-force

1 0.0 − 1.26A Em u0a

2 0.0 − 1.26A Em u0a

3 0.0 1.26A Em u0a

4 0.0 1.26A Em u0a

⎤⎥⎥⎥⎥⎥⎥⎥⎦

Element Axial Forces and Stresses:⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

elem axial force axial stress1 A Em u0

aEm u0a

2 − A2 Em2 u0

232

(A Em

232 a

+ A Ema

)a2

− A Em2 u0

232

(A Em

232 a

+ A Ema

)a2

3 A Em u0a

Em u0a

4 − A2 Em2 u0

232

(A Em

232 a

+ A Ema

)a2

− A Em2 u0

232

(A Em

232 a

+ A Ema

)a2

5

A Em

⎛⎜⎜⎜⎝a u0− A Em u0

232

⎛⎝ A Em

232 a

+ A Ema

⎞⎠

⎞⎟⎟⎟⎠

2a2

Em

⎛⎜⎜⎜⎝a u0− A Em u0

232

⎛⎝ A Em

232 a

+ A Ema

⎞⎠

⎞⎟⎟⎟⎠

2a2

6

A Em

⎛⎜⎜⎜⎝a u0− A Em u0

232

⎛⎝ A Em

232 a

+ A Ema

⎞⎠

⎞⎟⎟⎟⎠

2a2

Em

⎛⎜⎜⎜⎝a u0− A Em u0

232

⎛⎝ A Em

232 a

+ A Ema

⎞⎠

⎞⎟⎟⎟⎠

2a2

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

Page 53: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

42 3 Rods and Trusses

References

1. ÖchsnerA,MerkelM (2013)One-dimensional finite elements: an introduction to the FEmethod.Springer, Berlin

2. Öchsner A (2014) Elasto-plasticity of frame structure elements: modelling and simulation ofrods and beams. Springer, Berlin

3. Öchsner A (2016) Computational statics and dynamics-an introduction based on the finite ele-ment method. Springer, Singapore

Page 54: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Chapter 4Euler–Bernoulli Beams and Frames

Abstract This chapter briefly introduces to the theory of single Euler–Bernoullibeam elements and their arrangements as plane frame structures. Furthermore, acombination of Euler–Bernoulli beam and rod element is introduced as a general-ized beam and frame element. Comments on the computer implementation of thecorresponding Maxima modules are provided. The chapter concludes with detailedMaxima examples which allow an easy transfer to other problems.

4.1 Theory of Euler–Bernoulli Beam Elements

The theory of Euler–Bernoulli beams is applicable to long and slender beams wherethe length is much larger (e.g. more than ten times) than a characteristic dimension ofthe cross section. The theory neglects the shear deformations from the shear forces.This implies that a cross-sectional plane, which was perpendicular to the beam axisbefore the deformation, remains in the deformed state perpendicular to the beam axis.Furthermore, it is assumed that a cross-sectional plane stays plane and unwarped inthe deformed state. These two assumptions are also known as Bernoulli’s hypothesis.Altogether one imagines that cross-sectional planes are rigidly fixed to the center line(more precisely to the neutral fiber) so that a change of the center line affects theentire deformation. Consequently, it is also assumed that the geometric dimensionsof the cross-sectional planes do not change.

4.1.1 Euler–Bernoulli Beam Elements

Bending is normally considered in its general case to occur in two perpendicularplanes. We use in the following the x–y and x–z planes under the assumption thatthe x-axis is aligned to the longitudinal axis of the beam. Then, one can state theprincipal finite element equation for a single beam element of length L with constantbending stiffness E I (see [1, 2] for details of the derivation) in the x–y plane as

© The Author(s), under exclusive license to Springer International Publishing AG,part of Springer Nature 2019A. Öchsner and R. Makvandi, Finite Elements for Truss and Frame Structures,SpringerBriefs in Computational Mechanics, https://doi.org/10.1007/978-3-319-94941-3_4

43

Page 55: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

44 4 Euler–Bernoulli Beams and Frames

Table 4.1 Interpolation functions for Euler–Bernoulli beam elements in the x–y and x–z planegiven in Cartesian coordinates

Ni x–y plane x–z plane

N1u 1 − 3

(x

L

)2

+ 2

(x

L

)3

1 − 3

(x

L

)2

+ 2

(x

L

)3

N1ϕ x − 2x2

L+ x3

L2 −x + 2x2

L− x3

L2

N2u 3

(x

L

)2

− 2

(x

L

)3

3

(x

L

)2

− 2

(x

L

)3

N2ϕ − x2

L+ x3

L2

x2

L− x3

L2

E IzL3

⎡⎢⎢⎣

12 6L −12 6L6L 4L2 −6L 2L2

−12 −6L 12 −6L6L 2L2 −6L 4L2

⎤⎥⎥⎦

⎡⎢⎢⎣u1yϕ1z

u2yϕ2z

⎤⎥⎥⎦ =

⎡⎢⎢⎣F1y

M1z

F2y

M2z

⎤⎥⎥⎦ +

L∫0

qy(x)

⎡⎢⎢⎣N1u

N1ϕ

N2u

N2ϕ

⎤⎥⎥⎦ dx , (4.1)

respectively in the x–z plane as

E IyL3

⎡⎢⎢⎣

12 −6L −12 −6L−6L 4L2 6L 2L2

−12 6L 12 6L−6L 2L2 6L 4L2

⎤⎥⎥⎦

⎡⎢⎢⎣u1zϕ1y

u2zϕ2y

⎤⎥⎥⎦ =

⎡⎢⎢⎣F1z

M1y

F2z

M2y

⎤⎥⎥⎦ +

L∫0

qz(x)

⎡⎢⎢⎣N1u

N1ϕ

N2u

N2ϕ

⎤⎥⎥⎦ dx . (4.2)

Both equations can be stated in abbreviated form, i.e in matrix notation, as

K euep = f e , (4.3)

where K e is the elemental stiffness matrix, uep is the column matrix of nodal

unknowns, and f e is the column matrix of nodal loads. The interpolation func-tions Niu and Niϕ in Eqs. (4.1) and (4.2) are used to calculate the equivalent nodalloads for a given distributed load q(x), see Table 4.1 for details of the formulation.

Once the nodal displacements and rotations are known, e.g. based on uep =

(K e)−1 f e, further quantities can be calculated based on this result (the so-calledpost-processing, see Tables 4.2, 4.3, 4.4 and 4.5). Looking at Tables 4.2, 4.3, 4.4 and4.5, it can be concluded that an Euler–Bernoulli beam element has a cubic displace-ment and quadratic rotation distribution between the nodes whereas the strain andstress distribution is linear within an element. In regard to the internal reactions, thefollowing can be stated: the bending moment distribution is linear while the shearforce distribution is constant.

Page 56: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.1 Theory of Euler–Bernoulli Beam Elements 45

Table 4.2 Post-processingquantities (part 1) for aBernoulli beamelement given as beingdependenton the nodal values as a function of the physical coordinate 0 ≤ x ≤ L . Bending in the x–y plane

Vertical Displacement (Deflection) uy

uey(x) =⎡⎣1 − 3

(x

L

)2

+ 2

(x

L

)3⎤⎦ u1y +

[x − 2x2

L+ x3

L2

]ϕ1z

+⎡⎣3

(x

L

)2

− 2

(x

L

)3⎤⎦ u2y +

[− x2

L+ x3

L2

]ϕ2z

Rotation (Slope) ϕz = duy

dx

ϕez (x) =

[− 6x

L2 + 6x2

L3

]u1y +

[1 − 4x

L+ 3x2

L2

]ϕ1z

+[+ 6x

L2 − 6x2

L3

]u2y +

[−2x

L+ 3x2

L2

]ϕ2z

Curvature κz = d2uy

dx2

κez (x) =

[− 6

L2 + 12x

L3

]u1y +

[− 4

L+ 6x

L2

]ϕ1z

+[+ 6

L2 − 12x

L3

]u2y +

[− 2

L+ 6x

L2

]ϕ2z

4.1.2 Rotation of Beam Elements

The modeling of more realistic structures requires the arrangement of single beamelements in the three-dimensional space as a connecting mesh. For educational sim-plicity, we restrict ourselves to plane, i.e. two-dimensional, arrangements of beamstructures, see Fig. 4.1.

Following a similar approach as in Sect. 3.2, the transversal displacements at eachnode can be transformed into components parallel to the global axes (X–Y or X–Zplane) based on the following transformation matrices

T XY =

⎡⎢⎢⎣

− sin α cosα 0 0 0 00 0 1 0 0 00 0 0 − sin α cosα 00 0 0 0 0 1

⎤⎥⎥⎦ , (4.4)

Page 57: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

46 4 Euler–Bernoulli Beams and Frames

Table 4.3 Post-processing quantities (part 2) for an Euler–Bernoulli beam element given as beingdependent on the nodal values as function of the physical coordinate 0 ≤ x ≤ L . Bending in thex–y plane

Bending Moment Mz = E Izd2uy

dx2

Mez (x) = E Iz

([− 6

L2 + 12x

L3

]u1y +

[− 4

L+ 6x

L2

]ϕ1z

+[+ 6

L2 − 12x

L3

]u2y +

[− 2

L+ 6x

L2

]ϕ2z

)

Shear Force Qy = −E Izd3uy

dx3

Qey(x) = E Iz

([− 12

L3

]u1y +

[− 6

L2

]ϕ1z +

[+ 12

L3

]u2y +

[− 6

L2

]ϕ2z

)

Normal Strain εex (x, y) = −yd2uey(x)

dx2

εex (x, y) =([

+ 6

L2 − 12x

L3

]u1y +

[+ 4

L− 6x

L2

]ϕ1z

+[− 6

L2 + 12x

L3

]u2y +

[+ 2

L− 6x

L2

]ϕ2z

)y

Normal Stress σ ex (x, y) = Eεex (x, y)

(= −Mz

Izy

)

σ ex (x, y) =E

([+ 6

L2 − 12x

L3

]u1y +

[+ 4

L− 6x

L2

]ϕ1z

+[− 6

L2 + 12x

L3

]u2y +

[+ 2

L− 6x

L2

]ϕ2z

)y

and

T XZ =

⎡⎢⎢⎣sin α cosα 0 0 0 00 0 1 0 0 00 0 0 sin α cosα 00 0 0 0 0 1

⎤⎥⎥⎦ , (4.5)

where the matrix T XY relates to a transformation in the X–Y and the matrix T XZ toa transformation in the X–Z plane. It should be noted here that the nodal rotationsϕi do not require any transformation and the transformation matrices contain a ‘1’at the corresponding places. Application of the transformation matrix (4.4) to theelemental principal finite element Eq. (4.1) gives the following expression of theelemental principal finite element equation of an Euler–Bernoulli beam elementwhich is rotated by the rotation angle α in the X–Y plane:

Page 58: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.1 Theory of Euler–Bernoulli Beam Elements 47

Table 4.4 Post-processingquantities (part 1) for aBernoulli beamelement given as beingdependenton the nodal values as a function of the physical coordinate 0 ≤ x ≤ L . Bending in the x–z plane

Vertical Displacement (Deflection) uz

uez(x) =⎡⎣1 − 3

(x

L

)2

+ 2

(x

L

)3⎤⎦ u1z +

[−x + 2x2

L− x3

L2

]ϕ1y

+⎡⎣3

(x

L

)2

− 2

(x

L

)3⎤⎦ u2z +

[+ x2

L− x3

L2

]ϕ2y

Rotation (Slope) ϕy = −duzdx

ϕey(x) =

[+ 6x

L2 − 6x2

L3

]u1z +

[1 − 4x

L+ 3x2

L2

]ϕ1y

+[− 6x

L2 + 6x2

L3

]u2z +

[−2x

L+ 3x2

L2

]ϕ2y

Curvature κy = −d2uzdx2

κey(x) =

[+ 6

L2 − 12x

L3

]u1z +

[− 4

L+ 6x

L2

]ϕ1y

+[− 6

L2 + 12x

L3

]u2z +

[− 2

L+ 6x

L2

]ϕ2y

E IzL3

⎡⎢⎢⎢⎢⎢⎢⎣

12s2α −12sαcα −6Lsα −12s2α 12sαcα −6Lsα−12sαcα 12c2α 6Lcα 12sαcα −12c2α 6Lcα−6Lsα 6Lcα 4L2 6Lsα −6Lcα 2L2

−12s2α 12sαcα 6Lsα 12s2α −12sαcα 6Lsα12sαcα −12c2α −6Lcα −12sαcα 12c2α −6Lcα−6Lsα 6Lcα 2L2 6Lsα −6Lcα 4L2

⎤⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸K e

XY

⎡⎢⎢⎢⎢⎢⎢⎣

u1Xu1Yϕ1Z

u2Xu2Yϕ2Z

⎤⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸ueXY

=

⎡⎢⎢⎢⎢⎢⎢⎣

F1X

F1Y

M1Z

F2X

F2Y

M2Z

⎤⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸f eXY

.

(4.6)The sine (‘sα’) and cosine (‘cα’) values of the rotation angle α can be calculatedthrough the global node coordinates via

sα∧= sin αXY = Y2 − Y1

Lor cα

∧= cosαXY = X2 − X1

L, (4.7)

where the element length L results from the global node coordinates as:

L =√

(X2 − X1)2 + (Y2 − Y1)2. (4.8)

Based on the same procedure, we obtain the expression of the elemental principalfinite element equation of an Euler–Bernoulli beam element which is rotated by the

Page 59: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

48 4 Euler–Bernoulli Beams and Frames

Table 4.5 Post-processing quantities (part 2) for an Euler–Bernoulli beam element given as beingdependent on the nodal values as function of the physical coordinate 0 ≤ x ≤ L . Bending in thex–z plane

Bending Moment My = −E Iyd2uzdx2

Mey(x) =E Iy

([+ 6

L2 − 12x

L3

]u1z +

[− 4

L+ 6x

L2

]ϕ1y

+[− 6

L2 + 12x

L3

]u2z +

[− 2

L+ 6x

L2

]ϕ2y

)

Shear Force Qz = −E Iyd3uzdx3

Qez(x) = E Iy

([− 12

L3

]u1z +

[+ 6

L2

]ϕ1y +

[+ 12

L3

]u2z +

[+ 6

L2

]ϕ2y

)

Normal Strain εex (x, z) = −zd2uez(x)

dx2

εex (x, z) =([

+ 6

L2 − 12x

L3

]u1z +

[− 4

L+ 6x

L2

]ϕ1y

+[− 6

L2 + 12x

L3

]u2z +

[− 2

L+ 6x

L2

]ϕ2y

)z

Normal Stress σ ex (x, z) = Eεex (x, z)

(= My

Iyz

)

σ ex (x, z) =E

([+ 6

L2 − 12x

L3

]u1z +

[− 4

L+ 6x

L2

]ϕ1y

+[− 6

L2 + 12x

L3

]u2z +

[− 2

L+ 6x

L2

]ϕ2y

)z

rotation angle α in the X–Z plane:

E IyL3

⎡⎢⎢⎢⎢⎢⎢⎣

12s2α 12sαcα −6Lsα −12s2α −12sαcα −6Lsα12sαcα 12c2α −6Lcα −12sαcα −12c2α −6Lcα−6Lsα −6Lcα 4L2 6Lsα 6Lcα 2L2

−12s2α −12sαcα 6Lsα 12s2α 12sαcα 6Lsα−12sαcα −12c2α 6Lcα 12sαcα 12c2α 6Lcα−6Lsα −6Lcα 2L2 6Lsα 6Lcα 4L2

⎤⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸K e

X Z

⎡⎢⎢⎢⎢⎢⎢⎣

u1Xu1Zϕ1Y

u2Xu2Zϕ2Y

⎤⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸ueX Z

=

⎡⎢⎢⎢⎢⎢⎢⎣

F1X

F1Z

M1Y

F2X

F2Z

M2Y

⎤⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸f eX Z

.

(4.9)The sine (‘sα’) and cosine (‘cα’) values of the rotation angle α can be calculatedthrough the global node coordinates via

sα∧= sin αXZ = − Z2 − Z1

Lor cα

∧= cosαXZ = X2 − X1

L, (4.10)

Page 60: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.1 Theory of Euler–Bernoulli Beam Elements 49

Fig. 4.1 Rotationaltransformation of anEuler–Bernoulli beamelement: a x–y plane and bX–Z plane

(a)

(b)

where the element length L results from the global node coordinates as:

L =√

(X2 − X1)2 + (Z2 − Z1)2. (4.11)

4.2 Generalized Beam Elements

To further increase the modeling ability of one-dimensional elements, it is possi-ble to combine the rod (see Sect. 3.2) and the Euler–Bernoulli beam element (seeSect. 4.1.1) as a so-called generalized beam element which can now deform alongand perpendicular to its longitudinal axis. The independent superposition of bothstiffness matrices gives the following formulation for the elemental stiffness matrixin the x–y plane

Page 61: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

50 4 Euler–Bernoulli Beams and Frames

⎡⎢⎢⎢⎢⎢⎢⎢⎣

E AL 0 0 − E A

L 0 00 12E Iz

L36E IzL2 0 − 12E Iz

L36E IzL2

0 6E IzL2

4E IzL 0 − 6E Iz

L22E IzL− E A

L 0 0 E AL 0 0

0 − 12E IzL3 − 6E Iz

L2 0 12E IzL3 − 6E Iz

L2

0 6E IzL2

2E IzL 0 − 6E Iz

L24E IzL

⎤⎥⎥⎥⎥⎥⎥⎥⎦

⎡⎢⎢⎢⎢⎢⎢⎣

u1xu1yϕ1z

u2xu2yϕ2z

⎤⎥⎥⎥⎥⎥⎥⎦

=

⎡⎢⎢⎢⎢⎢⎢⎣

F1x

F1y

M1z

F2x

F2y

M2z

⎤⎥⎥⎥⎥⎥⎥⎦

, (4.12)

or in the x–z plane accordingly:

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎣

E AL 0 0 − E A

L 0 00 12E Iy

L3 − 6E IyL2 0 − 12E Iy

L3 − 6E IyL2

0 − 6E IyL2

4E IyL 0 6E Iy

L22E IyL− E A

L 0 0 E AL 0 0

0 − 12E IyL3

6E IyL2 0 12E Iy

L36E IyL2

0 − 6E IyL2

2E IyL 0 6E Iy

L24E IyL

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎦

⎡⎢⎢⎢⎢⎢⎢⎣

u1xu1zϕ1y

u2xu2zϕ2y

⎤⎥⎥⎥⎥⎥⎥⎦

=

⎡⎢⎢⎢⎢⎢⎢⎣

F1x

F1z

M1y

F2x

F2z

M2y

⎤⎥⎥⎥⎥⎥⎥⎦

. (4.13)

The fact that the rod and beam deformation modes are decoupled is represented bythe set of zero-entries in Eqs. (4.12)–(4.13).

The arrangement of single generalized beam elements in the three-dimensionalspace as a connecting mesh would be the next step for a more realistic simulationof real structures. For educational simplicity, we restrict ourselves to plane, i.e. two-dimensional, arrangements of frame structures, see Fig. 4.2.

The longitudinal and transversal displacements at each node can be transformedinto components parallel to the global axes (X–Y or X–Z plane) based on the fol-lowing transformation matrices

T XY =

⎡⎢⎢⎢⎢⎢⎢⎣

cosα sin α 0− sin α cosα 0

0 0 1

0 0 00 0 00 0 0

0 0 00 0 00 0 0

cosα sin α 0− sin α cosα 0

0 0 1

⎤⎥⎥⎥⎥⎥⎥⎦

, (4.14)

T XZ =

⎡⎢⎢⎢⎢⎢⎢⎣

cosα − sin α 0sin α cosα 00 0 1

0 0 00 0 00 0 0

0 0 00 0 00 0 0

cosα − sin α 0sin α cosα 00 0 1

⎤⎥⎥⎥⎥⎥⎥⎦

, (4.15)

where the matrix T XY relates to a transformation in the x–y and the matrix T XZ toa transformation in the X–Z plane. It should be noted again that the nodal rotationsϕi do not require any transformation and the transformation matrices contain a ‘1’

Page 62: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.2 Generalized Beam Elements 51

Fig. 4.2 Rotationaltransformation of ageneralized Euler–Bernoullibeam element: a x–y planeand b X–Z

(a)

(b)

at the corresponding places. Application of the transformation matrix (4.14) to theelemental principal finite element Eq. (4.12) gives the following expression (4.16) ofthe elemental principal finite element equation of a generalized beam element whichis rotated by the rotation angle α in the x–y plane. The corresponding transformedmatrix in the X–Z plane is given in Eq. (4.17). It should be noted here that thesines and cosines of the rotation angle as well as the element length can be obtainedfrom the nodal coordinates as outlined in Eqs. (4.7)–(4.8) and (4.10)–(4.11). Thereader should also refer to Table3.2 for the transformation of matrices between theelemental and global coordinate systems.

Page 63: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

52 4 Euler–Bernoulli Beams and Frames

E

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣

12I

L3

sin2

α+

A Lco

s2α

( −12

I

L3+

A L

) sinα

cosα

−6I L2sinα

−12

I

L3

sin2

α−

A Lco

s2α

( 12I L3−

A L

) sin α

cosα

−6I L2sinα

( −12

I

L3+

A L

) sinα

cosα

12I

L3

cos2

α+

A Lsin2

α

6I L2co

( 12I L3−

A L

) sinα

cosα

−12

I

L3

cos2

α−

A Lsin2

α

6I L2co

−6I L2sinα

6I L2co

4 I L

6I L2sinα

−6I L2co

2I L

−12

I

L3

sin2

α−

A Lco

s2α

( 12I L3−

A L

) sinα

cosα

6I L2sinα

−12

I

L3

sin2

α+

A Lco

s2α

( −12

I

L3+

A L

) sinα

cosα

6I L2sinα

( 12I L3−

A L

) sinα

cosα

−12

I

L3

cos2

α−

A Lsin2

α

−6I L2co

( −12

I

L3+

A L

) sinα

cos α

12I

L3

cos2

α+

A Lsin2

α

−6I L2co

−6I L2sinα

6I L2co

2I L

6I L2sinα

−6I L2co

4I L

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦︸

︷︷︸

Ke X

Y

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣u1X

u1Y

ϕ1Z

u2X

u2Y

ϕ2Z

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦=

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣F1X

F1Y

M1Z

F2X

F2Y

M2Z

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦.

(4.16)

Page 64: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.2 Generalized Beam Elements 53

E

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣

12I

L3

sin2

α+

A Lco

s2α

( 12I L3−

A L

) sinα

cosα

−6 I L2sinα

−12

I

L3

sin2

α−

A Lco

s2α

( −12

I

L3+

A L

) sin α

cosα

−6I L2sinα

( 12I L3−

A L

) sinα

cosα

12I

L3

cos2

α+

A Lsin2

α

−6I L2co

s α

( −12

I

L3+

A L

) sinα

cosα

−12

I

L3

cos2

α−

A Lsin2

α

−6I L2co

s α

−6I L2sinα

−6I L2co

4I L

6I L2sinα

6I L2co

2I L

−12

I

L3

sin2

α−

A Lco

s2α

( −12

I

L3+

A L

) sinα

cosα

6I L2sinα

12I

L3

sin2

α+

A Lco

s2α

( 12I L3−

A L

) sinα

cosα

6I L2sinα

( −12

I

L3+

A L

) sinα

cosα

−12

I

L3

cos2

α−

A Lsin2

α

6I L2co

( 12I L3−

A L

) sinα

cosα

12I

L3

cos2

α+

A Lsin2

α

6I L2co

−6I L2sinα

−6I L2co

2I L

6I L2sinα

6I L2co

4I L

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦︸

︷︷︸

Ke X

Z

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣u1X

u1Z

ϕ1Y

u2X

u2Z

ϕ2Y

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦=

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣F1X

F1Z

M1Y

F2X

F2Z

M2Y

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦.

(4.17)

Page 65: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

54 4 Euler–Bernoulli Beams and Frames

Fig. 4.3 Frame elementsupported by a rod

Table 4.6 Angles of rotationαi and sine and cosine valuesfor the problem shown inFig. 4.3

Element Angle of Rotation sine cosine

I 90◦ 1 0

II 0◦ 0 1

Let us now illustrate the single steps of the finite element solution procedure with aconcrete example. The steps are basically the same as outlined in the second part ofSect. 3.2 and we are going to omit a few intermediate steps and explanations.

Consider in the following a two-dimensional frame structure as shown in Fig. 4.3where a vertical frame element (E, I, A) is supported by a horizontal rod element(E, A). Both structural elements have the same length L . The structure is loaded inthe connecting node by a vertical force F0 and a prescribed horizontal displacementu0. The goal is to determine for this problem the global system of equations, thereduced system of equations, and the nodal deformations of the connecting node.

The first step of the solution procedure is to sketch the free-body diagram ofthe problem, including a global x–y coordinate system, see Fig. 4.4. In addition,the structure should be subdivided into finite elements. Then, the node and elementnumbers (the user may choose any numbering order), local coordinate systems, andequivalent nodal loads must be indicated. The local coordinate axes xi , yi (where‘i’ refers to the element number I or II) are used to define for each member thecorresponding rotation angles, see Table 4.6.

The next solution step is to write separately all elemental stiffness matricesexpressed in the global coordinate system. For this step, evaluate the general expres-sion given in Eq. (4.16). Then indicate for each element the nodal unknowns (degreesof freedom) on the right-hand side and over the matrix. In this step, the DOFs mustbe chosen according to the global coordinate system—conventionally, in the positivedirection.

Page 66: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.2 Generalized Beam Elements 55

Fig. 4.4 Free-body diagramof the frame elementsupported by a rod

K eI = E ×

u1X u1Y ϕ1Z u2X u2Y ϕ2Z

12IyL3 0 − 6Iy

L2 − 12IyL3 0 − 6Iy

L2 u1X

0 AL 0 0 − A

L 0 u1Y

− 6IyL2 0 4Iy

L6IyL2 0 2Iy

L ϕ1Z

− 12IyL3 0 6Iy

L2 − 12IyL3 0 6Iy

L2 u2X

0 − AL 0 0 A

L 0 u2Y6IyL2 0 2Iy

L6IyL2 0 4Iy

L ϕ2Z

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

, (4.18)

K eII = E ×

u3X u3Y ϕ3Z u2X u2Y ϕ2Z

AL 0 0 − A

L 0 0 u3X

0 0 0 0 0 0 u3Y0 0 0 0 0 0 ϕ3Z

− AL 0 0 A

L 0 0 u2X

0 0 0 0 0 0 u2Y0 0 0 0 0 0 ϕ2Z

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎦

, (4.19)

or in short:

K eII = E A

u3X u2X1 −1 u3X

−1 1 u2X

[ ]. (4.20)

Page 67: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

56 4 Euler–Bernoulli Beams and Frames

The next step is to determine the dimension of the global stiffness matrix and tosketch the structure of this matrix with global unknowns on the right-hand side andover the matrix, see Eq. (4.21). The dimensions of the matrix are equal to the totalnumber of degrees of freedom which can be determined by multiplying the numberof nodes by the number of degrees of freedom per node:

K = E ×

u1X u1Y ϕ1Z u2X u2Y ϕ2Z u3X34

34

34

34

34

34

34 u1X

34

34 u1Y

34

34 ϕ1Z

34

34 u2X

34

34 u2Y

34

34 ϕ2Z

34

34

34

34

34

34

34 u3X

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

. (4.21)

As a result of the above procedure, each cell in the elemental stiffness matrices (seeEqs. (4.18) and (4.20)) and in the global stiffness matrix (4.21) has a unique index.Based on this index, each element of an elemental matrix can be inserted step-by-step at its corresponding place in the global matrix (4.21). The following Eq. (4.22)shows the final assembly of both elemental matrices into the structure of the globalmatrix:

K = E ×

u1X u1Y ϕ1Z u2X u2Y ϕ2Z u3X12IyL3 0 − 6Iy

L2 − 12IyL3 0 − 6Iy

L2 034 u1X

0 AL 0 0 − A

L 0 0 u1Y

− 6IyL2 0 4Iy

L6IyL2 0 2Iy

L 0 ϕ1Z

− 12IyL3 0 6Iy

L2 − 12IyL3 + A

L 0 6IyL2 − A

L u2X

0 − AL 0 0 A

L 0 0 u2Y

− 6IyL2 0 2Iy

L6IyL2 0 4Iy

L 0 ϕ2Z

0 0 0 − AL 0 0 A

L u3X

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

. (4.22)

The next step of the solution procedure is to add the column matrix of unknowns andexternal loads to complete the global system of equations, see Eq. (4.23). It should benoted here that the column matrix of the external loads has been adjusted accordingto the free-body diagram, see Fig. 4.4.

Page 68: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.2 Generalized Beam Elements 57

E

u1X u1Y ϕ1Z u2X u2Y ϕ2Z u3X12IyL3 0 − 6Iy

L2 − 12IyL3 0 − 6Iy

L2 0340 A

L 0 0 − AL 0 0

− 6IyL2 0 4Iy

L6IyL2 0 2Iy

L 0

− 12IyL3 0 6Iy

L2 − 12IyL3 + A

L 0 6IyL2 − A

L

0 − AL 0 0 A

L 0 0

− 6IyL2 0 2Iy

L6IyL2 0 4Iy

L 0

0 0 0 − AL 0 0 A

L

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

u1Xu1Yϕ1Z

u2Xu2Yϕ2Z

u3X

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

FR1X

FR1Y

MR1Z

FR2X

F0

0

FR3X

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(4.23)This system of equations cannot be solved at this stage of the procedure. In order toproceed, the support conditions must be introduced. At node 1, there is no translationand rotation possible while the support at node 3 suppresses vertical and horizontalmovements. This means that the first three as well as the last equation (represented bytheir corresponding rows and columns) can be removed from the system of equations,see Eq. (4.24).

E

u1X u1Y ϕ1Z u2X u2Y ϕ2Z u3X

12IyL3 0 − 6Iy

L2 − 12IyL3 0 − 6Iy

L2 034

0 AL 0 0 −A

L 0 0

− 6IyL2 0 4Iy

L6IyL2 0 2Iy

L 0

− 12IyL3 0 6Iy

L2 − 12IyL3 +A

L 0 6IyL2 −A

L

0 −AL 0 0 A

L 0 0

− 6IyL2 0 2Iy

L6IyL2 0 4Iy

L 0AL0 0 0 −A

L 0 0 AL

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

u1X

u1Y

ϕ1Z

u2X

u2Y

ϕ2Z

u3X

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

=

FR1X

FR1Y

MR1Z

FR2X

F0

0

FR3X

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

.

(4.24)As a result, we obtain a 3 × 3 system of equations, see Eq. (4.25):

E

− 12IyL3 + A

L 0 6IyL2

0 AL 0

6IyL2 0 4Iy

L

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦

u2Xu2Yϕ2Z

⎡⎢⎣

⎤⎥⎦ =

FR2X

F0

0

⎡⎢⎢⎣

⎤⎥⎥⎦ . (4.25)

The consideration of the displacement boundary condition u2X = u0 at node 2 canbe done in the following way: Create an entry of ‘1’ in the corresponding cell and

Page 69: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

58 4 Euler–Bernoulli Beams and Frames

set the remaining entries of the row to ‘0’. Multiply the remaining elements ofthe corresponding column with the given displacement value u0. Then bring theseremaining elements of the column, which contains the known value u0, to the right-hand side of the system of equation, see Eqs. (4.26) and (4.27):

E

1E 0 0

0 AL 0

6IyL2 ×u0 0 4Iy

L

⎡⎢⎢⎢⎣

⎤⎥⎥⎦

u2Xu2Yϕ2Z

⎡⎢⎣

⎤⎥⎦ =

u0F0

0

⎡⎢⎣

⎤⎥⎦ , (4.26)

E

1E 0 0

0 AL 0

0 0 4IyL

⎡⎢⎢⎣

⎤⎥⎥⎦

u2Xu2Yϕ2Z

⎡⎢⎣

⎤⎥⎦ =

u0F0

− 6E Iyu0L2

⎡⎢⎢⎣

⎤⎥⎥⎦ . (4.27)

The solution of this system can be obtained, for example, by inverting the reducedstiffness matrix to get the reduced column matrix of the nodal displacements:

u2Xu2Yϕ2Z

⎡⎢⎣

⎤⎥⎦ = 1

E

E 0 00 L

A 0

0 0 L4Iy

⎡⎢⎣

⎤⎥⎥⎦

u0F0

− 6E Iyu0L2

⎡⎢⎢⎣

⎤⎥⎥⎦ =

u0F0LE A

− 3u02L

⎡⎢⎢⎢⎣

⎤⎥⎥⎥⎦ . (4.28)

4.3 Maxima Modules

The solution steps for beam and frame structures are basically the same as outlinedfor truss structures in the second part of Sect. 3.2 and their transformation toMaximamodules as outlined in Sect. 3.3. Thus, we will present in the following only twoelements and the reader is referred to the above mentioned sections. The entiresource code is provided in Sect. 6.

4.3.1 Stiffness Matrix for a Single Generalized BeamElements

The stiffness matrix of a single element is calculated with the moduleK_el_gen_Beam_xy(ncoor, Em, A, Izz), where the input parameters are the nodalcoordinates (ncoor), the Young’s modulus (E), the cross sectional area (A), and theaxial second moment of area (Izz), see Fig. 4.5.

Page 70: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.3 Maxima Modules 59

Fig. 4.5 Flowchart for the calculation of the elemental stiffness matrix K eXY of a generalized beam

element in the x–y plane

Fig. 4.6 Flowchart for the complete calculation of an entire frame structure in the x–y plane

Page 71: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

60 4 Euler–Bernoulli Beams and Frames

Fig. 4.7 Frame elementsupported by a rod: overview

4.3.2 Frame Structures

All the single modules are combined in a ‘master’ module called GenBeamSolu-tion_xy(nodxy, elenod, elefab, elemat, nodtag, nodval), which allows to evaluateentire frame structures, see Fig. 4.6.

4.4 Examples Based on Maxima

Let us mention again that the provided Maxima modules allow symbolic (i.e., basedon variables) or numerical (i.e., based on numbers) solutions. For educational pur-pose, we present in the following sections only symbolic calculations. All the exam-ples require that the librarymy_funs.mac is pre-loaded (the source code is providedin Sect. 6). For best display of results in wxMaxima, one should use Consolas (10)as the default and the math font (check the wxMaxima configuration window fordetails).

4.1 Example: Frame element supported by a rodGiven is a vertical frame element as shown in Fig. 4.7 where a horizontal rod supportsthe member at the upper end. Both members have the length L whereas the frame hasthe properties E, I, A and the rod is characterized by E, A. The structure is loaded atthe upper right corner by a prescribed horizontal displacement u0 and vertical forceF0.

Consider two finite elements and determine

• the deformations of the nodes,• the reactions at the supports and nodes where displacements are prescribed, and• the elemental normal and shear forces as well as the bending moments.

Page 72: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.4 Examples Based on Maxima 61

Fig. 4.8 Frame elementsupported by a rod: aoverview and b free-bodydiagram with node andelement numbering

Table 4.7 Different nodal arrays for the problem shown in Fig. 4.8

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value(nodval)

1 [0, 0] [1, 1, 1] [0, 0, 0]2 [L , 0] [0, 1, 0] [ p0L

2 , 0, q0L2

12 ]3 [2L , 0] [1, 1, 1] [0, 0, 0]

Table 4.8 Element definitions for the problem shown in Fig. 4.8

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [1, 2] A, I E

II [2, 3] A, I = 0 E

4.1 Solution

The solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 4.8.

The next step is to generate the required nodal arrays (see Table 4.7) and elementaldefinitions (see Table 4.8) to facilitate the model definition in Maxima.

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Page 73: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

62 4 Euler–Bernoulli Beams and Frames

Definition of Master Stiffness: Nodal Coordinates "nodxy", Element end nodes"elenod", Element materialproperties "elemat", Element fabrication properties "ele-fab", freedom tags list "nodtag", freedom values list "nodval"

−→ assume(L>0)$nodxy : matrix([0,0],[0,L],[-L,L])$elenod: matrix([1,2],[2,3])$numnod : length(nodxy)$numele : length(elenod)$elemat : makelist([Em],numele)$elefab : makelist([A, Izz],numele)$elefab[2] : [A, 0]$ nodtag : makelist([1,1,1],numnod)$nodval : makelist([0,0,0],numnod)$nodtag[2] : [1, 0, 0]$nodval[2] : [u0, F0, 0]$nodtag[3] : [1, 1, 1]$

Maxima Calculations and Output

−→ [noddis, nodfor, elefor] :GenBeamSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nodval)$

print(" ")$print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneGenBeamElementDataSymb(elenod, elemat, elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneGenBeamFreedomActivitySymb(nodtag, nodval))$

print(" ")$print("Computed Nodal Displacements and Rotations:")$print(" ",PrintPlaneGenBeamNodeDOFsSymb(noddis))$

print(" ")$print("Computed Nodal Forces and Moments:")$print(" ",PrintPlaneGenBeamNodeForcesSymb(nodfor))$

print(" ")$print("Elementwise Normal Forces, Bending Moments and Shear Forces:")$for e:1 thru numele do(

print(" "),print(" ", "Element ", e, ":"),print(" ",PrintPlaneGenBeamElemForcesSymb(elefor[e])) )$

Page 74: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.4 Examples Based on Maxima 63

Nodal Coordinates: ⎡⎢⎢⎣node x-coor y-coor1 0 02 0 L3 −L L

⎤⎥⎥⎦

Element Data: ⎡⎣elem nodes modulus fabrication

1 [1, 2] [Em] [A, Izz]2 [2, 3] [Em] [A, 0]

⎤⎦

DOF Activity: ⎡⎢⎢⎣node x-tag y-tag zrot-tag x-value y-value zrot-value1 1 1 1 0 0 02 1 0 0 u0 F0 03 1 1 1 0 0 0

⎤⎥⎥⎦

Computed Nodal Displacements and Rotations:⎡⎢⎢⎣node x-displ y-displ z-rot1 0 0 02 u0 F0L

A Em − 3u02L

3 0 0 0

⎤⎥⎥⎦

Computed Nodal Forces and Moments:⎡⎢⎢⎢⎣node x-force y-force Bending-moment1 − 3Em Izz u0

L3 −F0 3Em Izz u0L2

2Em

(A L2+3Izz

)u0

L3 F0 03 − A Em u0

L 0 0

⎤⎥⎥⎥⎦

Elementwise Normal Forces, Bending Moments and Shear Forces:

Element 1 :

⎡⎢⎢⎣local-node Normal-force Bending-moment Shear-force

1 −F0 A Em(3u0L2 − 6u0

L

)A Em

(12u0L2 − 9u0

L3

)2 −F0 A Em

(6u0L − 6u0

L2

)A Em

(12u0L2 − 9u0

L3

)⎤⎥⎥⎦

Element 2 :

⎡⎢⎢⎣local-node Normal-force Bending-moment Shear-force

1 A Em u0L A Em

(3u0L2 − 6F0

A Em

)A Em

(12F0A EmL − 9u0

L3

)2 A Em u0

L A Em(

6F0A Em − 6u0

L2

)A Em

(12F0A EmL − 9u0

L3

)⎤⎥⎥⎦

Page 75: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

64 4 Euler–Bernoulli Beams and Frames

Fig. 4.9 Generalized cantilever beam with two types of distributed loads: overview

Fig. 4.10 Generalized cantilever beamwith two types of distributed loads: free-body diagram withnode and element numbering

4.2 Generalized cantilever beam with two types of distributed loadsThe generalized beam shown in Fig. 4.9 is loaded by a constant vertical distributedload q0 in the range 0 ≤ X ≤ L and a constant horizontal load p0 in the rangeL ≤ X ≤ 2L . The material property (E) and the geometrical properties (I, A) areconstant and the total length of the beam is equal to 2L . Model the member with twogeneralized beam finite elements of length L to determine:

• the unknowns at the nodes,• the reactions at the supports, and• the internal reactions (normal force, shear force and bending moment) in eachelement.

4.2 SolutionThe solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 4.10.

Page 76: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.4 Examples Based on Maxima 65

Table 4.9 Different nodal arrays for the problem shown in Fig. 4.10

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value (nodval)

1 [0, 0] [1, 1, 1] [0, 0, 0]2 [L , 0] [0, 0, 1] [ p0L

2 , 0, q0L2

12 ]3 [2L , 0] [1, 1, 1] [0, 0, 0]

Table 4.10 Element definitions for the problem shown in Fig. 4.10

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [1, 2] A, I E

II [2, 3] A, I E

The next step is to generate the required nodal arrays (see Table 4.9) and elementaldefinitions (see Table 4.10) to facilitate the model definition in Maxima.

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Definition of Master Stiffness: Nodal Coordinates "nodxy", Element end nodes"elenod", Elementmaterial properties "elemat", Element fabrication properties"elefab",freedom tags list "nodtag", freedom values list "nodval"

(% i12) assume(L>0)$

nodxy : matrix([0,0],[L,0],[2*L,0])$elenod: matrix([1,2],[2,3])$

numnod : length(nodxy)$numele : length(elenod)$

elemat : makelist([Em],numele)$elefab : makelist([A, Izz],numele)$

nodtag : makelist([1,1,1],numnod)$nodval : makelist([0,0,0],numnod)$nodtag[2] : [0, 1, 0]$nodval[2] : [p0*L/2, 0, q0*L*L/12]$

Page 77: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

66 4 Euler–Bernoulli Beams and Frames

Maxima Calculations and Output

(% i31) [noddis, nodfor, elefor] :GenBeamSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nodval)$

print(" ")$ print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneGenBeamElementDataSymb(elenod, elemat,elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneGenBeamFreedomActivitySymb(nodtag, nodval))$

print(" ")$print("Computed Nodal Displacements and Rotations:")$print(" ",PrintPlaneGenBeamNodeDOFsSymb(noddis))$

print(" ")$print("Computed Nodal Forces and Moments:")$print(" ",PrintPlaneGenBeamNodeForcesSymb(nodfor))$

print(" ")$print("Elementwise Normal Forces, Bending Moments and Shear Forces:")$for e:1 thru numele do(print(" "),print(" ", "Element ", e, ":"),print(" ",PrintPlaneGenBeamElemForcesSymb(elefor[e])))$

Nodal Coordinates: ⎡⎢⎢⎣node x-coor y-coor1 0 02 L 03 2L 0

⎤⎥⎥⎦

Element Data: ⎡⎣elem nodes modulus fabrication

1 [1, 2] [Em] [A, Izz]2 [2, 3] [Em] [A, Izz]

⎤⎦

DOF Activity: ⎡⎢⎢⎣node x-tag y-tag zrot-tag x-value y-value zrot-value1 1 1 1 0 0 0

2 0 1 0 L p02 0 L2 q0

123 1 1 1 0 0 0

⎤⎥⎥⎦

Page 78: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.4 Examples Based on Maxima 67

Computed Nodal Displacements and Rotations:⎡⎢⎢⎣node x-displ y-displ z-rot1 0 0 0

2 L2 p04A Em 0 L3 q0

96Em Izz3 0 0 0

⎤⎥⎥⎦

Computed Nodal Forces and Moments:⎡⎢⎢⎢⎣node x-force y-force Bending-moment

1 − L p04

L q016

L2 q048

2 L p02 0 L2 q0

12

3 − L p04 − L q0

16L2 q048

⎤⎥⎥⎥⎦

Elementwise Normal Forces, Bending Moments and Shear Forces:

Element 1 : ⎡⎢⎣local-node Normal-force Bending-moment Shear-force

1 L p04 − A L2 q0

48IzzAL q016Izz

2 L p04

A L2 q024Izz

AL q016Izz

⎤⎥⎦

Element 2 : ⎡⎢⎣local-node Normal-force Bending-moment Shear-force

1 − L p04 − A L2 q0

24IzzAL q016Izz

2 − L p04

A L2 q048Izz

AL q016Izz

⎤⎥⎦

It should be noted here that the ‘Computed Nodal Forces and Moments’ givesthe complete right-hand side of the load vector. This means that in the case of node1 the sum FR

1Y − q0L2 is calculated. If the reaction force FR

1Y is required, one mustmanually calculate FR

1Y = q0L16 + q0L

2 = 9q0L16 . The calculation of the other reactions

may require a similar consideration. Thus, it might be good to explicitly write theload matrix based on the free-body diagram Fig. 4.10 as:

f =[FR1X FR

1Y − q0L2 MR

1Z − q0L2

12p0L2 FR

2Y − q0L2

q0L2

12 FR3X + p0L

2 FR3Y MR

3Z

]T.

(4.29)

4.3 Plane frame structure composed of generalized beam elementsThe plane frame structure shown in Fig. 4.11 is composed of generalized beamswhich are arranged in a T-shaped formation. The structure is loaded by a single forceF0 in its middle. The material property (E) and the geometrical properties (I, A)

are constant and the horizontal length of the beam is equal to L while the verticaldimension is equal to L

2 . Model the structure with three generalized beam finiteelements of length L

2 to determine:

• the unknowns at the nodes,• the reactions at the supports, and

Page 79: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

68 4 Euler–Bernoulli Beams and Frames

Fig. 4.11 Plane frame structure composed of generalized beam elements: overview

Fig. 4.12 Plane frame structure composed of generalized beam elements: free-body diagram withnode and element numbering

• the internal reactions (normal force, shear force and bending moment) in eachelement.

4.3 Solution

The solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 4.12.

Page 80: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.4 Examples Based on Maxima 69

Table 4.11 Different nodal arrays for the problem shown in Fig. 4.12

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value(nodval)

1 [0, 0] [1, 1, 1] [0, 0, 0]2 [ L2 , 0] [0, 0, 0] [0,−F0, 0]3 [L , 0] [1, 1, 1] [0, 0, 0]4 [ L2 , L

2 ] [1, 1, 1] [0, 0, 0]

Table 4.12 Element definitions for the problem shown in Fig. 4.12

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [1, 2] A, I E

II [2, 3] A, I E

II [2, 4] A, I E

The next step is to generate the required nodal arrays (see Table 4.11) and ele-mental definitions (see Table 4.12) to facilitate the model definition in Maxima.

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Definition of Master Stiffness: Nodal Coordinates "nodxy", Element end nodes"elenod", Element material properties "elemat", Element fabricationproperties "ele-fab", freedom tags list "nodtag", freedom values list "nodval"

−→ assume(L>0)$

nodxy : matrix([0,0],[L/2,0],[L,0],[L/2,L/2])$elenod: matrix([1,2],[2,3],[2,4])$

numnod : length(nodxy)$numele : length(elenod)$

elemat : makelist([Em],numele)$elefab : makelist([A, Izz],numele)$

nodtag : makelist([1,1,1],numnod)$nodval : makelist([0,0,0],numnod)$nodtag[2] : [0, 0, 0]$nodval[2] : [0, -F0, 0]$

Page 81: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

70 4 Euler–Bernoulli Beams and Frames

Maxima Calculations and Output

−→ [noddis, nodfor, elefor] :GenBeamSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nod-val)$

print(" ")$print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneGenBeamElementDataSymb(elenod, elemat,elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneGenBeamFreedomActivitySymb(nodtag, nod-val))$

print(" ")$print("Computed Nodal Displacements and Rotations:")$print(" ",PrintPlaneGenBeamNodeDOFsSymb(noddis))$

print(" ")$print("Computed Nodal Forces and Moments:")$print(" ",PrintPlaneGenBeamNodeForcesSymb(nodfor))$

print(" ")$print("Elementwise Normal Forces, Bending Moments and ShearForces:")$for e:1 thru numele do(print(" "),print(" ", "Element ", e, ":"),print(" ",PrintPlaneGenBeamElemForcesSymb(elefor[e])))$

Nodal Coordinates: ⎡⎢⎢⎢⎢⎣node x-coor y-coor1 0 02 L

2 03 L 04 L

2L2

⎤⎥⎥⎥⎥⎦

Page 82: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

4.4 Examples Based on Maxima 71

Element Data: ⎡⎢⎢⎣elem nodes modulus fabrication1 [1, 2] [Em] [A, Izz]2 [2, 3] [Em] [A, Izz]3 [2, 4] [Em] [A, Izz]

⎤⎥⎥⎦

DOF Activity:

⎡⎢⎢⎢⎣node x-tag y-tag zrot-tag x-value y-value zrot-value1 1 1 1 0 0 02 0 0 0 0 −F0 03 1 1 1 0 0 04 1 1 1 0 0 0

⎤⎥⎥⎥⎦

Computed Nodal Displacements and Rotations:⎡⎢⎢⎢⎢⎣node x-displ y-displ z-rot1 0 0 0

2 0 − F0 L3

2A Em L2+192Em Izz0

3 0 0 04 0 0 0

⎤⎥⎥⎥⎥⎦

Computed Nodal Forces and Moments:⎡⎢⎢⎢⎢⎢⎣

node x-force y-force Bending-moment1 0 48F0 Izz

A L2+96Izz12F0 IzzLA L2+96Izz

2 0 −F0 03 0 48F0 Izz

A L2+96Izz− 12F0 IzzL

A L2+96Izz

4 0 A F0 L2

A L2+96Izz0

⎤⎥⎥⎥⎥⎥⎦

Elementwise Normal Forces, Bending Moments and shear Forces:

Element 1 :⎡⎢⎣local-node Normal-force Bending-moment Shear-force

1 0 12A EmF0 L2

2A Em L2+192Em Izz− 48A EmF0L

2A Em L2+192Em Izz

2 0 − 12A EmF0 L2

2A Em L2+192Em Izz− 48A EmF0L

2A Em L2+192Em Izz

⎤⎥⎦

Element 2 :⎡⎢⎣local-node Normal-force Bending-moment Shear-force

1 0 − 12A EmF0 L2

2A Em L2+192Em Izz48A EmF0L

2A Em L2+192Em Izz

2 0 12A EmF0 L2

2A Em L2+192Em Izz48A EmF0L

2A Em L2+192Em Izz

⎤⎥⎦

Element 3 :⎡⎢⎣local-node Normal-force Bending-moment Shear-force

1 − 2A EmF0 L2

2A Em L2+192Em Izz0 0

2 − 2A EmF0 L2

2A Em L2+192Em Izz0 0

⎤⎥⎦

Page 83: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

72 4 Euler–Bernoulli Beams and Frames

References

1. Öchsner A, Merkel M (2013) One-Dimensional Finite Elements: An Introduction to the FEMethod. Springer, Berlin

2. Öchsner A (2016) Computational Statics and Dynamics - An Introduction Based on the FiniteElement Method. Springer, Singapore

Page 84: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Chapter 5Timoshenko Beams and Frames

Abstract This chapter briefly introduces to the theory of single Timoshenko beamelements and their arrangements as plane frame structures. Furthermore, a combi-nation of Timoshenko beam and rod element is introduced as a generalized beamand frame element. Comments on the computer implementation of the correspond-ing Maxima modules are provided. The chapter concludes with detailed Maximaexamples which allow an easy transfer to other problems.

5.1 Theory of Timoshenko Beam Elements

In the case of the Timoshenko beam, also called the shear-flexible beam, the sheardeformation is considered in addition to the bending deformation. As a consequence,Bernoulli’s hypothesis is partly no longer fulfilled for the Timoshenko beam: planecross sections remain plane after the deformation. However, a cross section whichstood at right angles to the beam axis before the deformation is not at right angles tothe beam axis after the deformation. Furthermore, the real parabolic distribution ofthe shear stress over the cross section is simplified to an equivalent constant shearstress. As a consequence, a so-called shear correction factor (ks) is introduced [1].

5.1.1 Timoshenko Beam Elements

Bending is again considered in two perpendicular planes.We use in the following thex-y and x-z planes under the assumption that the x-axis is aligned to the longitudinalaxis of the beam. Then, one can state the principal finite element equation for a singlebeam element of length L with constant bending (E I ) and shear stiffness (ksAG)

(see [2, 3] for details of the derivation) in the x-y plane as

© The Author(s), under exclusive license to Springer International Publishing AG,part of Springer Nature 2019A. Öchsner and R. Makvandi, Finite Elements for Truss and Frame Structures,SpringerBriefs in Computational Mechanics, https://doi.org/10.1007/978-3-319-94941-3_5

73

Page 85: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

74 5 Timoshenko Beams and Frames

ksAG

4L

⎡⎢⎢⎣

4 2L −4 2L2L 4

3 L2 + α −2L 4

6 L2 − α

−4 −2L 4 −2L2L 4

6 L2 − α −2L 4

3 L2 + α

⎤⎥⎥⎦

⎡⎢⎢⎣u1yφ1z

u2yφ2z

⎤⎥⎥⎦ =

⎡⎢⎢⎣F1y

M1z

F2y

M2z

⎤⎥⎥⎦ +

L∫

0

qy(x)

⎡⎢⎢⎣N1u

0N2u

0

⎤⎥⎥⎦ dx ,

(5.1)

where the abbreviation α = 4E IzksAG

is used. The corresponding equation for the x-zplane reads as

ksAG

4L

⎡⎢⎢⎣

4 −2L −4 −2L−2L 4

3 L2 + α 2L 4

6 L2 − α

−4 2L 4 2L−2L 4

6 L2 − α 2L 4

3 L2 + α

⎤⎥⎥⎦

⎡⎢⎢⎣u1zφ1y

u2zφ2y

⎤⎥⎥⎦ =

⎡⎢⎢⎣F1z

M1y

F2z

M2y

⎤⎥⎥⎦ +

L∫

0

qz(x)

⎡⎢⎢⎣N1u

0N2u

0

⎤⎥⎥⎦ dx ,

(5.2)

where the abbreviation α = 4E IyksAG

is used. Both equations can be stated in abbreviatedform, i.e in matrix notation, as

K euep = f e , (5.3)

where K e is the elemental stiffness matrix, uep is the column matrix of nodal

unknowns, and f e is the column matrix of nodal loads. The interpolation func-tions N1u(x) = 1 − x

L and N2u(x) = xL in Eqs. (5.1) and (5.2) are used to calculate

the equivalent nodal loads for a given distributed load q(x). It should be noted herethat also other types of interpolation functions can be found in literature, see [3].

Once the nodal displacements and rotations are known, e.g. based on uep =

(K e)−1 f e, further quantities can be calculated based on this result (the so-calledpost-processing, see Tables5.1 and 5.2). Looking at Tables5.1 and 5.2, it can beconcluded that this type of Timoshenko beam element has a linear displacement andlinear rotation distribution between the nodes as wells as a linear shear strain dis-tribution within an element. In regard to the internal reactions, the following can bestated: the bending moment distribution is linear while the shear force distributionis constant.

5.1.2 Rotation of Beam Elements

The modeling of more realistic structures requires the arrangement of single beamelements in the three-dimensional space as a connecting mesh. For educational sim-plicity, we restrict ourselves to plane, i.e. two-dimensional, arrangements of beamstructures, see Fig. 4.1 with the corresponding figure for an Euler–Bernoulli beam.Following the same approach as in Sect. 4.1.2, the transversal displacements at eachnode can be transformed into components parallel to the global axes (X -Y or X -

Page 86: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.1 Theory of Timoshenko Beam Elements 75

Table 5.1 Displacement, rotation, curvature, shear strain, shear force and bending moment distri-bution for a linear Timoshenko beam element given as a function of the nodal values in Cartesiancoordinates (bending occurs in the x-y plane)

Vertical displacement (deflection) uyuey(x) = [

1 − xL

]u1y + [ x

L

]u2y

Rotation φzφez (x) = [

1 − xL

]φ1z + [ x

L

]φ2z

Curvature κz = dφz

dxκez (x) = [− 1

L

]φ1z + [ 1

L

]φ2z

Shear strain γxy = duy

dx− φz

γ exy(x) = [− 1

L

]u1y + [ 1

L

]u2y − [

1 − xL

]φ1z − [ x

L

]φ2z

Shear Force Qy = ksAGγxy = ksAG

(duy

dx− φz

)

Qey(x) = ksAG

([− 1L

]u1y + [ 1

L

]u2y − [

1 − xL

]φ1z − [ x

L

]φ2z

)

Bending moment Mz = +E Izκz = E Izdφz

dxMe

z (x) = E Iy([− 1

L

]φ1z + [ 1

L

]φ2z

)

Table 5.2 Displacement, rotation, curvature, shear strain, shear force and bending moment distri-bution for a linear Timoshenko beam element given as a function of the nodal values in Cartesiancoordinates (bending occurs in the x-z plane)

Vertical Displacement (Deflection) uzuez(x) = [

1 − xL

]u1z + [ x

L

]u2z

Rotation φyφey(x) = [

1 − xL

]φ1y + [ x

L

]φ2y

Curvature κy = dφy

dxκey(x) = [− 1

L

]φ1y + [ 1

L

]φ2y

Shear Strain γxz = duzdx

+ φy

γ exz(x) = [− 1

L

]u1z + [ 1

L

]u2z + [

1 − xL

]φ1y + [ x

L

]φ2y

Shear Force Qz = ksAGγxz = ksAG

(duzdx

+ φy

)

Qez(x) = ksAG

([− 1L

]u1z + [ 1

L

]u2z + [

1 − xL

]φ1y + [ x

L

]φ2y

)

Bending Moment My = +E Iyκy = E Iydφy

dxMe

y(x) = E Iy([− 1

L

]φ1y + [ 1

L

]φ2y

)

Page 87: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

76 5 Timoshenko Beams and Frames

Fig. 5.1 Timoshenko frameelement supported by a rod:overview

Z plane). Application of the corresponding transformation matrix to the elementalprincipal finite element Eq. (5.1) gives the following expression of the elementalprincipal finite element equation of a Timoshenko beam element which is rotated bythe rotation angle α in the X -Y plane:

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

ks AG s(α)2

L − ks AG c(α) s(α)L − ks AG s(α)

2 − ks AG s(α)2

Lks AG c(α) s(α)

L − ks AG s(α)2

− ks AG c(α) s(α)L

ks AG c(α)2

Lks AG c(α)

2ks AG c(α) s(α)

L − ks AG c(α)2

Lks AG c(α)

2

− ks AG s(α)2

ks AG c(α)2

ks AGL3 + E Iz

Lks AG s(α)

2 − ks AG c(α)2

ks AGL6 − E Iz

L

− ks AG s(α)2

Lks AG c(α) s(α)

Lks AG s(α)

2ks AG s(α)2

L − ks AG c(α) s(α)L

ks AG s(α)2

ks AG c(α) s(α)L − ks AG c(α)2

L − ks AG c(α)2 − ks AG c(α) s(α)

Lks AG c(α)2

L − ks AG c(α)2

− ks AG s(α)2

ks AG c(α)2

ks AGL6 − E Iz

Lks AG s(α)

2 − ks AG c(α)2

ks AGL3 + E Iz

L

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸K e

XY

, (5.4)

or for the X -Z plane:

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

ks AG s(α)2

Lks AG c(α) s(α)

L − ks AG s(α)2 − ks AG s(α)2

L − ks AG c(α) s(α)L − ks AG s(α)

2

ks AG c(α) s(α)L

ks AG c(α)2

L − ks AG c(α)2 − ks AG c(α) s(α)

L − ks AG c(α)2

L − ks AG c(α)2

− ks AG s(α)2 − ks AG c(α)

2ks AGL

3 + E IzL

ks AG s(α)2

ks AG c(α)2

ks AGL6 − E Iz

L

− ks AG s(α)2

L − ks AG c(α) s(α)L

ks AG s(α)2

ks AG s(α)2

Lks AG c(α) s(α)

Lks AG s(α)

2

− ks AG c(α) s(α)L − ks AG c(α)2

Lks AG c(α)

2ks AG c(α) s(α)

Lks AG c(α)2

Lks AG c(α)

2

− ks AG s(α)2 − ks AG c(α)

2ks AGL

6 − E IzL

ks AG s(α)2

ks AG c(α)2

ks AGL3 + E Iz

L

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸K e

X Z

. (5.5)

Page 88: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.1 Theory of Timoshenko Beam Elements 77

It should be noted here that the sine (‘s(α)’) and cosine (‘c(α)’) values of the rotationangle α as well as the element length L can be calculated through the global nodecoordinates via Eqs. (4.7)–(4.8) and (4.10)–(4.11).

5.2 Generalized Beam Elements

To further increase the modeling ability of one-dimensional elements, it is possibleto combine the rod (see Sect. 3.2 and Timoshenko beam element (see Sect. 5.1.1) as aso-called generalized beam element which can now deform along and perpendicularto its longitudinal axis. The independent superposition of both stiffness matricesgives the following formulation for the elemental stiffness matrix in the x-y plane

⎡⎢⎢⎢⎢⎢⎢⎣

E AL 0 0 − E A

L 0 00 ksAG

LksAG2 0 − ksAG

LksAG2

0 ksAG2

ksAGL3 + E Iz

L 0 − ksAG2

ksAGL6 − E Iz

L− E AL 0 0 E A

L 0 00 − ksAG

L − ksAG2 0 ksAG

L − ksAG2

0 ksAG2

ksAGL6 − E Iz

L 0 − ksAG2

ksAGL3 + E Iz

L

⎤⎥⎥⎥⎥⎥⎥⎦

⎡⎢⎢⎢⎢⎢⎢⎣

u1xu1yφ1z

u3xu2yφ2z

⎤⎥⎥⎥⎥⎥⎥⎦

=

⎡⎢⎢⎢⎢⎢⎢⎣

F1x

F1y

M1z

F2x

F2y

M2z

⎤⎥⎥⎥⎥⎥⎥⎦

,

(5.6)

or in the x-z plane accordingly:

⎡⎢⎢⎢⎢⎢⎢⎣

E AL 0 0 − E A

L 0 00 ksAG

L − ksAG2 0 − ksAG

L − ksAG2

0 − ksAG2

ksAGL3 + E Iy

L 0 ksAG2

ksAGL6 − E Iy

L− E AL 0 0 E A

L 0 00 − ksAG

LksAG2 0 ksAG

LksAG2

0 − ksAG2

ksAGL6 − E Iy

L 0 ksAG2

ksAGL3 + E Iy

L

⎤⎥⎥⎥⎥⎥⎥⎦

⎡⎢⎢⎢⎢⎢⎢⎣

u1xu1zφ1y

u2xu2zφ2y

⎤⎥⎥⎥⎥⎥⎥⎦

=

⎡⎢⎢⎢⎢⎢⎢⎣

F1y

F1z

M1y

F2x

F2z

M2y

⎤⎥⎥⎥⎥⎥⎥⎦

,

(5.7)

The fact that the rod and beam deformation modes are decoupled is represented bythe set of zero-entries in Eqs. (5.6)–(5.7).

As in Sect. 4.2, we are going to rotate this generalized beam element in a singleplane as a two-dimensional frame structure. The corresponding expressions of theelemental principal finite element equations of a generalized beam element which iseither rotated in the X -Y or the X -Z plane is given in Eqs. (5.8) and (5.9).

Page 89: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

78 5 Timoshenko Beams and Frames

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

ks AG s(α)2

L + AE c(α)2

LAE c(α) s(α)

L − ks AG c(α) s(α)L − ks AG s(α)

2 − ks AG s(α)2

L − AE c(α)2

Lks AG c(α) s(α)

L − AE c(α) s(α)L − ks AG s(α)

2

AE c(α) s(α)L − ks AG c(α) s(α)

Lks AG c(α)2

L + AE s(α)2

Lks AG c(α)

2ks AG c(α) s(α)

L − AE c(α) s(α)L − ks AG c(α)2

L − AE s(α)2

Lks AG c(α)

2

− ks AG s(α)2

ks AG c(α)2

ks AGL3 + E Iz

Lks AG s(α)

2 − ks AG c(α)2

ks AGL6 − E Iz

L

− ks AG s(α)2

L − AE c(α)2

Lks AG c(α) s(α)

L − AE c(α) s(α)L

ks AG s(α)2

ks AG s(α)2

L + AE c(α)2

LAE c(α) s(α)

L − ks AG c(α) s(α)L

ks AG s(α)2

ks AG c(α) s(α)L − AE c(α) s(α)

L − ks AG c(α)2

L − AE s(α)2

L − ks AG c(α)2

AE c(α) s(α)L − ks AG c(α) s(α)

Lks AG c(α)2

L + AE s(α)2

L − ks AG c(α)2

− ks AG s(α)2

ks AG c(α)2

ks AGL6 − E Iz

Lks AG s(α)

2 − ks AG c(α)2

ks AGL3 + EIz

L

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸K e

XY

(5.8)

⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣

ks AG s(α)2

L + AE c(α)2

Lks AG c(α) s(α)

L − AE c(α) s(α)L − ks AG s(α)

2 − ks AG s(α)2

L − AE c(α)2

LAE c(α) s(α)

L − ks AG c(α) s(α)L − ks AG s(α)

2

ks AG c(α) s(α)L − AE c(α) s(α)

Lks AG c(α)2

L + AE s(α)2

L − ks AG c(α)2

AE c(α) s(α)L − ks AG c(α) s(α)

L − ks AG c(α)2

L − AE s(α)2

L − ks AG c(α)2

− ks AG s(α)2 − ks AG c(α)

2ks AGL

3 + E IzL

ks AG s(α)2

ks AG c(α)2

AGLk6 − E Iz

L

− ks AG s(α)2

L − AE c(α)2

LAE c(α) s(α)

L − ks AG c(α) s(α)L

ks AG s(α)2

ks AG s(α)2

L + AE c(α)2

Lks AG c(α) s(α)

L − AE c(α) s(α)L

ks AG s(α)2

AE c(α) s(α)L − ks AG c(α) s(α)

L − ks AG c(α)2

L − AE s(α)2

Lks AG c(α)

2ks AG c(α) s(α)

L − AE c(α) s(α)L

ks AG c(alpha)2

L + AE s(α)2

Lks AG c(α)

2

− ks AG s(α)2 − ks AG c(α)

2ks AGL

6 − E IzL

ks AG s(α)2

ks AG c(α)2

ks AGL3 + EIz

L

⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦

︸ ︷︷ ︸K e

X Z

(5.9)

5.3 Maxima Modules

The solution steps for Timoshenko beam and frame structures are basically the sameas outlined for the Euler–Bernoulli beam in Sect. 4.3. The major difference is thatthe user must define now in addition the shear stiffness (ksAG). The entire sourcecode is again provided in Chap.6.

5.4 Examples Based on Maxima

5.1 Example: Timoshenko Frame Element Supported by a RodGiven is a vertical Timoshenko frame element as shown in Fig. 5.1 where a horizontalrod supports the member at the upper end. Both members have the length L whereasthe frame has the properties A, I, ks, E,G and the rod is characterized by E, A. Thestructure is loaded at the upper right corner by a prescribed horizontal displacement

Page 90: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.4 Examples Based on Maxima 79

u0 and vertical force F0.

Consider two finite elements and determine

• the deformations of the nodes,• the reactions at the supports and nodes where displacements are prescribed, and• the elemental normal and shear force as well as the bending moment.

5.1 SolutionThe solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 5.2.

The next step is to generate the required nodal arrays (see Table5.3) and elementaldefinitions (see Table5.4) to facilitate the model definition in Maxima.

Fig. 5.2 Timoshenko frameelement supported by a rod:free-body diagram with nodeand element numbering

Table 5.3 Different nodal arrays for the problem shown in Fig. 5.2

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value (nodval)

1 [0, 0] [1, 1, 1] [0, 0, 0]2 [0, L] [1, 0, 0] [u0, F0, 0]3 [−L , L] [1, 1, 1] [0, 0, 0]

Table 5.4 Element definitions for the problem shown in Fig. 5.2

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [1, 2] A, I, ks E,G

II [3, 2] A, I = 0, ks = 0 E,G = 0

Page 91: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

80 5 Timoshenko Beams and Frames

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Definition of Master Stiffness: Nodal Coordinates "nodxy", Element end nodes"elenod", Element material properties "elemat", Element fabrication properties "ele-fab",freedom tags list "nodtag", freedom values list "nodval"

(% i14) assume(L>0)$

nodxy : matrix([0,0],[0,L],[-L,L])$elenod: matrix([1,2],[3,2])$

numnod : length(nodxy)$numele : length(elenod)$

elemat : makelist([Em,G],numele)$elefab : makelist([A, Izz, Ks],numele)$elefab[2] : [A, 0, 0]$

nodtag : makelist([1,1,1],numnod)$nodval : makelist([0,0,0],numnod)$nodtag[2] : [1, 0, 0]$nodval[2] : [u0, F0, 0]$nodtag[3] : [1, 1, 1]$

Maxima Calculations and Output

(% i33) [noddis, nodfor, elefor] :Timoshenko_GenBeamSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nodval)$

print(" ")$print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneGenBeamElementDataSymb(elenod, elemat, elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneGenBeamFreedomActivitySymb(nodtag, nodval))$

Page 92: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.4 Examples Based on Maxima 81

(% i33) print(" ")$print("Computed Nodal Displacements and Rotations:")$print(" ",PrintPlaneGenBeamNodeDOFsSymb(noddis))$

print(" ")$print("Computed Nodal Forces and Moments:")$print(" ",PrintPlaneGenBeamNodeForcesSymb(nodfor))$

print(" ")$print("Elementwise Normal Forces, Bending Moments and Shear Forces:")$for e:1 thru numele do(print(" "),print(" ", "Element ", e, ":"),print(" ",PrintPlaneGenBeamElemForcesSymb(elefor[e])))$

Nodal Coordinates:

⎡⎢⎢⎣node x-coor y-coor1 0 02 0 L3 −L L

⎤⎥⎥⎦

Element Data:

⎡⎣elem nodes modulus fabrication1 [1, 2] [Em,G] [A, Izz,Ks]2 [3, 2] [Em,G] [A, 0, 0]

⎤⎦

DOF Activity:

⎡⎢⎢⎣node x-tag y-tag zrot-tag x-value y-value zrot-value1 1 1 1 0 0 02 1 0 0 u0 F0 03 1 1 1 0 0 0

⎤⎥⎥⎦

Computed Nodal Displacements and Rotations:

⎡⎢⎢⎣

node x-displ y-displ z-rot1 0 0 02 u0 F0L

A Em − 3AG KsL u02(AG Ks L2+3Em Izz)

3 0 0 0

⎤⎥⎥⎦

Page 93: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

82 5 Timoshenko Beams and Frames

Computed Nodal Forces and Moments:

⎡⎢⎢⎢⎢⎣

node x-force y-force Bending-moment

1 − AG Ks(AG Ks L2+12Em Izz

)u0

4L (AG Ks L2+3Em Izz)−F0

AG Ks(AG Ks L2+12Em Izz

)u0

4(AG Ks L2+3Em Izz)

2A

(A G2 Ks2 L2+4A EmG Ks L2+12EmG Izz Ks+12Em2 Izz

)u0

4L (AG Ks L2+3Em Izz)F0 0

3 − A Em u0L 0 0

⎤⎥⎥⎥⎥⎦

Elementwise Normal Forces, Bending Moments and Shear Forces:

Element 1 :

⎡⎢⎢⎣local-node Normal-force Bending-moment Shear-force

1 −F0 A Em(

3AG Ks u0AG Ks L2+3Em Izz

− 6u0L

)A Em

(12u0L2 − 9AG Ks u0

L (AG Ks L2+3Em Izz)

)

2 −F0 A Em(6u0L − 6AG Ks u0

AG Ks L2+3Em Izz

)A Em

(12u0L2 − 9AG Ks u0

L (AG Ks L2+3Em Izz)

)

⎤⎥⎥⎦

Element 2 :

⎡⎢⎢⎣local-node Normal-force Bending-moment Shear-force

1 A Em u0L A Em

(3AG Ks u0

AG Ks L2+3Em Izz− 6F0

A Em

)A Em

(12F0A EmL − 9AG Ks u0

L (AG Ks L2+3Em Izz)

)

2 A Em u0L A Em

(6F0A Em − 6AG Ks u0

AG Ks L2+3Em Izz

)A Em

(12F0A EmL − 9AG Ks u0

L (AG Ks L2+3Em Izz)

)

⎤⎥⎥⎦

5.2 Generalized Cantilever Timoshenko Beam with Two Types of DistributedLoadsThe generalized Timoshenko beam shown in Fig. 5.3 is loaded by a constant verticaldistributed load q0 in the range 0 ≤ X ≤ L and a constant horizontal load p0 inthe range L ≤ X ≤ 2L . The material constants (E,G) and the geometrical proper-ties (A, I, ks) are constant and the total length of the beam is equal to 2L . Modelthe member with two generalized Timoshenko beam finite elements of length L todetermine:

Fig. 5.3 Generalizedcantilever Timoshenko beamwith two types of distributedloads: overview

Page 94: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.4 Examples Based on Maxima 83

• the unknowns at the nodes,• the reactions at the supports, and• the internal reactions (normal force, shear force and bending moment) in eachelement.

5.2 SolutionThe solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 5.4.

The next step is to generate the required nodal arrays (see Table5.5) and elementaldefinitions (see Table5.6) to facilitate the model definition in Maxima.

Fig. 5.4 Generalized cantilever Timoshenko beam with two types of distributed loads: free-bodydiagram with node and element numbering

Table 5.5 Different nodal arrays for the problem shown in Fig. 5.4

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value (nodval)

1 [0, 0] [1, 1, 1] [0, 0, 0]2 [L , 0] [0, 1, 0] [ p0L

2 , 0, q0L2

12 ]3 [2L , 0] [1, 1, 1] [0, 0, 0]

Table 5.6 Element definitions for the problem shown in Fig. 5.4

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [1, 2] A, I, ks E,G

II [2, 3] A, I, ks E,G

Page 95: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

84 5 Timoshenko Beams and Frames

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Definition of Master Stiffness: Nodal Coordinates "nodxy", Element end nodes"elenod", Elementmaterial properties "elemat", Element fabrication properties"elefab",freedom tags list "nodtag", freedom values list "nodval"

(% i12) assume(L>0)$

nodxy : matrix([0,0],[L,0],[2*L,0])$elenod: matrix([1,2],[2,3])$

numnod : length(nodxy)$numele : length(elenod)$

elemat : makelist([Em,G],numele)$elefab : makelist([A, Izz, Ks],numele)$

nodtag : makelist([1,1,1],numnod)$nodval : makelist([0,0,0],numnod)$nodtag[2] : [0, 1, 0]$nodval[2] : [p0*L/2, 0, q0*L*L/12]$

Maxima Calculations and Output

(% i31) [noddis, nodfor, elefor] :Timoshenko_GenBeamSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nodval)$

print(" ")$print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneGenBeamElementDataSymb(elenod, elemat, elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneGenBeamFreedomActivitySymb(nodtag, nodval))$

print(" ")$print("Computed Nodal Displacements and Rotations:")$print(" ",PrintPlaneGenBeamNodeDOFsSymb(noddis))$

Page 96: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.4 Examples Based on Maxima 85

(% i31) print(" ")$print("Computed Nodal Forces and Moments:")$print(" ",PrintPlaneGenBeamNodeForcesSymb(nodfor))$

print(" ")$print("Elementwise Normal Forces, Bending Moments and Shear Forces:")$for e:1 thru numele do(print(" "),print(" ", "Element ", e, ":"),print(" ",PrintPlaneGenBeamElemForcesSymb(elefor[e])))$

Nodal Coordinates:

⎡⎢⎢⎣node x-coor y-coor1 0 02 L 03 2L 0

⎤⎥⎥⎦

Element Data:

⎡⎣elem nodes modulus fabrication1 [1, 2] [Em,G] [A, Izz,Ks]2 [2, 3] [Em,G] [A, Izz,Ks]

⎤⎦

DOF Activity:

⎡⎢⎢⎣

node x-tag y-tag zrot-tag x-value y-value zrot-value1 1 1 1 0 0 0

2 0 1 0 L p02 0 L2 q0

123 1 1 1 0 0 0

⎤⎥⎥⎦

Computed Nodal Displacements and Rotations:

⎡⎢⎢⎢⎣

node x-displ y-displ z-rot1 0 0 0

2 L2 p04A Em 0 L3 q0

4(2AG Ks L2+6Em Izz)3 0 0 0

⎤⎥⎥⎥⎦

Page 97: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

86 5 Timoshenko Beams and Frames

Computed Nodal Forces and Moments:

⎡⎢⎢⎢⎢⎣

node x-force y-force Bending-moment

1 − L p04

AG Ks L3 q016(AG Ks L2+3Em Izz)

L2 (AG Ks L2−6Em Izz

)q0

48(AG Ks L2+3Em Izz)

2 L p02 0 L2 q0

12

3 − L p04

AG Ks L3 q016(AG Ks L2+3Em Izz)

L2(AG Ks L2−6Em Izz

)q0

48(AG Ks L2+3Em Izz)

⎤⎥⎥⎥⎥⎦

Elementwise Normal Forces, Bending Moments and Shear Forces:

Element 1 :

⎡⎢⎢⎣local-node Normal-force Bending-moment Shear-force

1 L p04 − A Em L2 q0

2(2AG Ks L2+6Em Izz)3A EmL q0

2(2AG Ks L2+6Em Izz)

2 L p04

A Em L2 q02AG Ks L2+6Em Izz

3A EmL q02(2AG Ks L2+6Em Izz)

⎤⎥⎥⎦

Element 2 :

⎡⎢⎢⎣local-node Normal-force Bending-moment Shear-force

1 − L p04 − A Em L2 q0

2AG Ks L2+6Em Izz3A EmL q0

2(2AG Ks L2+6Em Izz)

2 − L p04

A Em L2 q02(2AG Ks L2+6Em Izz)

3A EmL q02(2AG Ks L2+6Em Izz)

⎤⎥⎥⎦

5.3 Plane Frame Timoshenko Structure Composed of Generalized BeamElementsThe plane frame Timoshenko structure shown in Fig. 5.5 is composed of generalizedbeams which are arranged in a T-shaped formation. The structure is loaded by asingle force F0 in the middle of the structure. The material constants (E,G) and thegeometrical properties (A, I, ks) are constant and the horizontal length of the beamis equal to L while the vertical dimension is equal to L

2 . Model the structure withthree generalized Timoshenko beam finite elements of length L

2 to determine:

• the unknowns at the nodes,• the reactions at the supports, and• the internal reactions (normal force, shear force and bending moment) in eachelement.

5.3 SolutionThe solution starts with the free-body diagram of the problem, including a globalcoordinate system, subdivision of the geometry into the finite elements, indicationof the node and element numbers, and local coordinate systems, see Fig. 5.6.

Page 98: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.4 Examples Based on Maxima 87

Fig. 5.5 Plane frame Timoshenko structure composed of generalized beam elements: overview

Fig. 5.6 Plane frame Timoshenko structure composed of generalized beam elements: free-bodydiagram with node and element numbering

Page 99: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

88 5 Timoshenko Beams and Frames

Table 5.7 Different nodal arrays for the problem shown in Fig. 5.6

Node Coordinate (nodxy) Freedom tag (nodtag) Freedom value (nodval)

1 [0, 0] [1, 1, 1] [0, 0, 0]2 [ L2 , 0] [0, 0, 0] [0,−F0, 0]3 [L , 0] [1, 1, 1] [0, 0, 0]4 [ L2 , L

2 ] [1, 1, 1] [0, 0, 0]

Table 5.8 Element definitions for the problem shown in Fig. 5.6

Element Connectivity (elenod) Cross section (elefab) Modulus (elemat)

I [1, 2] A, I, ks E,G

II [2, 3] A, I, ks E,G

II [2, 4] A, I, ks E,G

The next step is to generate the required nodal arrays (see Table5.7) and elementaldefinitions (see Table5.8) to facilitate the model definition in Maxima.

The following listing in the gray box shows the entire wxMaxima code, includingthe obtained results.

−→ kill(all);load("/Users/.../my_funs.mac")$

(% o0) done

Definition of Master Stiffness: Nodal Coordinates "nodxy", Element end nodes"elenod", Elementmaterial properties "elemat", Element fabrication properties"elefab",freedom tags list "nodtag", freedom values list "nodval"

(% i12) assume(L>0)$

nodxy : matrix([0,0],[L/2,0],[L,0],[L/2,L/2])$elenod: matrix([1,2],[2,3],[2,4])$

numnod : length(nodxy)$numele : length(elenod)$

elemat : makelist([Em,G],numele)$elefab : makelist([A, Izz, Ks],numele)$

nodtag : makelist([1,1,1],numnod)$nodval : makelist([0,0,0],numnod)$nodtag[2] : [0, 0, 0]$nodval[2] : [0, -F0, 0]$

Page 100: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

5.4 Examples Based on Maxima 89

Maxima Calculations and Output

(% i31) [noddis, nodfor, elefor] :Timoshenko_GenBeamSolution_xy(nodxy, elenod, elemat, elefab, nodtag, nodval)$

print(" ")$print("Nodal Coordinates:")$print(" ", PrintPlaneNodeCoordinatesSymb(nodxy))$

print(" ")$print("Element Data:")$print(" ", PrintPlaneGenBeamElementDataSymb(elenod, elemat, elefab))$

print(" ")$print("DOF Activity:")$print(" ", PrintPlaneGenBeamFreedomActivitySymb(nodtag, nodval))$

print(" ")$print("Computed Nodal Displacements and Rotations:")$print(" ",PrintPlaneGenBeamNodeDOFsSymb(noddis))$

print(" ")$print("Computed Nodal Forces and Moments:")$print(" ",PrintPlaneGenBeamNodeForcesSymb(nodfor))$

print(" ")$print("Elementwise Normal Forces, Bending Moments and Shear Forces:")$for e:1 thru numele do(print(" "),print(" ", "Element ", e, ":"),print(" ",PrintPlaneGenBeamElemForcesSymb(elefor[e])))$

Nodal Coordinates:

⎡⎢⎢⎢⎢⎣

node x-coor y-coor1 0 02 L

2 03 L 04 L

2L2

⎤⎥⎥⎥⎥⎦

Element Data:

⎡⎢⎢⎣elem nodes modulus fabrication1 [1, 2] [Em,G] [A, Izz,Ks]2 [2, 3] [Em,G] [A, Izz,Ks]3 [2, 4] [Em,G] [A, Izz,Ks]

⎤⎥⎥⎦

Page 101: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

90 5 Timoshenko Beams and Frames

DOF Activity:

⎡⎢⎢⎢⎣

node x-tag y-tag zrot-tag x-value y-value zrot-value1 1 1 1 0 0 02 0 0 0 0 −F0 03 1 1 1 0 0 04 1 1 1 0 0 0

⎤⎥⎥⎥⎦

Computed Nodal Displacements and Rotations:

⎡⎢⎢⎢⎢⎣

node x-displ y-displ z-rot1 0 0 02 0 − F0L

4AG Ks+2A Em 03 0 0 04 0 0 0

⎤⎥⎥⎥⎥⎦

Computed Nodal Forces and Moments:

⎡⎢⎢⎢⎢⎣

node x-force y-force Bending-moment1 0 F0G Ks

2G Ks+EmF0G KsL

4(2G Ks+Em)

2 0 −F0 03 0 F0G Ks

2G Ks+Em − F0G KsL4(2G Ks+Em)

4 0 EmF02G Ks+Em 0

⎤⎥⎥⎥⎥⎦

Elementwise Normal Forces, Bending Moments and Shear Forces:

Element 1 :

⎡⎣local-node Normal-force Bending-moment Shear-force

1 0 12A EmF04AG Ks+2A Em − 48A EmF0

(4AG Ks+2A Em)L

2 0 − 12A EmF04AG Ks+2A Em − 48A EmF0

(4AG Ks+2A Em)L

⎤⎦

Element 2 :

⎡⎣local-node Normal-force Bending-moment Shear-force

1 0 − 12A EmF04AG Ks+2A Em

48A EmF0(4AG Ks+2A Em)L

2 0 12A EmF04AG Ks+2A Em

48A EmF0(4AG Ks+2A Em)L

⎤⎦

Element 3 :

⎡⎣local-node Normal-force Bending-moment Shear-force

1 − 2A EmF04AG Ks+2A Em 0 0

2 − 2A EmF04AG Ks+2A Em 0 0

⎤⎦

Page 102: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

References 91

References

1. Cowper GR (1966) The shear coefficient in Timoshenko’s beam theory. J Appl Mech 33:335–340

2. Öchsner A, Merkel M (2013) One-dimensional finite elements: an introduction to the FEmethod. Springer, Berlin

3. Öchsner A (2016) Computational statics and dynamics - an introduction based on the finiteelement method. Springer, Singapore

Page 103: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

Chapter 6Maxima Source Codes

Abstract This chapter provides the commented and structured source code of themain Maxima file which contains all the written routines.

The following file my_funs.macmust be included in allMaxima sheets for correctexecution and result display.

my_funs.mac (main file)

1 /*2 load("C:/.../my_funs.mac");3 */4

5 /*6 Matrix Eigenvalues7 Input:8 K Matrix9 Output:

10 eigvalues list of eigenvalues11 */12 eigenvalues_num(K):=13 block([lam,eqn,eigs,eigvalues,i],14 /* establish the characteristics polynomial */15 eqn : determinant(K - lam*ident(length(K))),16 /* find "eqn" roots numerically */17 eigs : allroots(eqn),18 /* initialize "eigvalues" */19 eigvalues : zeromatrix(1,length(K)),20 /* fill "eigvalues" using the components of "eigs" */21 i : 1,22 for elm in eigs do (23 eigvalues[1,i] : rhs(elm),24 i : i + 125 ),26 return(eigvalues)27 )$28

© The Author(s), under exclusive license to Springer International Publishing AG,part of Springer Nature 2019A. Öchsner and R. Makvandi, Finite Elements for Truss and Frame Structures,SpringerBriefs in Computational Mechanics, https://doi.org/10.1007/978-3-319-94941-3_6

93

Page 104: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

94 6 Maxima Source Codes

29

30 /*31 Rod Element Stiffness Matrix - XY Plane32 Inputs:33 ncoor Nodal coordinates34 Em Young’s modulus35 A Cross-section area36 Output:37 Ke Stiffness matrix38 */39 K_el_rod_xy(ncoor,Em,A):=40 block([x1,x2,y1,y2,x21,y21,EA,L,LL,LLL,Ke],41 [[x1,y1],[x2,y2]] : ncoor,42 [x21,y21] : [x2-x1,y2-y1],43 EA : Em*A,44 LL : (x21^2+y21^2),45 L : sqrt(LL),46 LLL:LL*L,47 Ke : (EA/LLL)*matrix([ x21*x21, x21*y21,-x21*x21,-x21*y21],48 [ y21*x21, y21*y21,-y21*x21,-y21*y21],49 [-x21*x21,-x21*y21, x21*x21, x21*y21],50 [-y21*x21,-y21*y21, y21*x21, y21*y21]),51 return(Ke)52 )$53

54 /*55 Rod Element Stiffness Matrix - XZ Plane56 Inputs:57 ncoor Nodal coordinates58 Em Young’s modulus59 A Cross-section area60 Output:61 Ke Stiffness matrix62 */63 K_el_rod_xz(ncoor,Em,A):=64 block([x1,x2,z1,z2,x21,z21,EA,L,LL,LLL,Ke],65 [[x1,z1],[x2,z2]] : ncoor,66 [x21,z21] : [x2-x1,z2-z1],67 EA : Em*A,68 LL : (x21^2+z21^2),69 L : sqrt(LL),70 LLL:LL*L,71 Ke : (EA/LLL)*matrix([ x21*x21, x21*z21,-x21*x21,-x21*z21],72 [ z21*x21, z21*z21,-z21*x21,-z21*z21],73 [-x21*x21,-x21*z21, x21*x21, x21*z21],74 [-z21*x21,-z21*z21, z21*x21, z21*z21]),75 return(Ke)76 )$

77

78 /*79 Generalized Beam Element Stiffness Matrix - XY Plane80 Inputs:81 ncoor Nodal coordinates

Page 105: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 95

82 Em Young’s modulus83 A Cross-section area84 Izz Second moment of area85 Output:86 Ke Stiffness matrix87 */88 K_el_gen_Beam_xy(ncoor,Em,A,Izz):=89 block([x1,x2,y1,y2,x21,y21,EA,EI,L,LL,LLL,Te,Kebar,Ke],90 [[x1,y1],[x2,y2]] : ncoor,91 [x21,y21] : [x2-x1,y2-y1],92 EA : Em*A,93 EI : Em*Izz,94 LL : (x21^2+y21^2),95 L : sqrt(LL),96 LLL : LL*L,97 Kebar : (EA/L)*matrix([

1,0,0,-1,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0],98 [-1,0,0,

1,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0]) +99 (2*EI/LLL)*matrix(100 [0,0,0,0,0,0],[0, 6, 3*L,0,-6,

3*L],[0,3*L,2*LL,0,-3*L, LL],101 [0,0,0,0,0,0],[0,-6,-3*L,0, 6,-3*L],[0,3*L,

LL,0,-3*L,2*LL]),102 Te :

matrix([x21,y21,0,0,0,0]/L,[-y21,x21,0,0,0,0]/L,[0,0,1,0,0,0],103

[0,0,0,x21,y21,0]/L,[0,0,0,-y21,x21,0]/L,[0,0,0,0,0,1]),104 Ke : transpose(Te) . Kebar . Te,105 return(Ke)106 )$107

108 /*109 Generalized Beam Element Stiffness Matrix - XZ Plane110 Inputs:111 ncoor Nodal coordinates112 Em Young’s modulus113 A Cross-section area114 Iyy Second moment of area115 Output:116 Ke Stiffness matrix117 */118 K_el_gen_Beam_xz(ncoor,Em,A,Iyy):=119 block([x1,x2,z1,z2,x21,z21,EA,EI,L,LL,LLL,Te,Kebar,Ke],120 [[x1,z1],[x2,z2]] : ncoor,121 [x21,z21] : [x2-x1,z2-z1],122 EA : Em*A,123 EI : Em*Iyy,124 LL : (x21^2+z21^2),125 L : sqrt(LL),126 LLL : LL*L,127 Kebar : (EA/L)*matrix([

1,0,0,-1,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0],

Page 106: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

96 6 Maxima Source Codes

128 [-1,0,0,1,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0]) +

129 (2*EI/LLL)*matrix(130 [0,0,0,0,0,0],[0,

6,-3*L,0,-6,-3*L],[0,-3*L,2*LL,0,3*L, LL],131 [0,0,0,0,0,0],[0,-6, 3*L,0, 6, 3*L],[0,-3*L,

LL,0,3*L,2*LL]),132 Te :

matrix([x21,z21,0,0,0,0]/L,[-z21,x21,0,0,0,0]/L,[0,0,1,0,0,0],133

[0,0,0,x21,z21,0]/L,[0,0,0,-z21,x21,0]/L,[0,0,0,0,0,1]),134 Ke : transpose(Te) . Kebar . Te,135 return(Ke)136 )$137

138 /*139 Generalized Timoshenko Beam Element Stiffness Matrix - XY Plane140 Inputs:141 ncoor Nodal coordinates142 Em Young’s modulus143 A Cross-section area144 Izz Second moment of area145 Ks Timoshenko shear coefficient146 G Shear modulus147 Output:148 Ke Stiffness matrix149 */150 K_el_timoshenko_gen_Beam_xy(ncoor,Em,A,Izz,Ks,G):=151 block([x1,x2,y1,y2,x21,y21,EA,EI,L,LL,KSAG,Te,Kebar,Ke],152 [[x1,y1],[x2,y2]] : ncoor,153 [x21,y21] : [x2-x1,y2-y1],154 EA : Em*A,155 EI : Em*Izz,156 LL : (x21^2+y21^2),157 L : sqrt(LL),158 KSAG : Ks*A*G,159 Kebar : (EA/L)*160 matrix([ 1,0,0,-1,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0],161 [-1,0,0, 1,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0])+162 matrix(163 [0,0,0,0,0,0],164 [0, KSAG/L, KSAG/2, 0,-KSAG/L, KSAG/2],165 [0,

KSAG/2,(KSAG*L/3)+(EI/L),0,-KSAG/2,(KSAG*L/6)-(EI/L)],166 [0,0,0,0,0,0],167 [0,-KSAG/L,KSAG/2,0,KSAG/L,-KSAG/2],168

[0,KSAG/2,(KSAG*L/6)-(EI/L),0,-KSAG/2,(KSAG*L/3)+(EI/L)]),169 Te :

matrix([x21,y21,0,0,0,0]/L,[-y21,x21,0,0,0,0]/L,[0,0,1,0,0,0],170

[0,0,0,x21,y21,0]/L,[0,0,0,-y21,x21,0]/L,[0,0,0,0,0,1]),171 Ke : transpose(Te) . Kebar . Te,

Page 107: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 97

172 return(Ke)173 )$

174

175 /*176 Generalized Timoshenko Beam Element Stiffness Matrix - XZ Plane177 Inputs:178 ncoor Nodal coordinates179 Em Young’s modulus180 A Cross-section area181 Iyy Second moment of area182 Ks Timoshenko shear coefficient183 G Shear modulus184 Output:185 Ke Stiffness matrix186 */187 K_el_timoshenko_gen_Beam_xz(ncoor,Em,A,Iyy,Ks,G):=188 block([x1,x2,z1,z2,x21,z21,EA,EI,L,LL,KSAG,Te,Kebar,Ke],189 [[x1,z1],[x2,z2]] : ncoor,190 [x21,z21] : [x2-x1,z2-z1],191 EA : Em*A,192 EI : Em*Iyy,193 LL : (x21^2+z21^2),194 L : sqrt(LL),195 KSAG : Ks*A*G,196 Kebar : (EA/L)*197 matrix([ 1,0,0,-1,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0],198 [-1,0,0, 1,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0])+199 matrix(200 [0,0,0,0,0,0],201 [0, KSAG/L, -KSAG/2, 0,-KSAG/L, -KSAG/2],202 [0, -KSAG/2,(KSAG*L/3)+(EI/L),0,KSAG/2,(KSAG*L/6)-(EI/L)],203 [0,0,0,0,0,0],204 [0,-KSAG/L,KSAG/2,0,KSAG/L,KSAG/2],205 [0,-KSAG/2,(KSAG*L/6)-(EI/L),0,KSAG/2,(KSAG*L/3)+(EI/L)]),206 Te :

matrix([x21,z21,0,0,0,0]/L,[-z21,x21,0,0,0,0]/L,[0,0,1,0,0,0],207

[0,0,0,x21,z21,0]/L,[0,0,0,-z21,x21,0]/L,[0,0,0,0,0,1]),208 Ke : transpose(Te) . Kebar . Te,209 return(Ke)210 )$211

212 /*213 Space Truss Global (Master) Stiffness Matrix - XY Plane214 Inputs:215 nodxy Nodal coordinates216 elenod Element end nodes217 elemat Element material properties218 elefab Element fabrication properties219 Output:220 K Global (Master) Stiffness matrix221 */222 K_gl_truss_xy(nodxy,elenod,elemat,elefab):=

Page 108: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

98 6 Maxima Source Codes

223 block([numele,numnod,neldof,e,eftab,ni,nj,i,j,ii,jj,ncoor,Em,A,Ke,K],224 numele : length(elenod),225 numnod : length(nodxy),226 K : zeromatrix(2*numnod, 2*numnod),227 for e:1 thru numele do (228 [ni,nj] : elenod[e],229 eftab : [2*ni-1,2*ni,2*nj-1,2*nj],230 ncoor : [nodxy[ni],nodxy[nj]],231 Em : elemat[e],232 A : elefab[e],233 Ke : K_el_rod_xy(ncoor,Em,A),234 neldof: length(Ke),235 for i:1 thru neldof do(236 ii : eftab[i],237 for j:1 thru neldof do(238 jj : eftab[j],239 K[ii,jj] : K[ii,jj]+Ke[i,j]240 )241 )242 ),243 return(K)244 )$245

246 /*247 Space Truss Global (Master) Stiffness Matrix - XZ Plane248 Inputs:249 nodxz Nodal coordinates250 elenod Element end nodes251 elemat Element material properties252 elefab Element fabrication properties253 Output:254 K Global (Master) Stiffness matrix255 */256 K_gl_truss_xz(nodxz,elenod,elemat,elefab):=257 block([numele,numnod,neldof,e,eftab,ni,nj,i,j,ii,jj,ncoor,Em,A,Ke,K],258 numele : length(elenod),259 numnod : length(nodxz),260 K : zeromatrix(2*numnod, 2*numnod),261 for e:1 thru numele do (262 [ni,nj] : elenod[e],263 eftab : [2*ni-1,2*ni,2*nj-1,2*nj],264 ncoor : [nodxz[ni],nodxz[nj]],265 Em : elemat[e],266 A : elefab[e],267 Ke : K_el_rod_xz(ncoor,Em,A),268 neldof: length(Ke),269 for i:1 thru neldof do(270 ii : eftab[i],271 for j:1 thru neldof do(272 jj : eftab[j],273 K[ii,jj] : K[ii,jj]+Ke[i,j]274 )275 )

Page 109: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 99

276 ),277 return(K)278 )$

279

280 /*281 Boundary conditions definition (applied forces matrix)282 Inputs:283 nodtag Nodal freedom tags list284 nodval Nodal freedom values list285 Output:286 f Applied force matrix287 */288 AppliedForceVector(nodtag,nodval):=289 block([i,ftag,fval,numdof,f],290 [ftag,fval] : [flatten(nodtag), flatten(nodval)],291 numdof : length(ftag),292 f : makelist(0,numdof),293 for i:1 thru numdof do (294 if (is(equal(ftag[i], 0))) then f[i] : fval[i]295 ),296 return(f)297 )$298

299 /*300 Modified Global (Master) Stiffness Matrix301 Inputs:302 nodtag Nodal freedom tags list303 K Global (master) stiffness matrix304 Output:305 Kmod Modified global (master) stiffness matrix306 */307 ModifiedMasterStiffness(nodtag,K) :=308 block([i,j,k,n:length(K),pdof,np,Kmod:copymatrix(K)],309 pdof : PrescDispDOFTags(nodtag),310 np : length(pdof),311 for k : 1 thru np do (312 i : pdof[k],313 for j : 1 thru n do (314 Kmod [i,j] : Kmod [j,i] : 0315 ),316 Kmod[i,i] : 1317 ),318 return(Kmod)319 )$320

321 /*322 Modified Nodal Forces Matrix323 Inputs:324 nodtag Nodal freedom tags list325 nodval Nodal freedom values list326 K Global (master) stiffness matrix327 f Global (master) force matrix328 Output:

Page 110: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

100 6 Maxima Source Codes

329 fmod Modified global (master) force matrix330 */331 ModifiedNodeForces(nodtag,nodval,K,f) :=332 block([i,j,k,n:length(K),pdof,pval,np,d,c,fmod:copymatrix(f)],333 pdof : PrescDispDOFTags(nodtag),334 np : length(pdof),335 pval : PrescDispDOFValues(nodtag, nodval),336 c : makelist(1,n),337 for k : 1 thru np do (338 i : pdof[k],339 c[i] : 0340 ),341 for k : 1 thru np do (342 i : pdof[k],343 d : pval[k],344 fmod[i,1] : d,345 if (d#0) then (346 for j : 1 thru n do (347 fmod[j,1] : fmod[j,1] - K[i,j]*c[j]*d348 ))349 ),350 return(fmod)351 )$

352

353 /*354 (Prescribed) Displacement DOF Tags355 Inputs:356 nodtag Nodal freedom tags list357 Output:358 pdof Prescribed displacement DOF tags list359 */360 PrescDispDOFTags(nodtag) :=361 block([j,n,numnod:length(nodtag),pdof:[],k:0,m],362 for n : 1 thru numnod do (363 m : length(nodtag[n]),364 for j : 1 thru m do (365 if (is(nodtag[n][j] > 0)) then pdof : append(pdof, [k+j])366 ),367 k : k + m368 ),369 return(pdof)370 );371

372 /*373 (Prescribed) Displacement DOF Values374 Inputs:375 nodtag Nodal freedom tags list376 nodval Nodal freedom values list377 Output:378 pval Prescribed displacement DOF values379 */380 PrescDispDOFValues(nodtag,nodval) :=381 block([j,n,numnod:length(nodtag),pval:[],k:0,m],

Page 111: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 101

382 for n : 1 thru numnod do (383 m : length(nodtag[n]),384 for j : 1 thru m do (385 if (is(nodtag[n][j] > 0)) then pval : append(pval,

[nodval[n][j]])386 ),387 k : k + m388 ),389 return(pval)390 )$391

392 /*393 Flattening an array394 Inputs:395 nv input array396 Output:397 nv flattened array398 */399 FlatNodeVector(nv) := flatten(nv)$400

401

402 /*403 Internal Forces - XY Plane (for all the elements)404 Inputs:405 nodxy Nodal coordinates406 noddis Nodal displacements407 elenod Element end nodes408 elemat Element material properties409 elefab Element fabrication properties410 Output:411 p Internal forces412 */413 PlaneTrussIntForces_xy(nodxy,elenod,elemat,elefab,noddis) :=414 block([numele:length(elenod),e,ni,nj,ncoor,Em,A,ue,p],415 p : makelist(0, numele),416 for e : 1 thru numele do (417 [ni,nj] : elenod[e],418 ncoor : [nodxy[ni],nodxy[nj]],419 ue : flatten([noddis[ni],noddis[nj]]),420 Em : elemat[e],421 A : elefab[e],422 p[e] : PlaneBar2IntForce_xy(ncoor,Em,A,ue)423 ),424 return(p)425 )$

426

427 /*428 Internal Forces - XZ Plane (for all the elements)429 Inputs:430 nodxz Nodal coordinates431 noddis Nodal displacements432 elenod Element end nodes433 elemat Element material properties

Page 112: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

102 6 Maxima Source Codes

434 elefab Element fabrication properties435 Output:436 p Internal forces437 */438 PlaneTrussIntForces_xz(nodxz,elenod,elemat,elefab,noddis) :=439 block([numele:length(elenod),e,ni,nj,ncoor,Em,A,ue,p],440 p : makelist(0, numele),441 for e : 1 thru numele do (442 [ni,nj] : elenod[e],443 ncoor : [nodxz[ni],nodxz[nj]],444 ue : flatten([noddis[ni],noddis[nj]]),445 Em : elemat[e],446 A : elefab[e],447 p[e] : PlaneBar2IntForce_xz(ncoor,Em,A,ue)448 ),449 return(p)450 )$451

452 /*453 Internal Force - XY Plane (for one element)454 Inputs:455 ncoor Nodal coordinates456 Em Young’s modulus457 A Cross-section area458 ue Nodal displacements459 Output:460 pe Element internal force461 */462 PlaneBar2IntForce_xy(ncoor,Em,A,ue) :=463 block([x1,x2,y1,y2,x21,y21,EA,LL,pe],464 [[x1,y1],[x2,y2]] : ncoor,465 [x21,y21] : [x2-x1,y2-y1],466 EA : Em*A,467 LL : x21^2 + y21^2,468 pe : (EA/LL)*(x21*(ue[3]-ue[1]) + y21*(ue[4]-ue[2])),469 return(pe)470 )$471

472 /*473 Internal Force - XZ Plane (for one element)474 Inputs:475 ncoor Nodal coordinates476 Em Young’s modulus477 A Cross-section area478 ue Nodal displacements479 Output:480 pe Element internal force481 */482 PlaneBar2IntForce_xz(ncoor,Em,A,ue) :=483 block([x1,x2,z1,z2,x21,z21,EA,LL,pe],484 [[x1,z1],[x2,z2]] : ncoor,485 [x21,z21] : [x2-x1,z2-z1],486 EA : Em*A,

Page 113: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 103

487 LL : x21^2 + z21^2,488 pe : (EA/LL)*(x21*(ue[3]-ue[1]) + z21*(ue[4]-ue[2])),489 return(pe)490 )$491

492 /*493 Element stresses494 Inputs:495 elefab Element fabrication properties496 elefor Element internal force497 Output:498 elesig Element stress499 */500 PlaneTrussStresses(elefab,elefor) :=501 block([numele:length(elefab),e,elesig],502 elesig : makelist(0,numele),503 for e : 1 thru numele do (504 elesig[e] : elefor[e]/elefab[e]505 ),506 return(elesig)507 )$

508

509 /*510 Generalized Beam Global (Master) Stiffness Matrix - XY Plane511 Inputs:512 nodxy Nodal coordinates513 elenod Element end nodes514 elemat Element material properties515 elefab Element fabrication properties516 Output:517 K Global (Master) Stiffness matrix518 */519 K_gl_beam_xy(nodxy,elenod,elemat,elefab):=520 block(521 [numele,numnod,neldof,e,eftab,ni,nj,i,j,ii,jj,ncoor,Em,A,Izz,Ke,K],522 numele : length(elenod),523 numnod : length(nodxy),524 K : zeromatrix(3*numnod, 3*numnod),525 for e:1 thru numele do (526 [ni,nj] : elenod[e],527 eftab : [3*ni-2,3*ni-1,3*ni,3*nj-2,3*nj-1,3*nj],528 ncoor : [nodxy[ni],nodxy[nj]],529 Em : elemat[e][1],530 [A,Izz] : elefab[e],531 Ke : K_el_gen_Beam_xy(ncoor,Em,A,Izz),532 neldof: length(Ke),533 for i:1 thru neldof do(534 ii : eftab[i],535 for j:1 thru neldof do(536 jj : eftab[j],537 K[ii,jj] : K[ii,jj]+Ke[i,j]538 )539 )

Page 114: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

104 6 Maxima Source Codes

540 ),541 return(K)542 )$543

544 /*545 Generalized Beam Global (Master) Stiffness Matrix - XZ Plane546 Inputs:547 nodxz Nodal coordinates548 elenod Element end nodes549 elemat Element material properties550 elefab Element fabrication properties551 Output:552 K Global (Master) Stiffness matrix553 */554 K_gl_beam_xz(nodxz, elenod,elemat,elefab):=555 block(556 [numele,numnod,neldof,e,eftab,ni,nj,i,j,ii,jj,ncoor,Em,A,Iyy,Ke,K],557 numele : length(elenod),558 numnod : length(nodxz),559 K : zeromatrix(3*numnod, 3*numnod),560 for e:1 thru numele do (561 [ni,nj] : elenod[e],562 eftab : [3*ni-2,3*ni-1,3*ni,3*nj-2,3*nj-1,3*nj],563 ncoor : [nodxz[ni],nodxz[nj]],564 Em : elemat[e][1],565 [A,Iyy] : elefab[e],566 Ke : K_el_gen_Beam_xz(ncoor,Em,A,Iyy),567 neldof: length(Ke),568 for i:1 thru neldof do(569 ii : eftab[i],570 for j:1 thru neldof do(571 jj : eftab[j],572 K[ii,jj] : K[ii,jj]+Ke[i,j]573 )574 )575 ),576 return(K)577 )$578

579 /*580 Generalized Timoshenko Beam Global (Master) Stiffness Matrix - XY

Plane581 Inputs:582 nodxy Nodal coordinates583 elenod Element end nodes584 elemat Element material properties585 elefab Element fabrication properties586 Output:587 K Global (Master) Stiffness matrix588 */589 K_gl_timoshenko_beam_xy(nodxy,elenod,elemat,elefab):=590 block(591 [numele,numnod,neldof,e,eftab,ni,nj,i,j,ii,jj,ncoor,Em,A,Ks,G,Ke,K],592 numele : length(elenod),

Page 115: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 105

593 numnod : length(nodxy),594 K : zeromatrix(3*numnod, 3*numnod),595 for e:1 thru numele do (596 [ni,nj] : elenod[e],597 eftab : [3*ni-2,3*ni-1,3*ni,3*nj-2,3*nj-1,3*nj],598 ncoor : [nodxy[ni],nodxy[nj]],599 [Em,G] : elemat[e],600 [A,Izz,Ks] : elefab[e],601 Ke : K_el_timoshenko_gen_Beam_xy(ncoor,Em,A,Izz,Ks,G),602 neldof: length(Ke),603 for i:1 thru neldof do(604 ii : eftab[i],605 for j:1 thru neldof do(606 jj : eftab[j],607 K[ii,jj] : K[ii,jj]+Ke[i,j]608 )609 )610 ),611 return(K)612 )$

613

614 /*615 Generalized Timoshenko Beam Global (Master) Stiffness Matrix - XZ Plane616 Inputs:617 nodxz Nodal coordinates618 elenod Element end nodes619 elemat Element material properties620 elefab Element fabrication properties621 Output:622 K Global (Master) Stiffness matrix623 */624 K_gl_timoshenko_beam_xz(nodxz,elenod,elemat,elefab):=625 block(626 [numele,numnod,neldof,e,eftab,ni,nj,i,j,ii,jj,ncoor,Em,A,Ks,G,Ke,K],627 numele : length(elenod),628 numnod : length(nodxz),629 K : zeromatrix(3*numnod, 3*numnod),630 for e:1 thru numele do (631 [ni,nj] : elenod[e],632 eftab : [3*ni-2,3*ni-1,3*ni,3*nj-2,3*nj-1,3*nj],633 ncoor : [nodxz[ni],nodxz[nj]],634 [Em,G] : elemat[e],635 [A,Iyy,Ks] : elefab[e],636 Ke : K_el_timoshenko_gen_Beam_xz(ncoor,Em,A,Iyy,Ks,G),637 neldof: length(Ke),638 for i:1 thru neldof do(639 ii : eftab[i],640 for j:1 thru neldof do(641 jj : eftab[j],642 K[ii,jj] : K[ii,jj]+Ke[i,j]643 )644 )645 ),646 return(K)

Page 116: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

106 6 Maxima Source Codes

647 )$648

649 /*650 Generalized Beam Element Internal Forces - XY Plane651 Inputs:652 nodxy Nodal coordinates653 noddis Nodal displacements654 elenod Element end nodes655 elemat Element material properties656 elefab Element fabrication properties657 Output:658 p Internal forces659 */660 PlaneGenBeamIntForces_xy(nodxy,elenod,elemat,elefab,noddis) :=661 block(662 [numele:length(elenod),e,i,j,ni,nj,ncoor,xi,L,LL,LLL,sin_a,cos_a],663 array(elefor, numele),664 for i:1 thru numele do( elefor[i] : zeromatrix(length(elenod[i]),3)),665 for e:1 thru numele do (666 [ni, nj] : elenod[e],667 ncoor : [nodxy[ni],nodxy[nj]],668 [[x1,y1],[x2,y2]] : ncoor,669 [x21,y21] : [x2-x1,y2-y1],670 LL : (x21^2+y21^2),671 L : sqrt(LL),672 LLL : LL*L,673 sin_a : y21/L,674 cos_a : x21/L,675 for j:1 thru length(elenod[e]) do (676 xi : [-1,+1],677 elefor[e][j,1] : (elemat[e][1]*elefab[e][1]/LL)*(678 x21*(noddis[nj,1] - noddis[ni,1]) +679 y21*(noddis[ni,2] - noddis[nj,2]) ),680 elefor[e][j,2] : (elemat[e][1]*elefab[e][1])*(681 (6/LL)*(-xi[j])*(682 y21*(noddis[ni,1] - noddis[nj,1]) +683 x21*(noddis[ni,2] - noddis[nj,2]))+684 (1/L)*(-1+3*xi[j])*noddis[ni,3]+685 (1/L)*(+1+3*xi[j])*noddis[nj,3]686 ),687 elefor[e][j,3] : (elemat[e][1]*elefab[e][1])*(688 (12/LLL)*(-1)*(689 y21*(noddis[ni,1] - noddis[nj,1]) +690 x21*(noddis[ni,2] - noddis[nj,2]))+691 (2/LL)*(+3)*(noddis[ni,3]+noddis[nj,3])692 )693 )694 ),695 return(elefor)696 )$697

698 /*699 Generalized Beam Element Internal Forces - XZ Plane700 Inputs:

Page 117: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 107

701 nodxz Nodal coordinates702 noddis Nodal displacements703 elenod Element end nodes704 elemat Element material properties705 elefab Element fabrication properties706 Output:707 p Internal forces708 */709 PlaneGenBeamIntForces_xz(nodxz,elenod,elemat,elefab,noddis) :=710 block([numele:length(elenod),e,i,j,ni,nj,ncoor,xi,L,LL,LLL,sin_a,cos_a],711 array(elefor, numele),712 for i:1 thru numele do( elefor[i] : zeromatrix(length(elenod[i]),3)),713 for e:1 thru numele do (714 [ni, nj] : elenod[e],715 ncoor : [nodxz[ni],nodxz[nj]],716 [[x1,z1],[x2,z2]] : ncoor,717 [x21,z21] : [x2-x1,z2-z1],718 LL : (x21^2+z21^2),719 L : sqrt(LL),720 LLL : LL*L,721 sin_a : z21/L,722 cos_a : x21/L,723 for j:1 thru length(elenod[e]) do (724 xi : [-1,+1],725 elefor[e][j,1] : (elemat[e][1]*elefab[e][1]/LL)*(726 x21*(noddis[nj,1] - noddis[ni,1]) +727 z21*(noddis[ni,2] - noddis[nj,2]) ),728 elefor[e][j,2] : (elemat[e][1]*elefab[e][1])*(729 (6/LL)*(-xi[j])*(730 z21*(noddis[ni,1] - noddis[nj,1]) +731 x21*(noddis[ni,2] - noddis[nj,2]))+732 (1/L)*(-1+3*xi[j])*noddis[ni,3]+733 (1/L)*(+1+3*xi[j])*noddis[nj,3]734 ),735 elefor[e][j,3] : (elemat[e][1]*elefab[e][1])*(736 (12/LLL)*(-1)*(737 z21*(noddis[ni,1] - noddis[nj,1]) +738 x21*(noddis[ni,2] - noddis[nj,2]))+739 (2/LL)*(+3)*(noddis[ni,3]+noddis[nj,3])740 )741 )742 ),743 return(elefor)744 )$

745

746 /*747 Truss Problem - Solution Driver - XY Plane748 Inputs:749 nodxy Nodal coordinates750 elenod Element end nodes751 elemat Element material properties752 elefab Element fabrication properties753 nodtag Nodal freedom tags list754 nodval Nodal freedom values list

Page 118: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

108 6 Maxima Source Codes

755 Outputs:756 noddis Nodal displacements757 nodfor Nodal forces758 elefor Element forces759 elesig Element stresses760 */761 PlaneTrussSolution_xy(nodxy,elenod,elemat,elefab,nodtag,nodval)

:=762 block([K,Kmod,f,fmod,u,noddis,nodfor,elefor,elesig,eftab,Ke,i,c],763 /* calculate the global stiffness matrix */764 K : K_gl_truss_xy(nodxy,elenod,elemat,elefab),765 /* calculate the modified global stiffness matrix */766 Kmod : ModifiedMasterStiffness(nodtag,K),767 /* calculate the global force matrix */768 f : transpose(FlatNodeVector(nodval)),769 /* calculate the modified force matrix */770 fmod : ModifiedNodeForces(nodtag,nodval,K,f),771 /* solve the system of equation for displacements */772 u : invert(Kmod).fmod,773 /* calculate the forces based on nodal displacements */774 f : float(K.u),775 /* transform f to nodfor (distinguished nodal forces) */776 nodfor : zeromatrix(length(f)/2,2),777 c : 0,778 for i: 1 thru (length(f)/2) do(779 c : c + 1,780 nodfor[i] : args(append(f[(c-1)*2+1],f[(c-1)*2+2]))781 ),782 /* transform u to noddis (distinguished nodal displacements) */783 noddis : zeromatrix(length(u)/2,2),784 c : 0,785 for i: 1 thru (length(u)/2) do(786 c : c + 1,787 noddis[i] : args(append(u[(c-1)*2+1],u[(c-1)*2+2]))788 ),789 /* calculate elements internal forces */790 elefor :

PlaneTrussIntForces_xy(nodxy,elenod,elemat,elefab,noddis),791 /* calculate elements stresses*/792 elesig : PlaneTrussStresses(elefab,elefor),793 return([noddis,nodfor,elefor,elesig])794 )$795

796 /*797 Truss Problem - Solution Driver - XZ Plane798 Inputs:799 nodxz Nodal coordinates800 elenod Element end nodes801 elemat Element material properties802 elefab Element fabrication properties803 nodtag Nodal freedom tags list804 nodval Nodal freedom values list805 Outputs:

Page 119: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 109

806 noddis Nodal displacements807 nodfor Nodal forces808 elefor Element forces809 elesig Element stresses810 */811 PlaneTrussSolution_xz(nodxz,elenod,elemat,elefab,nodtag,nodval)

:=812 block([K,Kmod,f,fmod,u,noddis,nodfor,elefor,elesig,eftab,Ke,i,c],813 /* calculate the global stiffness matrix */814 K : K_gl_truss_xz(nodxz,elenod,elemat,elefab),815 /* calculate the modified global stiffness matrix */816 Kmod : ModifiedMasterStiffness(nodtag,K),817 /* calculate the global force matrix */818 f : transpose(FlatNodeVector(nodval)),819 /* calculate the modified force matrix */820 fmod : ModifiedNodeForces(nodtag,nodval,K,f),821 /* solve the system of equation for displacements */822 u : invert(Kmod).fmod,823 /* calculate the forces based on nodal displacements */824 f : float(K.u),825 /* transform f to nodfor (distinguished nodal forces) */826 nodfor : zeromatrix(length(f)/2,2),827 c : 0,828 for i: 1 thru (length(f)/2) do(829 c : c + 1,830 nodfor[i] : args(append(f[(c-1)*2+1],f[(c-1)*2+2]))831 ),832 /* transform u to noddis (distinguished nodal displacements) */833 noddis : zeromatrix(length(u)/2,2),834 c : 0,835 for i: 1 thru (length(u)/2) do(836 c : c + 1,837 noddis[i] : args(append(u[(c-1)*2+1],u[(c-1)*2+2]))838 ),839 /* calculate elements internal forces */840 elefor :

PlaneTrussIntForces_xz(nodxz,elenod,elemat,elefab,noddis),841 /* calculate elements stresses*/842 elesig : PlaneTrussStresses(elefab,elefor),843 return([noddis,nodfor,elefor,elesig])844 )$845

846 /*847 Generalized Beam Problem - Solution Driver - XY Plane848 Inputs:849 nodxy Nodal coordinates850 elenod Element end nodes851 elemat Element material properties852 elefab Element fabrication properties853 nodtag Nodal freedom tags list854 nodval Nodal freedom values list855 Outputs:856 noddis Nodal displacements

Page 120: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

110 6 Maxima Source Codes

857 nodfor Nodal forces858 elefor Element forces859 */860 GenBeamSolution_xy(nodxy,elenod,elemat,elefab,nodtag,nodval) :=861 block([K,Kmod,f,fmod,u,noddis,nodfor,elefor,i,c],862 /* calculate the global stiffness matrix */863 K:K_gl_beam_xy(nodxy, elenod, elemat, elefab),864 /* calculate the modified global stiffness matrix */865 Kmod : ModifiedMasterStiffness(nodtag, K),866 /* calculate the global force matrix */867 f : transpose(FlatNodeVector(nodval)),868 /* calculate the modified force matrix */869 fmod : ModifiedNodeForces(nodtag, nodval, K, f),870 /* solve the system of equation for displacements */871 u : invert(Kmod).fmod,872 /* calculate the forces based on nodal displacements */873 f : factor(K.u),874 /* transform f to nodfor (distinguished nodal forces) */875 nodfor : zeromatrix(length(f)/3,3),876 c : 0,877 for i: 1 thru (length(f)/3) do(878 c : c + 1,879 nodfor[i] :

args(append(f[(c-1)*3+1],f[(c-1)*3+2],f[(c-1)*3+3]))880 ),881 /* transform u to noddis (distinguished nodal displacements) */882 noddis : zeromatrix(length(u)/3,3),883 c : 0,884 for i: 1 thru (length(u)/3) do(885 c : c + 1,886 noddis[i] :

args(append(u[(c-1)*3+1],u[(c-1)*3+2],u[(c-1)*3+3]))887 ),888 /* calculate elements internal forces */889 elefor :

PlaneGenBeamIntForces_xy(nodxy,elenod,elemat,elefab,noddis),890 return([noddis,nodfor,elefor])891 )$

892

893 /*894 Generalized Beam Problem - Solution Driver - XZ Plane895 Inputs:896 nodxz Nodal coordinates897 elenod Element end nodes898 elemat Element material properties899 elefab Element fabrication properties900 nodtag Nodal freedom tags list901 nodval Nodal freedom values list902 Outputs:903 noddis Nodal displacements904 nodfor Nodal forces905 elefor Element forces906 */

Page 121: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 111

907 GenBeamSolution_xz(nodxz,elenod,elemat,elefab,nodtag,nodval) :=908 block([K,Kmod,f,fmod,u,noddis,nodfor,elefor,i,c],909 /* calculate the global stiffness matrix */910 K:K_gl_beam_xz(nodxz, elenod, elemat, elefab),911 /* calculate the modified global stiffness matrix */912 Kmod : ModifiedMasterStiffness(nodtag, K),913 /* calculate the global force matrix */914 f : transpose(FlatNodeVector(nodval)),915 /* calculate the modified force matrix */916 fmod : ModifiedNodeForces(nodtag, nodval, K, f),917 /* solve the system of equation for displacements */918 u : invert(Kmod).fmod,919 /* calculate the forces based on nodal displacements */920 f : factor(K.u),921 /* transform f to nodfor (distinguished nodal forces) */922 nodfor : zeromatrix(length(f)/3,3),923 c : 0,924 for i: 1 thru (length(f)/3) do(925 c : c + 1,926 nodfor[i] :

args(append(f[(c-1)*3+1],f[(c-1)*3+2],f[(c-1)*3+3]))927 ),928 /* transform u to noddis (distinguished nodal displacements) */929 noddis : zeromatrix(length(u)/3,3),930 c : 0,931 for i: 1 thru (length(u)/3) do(932 c : c + 1,933 noddis[i] :

args(append(u[(c-1)*3+1],u[(c-1)*3+2],u[(c-1)*3+3]))934 ),935 /* calculate elements internal forces */936 elefor :

PlaneGenBeamIntForces_xz(nodxz,elenod,elemat,elefab,noddis),937 return([noddis,nodfor,elefor])938 )$939

940 /*941 Generalized Timoshenko Beam Problem - Solution Driver - XY Plane942 Inputs:943 nodxy Nodal coordinates944 elenod Element end nodes945 elemat Element material properties946 elefab Element fabrication properties947 nodtag Nodal freedom tags list948 nodval Nodal freedom values list949 Outputs:950 noddis Nodal displacements951 nodfor Nodal forces952 elefor Element forces953 */954 Timoshenko_GenBeamSolution_xy955 (nodxy,elenod,elemat,elefab,nodtag,nodval) :=956 block([K,Kmod,f,fmod,u,noddis,nodfor,elefor,i,c],

Page 122: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

112 6 Maxima Source Codes

957 /* calculate the global stiffness matrix */958 K:K_gl_timoshenko_beam_xy(nodxy, elenod, elemat, elefab),959 /* calculate the modified global stiffness matrix */960 Kmod : ModifiedMasterStiffness(nodtag, K),961 /* calculate the global force matrix */962 f : transpose(FlatNodeVector(nodval)),963 /* calculate the modified force matrix */964 fmod : ModifiedNodeForces(nodtag, nodval, K, f),965 /* solve the system of equation for displacements */966 u : invert(Kmod).fmod,967 /* calculate the forces based on nodal displacements */968 f : factor(K.u),969 /* transform f to nodfor (distinguished nodal forces) */970 nodfor : zeromatrix(length(f)/3,3),971 c : 0,972 for i: 1 thru (length(f)/3) do(973 c : c + 1,974 nodfor[i] :

args(append(f[(c-1)*3+1],f[(c-1)*3+2],f[(c-1)*3+3]))975 ),976 /* transform u to noddis (distinguished nodal displacements) */977 noddis : zeromatrix(length(u)/3,3),978 c : 0,979 for i: 1 thru (length(u)/3) do(980 c : c + 1,981 noddis[i] :

args(append(u[(c-1)*3+1],u[(c-1)*3+2],u[(c-1)*3+3]))982 ),983 /* calculate elements internal forces */984 elefor :

PlaneGenBeamIntForces_xy(nodxy,elenod,elemat,elefab,noddis),985 return([noddis,nodfor,elefor])986 )$

987

988 /*989 Generalized Timoshenko Beam Problem - Solution Driver - XZ Plane990 Inputs:991 nodxz Nodal coordinates992 elenod Element end nodes993 elemat Element material properties994 elefab Element fabrication properties995 nodtag Nodal freedom tags list996 nodval Nodal freedom values list997 Outputs:998 noddis Nodal displacements999 nodfor Nodal forces

1000 elefor Element forces1001 */1002 Timoshenko_GenBeamSolution_xz1003 (nodxz,elenod,elemat,elefab,nodtag,nodval) :=1004 block([K,Kmod,f,fmod,u,noddis,nodfor,elefor,i,c],1005 /* calculate the global stiffness matrix */1006 K:K_gl_timoshenko_beam_xz(nodxz,elenod,elemat,elefab),

Page 123: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 113

1007 /* calculate the modified global stiffness matrix */1008 Kmod : ModifiedMasterStiffness(nodtag,K),1009 /* calculate the global force matrix */1010 f : transpose(FlatNodeVector(nodval)),1011 /* calculate the modified force matrix */1012 fmod : ModifiedNodeForces(nodtag, nodval,K,f),1013 /* solve the system of equation for displacements */1014 u : invert(Kmod).fmod,1015 /* calculate the forces based on nodal displacements */1016 f : factor(K.u),1017 /* transform f to nodfor (distinguished nodal forces) */1018 nodfor : zeromatrix(length(f)/3,3),1019 c : 0,1020 for i: 1 thru (length(f)/3) do(1021 c : c + 1,1022 nodfor[i] :

args(append(f[(c-1)*3+1],f[(c-1)*3+2],f[(c-1)*3+3]))1023 ),1024 /* transform u to noddis (distinguished nodal displacements) */1025 noddis : zeromatrix(length(u)/3,3),1026 c : 0,1027 for i: 1 thru (length(u)/3) do(1028 c : c + 1,1029 noddis[i] :

args(append(u[(c-1)*3+1],u[(c-1)*3+2],u[(c-1)*3+3]))1030 ),1031 /* calculate elements internal forces */1032 elefor :

PlaneGenBeamIntForces_xz(nodxz,elenod,elemat,elefab,noddis),1033 return([noddis,nodfor,elefor])1034 )$1035

1036

1037 /* PRINT MODULES */1038 PrintPlaneNodeCoordinatesSymb(nodxy) :=1039 block([table,header,i],1040 table : zeromatrix(length(nodxy)+1,3),1041 table[1] : ["node", "x-coor", "y-coor"],1042 for i : 2 thru length(nodxy)+1 do (1043 table[i] : args(append([i-1],nodxy[i-1]))),1044 return(table)1045 )$1046

1047 PrintPlaneNodeCoordinatesSymb_xz(nodxz) :=1048 block([table,header,i],1049 table : zeromatrix(length(nodxz)+1,3),1050 table[1] : ["node", "x-coor", "z-coor"],1051 for i : 2 thru length(nodxz)+1 do (1052 table[i] : args(append([i-1],nodxz[i-1]))),1053 return(table)1054 )$1055

1056 PrintPlaneTrussElementDataSymb(elenod,elemat,elefab) :=

Page 124: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

114 6 Maxima Source Codes

1057 block([table,header,i],1058 table : zeromatrix(length(elenod)+1,4),1059 table[1] : ["elem", "nodes", " modulus ", "area"],1060 for i : 2 thru length(elenod)+1 do (1061 table[i] :1062 args(append([i-1],[elenod[i-1]],[elemat[i-1]],[elefab[i-1]]))),1063 return(table)1064 )$1065

1066

1067 PrintPlaneTrussFreedomActivitySymb(nodtag,nodval) :=1068 block([table,header,i],1069 table : zeromatrix(length(nodtag)+1,5),1070 table[1] : [" node", " x-tag", " y-tag",1071 " x-value", " y-value"],1072 for i : 2 thru length(nodtag)+1 do (1073 table[i] : args(append([i-1],nodtag[i-1],nodval[i-1]))),1074 return(table)1075 )$1076

1077 PrintPlaneTrussFreedomActivitySymb_xz(nodtag,nodval) :=1078 block([table,header,i],1079 table : zeromatrix(length(nodtag)+1,5),1080 table[1] : [" node", " x-tag", " z-tag",1081 " x-value", " z-value"],1082 for i : 2 thru length(nodtag)+1 do (1083 table[i] : args(append([i-1],nodtag[i-1],nodval[i-1]))),1084 return(table)1085 )$

1086

1087 PrintPlaneTrussNodeDisplacementsSymb(noddis) :=1088 block([table,header,i],1089 table : zeromatrix(length(noddis)+1,3),1090 table[1] : ["node", "x-displ", "y-displ"],1091 for i : 2 thru length(noddis)+1 do (1092 table[i] : args(append([i-1],noddis[i-1]))),1093 return(table)1094 )$1095

1096 PrintPlaneTrussNodeDisplacementsSymb_xz(noddis) :=1097 block([table,header,i],1098 table : zeromatrix(length(noddis)+1,3),1099 table[1] : ["node", "x-displ", "z-displ"],1100 for i : 2 thru length(noddis)+1 do (1101 table[i] : args(append([i-1],noddis[i-1]))),1102 return(table)1103 )$1104

1105 PrintPlaneTrussNodeForcesSymb(nodfor) :=1106 block([table,header,i],1107 table : zeromatrix(length(nodfor)+1,3),1108 table[1] : ["node","x-force","y-force"],1109 for i : 2 thru length(nodfor)+1 do (

Page 125: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 115

1110 table[i] : args(append([i-1],nodfor[i-1]))),1111 return(table)1112 )$1113

1114 PrintPlaneTrussNodeForcesSymb_xz(nodfor) :=1115 block([table,header,i],1116 table : zeromatrix(length(nodfor)+1,3),1117 table[1] : ["node","x-force","z-force"],1118 for i : 2 thru length(nodfor)+1 do (1119 table[i] : args(append([i-1],nodfor[i-1]))),1120 return(table)1121 )$1122

1123 PrintPlaneElemForcesAndStressesSymb(elefor,elesig) :=1124 block([table,header,i],1125 table : zeromatrix(length(elefor)+1,3),1126 table[1] : ["elem","axial force","axial stress"],1127 for i : 2 thru length(elefor)+1 do (1128 table[i] : args([i-1,elefor[i-1],elesig[i-1]])),1129 return(table)1130 )$1131

1132 PrintPlaneGenBeamNodeDOFsSymb(noddis) :=1133 block([table,header,i],1134 table : zeromatrix(length(noddis)+1,4),1135 table[1] : ["node", "x-displ", "y-displ", "z-rot"],1136 for i : 2 thru length(noddis)+1 do (1137 table[i] : args(append([i-1],noddis[i-1]))),1138 return(table)1139 )$1140

1141 PrintPlaneGenBeamNodeDOFsSymb_xz(noddis) :=1142 block([table,header,i],1143 table : zeromatrix(length(noddis)+1,4),1144 table[1] : ["node", "x-displ", "z-displ", "y-rot"],1145 for i : 2 thru length(noddis)+1 do (1146 table[i] : args(append([i-1],noddis[i-1]))),1147 return(table)1148 )$1149

1150 PrintPlaneGenBeamElementDataSymb(elenod,elemat,elefab) :=1151 block([table,header,i],1152 table : zeromatrix(length(elenod)+1,4),1153 table[1] : ["elem", "nodes", " modulus ", "fabrication"],1154 for i : 2 thru length(elenod)+1 do (1155 table[i] :1156 args(append([i-1],[elenod[i-1]],[elemat[i-1]],[elefab[i-1]]))),1157 return(table)1158 )$1159

1160 PrintPlaneGenBeamFreedomActivitySymb(nodtag,nodval) :=1161 block([table,header,i],1162 table : zeromatrix(length(nodtag)+1,7),

Page 126: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

116 6 Maxima Source Codes

1163 table[1] : [" node", "x-tag", "y-tag", "zrot-tag",1164 "x-value", "y-value","zrot-value"],1165 for i : 2 thru length(nodtag)+1 do (1166 table[i] : args(append([i-1],nodtag[i-1],nodval[i-1]))),1167 return(table)1168 )$1169

1170 PrintPlaneGenBeamFreedomActivitySymb_xz(nodtag,nodval) :=1171 block([table,header,i],1172 table : zeromatrix(length(nodtag)+1,7),1173 table[1] : [" node", "x-tag", "z-tag", "yrot-tag",1174 "x-value", "z-value","yrot-value"],1175 for i : 2 thru length(nodtag)+1 do (1176 table[i] : args(append([i-1],nodtag[i-1],nodval[i-1]))),1177 return(table)1178 )$1179

1180 PrintPlaneGenBeamNodeForcesSymb(nodfor) :=1181 block([table,header,i],1182 table : zeromatrix(length(nodfor)+1,4),1183 table[1] : ["node","x-force","y-force","Bending-moment"],1184 for i : 2 thru length(nodfor)+1 do (1185 table[i] : args(append([i-1],nodfor[i-1]))),1186 return(table)1187 )$

1188

1189 PrintPlaneGenBeamNodeForcesSymb_xz(nodfor) :=1190 block([table,header,i],1191 table : zeromatrix(length(nodfor)+1,4),1192 table[1] : ["node","x-force","z-force","Bending-moment"],1193 for i : 2 thru length(nodfor)+1 do (1194 table[i] : args(append([i-1],nodfor[i-1]))),1195 return(table)1196 )$1197

1198 PrintPlaneGenBeamElemForcesSymb(l_elefor) :=1199 block([table,header,i],1200 table : zeromatrix(length(l_elefor)+1,4),1201 table[1] :1202 ["local-node","Normal-force","Bending-moment","Shear-force"],1203 for i : 2 thru length(l_elefor)+1 do (1204 table[i] : args(append([i-1],l_elefor[i-1]))),1205 return(table)1206 )$1207

1208 /*1209 options:1210 symb : symbolic input1211 nume : numerical input1212 */1213

1214 PrintPlaneTrussNodeCoordinates(NodeCoordinates,option) :=1215 block([table,header,i],

Page 127: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 117

1216 table : zeromatrix(length(NodeCoordinates),3),1217 header : ["node", "x-coor", "y-coor"],1218 for i : 1 thru length(NodeCoordinates) do (1219 table[i] : args(append([i],NodeCoordinates[i]))),1220 printf(true," Node coordinates: ~%"),1221 printf(true,"~%"),1222 if (option=symb) then1223 (printf(true,"~{~8t~9a~8t~15a~8t~15a~}~%",header),1224 printf(true,"~{~{~8t~9a~8t~15a~8t~15a~}~%~}",table))1225 else1226 (printf(true," ~{ ~12a~}~%",header),1227 printf(true,"~{~{~9d ~12,6f ~12,6f ~}~%~}",table)),1228 return("")1229 )$1230

1231 PrintPlaneTrussElementData1232 (ElemNodes,ElemMaterials,ElemFabrications,option) :=1233 block([table,header,i],1234 table : zeromatrix(length(ElemNodes),5),1235 for i : 1 thru length(ElemNodes) do (1236 table[i] :1237 args(1238 append([i],ElemNodes[i],[ElemMaterials[i]],[ElemFabrications[i]]))),1239 printf(true," Element data: ~%"),1240 printf(true,"~%"),1241 if (option=symb) then1242 (header : ["elem", "nodes", "modulus", "area"],1243 printf(true,"~{~8t~8a ~8t~14a ~8t~12a~8t~12a~%~\}",header),1244 printf(true,"~{~8t~{~9a~t[~2a, ~2a] ~12a

~12a~}~%~}",table))1245 else1246 (header : [" elem", " nodes", "modulus", " area"],1247 printf(true,"~{~2t~<~12a~>~}~%",header),1248 printf(true,"~{~{~9d ~t[~2d, ~2d] ~12,2f

~12,2f~}~%~}",table)),1249 return("")1250 )$1251

1252

1253 PrintPlaneTrussFreedomActivity(NodeDOFTags,NodeDOFValues,option) :=1254 block([table,header,i],1255 table : zeromatrix(length(NodeDOFTags),5),1256 header : [" node", " x-tag", " y-tag",1257 " x-value", " y-value"],1258 for i : 1 thru length(NodeDOFTags) do (1259 table[i] : args(append([i],NodeDOFTags[i],NodeDOFValues[i]))),1260 printf(true," DOF activity: ~%"),1261 printf(true,"~%"),1262 if (option=symb) then1263 (header : ["node", "x-tag", "y-tag",1264 "x-value", "y-value"],1265 printf(true,"~{~8t~12a~}~%",header),1266 printf(true,"~{~{~8t~12a~}~%~}",table))1267 else

Page 128: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

118 6 Maxima Source Codes

1268 (header : [" node", " x-tag", " y-tag",1269 " x-value", " y-value"],1270 printf(true,"~{~9a~}~%",header),1271 printf(true,"~{~{~9d~}~%~}",table)),1272 return("")1273 )$

1274

1275 PrintPlaneTrussNodeDisplacements(noddis,option) :=1276 block([table,header,i],1277 table : zeromatrix(length(noddis),3),1278 for i : 1 thru length(noddis) do (1279 table[i] : args(append([i],noddis[i]))),1280 printf(true," Computed node displacements: ~%"),1281 printf(true,"~%"),1282 if (option=symb) then1283 (header : ["node", "x-displ", "y-displ"],1284 printf(true,"~{~8t~9a~8t~15a~8t~15a~}~%",header),1285 printf(true,"~{~{~8t~9a~8t~15a~8t~15a~}~%~}",table))1286 else1287 (header : [" node", " x-displ", " y-displ"],1288 printf(true,"~{ ~9a~}~%",header),1289 printf(true,"~{~{~9d ~12,6f ~12,6f ~}~%~}",table)),1290 return("")1291 )$1292

1293 PrintPlaneTrussNodeForces(nodfor,option) :=1294 block([table,header,i],1295 table : zeromatrix(length(nodfor),3),1296 for i : 1 thru length(nodfor) do (1297 table[i] : args(append([i],nodfor[i]))),1298 printf(true," Node Forces including reactions: ~%"),1299 printf(true,"~%"),1300 if (option=symb) then1301 (header : ["node", "x-force", "y-force"],1302 printf(true,"~{~8t~9a~8t~15a~8t~15a~}~%",header),1303 printf(true,"~{~{~8t~9a~8t~15a~8t~15a~}~%~}",table))1304 else1305 (header : [" node", " x-force", " y-force"],1306 printf(true,"~{ ~9a~}~%",header),1307 printf(true,"~{~{~9d ~12,4f ~12,4f~}~%~}",table)),1308 return("")1309 )$1310

1311 PrintPlaneElemForcesAndStresses(elefor,elesig,option) :=1312 block([table,header,i],1313 table : zeromatrix(length(elefor),3),1314 for i : 1 thru length(elefor) do (1315 table[i] : args([i,elefor[i],elesig[i]])),1316 printf(true," Int Forces and Stresses: ~%"),1317 printf(true,"~%"),1318 if (option=symb) then1319 (header : ["elem", "axial force", "axial stress"],1320 printf(true,"~{~8t~9a~8t~15a~8t~15a~}~%",header),

Page 129: Andreas Öchsner · Resam Makvandi Finite Elements for Truss ...

6 Maxima Source Codes 119

1321 printf(true,"~{~{~8t~9a~8t~15a~8t~15a~}~%~}",table))1322 else1323 (header : [" elem", " axial force", " axial stress"],1324 printf(true,"~{ ~9a~}~%",header),1325 printf(true,"~{~{~9d ~14,4f ~14,4f~}~%~}",table)),1326 return("")1327 )$


Recommended