Professional Documents
Culture Documents
Finite Element Computations in Mechanics With R: A Problem-Centered Programming Approach 1st Edition Khameel Bayo Mustapha
Finite Element Computations in Mechanics With R: A Problem-Centered Programming Approach 1st Edition Khameel Bayo Mustapha
https://textbookfull.com/product/finite-element-computations-in-
mechanics-with-r-a-problem-centered-programming-approach-first-
edition-bayo-mustapha/
https://textbookfull.com/product/the-finite-element-method-for-
boundary-value-problems-mathematics-and-computations-1st-edition-
reddy/
https://textbookfull.com/product/extended-finite-element-method-
tsinghua-university-press-computational-mechanics-series-1st-
edition-zhuo-zhuang/
https://textbookfull.com/product/business-statistics-with-
solutions-in-r-1st-edition-mustapha-abiodun-akinkunmi/
Finite Element Analysis A Primer 2nd Edition Musa
https://textbookfull.com/product/finite-element-analysis-a-
primer-2nd-edition-musa/
https://textbookfull.com/product/a-first-course-in-the-finite-
element-method-si-edition-martin/
https://textbookfull.com/product/electromagnetics-through-the-
finite-element-method-a-simplified-approach-using-maxwells-
equations-1st-edition-jose-roberto-cardoso/
https://textbookfull.com/product/introductory-quantum-mechanics-
a-traditional-approach-emphasizing-connections-with-classical-
physics-1st-edition-paul-r-berman/
https://textbookfull.com/product/finite-element-analysis-a-
primer-second-edition-sarhan-m-musa/
Finite Element Computations
in Mechanics with R
Finite Element Computations
in Mechanics with R
A Problem-Centered Programming
Approach
This book contains information obtained from authentic and highly regarded sources. Reasonable efforts
have been made to publish reliable data and information, but the author and publisher cannot assume
responsibility for the validity of all materials or the consequences of their use. The authors and publishers
have attempted to trace the copyright holders of all material reproduced in this publication and apologize to
copyright holders if permission to publish in this form has not been obtained. If any copyright material has
not been acknowledged please write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmit-
ted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented,
including photocopying, microfilming, and recording, or in any information storage or retrieval system,
without written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.
com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood
Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and
registration for a variety of users. For organizations that have been granted a photocopy license by the CCC,
a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used
only for identification and explanation without intent to infringe.
Preface .....................................................................................................................xv
Acknowledgments ............................................................................................. xvii
Author ................................................................................................................... xix
vii
viii Contents
10. Finite Element Formulations for Thermal Stress Problems .............. 277
10.1 Introduction ..................................................................................... 277
10.2 Finite Element Equations for Thermal Stress Problems ............ 277
10.2.1 Stress–Strain–Temperature Relationship ..................... 277
10.2.2 Minimization of the Total Potential Energy for
Thermal Stress Problems in Bar Elements ................... 279
10.2.3 Element Equations for Thermal Stress Problems
in Planar Trusses .............................................................. 280
10.3 Computer Implementation ............................................................ 281
10.3.1 Systematic Procedure for Analyses of Thermal
Stress in Bars and Trusses............................................... 281
10.3.1.1 Precomputation Phase ................................... 281
10.3.1.2 Computation Phase ........................................ 281
10.3.2 Implemented R Functions for the Thermal Stress
Analysis (Bar Elements) .................................................. 282
10.3.3 Implemented R Functions for Thermal Stress
Analysis (Truss Elements)............................................... 285
10.4 Examples .......................................................................................... 288
10.4.1 Example 10.1...................................................................... 288
10.4.1.1 Solution ............................................................ 288
10.4.2 Example 10.2 ..................................................................... 296
10.4.2.1 Solution ............................................................ 297
10.5 Exercises ...........................................................................................306
References ..................................................................................................... 307
Contents xiii
Index ...................................................................................................................361
Preface
The finite element method (FEM) occupies a prominent position in the simu-
lations of many intractable multiphysics problems. Across a wide range of
engineering fields (mechanical, civil, biomedical, electromagnetic, etc.), the
method remains a technical tool of choice in the workflow of simulation-
driven development and design of a variety of complex systems. The essen-
tiality of the knowledge of FEM is recognized in engineering education
curriculum, and it undergirds the proliferation of commercial finite element
analysis software in academia and industries. Yet the teaching of the FEM
is not without its challenges. Finding it difficult to strike a balance between
theory and hands-on practice, courses in the teaching of the FEM are either
too deep in the mathematical framework of the method or biased toward
a heavy reliant on commercial FEM software. The former approach pres-
ents challenges for students with shallow mathematics knowledge, whereas
the latter tends to create expert software users with hazy understanding of
the rudimentary activities required for conducting reliable finite element
analyses.
Although not discouraging the use of commercial FEM software, a mod-
est aim of this book is to contribute to the attempts, instigated by respected
figures in this field, to address this issue by encouraging the use of program-
ming languages to enhance the understanding of the procedural steps of
FEM. Indeed, in the past decades, programming approaches to the FEM
have been presented by several authors using FORTRAN, JAVA, MATLAB,
MATHEMATICA, and Python. Nonetheless, it is not the author’s motivation
to write a book just for the sole purpose of using R for the FEM. The desire
arises out of a deep belief in the suitability of the language along with its
growing ecosystem as another versatile computational tool in the arsenal
of engineers. In this spirit, this book provides an introductory coverage of
the FEM with the R programming language in a manner that emphasizes
link between theory and the procedural steps of implementing finite ele-
ment solutions for problems in engineering mechanics. A multiplatform
open-source language, the R programming language is matured with thou-
sands of library and functions developed by experienced developers. It is
also attractive as students and practitioners can download and install the
software free of charge.
The primary target of this book is readers who are studying structural
and solid mechanics with interests in an interactive exploration of the FEM.
Therefore, it is assumed that the reader is familiar with the fundamentals of
basic engineering mechanics and the theory of elasticity. Besides, although
knowledge of a computer language is helpful, it is not essential. The book
adopts a programming-by-example philosophy and provides automated R
xv
xvi Preface
functions that will allow readers to build the relevant skill set of under-
standing the essential conceptual basis of finite element computations,
without being burdened by the tedious longhand calculations associated
with the method. It also should appeal to readers who may already be familiar
with R and wish to get started on the fundamentals of FEM. Throughout
the chapters of the book, the convenience of the language for implementing
vectorized finite element routines for structural, thermal, and dynamic
analyses of elementary structural components is illustrated. The use of
the implemented functions is also demonstrated with numerous example
problems, most of which are derived from authoritative sources. In all, this
book contains 12 chapters. Chapter 1 presents a brief introduction to the
R programming language and the RStudio (a user-friendly GUI for writing
and editing of R scripts). In Chapter 2, we explored the functions available
for the manipulations of vectors and matrices in R. The remaining chapters
cover the finite element models and implemented functions for a variety of
problems with practical implications in components design. Specifically, the
other chapters contain problems that relate to
Within each chapter (starting from Chapter 3), we start with a cursory
account of the finite element model and then present the relevant code snip-
pet in the form of functions that implement specific aspects of the FEM pro-
cedure. Demonstrations of the functions are then presented with specific
examples. The implemented functions are all tested and validated with exer-
cise problems from authoritative sources. The codes for all the chapters can
be downloaded from the book’s website, can be used freely, and can also
easily be extended by readers.
As a final point, although attempts have been made to check for errors,
the author welcomes any suggestions or corrections by email KhameelB.
Mustapha@nottingham.edu.my. I leave the readers with the following quote:
If you really wish to learn you must mount a machine and become
acquainted with its tricks by actual trial.—Wilbur Wright
xvii
Author
xix
1
Overview of the R Programming
Environment, Installations, and
Basic Syntax
1.1 Introduction
The choice of R for the implementation of the finite element method (FEM)
will appear eccentric to those familiar with the language as a byword for sta-
tistical computing. Remarkably, within the wider engineering community,
the language has not received the attention it deserves for computational
analyses. But this is expected to change as more and more practitioners get
familiar with the status of R as a general-purpose programming language
with top-notch supports for a wide range of computational tasks.
Originally designed for statistical computations and visualization, R is an
open-source software environment that has gained reputation for intensive
data analyses. Yet, the language offers an enabling platform for computa-
tional tasks in mechanics, particularly for the coding of the FEM. For one, it is
free (no cost for download, installation, and usage). Further, the language is
designed with a rigorous support for matrix algebra (the backbone of FEM),
and it is endowed with comprehensive ecosystems for tackling of essential
modern computational tasks (such as parallel computations, big data analyt-
ics, etc.). As an added bonus, a swelling rank of expert users, most of whom
are eminent academics and researchers, keeps pushing the boundary of its
application into domains beyond the historical conception.
As part of our journey to deploy the R programming language for com-
putations related to the FEM, we will need two tools: the R installer and the
RStudio®. Sections 1.2 and 1.3 explain how to download and install these
two tools.
1
2 Finite Element Computations in Mechanics with R
FIGURE 1.1
The RStudio interface.
>
4 Finite Element Computations in Mechanics with R
where the symbol > is a prompt. At the prompt, one can enter any R com-
mand or expression, hit the Enter key, and the R interpreter will discern the
command and spits out the result accordingly in the Console. A series of
simple calculations are shown in the next block of code to demonstrate this.
> 2*5
[1] 10
> sqrt(16)
[1] 4
> 2^4
[1] 16
> log10(1000)
[1] 3
> log(1000)
[1] 6.907755
> exp(1)
[1] 2.718282
The first expression in the preceding code snippet shows the multiplication
of 2 and 5, and below the expression > 2*5 is the result. The rest of the
expressions show the use of the square root command (sqrt()), base 10 log-
arithm (log10()), natural logarithm (log()), and exponential (exp()).
Like in most programming languages, the results of an execution in an R
session can be stored using a variable. It is easy to create a variable by using
an assignment statement. Variables in R can be stored by using one of these
assignment operators:
• =
• <-
• ->
as illustrated in the Console pane of Figure 1.2 (the window on the left-hand
side). Typically, the workspace browser shows the name and value(s) of vari-
ables that have been created as shown in the Workspace pane of Figure 1.2.
As revealed in Figure 1.2, R allows a variable name to be on the left of the
assignment operators, for = and <- (which is the conventional way). Remarkably,
the language also supports the case of placing the variable name on the right if
the right-pointing operator (i.e., ->) is used (as demonstrated in the third vari-
able definition shown in Figure 1.2). This latter approach is not common with
other programming languages such as MATLAB®, for instance.
Overview of the R Programming Environment, Installations, and Basic Syntax 5
FIGURE 1.2
A demonstration of the use of assignment operators.
TABLE 1.1
Approaches for Searching the R Documentation
Search Format Output
example(matrix)
A list of demonstrations is also available, and one can explore these demon-
strations by simply typing and running:
• demo()
• demo(graphics)
• Open RStudio.
• Run install.packages(“package_name”) at the command line.
Overview of the R Programming Environment, Installations, and Basic Syntax 7
References
1. J. Verzani, Getting Started with RStudio, O’Reilly Media: Sebastopol, CA, 2011.
2. V. A. Bloomfield, Using R for Numerical Analysis in Science and Engineering,
Taylor & Francis Group: Boca Raton, FL, 2014.
3. G. Grolemund, Hands-On Programming with R: Write Your Own Functions and
Simulations, O’Reilly Media: Sebastopol, CA, 2014.
4. O. Jones, R. Maillardet, A. Robinson, Introduction to Scientific Programming and
Simulation Using R, Second Edition, Taylor & Francis Group: Boca Raton, FL, 2014.
Another random document with
no related content on Scribd:
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back