You are on page 1of 77

A Project

on
Computer Languages for Engineers

SUBMITTED BY
Majety, Narasimha Rao (3063753)

UNDER THE GUIDANCE OF

Dr. rer. nat. Ernst Baeck


Fakultät für Ingenieurwissenschaften
Abteilung für Bauwissenschaftten
Fachgebiet Baustatik und Baukonstruktion

31 July 2021
SS - 2021
Contents

1 OVERVIEW 7
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 FORTRAN . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.5 The Code::Blocks IDE . . . . . . . . . . . . . . . . . . . . . 8

2 IMPLEMENTATION OF NEWTON’S ALGORITHM 9


2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Function for Newton’s Method . . . . . . . . . . . . . . . . . 10
2.3 Input File . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 Project Structure . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4.1 Introduction of Project Scan for Roots . . . . . . . . . 12
2.4.2 Algorithm of the Project . . . . . . . . . . . . . . . . 12
2.5 Program Explination . . . . . . . . . . . . . . . . . . . . . . 17
2.6 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.6.1 Function 1 . . . . . . . . . . . . . . . . . . . . . . . 18
2.6.2 Function 2 . . . . . . . . . . . . . . . . . . . . . . . 19
2.6.3 Function 3 . . . . . . . . . . . . . . . . . . . . . . . 21
2.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3 MATRIX MULTIPLICATION 23
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2 Description of the Project . . . . . . . . . . . . . . . . . . . . 24
3.3 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.4 Program Explination . . . . . . . . . . . . . . . . . . . . . . 26
3.5 Results from FORTRAN . . . . . . . . . . . . . . . . . . . . 27
3.6 Validation of results with MATLAB . . . . . . . . . . . . . . 28
3.7 conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

1
4 Thin-Walled Approximation For Sectional Values Using C++ 30
4.1 Problem Description . . . . . . . . . . . . . . . . . . . . . . 30
4.2 Theoretical Background . . . . . . . . . . . . . . . . . . . . . 31
4.2.1 Area of Cross Section . . . . . . . . . . . . . . . . . 31
4.2.2 Center of Gravity . . . . . . . . . . . . . . . . . . . . 32
4.2.3 Moment of Inertia . . . . . . . . . . . . . . . . . . . 32
4.2.4 First Moments of an Area . . . . . . . . . . . . . . . 33
4.2.5 Moment of Inertia About User Coordinates . . . . . . 33
4.2.6 Moment of Inertia about Center of Mass . . . . . . . 34
4.3 Profile Values . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.4 Approximation of the Problem . . . . . . . . . . . . . . . . . 35
4.5 Analytical Calculations . . . . . . . . . . . . . . . . . . . . . 39
4.5.1 Area . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.5.1.1 Case 1: [Profile with U100] . . . . . . . . . 40
4.5.1.2 Case 2: [Profile with U120] . . . . . . . . . 40
4.5.1.3 Case 3: [Profile with U140] . . . . . . . . . 40
4.5.2 First Moment of Area . . . . . . . . . . . . . . . . . . 41
4.5.2.1 Case 1: [Profile with U100] . . . . . . . . . 41
4.5.2.2 Case 2: [Profile with U120] . . . . . . . . . 41
4.5.2.3 Case 3: [Profile with U140] . . . . . . . . . 42
4.5.3 Center of Mass . . . . . . . . . . . . . . . . . . . . . 42
4.5.3.1 Case-1: [Profile with U100] . . . . . . . . . 43
4.5.3.2 Case-2: [Profile with U120] . . . . . . . . . 43
4.5.3.3 Case-3: [Profile with U140] . . . . . . . . . 43
4.5.4 Moment of Inertia About User Coordinates . . . . . . 44
4.5.4.1 Case-1: [Profile with U100] . . . . . . . . . 44
4.5.4.2 Case-2: [Profile with U120] . . . . . . . . . 46
4.5.4.3 Case-3: [Profile with U140] . . . . . . . . . 48
4.5.5 Mass moment of Inertia . . . . . . . . . . . . . . . . 49
4.5.5.1 Case-1: [Profile with U100] . . . . . . . . . 50
4.5.5.2 Case-2: [Profile with U120] . . . . . . . . . 52
4.5.5.3 Case-3: [Profile with U140] . . . . . . . . . 54
4.6 Project Structure . . . . . . . . . . . . . . . . . . . . . . . . 56
4.6.1 Base Class . . . . . . . . . . . . . . . . . . . . . . . 56
4.6.2 Node Class . . . . . . . . . . . . . . . . . . . . . . . 56
4.6.3 Element Class . . . . . . . . . . . . . . . . . . . . . 57
4.6.4 Line-Element . . . . . . . . . . . . . . . . . . . . . . 58

2
4.6.5 Arc-Element . . . . . . . . . . . . . . . . . . . . . . 59
4.6.6 Profile class . . . . . . . . . . . . . . . . . . . . . . . 59
4.6.7 Gauss Class . . . . . . . . . . . . . . . . . . . . . . . 60
4.6.8 CombinedProfile Class . . . . . . . . . . . . . . . . . 61
4.6.9 UML class Hierarchy . . . . . . . . . . . . . . . . . . 62
4.6.10 Error Handling . . . . . . . . . . . . . . . . . . . . . 63
4.6.11 Profile Creation Structure . . . . . . . . . . . . . . . 64
4.7 User Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.7.1 Execution of The code . . . . . . . . . . . . . . . . . 65
4.7.2 Output Window . . . . . . . . . . . . . . . . . . . . . 66
4.8 Results and Deviation . . . . . . . . . . . . . . . . . . . . . . 69
4.8.1 Analytical Results . . . . . . . . . . . . . . . . . . . 69
4.8.2 Numerical Results . . . . . . . . . . . . . . . . . . . 69
4.8.3 Deviation of Results . . . . . . . . . . . . . . . . . . 70
4.9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

A Appendix 72

3
List of Figures
2.1 Graphical representation of Newton-Raphson method . . . . . 9
2.2 Input File Structure . . . . . . . . . . . . . . . . . . . . . . . 11
2.3 Implementation of main program "ScanForRootsMain.f90" . . 12
2.4 Checking of the input values . . . . . . . . . . . . . . . . . . 13
2.5 Searching for the roots . . . . . . . . . . . . . . . . . . . . . 14
2.6 Newton Method . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.7 Roots checking . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.8 Output window for Function 1 . . . . . . . . . . . . . . . . . 18
2.9 Function 1 plot showing roots . . . . . . . . . . . . . . . . . 19
2.10 Output window for Function 2 . . . . . . . . . . . . . . . . . 20
2.11 Function 2 plot showing roots . . . . . . . . . . . . . . . . . 20
2.12 Output window for Function 3 . . . . . . . . . . . . . . . . . 21
2.13 Function 3 plot showing roots . . . . . . . . . . . . . . . . . 22
3.1 Matrix Multiplication Flowchart . . . . . . . . . . . . . . . . 25
3.2 Matrix Multiplication Results from FORTRAN . . . . . . . . 28
3.3 Matrix Multiplication Results from Matlab . . . . . . . . . . . 29
4.1 Schematic Diagram of The Combined Profile . . . . . . . . . 31
4.2 Approximated Geometry after Discretization . . . . . . . . . 36
4.3 UML Diagram of Base Class . . . . . . . . . . . . . . . . . . 56
4.4 UML Diagram of Node Class . . . . . . . . . . . . . . . . . . 57
4.5 UML Diagram of Element Class . . . . . . . . . . . . . . . . 58
4.6 UML Diagram of Line-Element Class . . . . . . . . . . . . . 58
4.7 UML Diagram of Arc-Element Class . . . . . . . . . . . . . . 59
4.8 UML Diagram of Profile Class . . . . . . . . . . . . . . . . . 60
4.9 UML Diagram of Gauss Class . . . . . . . . . . . . . . . . . 61
4.10 UML Diagram of a Combinedprofile Class . . . . . . . . . . . 62
4.11 The UML Class Hierarchy . . . . . . . . . . . . . . . . . . . 63
4.12 Flow Chart explaining Profile Creation . . . . . . . . . . . . . 64

