COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University An Introduction to myself Mohammad Ebrahim Banihabib Associate Professor, PhD of Civil Engineering (Water Resources Engineering) University of Tehran, IRAN Email:[email protected], [email protected] COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University

An Introduction to myself RESEARCH INTERESTS: Water Resources planning and management Sediment transport, debris flow, flood management and river restoration PUBLICATIONS: Papers in Refereed Journals (In English): 39 Papers in Iranian Refereed Journals (In Persian): 49 Papers in Proceedings of International Conferences: 40 Papers in Proceedings of National Conferences: 117 Books and Guidelines: 11 books and national standard guidelines COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University

An Introduction to the course Course Title: COMPUTATIONAL METHODS IN CIVIL ENGINEERING Introduction to Basic Concepts Errors in Numerical Methods Curve Fitting Numerical Interpolation and Integration Solution of Systems of Algebraic Equations (linear and non-linear systems) Finite Differences Stability, Consistency and Convergence Boundary and Initial Conditions Partial Differential Equations Numerical Solutions to Parabolic, Hyperbolic and Elliptic Equations Method of Characteristics Applications in Civil Engineering

COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Extra syllabuses Optimization (Simplex and multi-objectives) Multi criteria decision models Artificial neural network Decision in uncertain and risk conditions COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern

Mediterranean University References 1. Rajasekaran, S. (1986) numerical methods in science and engineering (A practical approach). Chopra for A.H. Wheeler & co. (P) Ltd 2. Donand Greenspan & Vincecenzo Casulli (1988) numerical analysis for applied mathematics, science and engineering. Addison-Esley publishing company 3. Kopchenova N.V. and I.A. Maron (1987). Computational mathematics. MIR publishers, moscow 4. Gerald C.F. (1980) applied numerical analysis. Addision-Wesley publishing company 5. Hoffman J.D. (2001) numerical methods for engineers and scientists. Second edition revised and expanded. Marcel Dekker, Inc. New york. Basel

COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Similar courses Numerical methods Classic Numerical Methods Modern Numerical methods Computational Hydraulic Computational fluid Dynamic (CFD) COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib,

Visiting Professor, Eastern Mediterranean University Chapter 1. Introduction To Basic Concepts Steps of the basic concepts in computational methods Star t Real Engineering Problem Simplification Modellin g Algorith Programi

m/ ng scheme Error s Computat ion Example: 1. Rainfall- runoff simulation (flood simulation) by HEC-HMS 2. River flow simulation by HEC-RAS Result s COMPUTATIONAL METHODS IN

CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Prevention and reduction of the errors in models Wrong input data causes wrong output from the model: garbage out GIGO: garbage in Models should be tested for simple cases with exact solutions Models should be examined for extreme (max and min) conditions of the problems COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib,

Visiting Professor, Eastern Mediterranean University Prevention of the errors in algorithms Wrong algorithm causes wrong results Algorithms should be compared with examined previous algolithms Algorithms should be tested for simple cases Models should be examined for extreme (max and min) cases COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Prevention of errors in programing

Programs may have errors and warning: Errors always should be checked and remove from the program. But, warnings needs to be checked: They are: 1. Maybe errors (should be removed) 2. Or OK ( no action needed) COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Prevention of the errors in computation by computers This error comes from limited bits in saving numbers by computers and can be controlled by: Allocating enough digits for real numbers etc. (we talk about later)

COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors in Numerical Methods Terminology Storing real numbers in computers Storing integer numbers in computers Storing real numbers in normalized scientific notation in computers Round off and truncation (approximation) errors Reducing round off errors Absolute error, relative error and percent error Measurement errors

Errors in calculations, functions, polynomials and series COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors in Numerical Methods/Terminology Significant Digits (SD): The significant digits, or figures, in a number are the digits of the number which are known to be correct. There are three rules on determining how many significant figures are in a number: Non-zero digits are always significant. 123 (3 SD), 0.012 (2 SD), Any zeros between two significant digits are significant. 100.01 (5 SD) A final zero or trailing zeros in the decimal portion ONLY are

