Developing Python Code For Static and Modal Analysis of Plane Truss Structure
Developing Python Code For Static and Modal Analysis of Plane Truss Structure
BACHELOR OF TECHNOLOGY
IN
MECHANICAL ENGINEERING
BY
DUNGA DIVYA (317126520191)
GOLAKOTI SRI NETHIKONDA (318126520L49)
DEEPAK KUMAR BEHERA (317126520190)
PASUPULETI BHARGAVI SRI (317126520213)
DATLA SANTOSH SUNIL VARMA (317126520189)
Under the esteemed guidance of
Professor
(Affiliated to Andhra University, Accredited By NBA and NAAC with ‘A’ Grade)
2021
ACKNOWLEDGEMENTS
district for his valuable guidance and encouragement at every stage of the work
Last but not the least, we like to convey our thanks to all who have contributed either
CHAPTER-I
INTRODUCTION
1.0 Scope and background 1
i
1.7.3 Numerical methods using python scipy 13
CHAPTER-II
LITERATURE REVIEW 14
2.0 Overview of the project 17
CHAPTER-III
ANALYSIS OF TRUSS USING ANSYS SOFTWARE 18
3.0 Ansys 18
3.1 Advantages 20
3.2 Problem statement 21
3.3 Structural analysis of truss 21
3.3.1 Nodal displacement results 35
CHAPTER-IV
FEA ANALYSIS OF TRUSS STRUCTURE USING PYTHON 51
4.1 Need of python 51
4.1.1 Reasons for using python for scientific computing 53
4.1.2 Reasons for using python over mat lab 53
4.2 Methodology of implementing python for current project 53
4.2.1 Jupyter notebook 53
4.2.2 Python version 54
ii
4.4 Python code for truss structure for static &dynamic analysis 64
4.5 How the python prints the results 75
CHAPTER-V
RESULTS AND DISCUSSION 97
5.1 Results 97
5.1.1 Results comparision for validadion between ansys apdl and pythoncode 98
5.1.2 Modal analysis using python code 101
5.2 Plotting mode shapes 101
CHAPTER-Ⅵ
CONCLUSIONS AND FUTURE SCOPE 120
CHAPTER-Ⅶ
REFERANCES 121
iii
LIST OF TABLES
iv
LIST OF FIGURES
v
3.21 Nodal displacement in x component 33
3.22 Nodal displacement in y component 34
3.23 Nodal displacement in z component 34
3.24 Nodal solution at global coordinate system 35
3.25 Ansys file 38
3.26 Ansys processor 38
3.27 Ansys element type 39
3.28 Selection of link 180 element 39
3.29 Material in steel 40
3.30 Material property selection 41
3.31 Adding link section and link area 41
3.32 Creating truss nodes in active coordinate system 43
3.33 Creating truss elements in between two nodes 43
3.34 Modal analysis selection 44
3.35 Modal extraction method 45
3.36 Options in modal analysis 45
3.37 Applied displacements on nodes 46
3.38 Solving truss in current load step 46
3.39 Solution in current load step 47
3.40 Natural frequencies at modes 48
3.41 Deformed shape of truss 49
4.1 Displacement of truss at nodes 56
4.2 Global displacement vector at nodes 56
4.3 Railway bridge truss 59
5.1 Deformation of truss in modal alaysis 98
5.2 Figures of mode shapes 102
vi
vii
CHAPTER- I
INTRODUCTION
1.0 SCOPE AND BACKGROUND:
It is no secret that problems that were 10 years ago considered intractable except on
dedicated supercomputers, now routinely run on modest commodity personal
computers. However, it is not quite as well recognized that these advances have also
been accompanied by important changes in programming languages, all of which
aim at greatly reducing the effort of writing codes. Scientific applications are no
exceptions; many legacy programs written in Fortran, C or even C++ could
probably be rewritten in a more concise way using a variety of scripting languages,
such as Matlab, Scilab, IDL, Mathematica and others.
Scripting languages have several advantages over ‘conventional’ languages.
(1) scripting languages produce portable codes,
(2) require little or nor memory management responsibility by the programmer and
(3) allow data types to be dynamically set at run time.
All of these factors contribute to making codes less bug prone and so ultimately lead
to increased productivity and shorter code development cycles.
These advantages, unfortunately, have a price; scripting languages tend to be
inferior in raw numerical performance when benchmarked against compiled codes.
Our experience, however, has been that scripting languages, and in particular
Python, often perform above expectation, and are thus well positioned to find the
optimum between satisfactory execution time and acceptable program development
cost.
It is convenient here to distinguish between matrix oriented scripting languages
(Matlab, Scilab, IDL,...) geared towards engineering and scientific applications
from symbolic languages (Mathematica, Maple,...) that are strong in manipulating
mathematical expressions, and general purpose scripting languages (Python,
Perl,...). Although this distinction has become increasingly blurred, Matlab now
allows for some degree of abstract programming while Mathematica improved its
raw numerical performance, it is generally true that languages in group one are
superior in number crunching at the expense, perhaps, of limited programming
flexibility. Languages in group three on the other hand are traditionally used for
1
web programming, as substitutes to shell scripts, for text processing and the
production of graphical user interfaces. Python is one such language although one
could also claim that, thanks to the NumPy module extension, Python has some
overlap with languages in group one, too.
Although extremely useful for rapid prototyping, we have found that matrix oriented
languages are not always suitable for scientific applications. Many objects such as
trees, graphs and sparse matrices do not neatly fit into a matrix cast. In dealing with
unstructured meshes for instance, there can be an arbitrary number of connections
between a node and its neighbors, which may only be known at run time. These are
typical cases where Python nested structures are best suited. We have also found the
dictionary data type in Python, where values are accessed by keys, extremely useful.
Dictionaries (or hash tables) can grow dynamically during a calculation. Keys can
be (immutable) aggregate objects, including strings, integers, doubles, a list, or a
mixture of these. Finally, Python is unique in fully supporting (yet not enforcing)
object oriented programming. The usual arithmetic operators can be overloaded as
in C++. However, in addition to C++ the slicing operators such as a(n:m) (available
in Fortran 90 and Matlab) can also be overloaded.
In summary, Python contains features individually but not globally available in
Fortran 90, Java and C++.
It is for the above reasons that we have selected Python as the programming
scripting language for analysis of structural problems like plane truss structure.
1.1 INTRODUCTION OF TRUSS
1. Pitched Truss
2. Parallel Truss
A parallel truss is made up of the parallel chord and bottom. The chord and
bottom run straight in a parallel path. Both the stringers (chord and bottom) are
interconnected by means of struts (the connecting rods). If compared, the
pitched trusses are stronger than the parallel truss. A parallel truss is generally
used instead of girders and beams.
1. Warren Truss
2. Octet Truss
3. Prat Truss
4. Bowstring Truss
5. King post Truss
6. Lenticular Truss
7. Town’s Lattice Truss
8. Vierendeel Truss
It is a very simple type of trusses, in which the truss members form a series of
equilateral triangles. These are included in the category of the parallel truss.
3
Fig 1.1 warren truss
In this type of trusses, the truss members are made up of all equivalent
equilateral triangles. This is a very complicated truss, in which each triangle is
associated with the other in multi-dimensions. This type of truss is strongest as
compared to the rest of the types. This type of trusses is designed with very high
skill and is very difficult to understand.
In 1844, the engineers of the Boston railway track designed it. Two types of
members are used in this truss. One is vertical and the other is a diagonal
member. The two types of members consecutively, follow one another. The
vertical members are for compression and the diagonal members are for
responding tension.
4
Fig 1.3 pratt truss
Bowing Strings are used in this type of trusses. The bowstrings act as an arch.
These strings give extra turgidity to the truss. These were, first used in World
War II. The need for such type of trusses was felt, the curved roof of aircraft was
to be designed.
5
1.3.6 Lenticular Truss:
Lenticular Truss was, first time used in the Gaunless Railway bridge of
Stockholm and Darlington in 1823. In this type the chord and the bottom, both
are arched and connect with each other at both ends.
In these trusses, the inclined members are used which cross over one another at
frequent points. An American architect “Itheal Town” designed it, this is why is
known after his name.
Almost all the trusses are made up of three fundamental components. The chord,
the bottom, and the members.
6
1. Upper stringer in a truss is called the chord.
3. Members, also called struts are the bars, rod, and strips that connect the chord
and bottom of the truss.
The roots of this equation are ωi2 , the eigenvalues, where i ranges from 1 to
number of DOF. Corresponding vectors are {u}i , the eigenvectors.
The square roots of the eigenvalues are ωi , the structure’s natural circular
frequencies (radians/sec). Natural frequencies fi are then calculated as fi = ωi /2π
(cycles/sec). It is the natural frequencies fi that are input by the user and output
by ANSYS.
The eigenvectors {u}i represent the mode shapes - the shape assumed by the
structure when vibrating at frequency fi .
It has a dual meaning. For the reduced method, mode expansion means
calculating the full mode shapes from the reduced mode shapes. For all other
methods, mode expansion simply means writing mode shapes to the results file.
8
Subspace
PowerDynamics
Reduced
Unsymmetric
Damped (full)
QR Damped
Which method you choose depends primarily on the model size (relative to your
computer resources) and the particular application.
Linear
Extraction Solver
method Used Remarks
Block Sparse Recommended for most
Lanczos Matrix applications; Most stable;
Same as subspace but with PCG
solver; Can
handle very large models; Lumped
mass only; May
miss modes; Modes cannot be used
in
Powerdynami PCG subsequent spectrum and PSD
cs solver analyses
In general fastest; Accuracy
depends on Master
DOF selection; Limitations similar
to Subspace;
Not recommended due to expertise
Frontal required in
Reduced Solver selecting Master DOF.
9
1.6.6 Modal Analysis Procedure:
Four main steps in a modal analysis:
Build the model
Choose analysis type and options
Apply boundary conditions and solve
Review results.
Build the model :
Remember density!
Linear elements and materials only. Nonlinearities are ignored.
Choose analysis type and options
Enter Solution and choose modal analysis.
Mode extraction options*
Mode expansion options*
Other options*
Mode extraction options
Method: Block Lanczos recommended for most applications.
Number of modes: Must be specified (except Reduced method).
Frequency range: Defaults to entire range, but can be limited to a desired range
(FREQB to FREQE). Specification of a frequency range requires additional
factorizations and it is typically faster to simply request a number of modes
which will overlap the desired range.
Normalization:
Only the shape of the DOF solution has real meaning. It is therefore customary
to normalize them for numerical efficiency or user convenience.
Modes are normalized either to the mass matrix or to a unit matrix (unity). –
Normalization to mass matrix is the default, and is required for a spectrum
analysis or if a subsequent mode superposition analysis is planned. – Choose
normalization to unity when you want to easily compare relative values of
displacements throughout the structure.
Modes normalized to unity cannot be used in subsequent mode superposition
analyses (transient, harmonic, spectrum or random vibration).
10
Mode expansion:
You need to expand mode shapes if you want to do any of the following:
Have element stresses calculated.
Do a subsequent spectrum or mode superposition analysis.
1.6.7 Other analysis options:
Lumped mass matrix – Mainly used for slender beams and thin shells, or for
wave propagation problems. – Automatically chosen for PowerDynamics
method.
Pre-stress effects – For Pre-stressed modal analysis (discussed later).
Full damping – Used only if Damped mode extraction method is chosen. –
Damping ratio, alpha damping, and beta damping are allowed. – BEAM4 and
PIPE16 also allow gyroscopic damping.
QR damping – All types of damping are allowed.
Apply boundary conditions and solve
Displacement constraints
External loads
However, ANSYS creates a load vector which you can use in a subsequent
mode superposition analysis.
Review results using POST1, the general postprocessor
List natural frequencies
View mode shapes
Review participation factors
Review modal stresses.
1.7 WHY PYTHON FOR SCENTIFIC COMPUTERING?
The design focus on the Python language is on productivity and code readability,
for example through:
• Interactive python console
• Very clear, readable syntax through whitespace indentation
• Strong introspection capabilities
• Full modularity, supporting hierarchical packages
• Exception-based error handling
11
• Dynamic data types & automatic memory management
As Python is an interpreted language, and it runs many times slower than
compiled code, one might ask why anybody should consider such a ’slow’
language for computer simulations?
1.7.1 Numerical Python:
The NumPy package (read as NUMericalPYthon) provides access to
• a new data structure called arrays which allow efficient vector and matrix
operations.
It also provides a number of linear algebra operations (such as solving of
systems of linear equations, computation of Eigenvectors and Eigenvalues).
There are two other implementations that provide nearly the same functionality
as NumPy. These are called “Numeric” and “numarray”:
• Numeric was the first provision of a set of numerical methods (similar to
Matlab) for Python. It evolved from a PhD project.
• Numarray is a re-implementation of Numeric with certain improvements (but
for our purposes both Numeric and Numarray behave virtually identical).
• Early in 2006 it was decided to merge the best aspects of Numeric and
Numarray into the Scientific Python (scipy) package and to provide (a hopefully
“final”) array data type under the module name “NumPy”. We will use in the
following materials the “NumPy” package as provided by (new) SciPy.
If for some reason this doesn’t work for you, chances are that your SciPy is too
old. In that case, you will find that either “Numeric” or “numarray” is installed
and should provide nearly the same capabilities.
1.7.2 Visualisation in Python:
The Python library Matplotlib is a python 2D plotting library which produces
publication quality figures in a variety of hardcopy formats and interactive
environments. Matplotlib tries to make easy things easy and hard things
possible. You can generate plots, histograms, power spectra, bar charts,
errorcharts, scatterplots, etc, with just a few lines of code. For more detailed
information, check these links
12
• A very nice introduction in the object oriented Matplotlib interface, and
summary of all important ways of changing style, figure size, linewidth, etc.
This is a useful reference:
http://nbviewer.ipython.org/urls/raw.github.com/jrjohansson/scientific-python-
lectures/master/Lecture4-Matplotlib.ipynb
• Matplotlib tutorial http://matplotlib.sourceforge.net/users/index.html
• Matplotlib home page http://matplotlib.sourceforge.net
• List of simple screenshot examples
http://matplotlib.sourceforge.net/users/screenshots.html
• Extended thumbnail gallery of examples
http://matplotlib.sourceforge.net/gallery.html
1.7.3 Numerical Methods using Python SciPy:
scipy package (SCIentificPYthon) which provides a multitude of numerical
algorithms
Many of the numerical algorithms available through scipy and numpy are
provided by established compiled libraries which are often written in Fortran or
C. They will thus execute much faster than pure Python code (which is
interpreted). As a rule of thumb, we expect compiled code to be two orders of
magnitude faster than pure Python code.
13
CHAPTER-II
LITERATURE REVIEW
16
CHAPTER-III
3.0 ANSYS
ANSYS is a general purpose finite element modelling package for numerically
solving a wide variety of mechanical problems. These problems include:
static/dynamic structural analysis (both linear aswell as acoustic and electro-
magnetic problems.Ansys develops and markets engineering simulation
software for use across the product life cycle. Ansys Mechanical finite
element analysis software is used to simulate computer models of structures,
electronics, or machine components for analysing strength, toughness,
elasticity, temperature distribution, electromagnetism, fluid flow, and other
attributes. Ansys is used to determine how a product will function with
different specifications, without building test products or conducting crash
tests. For example , Ansys software may simulate how a bridge will hold
up after years of traffic, how to best process salmon in a cannery to
reduce waste, or how to design a slide that uses less material without
sacrificing safety.Typically Ansys users break down larger structures into
smallcomponents that are each modelled and tested individually.A user may
start by defining thedimensions of an object, and then adding weight, pressure,
temperature and other physical properties. Finally, the Ansys software simulates
and analyses movement, fatigue, fractures, fluid flow, temperature distribution,
electromagnetic efficiency and other effects over time.
17
Ansys also develops software for data management and backup, academic
research and teaching. Ansys software is sold on an annual subscription basis.
In general, a finite element solution may be broken into the following three
stages.This is a general guideline that can be used for setting up any finite
element analysis.
1. Preprocessing defining the problem ; The major steps in preprocessing
aregiven below:
→Define keypoints/lines/areas/volumes
→ Define element type and material/geometric properties
→ Mesh lines/areas/volumes as required
The amount of detail required will depend on the dimensionality of the
analysis (i.e. 1D, 2D, axi-symmetric, 3D).
Solution: assigning loads, constraints and solving here we specify the loads
(point or pressure), constraints (translational and rotational) and finally solve the
resulting set of equations.
2.Postprocessing processing further and viewing of the results in this stage
one
may wish to see:
→ Lists of nodal displacements
→ Element forces and moments
→Deflection plots
→Stress contour diagrams
ANSYS uses certain inputs and evaluates the product behaviour to the physics
that you are testing it in. It is a general purpose software used to simulate the
interactions between various physics like dynamics, statics, fluids,
electromagnetic, thermal, and vibrations. ANSYS typically creates the user an
opportunity to create a virtual environment to simulate the tests or working
conditions of the products before manufacturing the prototypes. This would
certainly reduce the cost of producing prototypes and mainly the time. In this
competitive world the accuracy and time are the most deciding factors for the
18
company or the organization to sustain. ANSYS helps in increasing the accuracy
and decreasing the time of outcome of the final product.
3.1 ADVANTAGES
1. ANSYS can import all kinds of CAD geometries (3D and 2D) from different
CAD software's like Design Modeler and Space Claim which makes the work
flow even smoother.
2. ANSYS has the capability of performing advanced engineering simulations
accurately and realistic in nature by its variety of contact algorithms, time
dependent simulations and non linear material models.
3. ANSYS has the capability of integrating various physics into one platform
and perform the analysis. Just like integrating a thermal analysis with
structural and integrating fluid flow analysis with thermal and structural,etc.,
4. ANSYS now has featured its development into a product called ANSYS
AIM, which is capable of performing multi physics simulation. It is a single
platform which can integrate all kinds of physics and perform simulations.
5. ANSYS has its own customization tool called ACT which uses python as a
background scripting language and used in creating customized user
required features in it.
6.ANSYS hasthe capability to optimize various features like the geometrical
design, boundary conditions and analyse the behaviour of the product under
various criterion's.
19
Fig 3.1 railway bridge truss
3.3 STRUCTURAL ANALYSIS OF TRUSS
20
Step 1:-firstly, we click on Preferences in main menu and then we select the type
of analysis by choosing structural and proceed on by clicking Ok.
21
Fig 3.5 selection of link 180 element
Step 3:-In this we choose the Material props and Select the available Material
models under StructuralLinearElasticIsotropic and click Ok.
We assign the material property values for the material 1. Ex= 200GPA
,PRXY=0.3 Ok
The material taken in steel
22
Fig 3.6 material in steel
23
Fig 3.8 adding link section and link area
Step 5:-Now click on Modelling and select Create. We can see other functions
below, select Nodes and then click on InactiveCS. A window will appear as
shown in belowfig ,and we can choose the nodes and assign the values for the
nodes.
Node number 1 at X = 0 , Y = 0 , Z = 0 Apply
Node number 2 at X = 1800 , Y = 3118 , Z = 0 Apply
Node number 3 at X = 3600 , Y = 0 , Z = 0 Apply
Node number 4 at X = 5400 , Y = 3118 , Z = 0 Apply
Node number 5 at X = 7200 , Y = 0 , Z = 0 Apply
Node number 6 at X = 9000 , Y = 3118 , Z = 0 Apply
Node number 7 at X = 10800 , Y = 0 , Z = 0 Apply
Node number 8 at X = 12600 , Y = 3118 , Z = 0 Apply
Node number 9 at X = 14400 , Y = 0 , Z = 0 Apply
Node number 10 at X = 16200 , Y = 3118 , Z = 0 Apply
Node number 11 at X = 18000 , Y = 0 , Z = 0 Apply
Node number 12 at X = 19800 , Y = 3118 , Z = 0 Apply
Node number 13 at X = 21600 , Y = 0 , Z = 0 Apply
Node number 14 at X = 23400 , Y = 3118 , Z = 0 Apply
Node number 15 at X = 25200 , Y = 0 , Z = 0 Apply
Node number 16 at X = 27000 , Y = 3118 , Z = 0 Apply
Node number 17 at X = 28800 , Y = 0 , Z = 0 Apply
Node number 18 at X = 30600 , Y = 3118 , Z = 0 Apply
Node number 19 at X = 32400 , Y = 0 , Z = 0 Apply Ok
24
Fig 3.9 creating truss nodes in active coordinating system
Step 6:-We click on Element tool and under that we click on Auto numbered
and below that we select Thru nodes and Select the nodes 1&2 and click on
Apply . In the same way we select thenodes 1&3 and click on Apply.
We Repeat the same procedure.
25
Fig 3.10 creating truss elements in between two nodes
Step 7:-Now on the main menu we select ‘Loads’ and Define the loads and
click on Apply.Apply the‘Structural’ tool and select ‘Displacement’ and then
‘On nodes’. Now select node 1 and clickOk . A pop-up window opens , the
DOF’S needs to be constrained so we select All DOF’S and click Apply.
Then select node 7 Ok UY Ok.
26
Fig 3.12 generate support reaction at nodes
27
Fig 3.13 applying external loads on truss nodes
28
Step 9:- In ‘Solution’menu , we click on ‘Solve’and below it select‘Current
LS’, a window will open showing solution options. Now press Ok to start the
Solution . it finally shows ‘Solution is done’ and then we ‘Close’.
29
Step 10:-In the above tool bar click on ‘Plot ctrlS’and select ‘Style’ in which we
aagain select ‘Size & Shape’ and finally Display of element is done and click
Ok.
32
Fig 3.23 nodel displacement in z-component
33
3.3.1 Nodal displacement results
PRINT U NODAL SOLUTION PER NODE
NODE UX UY UZ USUM
1 0.0000 0.0000 0.0000 0.0000
2 80.572 -52.717 0.0000 96.286
3 2.6857 -103.88 0.0000 103.92
4 75.201 -150.40 0.0000 168.15
5 10.072 -192.65 0.0000 192.91
6 65.801 -227.92 0.0000 237.23
7 20.815 -257.00 0.0000 257.84
8 53.715 -277.54 0.0000 282.69
9 33.572 -290.72 0.0000 292.65
10 40.286 -294.59 0.0000 297.34
11 47.001 -290.72 0.0000 294.49
12 26.857 -277.54 0.0000 278.84
13 59.758 -257.00 0.0000 263.85
14 14.772 -227.92 0.0000 228.40
15 70.501 -192.65 0.0000 205.14
16 5.3715 -150.40 0.0000 150.49
17 77.887 -103.88 0.0000 129.84
18 0.79378E-012 -52.717 0.0000 52.717
19 80.572 0.0000 0.0000 80.572
MINIMUM VALUES
NODE 1 1 10 1 1
VALUE 0.0000 0.0000 -373.02 74.615 74.615
MAXIMUM VALUES
NODE 9 1 3 9 9
VALUE 382.35 0.0000 0.0000 382.35 382.35
3.3.3 ELEMENTARY STRESS RESULTS
PRINT ELEMENT TABLE ITEMS PER ELEMENT
STAT ELEM CURRENT SAXL
1 149.21
2 410.32
3 596.83
4 708.74
5 746.04
6 708.74
7 596.83
8 410.32
9 149.21
10 -298.42
11 -522.23
12 -671.44
13 -746.04
14 -746.04
15 -671.44
16 -522.23
17 -298.42
18 -298.44
19 298.44
20 -223.83
21 223.83
22 -149.22
23 149.22
24 -74.610
25 74.610
26 0.0000
27 0.27756E-011
35
28 74.610
29 -74.610
30 149.22
31 -149.22
32 223.83
33 -223.83
34 298.44
35 -298.44
MINUMUM VALUES
ELEM 13
VALUE -746.04
MAXIMUM VALUES
ELEM 5
VALUE 746.04
36
.
37
Fig 3.28 selection of link 180 element
Step 3:-In this we choose the Material props and Select the available Material
models under StructuralLinearElasticIsotropic and click Ok.
We assign the material property values for the material 1. Ex= 200GPA
,PRXY=0.3 Ok
The material taken in steel
40
Fig 3.32 creating truss nodes in active coordinating system
Step 6:-We click on Element tool and under that we click on Auto numbered
and below that we select Thru nodes and Select the nodes 1&2 and click on
Apply . In the same way we select thenodes 1&3 and click on Apply.
We Repeat the same procedure.
43
Step-11:- In ‘Solution’ menu , we click on ‘Solve’ and below it select ‘Current
LS’ , a window will open showing solution options. Now press Ok to start the
Solution . it finally shows ‘Solution is done’ and then we ‘Close’.
44
Step-12:-We click on General post proc and select ‘Read results’we see the
results ‘By pick’ and select 4result and click onClose.
45
Step-15:-We click on Plot results and select Deformed shape after that we
again consider Def+Undeformed and click on Ok.
Step-16:-Now we repeat the steps 14 and 15 for the nodes 6-40.
Step-17:-Click on plot ctrls and below it click on deformed shape and select
‘Animate’ and chose Mode shape. Now we give the animation data, No of
frames to create as 10 and Time delay(seconds) as 0.5 secs. We chose
acceleration type as linear . the nodal solution data is given by selecting ‘DOF
solution’ and then click on deformed shape and click Ok.
2 0.0000 1 2 2
3 0.0000 1 3 3
4 0.0000 1 4 4
5 0.0000 1 5 5
46
6 0.23237E-07 1 6 6
7 0.76996E-02 1 7 7
8 0.22980E-01 1 8 8
9 0.29891E-01 1 9 9
10 0.53372E-01 1 10 10
11 0.75282E-01 1 11 11
12 0.84342E-01 1 12 12
13 0.11409 1 13 13
14 0.12950 1 14 14
15 0.14925 1 15 15
16 0.17973 1 16 16
17 0.18595 1 17 17
18 0.20085 1 18 18
19 0.21743 1 19 19
20 0.22183 1 20 20
21 0.23885 1 21 21
22 0.25510 1 22 22
23 0.25818 1 23 23
47
24 0.27867 1 24 24
25 0.28256 1 25 25
26 0.29536 1 26 26
27 0.30313 1 27 27
28 0.33320 1 28 28
29 0.33579 1 29 29
30 0.33893 1 30 30
31 0.34431 1 31 31
32 0.35306 1 32 32
33 0.36434 1 33 33
34 0.37680 1 34 34
35 0.39635 1 35 35
36 0.42150 1 36 36
37 0.43633 1 37 37
38 0.45981 1 38 38
39 0.47060 1 39 39
40 0.48353 1 40 40
48
CHAPTER – Ⅳ
Science has basically been divided into theoretical and experimental disciplines, but
during the last several decades computing has emerged as an important part of science.
Scientific computing is closely based to theory, but it has many characteristics in
common with experimental work. It is therefore often viewed as a new third branch of
science. In most fields of science, computational work is a very important complement
to both theory as well as experiments, and nowadays a large majority of both
theoretical and experimental papers involve some numerical calculations, computer
modeling or simulations. In theoretical and experimental sciences there are good
established codes of conducts for how methods as well as results are published and
made available to other scientists. For example, in theoretical sciences, derivations,
proofs as well as results are published in full detail and in experimental sciences, the
methods used as well as results are published. In computational sciences there are not
yet any well established guidelines for how source code as well as generated data
should be handled. For example, it is relatively rare that source code used in
simulations for published papers are provided to readers, in contrast to the open
nature of theoretical and experimental work. It is not uncommon that source code for
simulation software is withheld as well as considered a competitive advantage. So, this
problem has recently started to attract increasing attention, as well as a number of
editorials in high-profile journals have called for increased openness in computational
sciences. Some journals, including Science, have even started to demand of authors to
provide the source code for simulation software used in publications to readers upon
request. Replication (An author of a scientific paper that involves numerical calculations
should be able to rerun the simulations as well as replicate the results upon request
and other scientist should also be able to perform the same calculations as well as
obtain the same results, given the information about the methods used in a
publication.) and reproducibility (The results obtained from numerical simulations
should be reproducible with an independent implementation of the method.) are two
of the cornerstones in the scientific method. In short summary, a sound scientific result
should be reproducible, as well as a sound scientific study should be replicable.
Ensuring replicability as well as reproducibility of scientific simulations is a complicated
problem, but there are some good tools to help with this such as Revision Control
System (RCS) software (git, mercurial (hg) and subversion (svn)) as well as online
repositories for source code, that available as both public and private repositories
(GitHub, Bit bucket and Privately hosted repositories). Python is a modern, general-
purpose, object-oriented, high-level programming language that includes some general
49
characteristics like clean and simple language, expressive language, dynamically typed,
automatic memory management and interpreted. The main advantage is ease of
programming, minimizing the time required to develop, debug, maintain the code,
modular, object-oriented programming, good system for packaging, re-use of code,
documentation tightly integrated with the code, large standard library, and a large
collection of add-on packages. Python has a strong position in scientific computing
because it contains extensive ecosystem of scientific libraries as well as environments
like numpy, scipy, matplotlib etc. Python supports for parallel processing with
processes and threads, Interprocess communication as well as GPU computing and
suitable for use on high-performance computing clusters.
50
4.2 Methodology of Implementing Python for current Project
4.2.1 Jupyter Notebook
o Jupyter Notebook (open source code), which began as the iPython
Notebook project, is a development environment for writing and
executing Python code. Jupyter Notebook is often used for
exploratory data analysis and visualization.
o Project Jupyter is the top-level project name for all of the subprojects
under development, which includes Jupyter Notebook. Jupyter Notebooks
can also run code for other programming languages such as Julia and R.
o The key piece of Jupyter Notebook infrastructure is a web application that
runs locally for creating and sharing documents that contain embedded
code and execution results.
o IPython Notebook was the original project that proved that there was
great demand among data scientists and programmers for an interactive,
repeatable development environment. Jupyter Notebook became the new
official name for the overall project during The Big Split after the IPython
Notebook project matured into distinct submodules such as the interactive
shell, notebook document format and user interface widgets tools.
However, the IPython Notebook name sticks around as the Python
backend for Jupyter Notebook which is seriously confusing if you are
searching the internet and come across both current and old articles that
use all of these names interchangeably.
4.2.2 Python Version
For this current project we used python 3.9.5 version for developing code. Python
is an easy to learn, powerful programming language. It has efficient high-level
data structures and a simple but effective approach to object-oriented
programming. Python’s elegant syntax and dynamic typing, together with its
interpreted nature, make it an ideal language for scripting and rapid application
development in many areas on most platforms.
4.2.3 Python Libraries
A library is a collection of pre-combined codes that can be used iteratively to
reduce the time required to code. They are particularly useful for accessing
the pre-written frequently used codes, instead of writing them from scratch
every single time. Similar to the physical libraries, these are a collection of
reusable resources, which means every library has a root source. This is the
foundation behind the numerous open-source libraries available in
Python. There are many libraries but we are listing the libraries which we
used during this current project.
o NumPy : NumPy is the basic package for scientific computing in Python
that provides multi-dimensional arrays and matrices, broadcasting
51
functions, tools for integrating C/C++, Fortran code, mathematical,
logical, shape manipulation, sorting, selecting, I/O, useful linear algebra,
Fourier transform, random number capabilities, basic statistical operations
and much more. NumPy can be used as an efficient multi-dimensional
container of generic data and it is licensed under the BSD license.
o SciPy library : SciPy library is one of the core packages used by
scientists, analysts, and engineers that provides many user-friendly and
efficient numerical routines such as routines for numerical integration,
optimization, linear algebra, integration, interpolation, special functions,
FFT, signal and image processing. SciPy builds on the NumPy array
object as well as is part of the NumPy stack that includes tools like
Matplotlib, pandas and SymPy. The SciPy library is currently distributed
under the BSD license, as well as its development is supported and
sponsored by an open community of developers. It is also supported by
Numfocus that is a community foundation for supporting reproducible
and accessible science.
o Matplotlib : Matplotlib is a 2D plotting library for the Python
programming language that produces publication quality figures in a
variety of hardcopy formats as well as
o interactive environments across platforms. Matplotlib tries to make easy
things easy as well as hard things possible and provides an object-oriented
API for embedding plots into applications using general-purpose GUI
toolkits such as wxPython, Qt, or GTK+. Matplotlib was mainly written
by John D. Hunter, has an active development community, and is
distributed under a BSD-style license.
Our project is to develop full working code for any type of truss structure for fea
analysis. Inorder to develop pythode code using jupyter Notebook we considered
Railway Bridge problem from the text book of Introduction to finite elements in
Engineering by Tirupathi R. Chandrapatla and Ashok D Belugundu.
4.3.1 Formulation of Truss behind developing code for static analysis
There are two joints for an arbitrarily inclined single truss element (at an angle q ,
positive counter-clockwise from +ve x- axis). For each joint i, there are two degrees
of freedom, i.e.,a joint can have horizontal displacement u(i) and vertical
displacement v(i) . Hence, for a single truss element, there are 4 degrees of freedom.
The nodal displacement degrees of freedom and the nodal force de grees of freedom
are shown in the following figgure.
52
Fig 4.1 displacement of truss at nodes
Note that the deformations occurring in the truss members are so small that they are
only axial. The axial displacement of the truss can be resolved along horizontal x-
axis and vertical y-axis. But in our derivation, let us resolve the horizontal and
vertical displacements (in xy-axes) of a joint along and perpendicular to the truss
member (in x’y-axes). Refer to the Figure in the next page. Note ui sinq component
acting towards negative y -direction and all other components acting towards in +ve
x - and y -directions.
53
{u¢}=[T ]{u}
where [T]is the transformation matrix It is important to note that the
displacements v ¢(i) and v(i) are both zero since there can be no displacements
perpendicular to the length of the member. Also [T ]-1 =[T ]T
Similarly, we resolve forces along the length of the member (positive x direction)
and perpendicular to the length of the member (positive y direction)
{F '}=[T ]{F }
where [T]is the transformation matrix
The arbitrarily inclined truss member can be thought of as a simple bar element
oriented at the same angle q . Hence, we can write the finite element equation for this
inclined bar element (in x¢ycoordinate system) as
55
calculations using the FEM, the object being analyzed can have arbitrary shape and the
results of the calculations are acceptable. The types of equations which arise from modal
analysis are those seen in eigensystems. The physical interpretation of
the eigenvalues and eigenvectors which come from solving the system are that they
represent the frequencies and corresponding mode shapes. Sometimes, the only desired
modes are the lowest frequencies because they can be the most prominent modes at
which the object will vibrate, dominating all the higher frequency modes.
It is also possible to test a physical object to determine its natural frequencies and mode
shapes. This is called an Experimental Modal Analysis. The results of the physical test
can be used to calibrate a finite element model to determine if the underlying
assumptions made were correct (for example, correct material properties and boundary
conditions were used).
1 0 0
2 1800 3118
56
3 3600 0
4 5400 3118
5 7200 0
6 9000 3118
7 10800 0
8 12600 3118
9 14400 0
10 16200 3118
11 18000 0
12 19800 3118
13 21600 0
14 23400 3118
15 25200 0
16 27000 3118
17 28800 0
18 30600 3118
19 32400 0
1 1 3
2 3 5
3 5 7
4 7 9
57
5 9 11
6 11 13
7 13 15
8 15 17
9 17 19
10 2 4
11 4 6
12 6 8
13 8 10
14 10 12
15 12 14
16 14 16
17 16 18
18 1 2
19 2 3
20 3 4
21 4 5
22 5 6
23 6 7
24 7 8
25 8 9
26 9 10
27 10 11
28 11 12
58
29 12 13
30 13 14
31 14 15
32 15 16
33 16 17
34 17 18
35 18 19
1 Hinged Support
1 0 -280000
3 0 -210000
5 0 -210000
7 0 -210000
9 0 -210000
11 0 -210000
13 0 -210000
15 0 -210000
17 0 -210000
59
19 0 -360000
60
4.4 Python code for truss structure for Static and Dynamic Analysis
# importing libraries
import math
import matplotlib.pyplot as plot
import numpy as np
# creating path for a file
file = open(r"D:\Remo desktop\PhD work\Python Project 2021\out.txt","w+")
# creating input data and print
noofnodes=int(input("enter the total number of nodes"))
file.write("the total number of nodes= "+str(noofnodes)+ '\n')
noofelements=int(input("enter the total number of elements"))
file.write("the total number of elements= "+str(noofelements)+ '\n')
coordinates={}
for i in range(1,noofnodes+1):
coordinates[i]=list(map(int,input("enter coordinates for node "+ str(i)+ ' in mm
:').split(",")))
file.write('coordinates for node' + str(i)+ 'in mm : '+ str(coordinates[i])+ '\n')
area=float(input("enter area in mm-square"))
file.write("area in mm-square= "+str(area)+ '\n')
elasticity=float(input("enter the modulus of elasticity in N/mm-square"))
file.write("modulus of elasticity in N/mm-square= "+str(elasticity)+ '\n')
startend={}
for i in range(1,noofelements+1):
startend[i]=list(map(int,input("enter the start node and end node for element "+
str(i)+ ' :').split(",")))
file.write('the start node and end node for element '+ str(i)+ ' :'+str(startend[i])+ '\n')
noofsuppnodes=int(input("enter the total number of nodes having supports"))
file.write('the total number of nodes having supports '+str(noofsuppnodes)+ '\n')
nodesandtypesupport=[]
for i in range(noofsuppnodes):
x=int(input("enter the node number having support"))
print("enter the type of support")
print("h for hinged/fixed")
print("hrs for horizontal roller support")
print("vrs for vertical roller support")
t=input()
file.write('the node number having support is '+str(x)+' type of support is '+t+ '\n')
61
nodesandtypesupport.append([x,t.lower()])
print(nodesandtypesupport)
noofloadnodes=int(input("enter total number of loaded nodes "))
file.write('total number of loaded nodes '+str(noofloadnodes)+ '\n')
loadnodes=[]
typeofload={}
for i in range(noofloadnodes):
x=int(input("enter the node number having load "))
loadnodes.append(x)
typeofload[x]=list(map(float,input('enter the horizontal and vertical loads in N
').split(',')))
file.write('the node number having load is '+str(x)+' horizontal and vertical
loads in N is '+str(typeofload[x])+ '\n')
density=float(input("enter density in gm/mm-cube "))
poission=float(input("enter poission's ratio "))
file.write('density in gm/mm-cube is '+str(density)+ '\n')
file.write('poissions ratio is '+str(poission)+ '\n')
# calculating length of element direction cosines
lengthofelements={}
cos={}
sin={}
for i in range(1,noofelements+1):
x,y=startend[i][0],startend[i][1]
a,b=coordinates[x][0],coordinates[x][1]
c,d=coordinates[y][0],coordinates[y][1]
l=math.sqrt((d-b)**2+(c-a)**2)
lengthofelements[i]=l
cos[i]=(c-a)/l
sin[i]=(d-b)/l
for i in range(1,noofelements+1):
mat=[[2,0,1,0],[0,2,0,1],[1,0,2,0],[0,1,0,2]]
a=(area*density*lengthofelements[i])/6
for j in range(4):
for k in range(4):
mat[j][k]=a*mat[j][k]
print("mass matrix of element "+str(i))
for j in range(4):
for k in range(4):
print(mat[j][k],end=' ')
print()
print()
print()
mass[i]=mat
# calculating Global Stiffness matrix and global mass matrix
ndof = noofnodes * 2
print(ndof)
globstifmat=[]
for i in range(ndof):
globstifmat.append([0]*ndof)
x=0
asinode={}
for i in range(1,noofnodes+1):
asinode[i]=[x,x+1]
63
x+=2
e=startend
n=asinode
d={}
for i in range(1,noofelements+1):
x=[]
p=e[i]
q=p[0]
r=p[1]
x.extend([n[q][0],n[q][1],n[r][0],n[r][1]])
d[i]=x
print(d)
for i in range(ndof):
for j in range(ndof):
s=0
for k in d:
if(i in d[k] and j in d[k]):
zzz=stiffness[k]
s+=zzz[d[k].index(i)][d[k].index(j)]
globstifmat[i][j]=s
print("global stiffness matrix ")
for j in range(ndof):
for k in range(ndof):
print(globstifmat[j][k],end=' ')
print()
print()
print(len(globstifmat))
print(len(globstifmat[0]))
ndof = noofnodes * 2
print(ndof)
globmassmat=[]
for i in range(ndof):
globmassmat.append([0]*ndof)
for i in range(ndof):
for j in range(ndof):
s=0
for k in d:
if(i in d[k] and j in d[k]):
zzz=mass[k]
64
s+=zzz[d[k].index(i)][d[k].index(j)]
globmassmat[i][j]=s
print("global mass matrix ")
for j in range(ndof):
for k in range(ndof):
print(globmassmat[j][k],end=' ')
print()
print()
# calculating global load vector
globloadvector=[0]*noofnodes*2
for i in typeofload:
globloadvector[asinode[i][0]]=typeofload[i][0]
globloadvector[asinode[i][1]]=typeofload[i][1]
print(globloadvector)
print(nodesandtypesupport)
coltorem=[]
rowtorem=[]
for i in nodesandtypesupport:
if(i[1]=='h'):
coltorem.extend(asinode[i[0]])
rowtorem.extend(asinode[i[0]])
elif(i[1]=='hrs'):
coltorem.append(asinode[i[0]][1])
rowtorem.append(asinode[i[0]][1])
elif(i[1]=='vrs'):
coltorem.append(asinode[i[0]][0])
rowtorem.append(asinode[i[0]][0])
print(coltorem)
print(rowtorem)
npglobstifmat=np.array(globstifmat)
onpglobstifmat=npglobstifmat
print(npglobstifmat)
print(npglobstifmat.shape)
# Reducing Global Stiffness Matrix, global mass matrix and global load vector
#removing row
npglobstifmat=np.delete(npglobstifmat, rowtorem, 0)
print(npglobstifmat)
65
print(npglobstifmat.shape)
#removing column
npglobstifmat=np.delete(npglobstifmat, rowtorem, 1)
print(npglobstifmat)
rednpglobstifmat=npglobstifmat
print(npglobstifmat.shape)
#mass matrix removing rows nd columns
npglobmassmat=np.array(globmassmat)
onpglobmassmat=npglobmassmat
print(npglobmassmat)
npglobmassmat=np.delete(npglobmassmat, rowtorem, 0)
print(npglobmassmat)
npglobmassmat=np.delete(npglobmassmat, rowtorem, 1)
print(npglobmassmat)
rednpglobmassmat=npglobmassmat
print(npglobmassmat.shape)
print(globloadvector)
#coverting to column vector
npglobloadvector=np.array(globloadvector)
orignpglobloadvector=npglobloadvector
print(npglobloadvector.shape)
#removing rows
npglobloadvector=np.delete(npglobloadvector, rowtorem, 0)
print(npglobloadvector)
print(npglobloadvector.shape)
# Solving KQ = F to determine Nodal Displacments
#linear eqn solving
a = npglobstifmat
b = npglobloadvector
nodaldisplacement = np.linalg.solve(a, b)
print("nodal displacement matrix in mm")
print(nodaldisplacement)
#changing dimension
xx=[]
zz=list(nodaldisplacement)
i=0
s=set(rowtorem)
for j in range(noofnodes*2):
if(j not in s):
xx.append(nodaldisplacement[i])
66
i+=1
else:
xx.append(0)
print(xx)
file.write('nodal displacements in mm are ' + str(xx)+'\n')
#changing to col matrix
npnodaldisplacement=np.array(xx)
print(npnodaldisplacement.shape)
print('nodal displacement vector in mm')
print(npnodaldisplacement)
# calculating Element Stresses
elementstresses={}
for i in range(1,noofelements+1):
l=cos[i]
m=sin[i]
m1=np.array([-l,-m,l,m]).reshape(1,-1)
pq=[]
for z in d[i]:
pq.append(npnodaldisplacement[z])
zz=np.array(pq).reshape(-1,1)
a=(elasticity/lengthofelements[i])
b=np.matmul(m1,zz)
elementstresses[i]=a*b
print("element stresses in N/mm-square")
for i in elementstresses:
print("element"+str(i)+"="+str(elementstresses[i][0][0]))
npglobstifmat=np.array(globstifmat)
x=np.matmul(npglobstifmat,npnodaldisplacement)
y=x-orignpglobloadvector
reactionmat=y
print("reaction at support nodes in N")
print(reactionmat)
j=0
for i in nodesandtypesupport:
67
if(i[1]=='h'):
print('reaction node at R'+str(i[0])+"X in N "+str(reactionmat[(i[0]-1)*2]))
print('reaction node at R'+str(i[0])+"Y in N "+str(reactionmat[(i[0]-1)*2+1]))
file.write('reaction node at R'+str(i[0])+"X in N "+str(reactionmat[(i[0]-1)*2])+
'\n')
file.write('reaction node at R'+str(i[0])+"Y in N "+str(reactionmat[(i[0]-
1)*2+1])+ '\n')
elif(i[1]=='hrs'):
print('reaction node at R'+str(i[0])+"Y in N "+str(reactionmat[(i[0]-1)*2+1]))
file.write('reaction node at R'+str(i[0])+"Y in N "+str(reactionmat[(i[0]-
1)*2+1])+ '\n')
elif(i[1]=='vrs'):
print('reaction node at R'+str(i[0])+"X in N "+str(reactionmat[(i[0]-1)*2]))
file.write('reaction node at R'+str(i[0])+"X in N "+str(reactionmat[(i[0]-1)*2])+
'\n')
#modal analysis
#(globalstiffnessmatrix-(lambda)globalmassmatrix)X
class Eigen(object):
68
def GetOrthogonalVector(self, ndofs, trial, mg, ev,evec):
const = 0
s = [ndofs]
sumcu= np.zeros(s)
for e in range(ev ):
U = evec[:,e]
const += trial @ mg @ U
cu = [x * const for x in U]
sumcu += cu
trial = trial - sumcu
return trial
def Solve(self,kg, mg, tolerance = 0.00001 ):
dims = kg.shape
ndofs = dims[0]
s = (ndofs,ndofs)
evec = np.zeros(s)
s = (ndofs)
eval = np.zeros(ndofs)
trial = np.ones(ndofs)
eigenvalue0 = 0
for ev in range(ndofs):
print("Computing eigenvalue and eigen vector " + str(ev) + "... " , end="")
converged = False
uk_1 = trial
k=0
while converged == False:
k += 1
if ev > 0:
uk_1 = self.GetOrthogonalVector(ndofs,uk_1,mg,ev,evec)
vk_1 = mg @ uk_1
uhatk = np.linalg.solve(kg,vk_1)
vhatk = mg @ uhatk
uhatkt = np.transpose(uhatk)
eigenvalue = (uhatkt @ vk_1)/(uhatkt @ vhatk)
denominator = math.sqrt(uhatkt @ vhatk)
uk = uhatk/denominator
tol = abs((eigenvalue - eigenvalue0) / eigenvalue)
if tol <= tolerance:
69
converged = True
evec[:,ev] = uk
eval[ev] = eigenvalue
print("Eigenvalue = " + str(eigenvalue))
print('no of iterations= ',k)
else:
eigenvalue0 = eigenvalue
uk_1 = uk
if k > 1000:
evec[:,ev] = uk
eval[ev] = eigenvalue
print ("could not converge. Tolerance = " + str(tol))
break
self.eigenvalues = eval
return evec
rednpglobstifmat.shape
rednpglobmassmat.shape
# compute eigenvalues and eigen vectors
e = Eigen()
evec = e.Solve(rednpglobstifmat,rednpglobmassmat)
evect = e.RescaleEigenVectors(evec)
eval = e.eigenvalues
neval = len(eval)
print("eigen values")
eigvalues=e.eigenvalues
print(e.eigenvalues)
file.write("eigen values are "+str(eigvalues)+'\n')
print(len(e.eigenvalues))
print("eigen vectors")
print(len(evect))
print(evect)
for i in evect:
file.write("eigen vectors are "+str(list(i))+'\n')
from scipy.linalg import eigvalsh
ab=eigvalsh(rednpglobstifmat,rednpglobmassmat)
print(ab[0])
f1=np.sqrt(ab[0])
70
f1
f2=np.sqrt(ab[0])
f2=f2/(2*3.14)
f2
#frequency
freq=[]
for i in eigvalues:
freq.append(math.sqrt(i)/(2*3.14))
print("natural frequency in hertz",freq)
file.write("natural frequency in hertz "+str(freq)+ '\n')
import matplotlib.pyplot as plt
z=1
for i in evect:
time = np.array(i)
amplitude = np.sin(time)
plot.plot(time, amplitude)
plot.title('mode'+str(z))
plot.xlabel('vector')
plot.ylabel('sin(vector)')
plot.grid(True, which='both')
plot.axhline(y=0, color='k')
plot.savefig(r"D:\Remo desktop\PhD work\Python Project
2021\mode"+str(z)+'.png', bbox_inches='tight')
plot.show()
plot.show()
z+=1
file.close()
88
0.02690913664607076, -0.08053868493887521, -0.08976191098687084,
0.02138023115097929]
eigen vectors are [0.1725311904068664, 0.21631415434606466, -
0.34063137776943236, 0.4951636799784924, 0.3569001149130205,
0.5470687253186791, -0.37548566763920516, 0.3844708366425129, -
5.726194443605213, -1.8638741550248314, -0.26483759900236353,
0.1862755365372125, 0.20801509288560988, 0.2411345559758594,
0.19529768849300172, -0.7908977044198306, 0.19085443008166667, -
0.7669717056713958, 0.18746574948192649, -0.7484958418741231,
0.18513852080782134, -0.7340132188626849, 0.1834497968315468, -
0.7224374351441978, -0.7462084111042016, 0.18308548719733586, -
0.7311237642677174, 0.18182207004056308, -0.7193655131601153,
0.1808422545094237, -0.7099424314165719, 0.18005883066983644, -
0.7022199456916531, -0.7069684851001788, 0.1792002024882986]
eigen vectors are [-0.2891576758597114, 0.7285863169669518,
0.8200063862766722, -0.01634406194298168, -1.1070465455964957, -
1.2244949171564008, 0.3661413139819448, 0.5299318810178555, -
1.2148930284577546, 0.30006207947242036, -1.5293462560769877,
0.7856652205367481, -0.09470080417885984, 0.11129670341190978, -
0.16470706103879698, 0.9517914233371336, -0.19247100476223764,
0.9635525654178776, -0.2100084777644408, 0.9728261575960667, -
0.22213840432099963, 0.9801902162173645, -0.2309873068876496,
0.9861289978648213, 0.9737378297942274, -0.23286816272838357,
0.9815539046827625, -0.2395478518685038, 0.987670415599645, -
0.2447365012378604, 0.9925879906434496, -0.24889063322997193,
0.9966289978922684, 0.9941357413827956, -0.2534505229283462]
natural frequency in hertz [0.007703503204665013,
0.022991600605499613, 0.029906056449980054, 0.05339928477376626,
0.07531757807865841, 0.07104669894212147, 0.05333697346367255,
0.027231599568402928, 0.012772210975147915, 0.010677490254064573,
0.023010982615878518, 0.023787264146577062, 0.009696317064634398,
89
0.014113478513246161, 0.008554170055072698, 0.007951486848923174,
0.008226394161470186, 0.007895503869950136, 0.008054194602876177,
0.007855526590241307, 0.007954627092713318, 0.007826517972431668,
0.00789233437775372, 0.00780498893290061, 0.007850875842142314,
0.00788011335206704, 0.007821031537877629, 0.00784046858362362,
0.007799552608904261, 0.007813139572461643, 0.007783574311242421,
0.0077934536174361566, 0.00777135850232812, 0.007778775096071561,
0.0077740987579034545].
CHAPTER – Ⅴ
5.1 Results
This project carried out in ANSYS APDL Software and Python for validation
purpose for both static and vibration analysis for any truss structure.
90
Fig 5.1 deformation of stress in model analaysis
5.1.1 Results comparison for validation between Ansys APDL and Python
Code:
Static analysis results of python code were compared with Ansys APDL
software. The below tables shows the comparision of nodal displacements ,
element stresses and reaction forces at the supports.
Reaction Reaction
Reaction forces forces
forces from from
93
Ansys Python
APDL in N Code in N
1.1816E- 1.1816E-
R1x 08 08
R1y 1119999.9 1119999.9
R19y 1199999.9 1199999.9
From the above comparison we found almost zero error between the results
obtained using python code and ANSYS software.
From this we can confirm that the python code which we developed is working
fully with almost zero error.
5.1.2 Modal Analysis using Python Code:
Just for validation we compared any of five natural frequencies from both
python and ansys software and we found that the results obtained are very close.
Already results obtained from ansys software were discussed in chapter 3. In this
chapter we will show the results obtained from python code.
94
From the data of current project we obtained 35 mode shapes for the
corresponding natural frequencies. The following fig shows the model shapes of
truss structure.
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Fig 5.2 Figures of mode shapes
112
CHAPTER – Ⅵ
CONCLUSIONS AND FUTURE SCOPE
6.0 Conclusions
From the present investigation, it can be concluded that the results
obtained by running python code were almost matched with the results obtained
from ANSYS APDL software. The current project investigated static and
vibrational analysis of Railway Bridge structure using Python code and results
obtained are exceptional.
The python code which we developed is suitable for all truss structures
with any material. Our code is restricted to linear properties only.The code
which we developed is used for automation for conducting stress analysis and
vibration analysis .
If for different materials this same experiment has to run, then the entire
pre-processing process has to be changed and re-run the analysis. If in another
case the truss structure was different or number of elements used are differnet,
then the entire modeling work and then the pre & post works has to be carried
out newly while using ANSYS APDL Software. With this Python code, the
mentioned challenges can be solved very easily and at rocket speeds.
6.1 Future Scope
This Python code developed for any type of truss structure. In future it
can be upgraded to work for all structural members like beams plates columns
etc Also same procedure can be followed to develop python code that can work
for plates with notches. Also we can implement in composite materials also.
113
CHAPTER Ⅶ
REFERENCE
[1] An Object-Oriented class design for the Generalized Finite Element Method
programmingDorivalPiedadeNeto* ManoelDênis Costa FerreiraSergio
PersivalBaronciniProença, latin American journal of solids and structures,
10(2013) 1267 – 1291
[3] Bordas, S. P. A., Nguyens, P. V., Dunant, C., Guidoum, A., Nguens-Dand, H.
(2007). An extended finite element library, International Journal for Numerical
Methods in Engineering, Vol. 71, pp. 703-732
[6] Cimrman, R., Lukeš, V., & Rohan, E. (2019). Multiscale finite element
calculations in Python using SfePy. Advances in Computational Mathematics.
doi:10.1007/s10444-019 09666-0