4
4.13 Opening Project File . . . . . . . . . . . . . . . . . . . . . . 65
4.14 Execution of the Project File . . . . . . . . . . . . . . . . . . 65
4.15 Output Window for Case 1 . . . . . . . . . . . . . . . . . . . 66
4.16 Output Window for Case 2 . . . . . . . . . . . . . . . . . . . 67
4.17 Output Window for Case 3 . . . . . . . . . . . . . . . . . . . 68
A.1 TaskSheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
A.2 Dimensional Details and Sectional Properties of U-Profile . . 73
A.3 Dimensional Details and Sectional Properties of I-Profile . . . 74
A.4 Dimensional Details and Sectional Properties of Circle-Profile 75

5
List of Tables
4.1 circle profile dimensions . . . . . . . . . . . . . . . . . . . . 35
4.2 U-Profile dimensions . . . . . . . . . . . . . . . . . . . . . . 35
4.3 I-Profile dimensions . . . . . . . . . . . . . . . . . . . . . . . 35
4.4 Circle Node Chart . . . . . . . . . . . . . . . . . . . . . . . . 37
4.5 Arc Element Chart . . . . . . . . . . . . . . . . . . . . . . . 37
4.6 Node Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.7 Line Element Chart . . . . . . . . . . . . . . . . . . . . . . . 39
4.8 Section Values Obtained Through Analytical Calculations . . . 69
4.9 Section Values Obtained Through Numerical Calculations . . 70
4.10 Relative Error of All Three Profile Cases . . . . . . . . . . . . 71

6
Chapter 1

OVERVIEW
1.1 Introduction
Computer languages for engineers playing a significant role to solve or im-
plement the complicated mathematical models and mechanics problem. And
these programming languages are helps in avoiding complex repetitive prob-
lems. These are the revolutionary approaches in Computer Aided Design field.
During this course of study, for an extensive design calculation it is necessary
to implement programming languages and the algorithms approach by means
of C++ and FORTRAN.
The main aim of this project is acquiring the knowledge and command on
the programming languages and trying to implement them in Engineering prob-
lem related to course of study. The detailed explanation of the projects is dis-
cussed in the bellow.

1.2 Projects
This report presents the implementation and results of the given projects, which
are implemented in (FORTRAN and C++) two different Programming Lan-
guages. The Objectives are as Mentioned below:

1. Scan for roots Implementation of Newton’s Algorithm using FORTRAN

2. Matrix Multiplication using FORTRAN

3. Calculation of the sectional values of a given combined profle using C++


and to compare these results with the analytical values.

7
1.3 FORTRAN
In 1950’s FORTRAN (FORMULATRANSLATOR) was developed by the IBM
programmers. It is the world’s first modern programming language which
helped to replace the complicated Assembly binary language 0’s and 1’s. Fur-
therly Fortran has become a popular among the scientific and mathematics.Advantages
of the Fortran language are Some discussed below .

1. Fortran is a simple language

2. Fortran compilers are generally available

3. Good at numerical analysis and technical calculations

4. Efficient compilers

1.4 C++
Bjarne Stroustrup was developed a C++ program and it is the objectoriented
programming (OOP) language. C++ is an extension of the C language. Hence
C++ is possible to code in a “C style” or object-oriented style. Despite of other
programming languages, like C and Java, C++ also found to be most widely
used language for scripting. C++ is used in many applications like Gaming,
Graphic User Interfaces (GUI), Advance Computations, Graphics design, Web
Browsers, Database Software, and in Operating Systems. Especially this pro-
gramming languages were bought great revolution in Medical and Engineering
Applications.

1.5 The Code::Blocks IDE


Code Blocks is a widely used open-source cross platform IDE that supports
multiple compilers which include C++/C and FORTRAN. FORTRAN version
of code blocks need to be installed during installation, as it is a simple add on
to the original one.

8
Chapter 2

IMPLEMENTATION OF
NEWTON’S ALGORITHM
2.1 Introduction
In numerical methods, Newton’s method it is also called as Newton-Raphson
Method. “Is a method for finding successively better approximations to the
roots of a real-valued function”, and it is powerful technique for solving nu-
merical equations.
The graphical representation of the Newton Raphson method shows in the
figure 2.1.

Figure 2.1: Graphical representation of Newton-Raphson method

Where:

9
• f (x) is a function

• f 0 (x) is derivative of the function

• x0 is starting point

• x1 , x2 ,......., xn + 1 are number of approximations or iterations

In this method an iterative scheme starts with an initial guess which is rea-
sonably close the true root (X0 ), then the function is approximated by its tangent
line and computes the intercept of X-axis. With the help of this iterative method
the intercepted x-value will be a better approximation than the first considered
valve and this iterative method continues until the real roots are found.

f (x)
xn+1 = xn − (2.1.1)
f 0 (x)
With the help of Newton’s method, not only the simple calculations but also
complex polynomials can be solved. Almost all the simulation software’s are
using Newton-Raphson.

Pros and Cons of the Newton’s Method


Pros:

• Quadratic formulation is Converges fast

• Requires only one guess of iteration

Cons:

• f 0 (x) (Derivation of give function) is a real disaster

• f ”(x) (Double derivation) will causes the solution to diverse

2.2 Function for Newton’s Method


(1 − 2x − 7x2 ) ∗ sin(4x)
f (x) = (2.2.1)
(1 + xsin(2x) − x2 cos(3x))

x5
f (x) = − 10x4 − 3x3 + 8x2 − 7x − 4 (2.2.2)
2
f (x) = e−3x/4 (2 − xsin(3x)) − e3x/4 (2 + xcos(3x)) (2.2.3)

10
2.3 Input File
The Main Task of the problem is to develop a Code to find the roots in cho-
sen interval using Newton’s algorithm method. In ScanforRootsInp.inp the
parameters must define, and it should be read by the program to run the code.
Driven by the demands of the project, developer can change the input param-
eters. ScanforRootsInp.inp input file must be in a structure, so that the input
values should be read and assign to the variables in certain order. The develop-
ment of the code Should be as follows.

• Chose starting position x0

• maxroots: It contains the number of roots for a given function for a given
interval.

• Lower bound (lb): The interval in which roots need to be found.

• Upper bound (lb): The interval in which roots need to be found.

• Step size sw: Towards the max/min of the Function.

• Precision valve eps: To check the validity of roots.

• Slope deviation h: It is used in the case of vanishing slope.

• maxitx: Contains Maximum number of cycles to repeat.

The input file structure is shown in figure 2.2.

Figure 2.2: Input File Structure

The program initially should scan for the roots of the function, with the
initial position x0 . The ub, lb, and sw are the parameters described in the input
file from which the starting position x0 should be taken from the interval and the
roots of the functions which found are saved in a dynamic array. This should
be parameter of the function ScanForRootsFunction. The array size set by a
parameter and reads from the input file.

11
2.4 Project Structure
2.4.1 Introduction of Project Scan for Roots
In this section, the developed program for finding the roots is discussed. This
project contains multiple files to understand the project easily. The functional-
ity of the project is shown in terms flow charts.

2.4.2 Algorithm of the Project


The flow chart represents the implementations of the main program “ScanFor-
RootsMain.f90”. The program initially starts with reading the input data by
calling the function “inpReadfunction” values are passes to the main program
only if the input data is valid if not the program exits with an error message.
In the next step dynamic array is declared to allocate the found roots. Fur-
ther “ScanForRootsInp” function searches for the roots that are passed on and
finally this is the output file "ScanforRootsOut.out" were calculated roots are
written.