significant. 500. (3 SD), 0.0700 (3 SD) COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors in Numerical Methods/Terminology Precision and Accuracy Precision refers to how closely a number represents the number it is representing. Accuracy refers to how closely a number agrees with the true value of the number it is representing. Precision is governed by the number of digits being carried in the numerical calculations. Accuracy is governed by the errors in the numerical approximation.

Precision and accuracy are quantified by the errors in a numerical calculation. COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors in Numerical Methods/Terminology The accuracy of a numerical calculation is quantified by the error of the calculation. Several types of errors can occur in numerical calculations: Errors in the parameters (inputs) of the problem (assumed nonexistent). Algebraic errors (algorithms) in the calculations (assumed nonexistent). Iteration errors. Approximation errors (Ex: truncation error). Round-off errors.

COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors in Numerical Methods/Terminology Iteration error is the error in an iterative method that approaches the exact solution of an exact problem wrongly. Round-off error is the error caused by the digit/bite length employed in the calculations. Approximation error is the difference between the exact solution of an exact problem and the exact solution of an approximation of the exact problem.

COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors In Numerical Methods: Storing real numbers in computers X=+/-(b n, bn-1, bn-2, b2, b1, b0, b-1, b-2, b-3, .b-k+1, bk ) +/-(bn, bn-1, bn-2, b2, b1, b0) is integer part. +/-(b-1, b-2, b-3, .b-k+1, bk ) is mantissa part

For Example: 6.125=+(1x2^2+1x2^1+0X2^0)+(0x2^-1+0X2^-2+1X2^-3) 6.125=(110.001) in binary form COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors In Numerical Methods: Storing real numbers in computers For m bits t-1. For k bits t. For example: In 32 bit computer, we have 31 bits for integer figure and 1 bit for the sign (+/-):-1 =2,147,483,647

COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors In Numerical Methods: normalized scientific notation X= +/- M* Where: M= mantissa C= exponent For example: in a 32 bit computers: 23 bits is for mantissa 7 bits is for exponent 1 bit is for the sign (+/-) of mantissa

1 bit is for the sign (+/-) of exponent COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors In Numerical Methods: normalized scientific notation Accordingly: The largest exponent is: -1=127 The largest exponent is: =0.999,999,880,790,710,449,218,75 Thus, the largest normalized scientific notation in a 32 bit computer is: The largest exponent is: (1-)=1.70141* Therefore: for numbers larger than Therefore: for numbers smaller than

Overflow underflow COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors In Numerical Methods: round-off and truncating errors If we allocate n bits for mantissa: = COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Chapter 2. Errors In Numerical Methods: truncation error Truncation error comes reminder of the series and polynomials: For example: we need to calculate series like this for sin, cos, tan, cotan If we use COMPUTATIONAL METHODS IN CIVIL ENGINEERING Dr. Mohammad Ebrahim Banihabib,

Visiting Professor, Eastern Mediterranean University Chapter 2. Errors In Numerical Methods: Reducing round-off errors 1. Use maximum bits for mantissa for example 23 bits in 32 bit computers 2. Avoid from overflow and underflow and keep value [-1, 1] in calculations. For example: If x and z have small values comparing to y, use (x/z)*y instead of (x*y)/z 3. Reduce number of calculation. For example use Hoerners scheme in calculating polynomials. 4. Remove ambiguity. For example f(x)= (1-cos x)/x, when x=0 5. Use Maclaurin Series in calculating sin & cos. 6. Use double precision in calculation. COMPUTATIONAL METHODS IN CIVIL ENGINEERING

Dr. Mohammad Ebrahim Banihabib, Visiting Professor, Eastern Mediterranean University Homework and Exams Email your homework to: [email protected] Note: other email should be send to: [email protected] Every class homework: 1. Write 3 key statement of the class 2. Ask a Q about what was taught in class 3. Write a comment/suggestion about what was taught in class Final grade: 20% homework 35% midterm exam 45% final exam