Figure 2.3: Implementation of main program "ScanForRootsMain.f90"

12
In this step "InpReadFunction" function opens the input file to read the in-
put file “ScanForRoots.inp”. In the next step the checks the input parameters
for validity and if the values are okay, then the function proceeds further calcu-
lations, otherwise it ends with an error message.

Figure 2.4: Checking of the input values

In the further step the main program calls the function “ScanForRootsInp”
to search for the roots in the specified intervals which is shown as below.

13
Figure 2.5: Searching for the roots

for the execution processes “ScanForRootsInp” function, now Newton func-


tion is called to find the roots and the process is explained in the below flow
chart.

14
Figure 2.6: Newton Method

In the above procedures, the roots are found and will check if there are
any repetition of the roots printed, the function ScanForRootsMain calls the
Subroutine “Duplicacy” as showed in the form of flow chart as below.

15
Figure 2.7: Roots checking

16
2.5 Program Explination
As discussed previously about the flow charts of different functions/subroutines
used in the program to calculate the roots of a given function. In additionally,
the individual functions will be discussing in detailed with the code in this
section:

• Main Program

– To open and read the input file, call the function 0readData
* Open and read the input file "ScanForRoots.inp"
* If the file is not readable, the program will stop and will show
an error message
* If not, it will write an input value
* To check for the validity of the input parameters perform an
error handling operation
* If the values are okay, then only returns to the main program
with input values

– Call the function "ScanForRoots" to calculate the roots of a given


function
* Call the function "Newton" and it will implement the Newton’s
algorithm to find the roots for a given function
* To find the "Duplicacy" and filter any repetitive roots call the
subroutine function

– Call the funciton "WriteOutput" to write the output in a text file


– In the "ScanForRoots.out" Open and write the output values
– If the file is unable to write, the program will get stop with an error
message

• End Program

17
2.6 Results
Using this FORTRAN Project Code, the roots for the given three functions are
calcu- lated. The results are displayed in the output window and prints the roots
in the ScanforRootsOut.out

2.6.1 Function 1
The given function is,
(1 − 2x − 7x2 ) ∗ sin(4x)
f (x) =
(1 + xsin(2x) − x2 cos(3x))
Total 15 roots have been found in the interval -5 to 5 and are successfully
listed in the output window as shown in figure 2.8 . The graphical representa-
tion of the given function in interval -5 to 5 is shown in the figure 2.9

Figure 2.8: Output window for Function 1

18
Figure 2.9: Function 1 plot showing roots

2.6.2 Function 2
The given function is,

x5
f (x) = − 10x4 − 3x3 + 8x2 − 7x − 4
2
Total 2 roots have been found in the interval -5 to 5 and are successfully
listed in the output window as shown in figure 2.10 . The graphical representa-
tion of the given function in interval -5 to 5 is shown in the figure 2.11

19
Figure 2.10: Output window for Function 2

Figure 2.11: Function 2 plot showing roots

20
2.6.3 Function 3
The given function is,

x5
f (x) = − 10x4 − 3x3 + 8x2 − 7x − 4
2
Total 7 roots have been found in the interval -5 to 5 and are successfully
listed in the output window as shown in figure 2.12 . The graphical representa-
tion of the given function in interval -5 to 5 is shown in the figure 2.13

Figure 2.12: Output window for Function 3

21
Figure 2.13: Function 3 plot showing roots

2.7 Conclusion
The main aim of developing code for the function is to scan a given algebraic
function f(x) for its roots by using the Newton’s algorithm. And the code has
been served by finding the roots for the given respective function. The imple-
mentation of newton’s scheme is resulting on how close to FORTRAN gener-
ated results are comparable to the roots generated by theoretical and this vali-
dation is done by comparing the graphical methods. The developed code has
capabilities of choosing starting point x0 and reading ub, lb parameters and
reading of sw from the input file. Therefore, this project is capable of listing
the calculated roots of the function in the output window and saves the values
in the dynamical arrays, prints the roots in the output file.

22
Chapter 3

MATRIX
MULTIPLICATION
3.1 Introduction
Multiplication of matrix is a very simple process, which is extensively using
in engineering applications such as FEA, FEM and Calculus. In general, if the
column of first matrix should have same number of entries as that of the entities
in the row of second matrix then the output of the matrix multiplication would
be considered correct. Therefore, in order to matrix multiplication must be sat-
isfy (n x m)(m x p)=(n x p). This method is useful even in case of any complex
matrix multiplication. Let consider A and B are the matrices as shown below:

   
A1,1 A1,2 · · · A1,m B1,1 B1,2 · · · B1,p
A
 2,1 A2,2 · · · A2,m 

 B2,1 B2,2
 · · · B2,p 
A =  .. ..  B =  ..

.. ... .. ... .. 
 . . .   . . . 
An,1 An,2 · · · An,m Bm,1 Bm,2 · · · Bm,p
The product of two matrices A, B is computed as A1ixj * A2jxk * A3kxm.
. . Anoxp = Sixp and represented as like AB and defined like n x p matrix.
 
AB1,1 AB1,2 · · · AB1,p
 2,1 AB2,2 · · · AB2,p 
AB 
AB =  .. .. ... .. 
 . . . 
ABn,1 ABn,2 · · · ABn,p

23
3.2 Description of the Project
The Main aim of the second Project is to develop a program in FORTRAN to
multiply a given set of Matrices.

[2X5][5X9][9X2][2X7][7X4] = [2X4]
The basic reference code structure for the Matrix multiplication has been
taken from the code developed in the Lectures. The code should be described in
a specific way for matrix multiplication. The first line should contain the num-
ber of matrices and the second line contains the number of rows and columns
of the first matrix. The following code lines should be having the values of
the matrix one. And the next line will contain the order of the next matrix, the
following lines contains the data of this matrix. This process is repeated for all
the matrices, whose product should be calculated. The problem can be diag-
nosable i.e., dynamic allocable arrays should be used for implementation of the
program variables, minimize the allocated memory for making the program an
efficient as possible, and the data should read line by line to be print in the out-
put file. The validation of the results is required to check, whether the program
is writing the accurate results or not.

3.3 Flowchart
The algorithm used for the multiplication of the chain of matrices is given be-
low:

• Declaration of the various input parameters and functions used in the


program

• Assigning the input and output files a name and Open the input file

• Call the ReadInput function and read the input matrices and their dimen-
sions

• Check the validity of the input parameters and values then open the output
file else report an opening error

• Calculate the product of first two matrices and store the results in matrix
C and deallocate matrices A and B

24
• Call MatrixMult function to calculate the product of further matrices by
assigning the third matrix to matrix A and the matrix C to matrix B.
Calculating the product of these two and storing it in matrix C

N- number of matrices multiplication represented in flowchart as:

Figure 3.1: Matrix Multiplication Flowchart

25
3.4 Program Explination
This section presents an insight into the development of the program to calcu-
late the chain of n matrices multiplication.
• Declaration of global input parameters
This section defines the different input parameters used in the program
under the main module. Some of the global declarations made in this
program described as:

– Channel numbers : These are the channel numbers assigned to


ioin and ioout
– Arrays : Different arrays was defined to store the values of the
matrices, ArrayA, ArrayB and ArrayC
– Arrays : Different arrays was defined to store the values of the
matrices, ArrayA, ArrayB and ArrayC
– Dimensions of the arrays : dimA, dimB and dimC
– Return codes : These are the integer values, that each function
returns to the main module after calling in to the program iReadMat,
iReadMatDim, iListMat and iMatMult
– Read and Write files : MatInp.inp and MatOut.out, these files are
defined to read the input values from and write the final values into
a file respectively.
• Reading Input File
In this section the different point of reference required for matrix multi-
plication, which are defined by reading the values from input file.

– Minimum matrix requirement : The minimum number of matri-


ces required for matrix multiplication. The program will be termi-
nating if the specified matrices are less than specific value.
– Dimension of matrix : In this section, the dimensions of the given
matrices are checked. If the specified dimensions are invalid, the
program terminates.
– Matrix multiplication criteria : The order of the two matrix is
A and B are mxn and pxq respectively. The multiplication of the
matrices is only possible when the specified dimensions n = p This
section checks this criterion for successive multiplication of matrix.

26
– Memory allocation : If the above specified conditions are satisfied,
then the program will allocate the memory to the arrays containing
the matrix values.

• Calculate the product of matrices


In this section the program performs the chain of matrix multiplications
and returns the final product matrixC.

– Call the matrix multiplication : In this section, the program calls


the function iMatMult to calculate the product immediately, after
allocating the memory to the first two matrices that means, MatrixA
and MatrixB
– Matrix product : The product of the given two matrices MatrixA
and MatrixB will be calculated as follows:

c(i, j) = A(i, k) ∗ B(k, j)


– Deallocate matrices : The memory of the matrix A and the matrix
B are deallocated immediately after computing product of the first
two matrices.
– Chain product : Eventually, the values of matrix C are dynamically
transferred into matrix A and the next matrix values are allocated to
matrix B, and the product of these two matrices are computed and
also stored in matrix C. In the next step the matrix C will have the
multiplication values. This process is continuing for all the matri-
ces.

• Writing output file


After the calculation of all the matrices by considering the previous steps,
then the program will call the write function, which lists all the matrices
and their values in an output file MatOut.out along with the final matrix
multiplications. The results will be displayed in the output file along with
the final product of all the matrices.

3.5 Results from FORTRAN


FORTRAN generated output file for the matrix multiplication is shown in figure
3.2

27
Figure 3.2: Matrix Multiplication Results from FORTRAN

The final result of multiplication of 5 matrices is


 
125764 286125 248507 375278
226424 519020 448978 676692

3.6 Validation of results with MATLAB


To validate this solution, the multiplication of all matrices given as input is done
using MATLAB as shown in figure 3.3.

28
Figure 3.3: Matrix Multiplication Results from Matlab

3.7 conclusion
The code is developed in FORTRAN for the multiplication of multiple ma-
trices. The result is compared with the results from a mathematical software
MATLAB and concludes this project is giving the efficient results.

29
Chapter 4

Thin-Walled Approximation
For Sectional Values Using
C++
C++ is a general-purpose programming language with a bias towards the system
programming that supports data abstraction. It is a Object-Oriented-Programming
(OOP). It is originally known a C with Classes. It is renamed as C++ in 1983

4.1 Problem Description


The aim of this task is to develop the project files using C++ for the given com-
bined profile, which calculates the sectional values like Area, Center of mass
and Moment of Inertia. A thin- walled approximation is implemented to cal-
culate the numerical values of sectional properties. These obtained numerical
values compared with the analytic values and evaluates the deviations for each
sectional value. The given combined profile consists of three different profiles
(1 I- Section , 2 U- Sections and 1 circle section) as shown in figure

30
Figure 4.1: Schematic Diagram of The Combined Profile

4.2 Theoretical Background


In this section, a brief introduction is given on the basic formulas which are
necessary for describing the section properties of a thin walled approximation
model. A thin-wall model of a profile section consists of set of lines which
describe the original profile at center lines.

4.2.1 Area of Cross Section


The area of a profile section is approximately the sum of all areas under the
lines of the thin-wall model.
Z n
A= eµ · dA ≈ ∑ eµ,i · Li · ti (4.2.1)
A i=1

Where,
eµ,i = T he relative elasticity o f line i f or only one material.

31
Li = T he length o f line i.
ti = T he thickness o f line i.

4.2.2 Center of Gravity


A point where whole weight of the body is equally distributed is called Center
of gravity and is calculated by taking moments of the object in the numerator
and whole weight of the body in the denominator. The mathematical relation
for the Center of gravity of a profile is given as follows.

∑ni=1 x̄i ·Ai


R
A x · dA
Xc = ≈ (4.2.2)
∑ni=1 Ai
R
A dA

∑ni=1 ȳi ·Ai


R
A y · dA
Yc = ≈ (4.2.3)
∑ni=1 Ai
R
A dA

x̄i and ȳi represent the center of gravity of the profile.

Where,
Ai = T he area o f line i.
x̄i = T he x coordinate o f the center o f line i.
ȳi = T he y coordinate o f the center o f line i.

4.2.3 Moment of Inertia


Moment of Inertia is the resistive torque against the angular acceleration of the
body. So generally it can be written how much inertial force is required in
order to accelerate the body rotationally. This can be written mathematically
mass times square of the perpendicular distance.

I = m ∗ r2 (4.2.4)

Where,
m = Mass o f the body
r = Perpendicular distance f rom the axis o f rotation
Above mathematical relation is for general case and the dierent forms of
moments of Inertia are explained below.

32
4.2.4 First Moments of an Area
The first moment of area is a measure of the distribution of the area of a shape
in relation to an axis. The first moments of an area are the area integrals given
below. The (x,y) values are related to the given coordinate system.
Z n
Sx = eµ · y · dA ≈ ∑ eµ,i · ȳi · Ai (4.2.5)
A i=1

Z n
Sy = eµ · x · dA ≈ ∑ eµ,i · x̄i · Ai (4.2.6)
A i=1

Where,
Ai = T he area o f line i.
x̄i = T he x coordinate o f the center o f line i.
ȳi = T he y coordinate o f the center o f line i.

4.2.5 Moment of Inertia About User Coordinates


This moments of inertia can be calculated with the formulas below. If we have
a given arbitrary coordinate system in general we have three values of inertia
the Ix , the Iy and the combined Ixy as follows :

n
2 ! !
yb,i − ya,i
Z
Ixx = eµ · y2 · dA ≈ ∑ eµ,i · + ȳ2i · Ai (4.2.7)
A i=1 12

n
2 ! !
xb,i − xa,i
Z
Iyy = eµ · x2 · dA ≈ ∑ eµ,i · ( + x̄i2 · Ai (4.2.8)
A i=1 12

  ! !
Z n xb,i − xa,i · yb,i − ya,i
Ixy = − eµ · x · y · dA ≈ − ∑ eµ,i · + x̄i · ȳi · Ai
A i=1 12
(4.2.9)
33
Where,
Ai = T he area o f line i.
x̄i = T he x coordinate o f the center o f line i.
ȳi = T he y coordinate o f the center o f line i.
xa,i = T he x coordinate o f the f irst point o f line i.
ya,i = T he y coordinate o f the f irst point o f line i.
xb,i = T he x coordinate o f the second point o f line i.
yb,i = T he y coordinate o f the second point o f line i.

4.2.6 Moment of Inertia about Center of Mass


we can calculate the moments of inertia with respect to the center of mass using
parallel axis theorem

Ixx,c = Ixx +Yc2 · A (4.2.10)

Iyy,c = Iyy + Xc2 · A (4.2.11)

Ixy,c = Ixy + Xc ·Yc · A (4.2.12)

Where,
Ai = T he area o f line i.
Xc = T he x coordinate o f the center o f mass i.
Yc = T he y coordinate o f the center o f mass i.
Ixx = T he moment o f inertia o f the pro f ile i about x − axis.
Iyy = T he moment o f inertia o f the pro f ile i about y − axis.
Ixy = T he moment o f inertia o f the pro f ile i about z − axis.

4.3 Profile Values


The dimensions of these profiles are considered according to DIN standards as
show below,

The Dimensions of circle-profile are:

34
Profile do (mm) tc(mm A(cm2 ) Ixx (cm4 ) Iyy (cm4 ) ex (cm) ey (cm)

circle 88.9 2.9 7.84 72.5 72.5 0 0

Table 4.1: circle profile dimensions

The Dimensions of U-profile are:

Profile hu(mm) bu(mm) su(mm) tu(mm) A(cm2 ) Ixx (cm4 ) Iyy (cm4 ) ex (cm) ey (cm)

U-100 100 50 6 8.5 13.5 29.3 206 1.55 0

U-120 120 55 7 9 17 43.2 364 1.60 0

U-140 140 60 7 10 20.4 62.7 605 1.75 0

Table 4.2: U-Profile dimensions

The Dimensions of I-profile are:

Profile hh(mm) bh(mm) sh(mm) th(mm) A(cm2 ) Ixx (cm4 ) Iyy (cm4 ) ex (cm) ey (cm)

I-200 190 200 6.5 10 53.8 1340 3690 0 0

Table 4.3: I-Profile dimensions

4.4 Approximation of the Problem


As discussed earlier the geometry of the profile is complex which contains fil-
lets and edges. In order to neglect these we need to code them in 2D elements
to approximate 1D according to thin wall approximation. This approximation
may lead into affecting the accuracy of the results which is discussed later in
this chapter.
The geometry of combined profile which is discretized with node and ele-
ments is shown in the figure 4.2

35
Figure 4.2: Approximated Geometry after Discretization

The above figure gives us a set of 23 nodes and 13 elements, the position of
the nodes and the element connectivity are as given below,
Helpers used: Some of the following Helpers are used in defining the nodes
are shown below:

hh
• q= 2 − th
hh th
• d= 2 − 2
hu tu
• k= 2 − 2

• w = bu − su
2
bh
• g= 2
do
• x= 2 − tc2
bh
• y= 2
hh
• z= 2
hu
• g= 2

• r = bu − su

36
Circle Nodes Coordinates
X Y
do
1 0 2 + sh
2
sh tc
2 0 2 + 2
do
3 x 2 + sh
2
tc sh
4 0 do - 2 + 2
do
5 -x 2 + sh
2

Table 4.4: Circle Node Chart

Arc-Elements Node1 Node2 Node3 Thickness (dt)


1 1 2 3 tc
2 1 3 4 tc
3 1 4 5 tc
4 1 5 2 tc

Table 4.5: Arc Element Chart

37
Nodes Coordinates
X Y
6 -q 0
7 q 0
8 -d g
9 -d -g
10 d g
11 d -g
12 -y k
13 -y -k
14 y k
15 y -k
16 -y-r k
17 -y-r -k
18 y+r k
19 y+r -k
20 -y-w z
21 -y-w -z
22 y+w z
23 y+w -z

Table 4.6: Node Chart

38
Line-Elements Node1 Node2 Thickness (dt)
5 6 7 sh
6 8 9 th
7 10 11 th
8 12 16 tu
9 13 17 tu
10 14 18 tu
11 15 19 tu
12 20 21 su
13 22 23 su

Table 4.7: Line Element Chart

4.5 Analytical Calculations


Based on the fundamental equations discussed in the above section, the analyt-
ical calculations are done in this section.

4.5.1 Area
The total area is the sum of all the areas of individual profiles. Let A be the
total Area of the combined profile. The area of the combined profile in three
different cases is calculated as follows: (Note: The proiles I and circle remains
same and the U section properties are varying.) The dimensions of each profile
are shown in the tables 4.1, 4.2, 4.3.

39
4.5.1.1 Case 1: [Profile with U100]

A = A1 + A2 + A3 + A4 (4.5.1)
= 13.5 + 53.8 + 7.84 + 13.5 cm2
= 88.64 cm2

Here,

A1 = Area o f the Le f t U pro f ile.


A2 = Area o f the I pro f ile.
A3 = Area o f the circle pro f ile.
A4 = Area o f the Right U pro f ile.

4.5.1.2 Case 2: [Profile with U120]

A = A1 + A2 + A3 + A4 (4.5.2)
= 17 + 53.8 + 7.84 + 17 cm2
= 95.64 cm2

Here,

A1 = Area o f the Le f t U pro f ile.


A2 = Area o f the I pro f ile.
A3 = Area o f the circle pro f ile.
A4 = Area o f the Right U pro f ile.

4.5.1.3 Case 3: [Profile with U140]

A = A1 + A2 + A3 + A4 (4.5.3)
= 20.4 + 53.8 + 7.84 + 20.4 cm2
= 102.44 cm2

Here,

A1 = Area o f the Le f t U pro f ile.


A2 = Area o f the I pro f ile.
A3 = Area o f the circle pro f ile.
A4 = Area o f the Right U pro f ile.

40
4.5.2 First Moment of Area
By using the above calculated areas we calculate the first moment of area along
X and Y-Axis. And as we already know the profile combinations for each case,
we are directly going to the calculation steps.

4.5.2.1 Case 1: [Profile with U100]


X-Axis

Sx = ∑ yi · A i  
sh do
Sx = eyu · A1 + eyI · A2 + + + eyc · A3 + (eyu ) · A4
2 2
 
0.65 8.89
= 0 · (13.5) + 0 · (53.8) + + + 0 · 7.84 + 0 · (13.5)
2 2
= 37.3968 cm3

Y-Axis

Sy = ∑ xi · Ai
   
−hh hh
Sy = − bu + exu · A1 + (exI ) · A2 + (exc ) · A3 + + bu − exu · A4
2 2
   
−19 19
= − 5 + 1.55 · (13.5) + 0 · (53.8) + 0 · (7.84) + + 5 − 1.55 · (13.5)
2 2
= 0 cm3

4.5.2.2 Case 2: [Profile with U120]


X-Axis

Sx = ∑ yi · A i  
sh do
Sx = eyu · A1 + eyI · A2 + + + eyc · A3 + (eyu ) · A4
2 2
 
0.65 8.89
= 0 · (17) + 0 · (53.8) + + + 0 · 7.84 + 0 · (17)
2 2
= 37.3968 cm3

41
Y-Axis

Sy = ∑ xi · Ai
   
−hh hh
Sy = − bu + exu · A1 + (exI ) · A2 + (exc ) · A3 + + bu − exu · A4
2 2
   
−19 19
= − 5.5 + 1.6 · (17) + 0 · (53.8) + 0 · (7.84) + + 5.5 − 1.6 · (17)
2 2
= 0 cm3

4.5.2.3 Case 3: [Profile with U140]


X-Axis

Sx = ∑ yi · A i  
sh do
Sx = eyu · A1 + eyI · A2 + + + eyc · A3 + (eyu ) · A4
2 2
 
0.65 8.89
= 0 · (20.4) + 0 · (53.8) + + + 0 · 7.84 + 0 · (20.4)
2 2
= 37.3968 cm3

Y-Axis

Sy = ∑ xi · Ai
   
−hh hh
Sy = − bu + exu · A1 + (exI ) · A2 + (exc ) · A3 + + bu − exu · A4
2 2
   
−19 19
= − 6 + 1.75 · (20.4) + 0 · (53.8) + 0 · (7.84) + + 6 − 1.75 · (20.4)
2 2
= 0 cm3

4.5.3 Center of Mass


The X and Y coordinates of center of mass of given profile is calculated by
using the equations (4.2.2) and (4.2.3). The calculated coordinates of center of
mass for the given profile in all three cases are as follows.

42
4.5.3.1 Case-1: [Profile with U100]

Sy 0 cm3
XC = = = 0 cm
A 88.64 cm2

Sx 37.3968 cm3
YC = = = 0.4220 cm
A 88.64 cm2

4.5.3.2 Case-2: [Profile with U120]

Sy 0 cm3
XC = = = 0 cm
A 95.64 cm2

Sx 37.3968 cm3
YC = = = 0.3910 cm
A 95.64 cm2

4.5.3.3 Case-3: [Profile with U140]

Sy 0 cm3
XC = = = 0 cm
A 102.44 cm2

Sx 37.3968 cm3
YC = = = 0.3651 cm
A 102.44 cm2

43
4.5.4 Moment of Inertia About User Coordinates
The moment of inertia of combined profiles is the sum of the moments of iner-
tia of the individual profiles for the three profile combination cases.

4.5.4.1 Case-1: [Profile with U100]


About X-Axis:

Ixx1 = Ixx + A1 · dy21


= Ixx + A1 · (eyu )2
= 206 cm4 + 13.5 cm2 · (0)2 cm2
= 206 cm4
Ixx2 = Ixx + A2 · dy22
= Ixx + A2 · (eyI )2
= 1340 cm4 + 53.8 cm2 · (0)2 cm2
= 1340 cm4
 2
sh do
Ixx3 = Ixx + A3 · + + eyc
2 2
 2
0.65 8.89
= 72.5 cm4 + 7.84 cm2 · + +0 cm2
2 2
= 250.8827 cm4
Ixx4 = Ixx + A4 · dy24
= Ixx + A4 · (eyu )2
= 206 cm4 + 13.5 cm2 · (0)2 cm2
= 206 cm4
Ixx user = Ixx1 + Ixx2 + Ixx3 + Ixx4
= 206 cm4 + 1340 cm4 + 250.8827 cm4 + 206 cm4
= 2002.8827 cm4

44
About Y-Axis

Iyy1 = Iyy + A1 · dx21


 2
−hh
= Iyy + A1 · − bu + exu
2
 2
4 2 −19
= 29.3 cm + 13.5 cm · − 5 + 1.55
2
= 2293.28 cm4
Iyy2 = Iyy + A2 · dx22
= 3690 + 53.8 · (0)2 cm2
= 3690 cm4
Iyy3 = Iyy + A3 · dx23
= 72.5 + 7.84 · (0)2 cm2
= 72.5 cm4
Iyy4 = Iyy + A4 · dx24
 2
hh
= Iyy + A4 · + bu − exu
2
 2
19
= 29.3 cm4 + 13.5 cm2 · + 5 − 1.55
2
= 2293.28 cm4
Iyy user = Iyy1 + Iyy2 + Iyy3 + Iyy4
= 2293.28 cm4 + 3690 cm4 + 72.5 cm4 + 2293.28 cm4
= 8349.0675 cm4

45
4.5.4.2 Case-2: [Profile with U120]
About X-Axis:

Ixx1 = Ixx + A1 · dy21


= Ixx + A1 · (eyu )2
= 364 cm4 + 17 cm2 · (0)2 cm2
= 364 cm4
Ixx2 = Ixx + A2 · dy22
= Ixx + A2 · (eyI )2
= 1340 cm4 + 53.8 cm2 · (0)2 cm2
= 1340 cm4
 2
sh do
Ixx3 = Ixx + A3 · + + eyc
2 2
 2
0.65 8.89
= 72.5 cm4 + 7.84 cm2 · + +0 cm2
2 2
4
= 250.8827 cm
Ixx4 = Ixx + A4 · dy24
= Ixx + A4 · (eyu )2
= 364 cm4 + 17 cm2 · (0)2 cm2
= 364 cm4
Ixx user = Ixx1 + Ixx2 + Ixx3 + Ixx4
= 364 cm4 + 1340 cm4 + 250.8827 cm4 + 364 cm4
= 2318.8827 cm4

46
About Y-Axis

Iyy1 = Iyy + A1 · dx21


 2
−hh
= Iyy + A1 · − bu + exu
2
 2
4 2 −19
= 43.2 cm + 17 cm · − 5.5 + 1.6
2
= 3095.72 cm4
Iyy2 = Iyy + A2 · dx22
= 3690 + 53.8 · (0)2 cm2
= 3690 cm4
Iyy3 = Iyy + A3 · dx23
= 72.5 + 7.84 · (0)2 cm2
= 72.5 cm4
Iyy4 = Iyy + A4 · dx24
 2
hh
= Iyy + A4 · + bu − exu
2
 2
19
= 43.2 cm4 + 17 cm2 · + 5.5 − 1.6
2
= 3095.72 cm4
Iyy user = Iyy1 + Iyy2 + Iyy3 + Iyy4
= 3095.72 cm4 + 3690 cm4 + 72.5 cm4 + 3095.72 cm4
= 9953.94 cm4

47
4.5.4.3 Case-3: [Profile with U140]
About X-Axis:

Ixx1 = Ixx + A1 · dy21


= Ixx + A1 · (eyu )2
= 605 cm4 + 20.4 cm2 · (0)2 cm2
= 605 cm4
Ixx2 = Ixx + A2 · dy22
= Ixx + A2 · (eyI )2
= 1340 cm4 + 53.8 cm2 · (0)2 cm2
= 1340 cm4
 2
sh do
Ixx3 = Ixx + A3 · + + eyc
2 2
 2
0.65 8.89
= 72.5 cm4 + 7.84 cm2 · + +0 cm2
2 2
4
= 250.8827 cm
Ixx4 = Ixx + A4 · dy24
= Ixx + A4 · (eyu )2
= 605 cm4 + 20.4 cm2 · (0)2 cm2
= 605 cm4
Ixx user = Ixx1 + Ixx2 + Ixx3 + Ixx4
= 605 cm4 + 1340 cm4 + 250.8827 cm4 + 605 cm4
= 2800.8827 cm4

48
About Y-Axis

Iyy1 = Iyy + A1 · dx21


 2
−hh
= Iyy + A1 · − bu + exu
2
 2
4 2 −19
= 62.7 cm + 20.4 cm · − 6 + 1.75
2
= 3919.575 cm4
Iyy2 = Iyy + A2 · dx22
= 3690 + 53.8 · (0)2 cm2
= 3690 cm4
Iyy3 = Iyy + A3 · dx23
= 72.5 + 7.84 · (0)2 cm2
= 72.5 cm4
Iyy4 = Iyy + A4 · dx24
 2
hh
= Iyy + A4 · + bu − exu
2
 2
19
= 62.7 cm4 + 20.4 cm2 · + 6 − 1.75
2
= 3919.575 cm4
Iyy user = Iyy1 + Iyy2 + Iyy3 + Iyy4
= 3919.575 cm4 + 3690 cm4 + 72.5 cm4 + 3919.575 cm4
= 11601.65 cm4

4.5.5 Mass moment of Inertia


The total mass moment of inertia of the given profile is the sum of mass moment
of inertia of individual profiles around the center of mass.

49
4.5.5.1 Case-1: [Profile with U100]
About X-Axis:
2
ICxx1 = Ixx + A1 · dyc 1

= Ixx + A1 · (YC − eyu )2


= 206 cm4 + 13.5 cm2 · (0.4220 − 0)2 cm2
= 208.4041 cm4
2
ICxx2 = Ixx + A2 · dyc 2

= Ixx + A2 · (YC − eyI )2


= 1340 cm4 + 53.8 cm2 · (0.4220 − 0)2 cm2
= 1349.5809 cm4
  2
sh do
ICxx3 = Ixx + A3 · YC − + + eyc
2 2
  2
0.65 8.89
= 72.5 cm4 + 7.84 cm2 · 0.4220 − + +0 cm2
2 2
4
= 220.7160 cm
2
ICxx4 = Ixx + A4 · dyc 4

= Ixx + A4 · (YC − eyu )2


= 206 cm4 + 13.5 cm2 · (0.4220 − 0)2 cm2
= 208.4041 cm4
ICxx center o f mass = ICxx1 + ICxx2 + ICxx3 + ICxx4
= 208.4041 cm4 + 1349.5809 cm4 + 220.7160 cm4 + 208.4041 cm4
= 1987.1051 cm4

50
About Y-Axis

2
ICyy1 = Iyy + A1 · dxc1
  2
−hh
= Iyy + A1 · Xc − − bu + exu
2
  2
4 2 −19
= 29.3 cm + 13.5 cm · 0 − − 5 + 1.55
2
= 2293.28 cm4
2
ICyy2 = Iyy + A2 · dxc2

= 3690 + 53.8 · (Xc − 0)2 cm2


= 3690 + 53.8 · (0 − 0)2 cm2
= 3690 cm4
2
ICyy3 = Iyy + A3 · dxc3

= 72.5 + 7.84 · (Xc − 0)2 cm2


= 72.5 + 7.84 · (0 − 0)2 cm2
= 72.5 cm4
2
ICyy4 = Iyy + A4 · dxc4
  2
hh
= Iyy + A1 · Xc − + bu − exu
2
  2
19
= 29.3 cm4 + 13.5 cm2 · 0 − + 5 − 1.55
2
= 2293.28 cm4
ICyy Center o f mass = ICyy1 + ICyy2 + ICyy3 + ICyy4
= 2293.28 cm4 + 3690 cm4 + 72.5 cm4 + 2293.28 cm4
= 8349.0675 cm4

51
4.5.5.2 Case-2: [Profile with U120]
About X-Axis:
2
ICxx1 = Ixx + A1 · dyc 1

= Ixx + A1 · (YC − eyu )2


= 364 cm4 + 17 cm2 · (0.3910 − 0)2 cm2
= 366.5989 cm4
2
ICxx2 = Ixx + A2 · dyc 2

= Ixx + A2 · (YC − eyI )2


= 1340 cm4 + 53.8 cm2 · (0.3910 − 0)2 cm2
= 1348.2249 cm4
  2
sh do
ICxx3 = Ixx + A3 · YC − + + eyc
2 2
  2
0.65 8.89
= 72.5 cm4 + 7.84 cm2 · 0.3910 − + +0 cm2
2 2
4
= 222.8370 cm
2
ICxx4 = Ixx + A4 · dyc 4

= Ixx + A4 · (YC − eyu )2


= 364 cm4 + 17 cm2 · (0.3910 − 0)2 cm2
= 366.5989 cm4
ICxx center o f mass = ICxx1 + ICxx2 + ICxx3 + ICxx4
= 366.5989 cm4 + 1348.2249 cm4 + 222.8370 cm4 + 366.5989 cm4
= 2304.2597 cm4

52
About Y-Axis

2
ICyy1 = Iyy + A1 · dxc1
  2
−hh
= Iyy + A1 · Xc − − bu + exu
2
  2
4 2 −19
= 43.2 cm + 17 cm · 0 − − 5.5 + 1.6
2
= 3095.72 cm4
2
ICyy2 = Iyy + A2 · dxc2

= 3690 + 53.8 · (Xc − 0)2 cm2


= 3690 + 53.8 · (0 − 0)2 cm2
= 3690 cm4
2
ICyy3 = Iyy + A3 · dxc3

= 72.5 + 7.84 · (Xc − 0)2 cm2


= 72.5 + 7.84 · (0 − 0)2 cm2
= 72.5 cm4
2
ICyy4 = Iyy + A4 · dxc4
  2
hh
= Iyy + A1 · Xc − + bu − exu
2
  2
19
= 43.2 cm4 + 17 cm2 · 0 − + 5.5 − 1.6
2
= 3095.72 cm4
ICyy Center o f mass = ICyy1 + ICyy2 + ICyy3 + ICyy4
= 3095.72 cm4 + 3690 cm4 + 72.5 cm4 + 3095.72 cm4
= 9953.94 cm4

53
4.5.5.3 Case-3: [Profile with U140]
About X-Axis:
2
ICxx1 = Ixx + A1 · dyc 1

= Ixx + A1 · (YC − eyu )2


= 605 cm4 + 20.4 cm2 · (0.3651 − 0)2 cm2
= 607.7192 cm4
2
ICxx2 = Ixx + A2 · dyc 2

= Ixx + A2 · (YC − eyI )2


= 1340 cm4 + 53.8 cm2 · (0.3651 − 0)2 cm2
= 1347.17 cm4
  2
sh do
ICxx3 = Ixx + A3 · YC − + + eyc
2 2
  2
0.65 8.89
= 72.5 cm4 + 7.84 cm2 · 0.3651 − + +0 cm2
2 2
4
= 224.6206 cm
2
ICxx4 = Ixx + A4 · dyc 4

= Ixx + A4 · (YC − eyu )2


= 605 cm4 + 20.4 cm2 · (0.3651 − 0)2 cm2
= 607.7192 cm4
ICxx center o f mass = ICxx1 + ICxx2 + ICxx3 + ICxx4
= 366.5989 cm4 + 1348.2249 cm4 + 222.8370 cm4 + 366.5989 cm4
= 2787.2290 cm4

54
About Y-Axis

2
ICyy1 = Iyy + A1 · dxc1
  2
−hh
= Iyy + A1 · Xc − − bu + exu
2
  2
4 2 −19
= 62.7 cm + 20.4 cm · 0 − − 6 + 1.75
2
= 3919.575 cm4
2
ICyy2 = Iyy + A2 · dxc2

= 3690 + 53.8 · (Xc − 0)2 cm2


= 3690 + 53.8 · (0 − 0)2 cm2
= 3690 cm4
2
ICyy3 = Iyy + A3 · dxc3

= 72.5 + 7.84 · (Xc − 0)2 cm2


= 72.5 + 7.84 · (0 − 0)2 cm2
= 72.5 cm4
2
ICyy4 = Iyy + A4 · dxc4
  2
hh
= Iyy + A1 · Xc − + bu − exu
2
  2
19
= 62.7 cm4 + 20.4 cm2 · 0 − + 6 − 1.75
2
= 3919.575 cm4
ICyy Center o f mass = ICyy1 + ICyy2 + ICyy3 + ICyy4
= 3919.575 cm4 + 3690 cm4 + 72.5 cm4 + 3919.575 cm4
= 11601.65 cm4

55
4.6 Project Structure
To develop the structure of project using C++ program, the different classes are
defined. These classes are discussed in detail using UML diagrams here.

4.6.1 Base Class


As we already know, a class can inherit from more than one class. For this
case, the general class is named as Base class. The main task of this class is to
keep the track of various instances which are included in the program. It is also
keeping the log of these activities. It creates and writes the log file which can
be accessed in the later stages. The UML diagram of the Base class is shown
in figure 4.3

Figure 4.3: UML Diagram of Base Class

4.6.2 Node Class


This Node class creates a node object with a number or ID and the respected
coordinates. All the node data is stored in the Node class as a list to facilitate
the extraction of data from an 3D array. This class contains both constructor
and destructor functions. These functions are used to allocate and deallocate
the memory. The UML diagram of the node class is shown in figure 4.4.

56
Figure 4.4: UML Diagram of Node Class

4.6.3 Element Class


The Element Class describes the connection between the nodes and the connec-
tion types. This element has a thickness and defines in the definition. In this
project, the properties of the given profile are represented by the sum of over
elements.To calculate the properties of the elements, the element must know
the about the connecting of the nodes. The UML diagram of the Element class
is shown in figure 4.5.

57
Figure 4.5: UML Diagram of Element Class

4.6.4 Line-Element
The Line-Element Class describes the connection between the nodes and the
connection types. One element is defined with the two nodes. This element
has a thickness and defines in the definition. The UML diagram of the Element
class is shown in figure 4.6.

Figure 4.6: UML Diagram of Line-Element Class

58
4.6.5 Arc-Element
The Arc-Element Class describes the connection between the nodes and the
connection types of circle profile. One element is defined with the three nodes.
This element has a thickness and defines in the definition. The UML diagram
of the Element class is shown in figure 4.7.

Figure 4.7: UML Diagram of Arc-Element Class

4.6.6 Profile class


The created elements in Element class are combined in the Profile class to
create the new combined profile. The features like project name, thin-walled
model implementation will be listed here. An element container is introduced,
thereafter an element instance is inserted by using a specific method. To calcu-
late the sectional values, specific methods are implemented, which calculates
the global sectional values by adding up all the element values and transform
into the desired coordinate system. This Profile Class inherits the attribute val-
ues of the Base Class and all these activities are logged in an output file. The
figure 4.8 shows the UML diagram of the Profile Class.

59
Figure 4.8: UML Diagram of Profile Class

4.6.7 Gauss Class


The class Gauss is a helper class which comes with the implementation of meth-
ods we use to numerically integrate features of an element with or without in-
terpolation. Because this are object independent features we introduce them as
static items.

60
Figure 4.9: UML Diagram of Gauss Class

4.6.8 CombinedProfile Class


The input data of this program is represented by cobinedprofile class. The
dependent features of the given user profile are discussed here. The profile pa-
rameters like height, width, thickness, diameter of respected profiles are given
as attributes. Each containers is used by specific methods to add nodes and ele-
ments. The error handling is done in this class. This class checks and validates
all the input data. The UML diagram of the combinedprofile class is shown in
4.10

61
Figure 4.10: UML Diagram of a Combinedprofile Class

4.6.9 UML class Hierarchy


The class hierarchy as a pictorial representation is shown in figure 4.11. The
connection between different defined classes can be seen clearly.

62
Figure 4.11: The UML Class Hierarchy

4.6.10 Error Handling


Error check is carried in Proile project (combinedprofile class), where it checks
the various possible errors that may arise at various steps of the process of
implementing code. To ensure that the program is running correctly, these error
checking must be carried and error messages need to be printed to the user
accessing the program. The following errors must be checked:

• Error in opening the input file.

• Checks all the input parameters like height, width, thickness and length
of profiles. These values should not be negative.

• Errors in opening output file.

63
4.6.11 Profile Creation Structure
The algorithm of profile creation is shown in figure 4.12. Firstly, the project file
reads the input parameters and checks all the input parameters. If errors found,
it will display error message and terminates the program. If no errors found in
the input file, the nodes will create and the connecting nodes will follows. After
successfully connecting all the nodes, the program will assign each element to
their respective section. Here, the sectional values will be calculated. After
calculating all the defined section values, it will display the obtained values.

Figure 4.12: Flow Chart explaining Profile Creation

64
4.7 User Manual
This section gives an information to an user regarding execution of the devel-
oped program for calculation of section properties of combined profile using
thin wall approximation. The program is developed using CODE:Blocks IDE
and is compiled using the GCC compiler for C++. The brief discussion of of
the usage of files is discussed here.

4.7.1 Execution of The code


Open the CODE:BLOCKS and then click on Open an existing project as shown
in figure 4.13. After that you have to select the project file. After the project
opened succesfully, press F9 or Click on icon Bild Run as shown in figure 4.14.

Figure 4.13: Opening Project File

Figure 4.14: Execution of the Project File

65
4.7.2 Output Window
After successfully execution of the program, the sectional values will be printed
on the output window. The obtained output results for each case are shown in
figures 4.15, 4.16, 4.17. The given combined profile has three cases. Case 1
has the one IPE 200, one circle and two U100x50x6 profiles. Case 2 has the
one IPE 200, one circle and two U120x55x7 profiles. Case 3 has the one IPE
200, one circle and two U140x60x7 profiles. The program prints the data of the
profile as mentioned in the input file, the nodes and elements created and prints
all the calculated sectional values and prints in Output window.

Figure 4.15: Output Window for Case 1

66
Figure 4.16: Output Window for Case 2

67
Figure 4.17: Output Window for Case 3

68
4.8 Results and Deviation
4.8.1 Analytical Results
Sectional Values of the three combinations are calculated in the section 4.5.
The values are tabulated below in table 4.8.

Moment of Moment of
First moment
Area Centroid inertia about Inertia about
Profile of Inertia
(cm2 ) (cm) user axis centroid
(cm3 )
(cm4 ) (cm4 )
A Sx Sy XC YC Ixx,user Iyy,user Ixx,C Iyy,C

Case: 1 88.64 37.40 0 0 0.42 2002.88 8349.07 1987.11 8349.07

Case: 2 95.64 37.40 0 0 0.39 2318.88 9953.94 2304.26 9953.94

Case: 3 102.44 37.40 0 0 0.37 2800.88 11601.65 2787.23 11601.65

Table 4.8: Section Values Obtained Through Analytical Calculations

4.8.2 Numerical Results


The numerical results that are obtained after successful execution of the pro-
gram are listed in the table 4.9.

69
Moment of Moment of
First moment
Area Centroid inertia about Inertia about
Profile of Inertia
(cm2 ) (cm) user axis centroid
(cm3 )
(cm4 ) (cm4 )
A Sx Sy XC YC Ixx,user Iyy,user Ixx,C Iyy,C

Case: 1 85.85 37.38 0 0 0.44 1997.25 8070.33 1980.97 8070.33

Case: 2 92.97 37.38 0 0 0.40 2317.99 9664.5 2302.97 9664.5

Case: 3 99.69 37.38 0 0 0.38 2799.66 11256.5 2785.94 11256.5

Table 4.9: Section Values Obtained Through Numerical Calculations

4.8.3 Deviation of Results


The Numerical and analytical results have been already available from the
above sections. The formula to calculate the error is shown below and by using
this formula error calculation is done and values are tabulated in the table 4.10.

Analytical result − Numerical result


Relative Error = × 100%
Analytical result

70
Moment of Moment of
First moment
Area Centroid inertia about Inertia about
Profile of Inertia
[%] [%] user axis centroid
[%]
[%] [%]
A Sx Sy XC YC Ixx,user Iyy,user Ixx,C Iyy,C

Case: 1 3.15 0.04 - - -3.18 0.28 3.34 0.31 3.34

Case: 2 2.79 0.04 - - -2.81 0.04 2.91 0.06 2.91

Case: 3 2.68 0.04 - - -2.68 0.04 2.98 0.05 2.98

Table 4.10: Relative Error of All Three Profile Cases

4.9 Conclusion
After comparing the results of Analytical and C++ program the output is sat-
isfactory with considerable errors. Since we were neglected the fillets across
the edges and the exterior curved sections, which causes the missing of the data
during the code computation. This could be the major reasons for the error
difference in the combined profile. For more accurate results, number of nodes
can be increase. From the comparison we can say that the results obtained from
the program are reliable. The maximum area deviation was found below 4 per-
centage in case-1, The maximum deviation in the moment of inertia was found
below 3 percentage with the case-1.

71
Appendix A

Appendix

Figure A.1: TaskSheet

72
Figure A.2: Dimensional Details and Sectional Properties of U-Profile

73
Figure A.3: Dimensional Details and Sectional Properties of I-Profile

74
Figure A.4: Dimensional Details and Sectional Properties of Circle-Profile

75
Bibliography
[1] Class Material from Prof, Dr. rer. nat. Ernst Baeck,
http://info.baustatik.uni-due.de/

[2] FORTRAN,
https://gcc.gnu.org/fortran/

[3] C++,
https://isocpp.org/

[4] LATEX
https://www.latex-project.org//

[5] Application used for plotting functions,


https://www.desmos.com/calculator/8keeh1pt5l

76

You might also like