ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Modeling, Computers, and Error Analysis.

Slides:



Advertisements
Similar presentations
Object Oriented Programming A programming concept which views programs as objects with properties and ways to manipulate the object and the properties.
Advertisements

Some computer fundamentals and jargon Memory: Basic element is a bit – value = 0 or 1 Collection of “n” bits is a “byte” Collection of several bytes is.
ALGORITHMS THIRD YEAR BANHA UNIVERSITY FACULTY OF COMPUTERS AND INFORMATIC Lecture two Dr. Hamdy M. Mousa.
CS0004: Introduction to Programming Repetition – Do Loops.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 4 Programming and Software EXCEL and MathCAD.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 2 Mathematical Modeling and Engineering Problem Solving.
The Islamic University of Gaza Faculty of Engineering Numerical Analysis ECIV 3306 Introduction.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 3 Programming and Software.
Chapter 1 Program Design
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 11.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Chapter 4 Sec. 4.1, 4.2, 4.4 Procedures (User-defined)
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 1 Mathematical Modeling.
Chapter 3 Planning Your Solution
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Mathematical Modeling and Engineering Problem solving.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 02.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Languages and Environments Higher Computing Unit 2 – Software Development.
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
IE 212: Computational Methods for Industrial Engineering
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 MATLAB Programming Chapter 2.
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
Data Structures & AlgorithmsIT 0501 Algorithm Analysis I.
MMJ 1113 Computational Methods for Engineers Mohsin Mohd Sies Fakulti Kejuruteraan Mekanikal, Universiti Teknologi Malaysia.
Chapter 1 Computing Tools Analytic and Algorithmic Solutions Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Numerical Methods in Scientific Computation Lecture 2 Programming and Software Introduction to error analysis Numerical Methods, Lecture 2 1 Prof. Jinbo.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University 1 Chapter 1 Mathematical.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 2.
Mathematical Modeling and Engineering Problem Solving
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation
Visual Basic Programming
Lecture 2 Numerical Methods for Engineering MECN 3500 Department of Mechanical Engineering Inter American University of Puerto Rico Bayamon Campus Dr.
Chapter 2: General Problem Solving Concepts
ME 142 Engineering Computation I Exam 2 Review VBA.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
Spreadsheet Models for Managers: Session 14 14/1 Copyright © Richard Brenner Spreadsheet Models for Managers Session 14 Using Macros II Function.
ME 142 Engineering Computation I Using Subroutines Effectively.
ES 240: Scientific and Engineering Computation. Chapter 1 Chapter 1: Mathematical Modeling, Numerical Methods and Problem Solving Uchechukwu Ofoegbu Temple.
Part 1 Chapter 1 Mathematical Modeling, Numerical Methods, and Problem Solving PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and.
Computing Higher – SD Unit - Topic 8 – Procedure and Standard Algorithms P Lynch, St Andrew’s High School Unit 2 Software Development Process Topic.
Part 1 Chapter 1 Mathematical Modeling, Numerical Methods, and Problem Solving PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and.
ERT 216 HEAT & MASS TRANSFER Sem 2/ Dr Akmal Hadi Ma’ Radzi School of Bioprocess Engineering University Malaysia Perlis.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
Team  Spatially distributed deterministic models  Many hydrological phenomena vary spatially and temporally in accordance with the conservation.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1-1 Chapter 1.
Algorithms and Problem Solving
Chapter 1.
Chapter 2: Input, Processing, and Output
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Functions CIS 40 – Introduction to Programming in Python
Introduction to science
Unit# 9: Computer Program Development
Problem Solving Techniques
Objective of This Course
Mathematical Modeling, Numerical Methods, and Problem Solving
Algorithms and Problem Solving
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Mathematical Model.
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Lesson 1 - Visualizing Dependencies
APPLICATION OF LINEAR ALGEBRA IN MECHANICAL ENGINEERING
Basic Concepts of Algorithm
Pseudocode For Program Design.
Presentation transcript:

ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Modeling, Computers, and Error Analysis

Mathematical Modeling and Engineering Problem Solving Requires understanding of engineering systems – By observation and experiment – Theoretical analysis and generalization Computers are great tools, however, without fundamental understanding of engineering problems, they will be useless.

 A mathematical model is represented as a functional relationship of the form Dependent IndependentForcing Variable = f Variables, Parameters,Functions  Dependent variable: Characteristic that usually reflects the state of the system  Independent variables: Dimensions such as time and space along which the systems behavior is being determined  Parameters: reflect the system’s properties or composition  Forcing functions: external influences acting upon the system

 States that “the time rate change of momentum of a body is equal to the resulting force acting on it.”  The model is formulated as F = m a (1.2) F = net force acting on the body (N) m = mass of the object (kg) a = its acceleration (m/s 2 ) Newton’s 2 nd law of Motion

 Formulation of Newton’s 2 nd law has several characteristics that are typical of mathematical models of the physical world:  It describes a natural process or system in mathematical terms  It represents an idealization and simplification of reality  Finally, it yields reproducible results, consequently, can be used for predictive purposes.

 Some mathematical models of physical phenomena may be much more complex.  Complex models may not be solved exactly or require more sophisticated mathematical techniques than simple algebra for their solution  Example, modeling of a falling parachutist:

 This is a differential equation and is written in terms of the differential rate of change dv/dt of the variable that we are interested in predicting.  If the parachutist is initially at rest (v=0 at t=0), using calculus FUFU FDFD m c

Independent variable Dependent variable Parameters Forcing function

212,428 nodes, 189,078 brick elements and 1500 shell elements Circular boundary to reduce reflections

Conservation Laws and Engineering  Conservation laws are the most important and fundamental laws that are used in engineering. Change = Increases – Decreases (1.13)  Change implies changes with time (transient). If the change is nonexistent (steady-state), Eq becomes Increases = Decreases

 For steady-state incompressible fluid flow in pipes: Flow in = Flow out or = Flow 4 Flow 4 = 60

Programming and Software  Objective is how to use the computer as a tool to obtain numerical solutions to a given engineering model. There are two ways in using computers:  Use available software  Write computer programs to extend the capabilities of available software  Engineers should not be tool limited, it is important that they should be able to do both!

 Computer programs are set of instructions that direct the computer to perform a certain task.  To be able to perform engineering-oriented numerical calculations, you should be familiar with the following programming topics:  Simple variables (constants, variables, and type declaration)  Structured variables (data structure, arrays, and records)  Mathematical formulas (assignment, priority rules, and intrinsic functions)  Input/Output  Logical flow (sequence, selection, and repetition)  Modular programming (functions and subroutines )

Sub dft() Dim ytime(0 To 18000) As Double Dim omega(0 To 8096) As Double Dim yfreqr(0 To 8096) As Double Dim yfreqi(0 To 8096) As Double Dim t As Double, sumr As Double, sumi As Double Dim sum As Double, omegadt As Double, omegat As Double, deltime As Double Dim sigmaz(1 To 30, 1 To 30) As Single 'a two dimensional array of single-precision Dim rowstep, colstep As Integer 'steps used to point Dim i, j As Integer 'more counters

Structured Programming  Structured programming is a set of rules that prescribe good style habits for programmers  An organized, well structured code  Easily sharable  Easy to debug and test  Requires shorter time to develop, test, and update  The key idea is that any numerical algorithm can be composed of using the three fundamental structures:  Sequence, selection, and repetition

 Sequence. Computer code must be implemented one instruction at a time, unless you instruct otherwise. The structure can be expressed as a flowchart or pseudocode.

Type Soil_Data 'Data for single soil layer Start_Depth As Single End_Depth As Single Dry_Weight As Single Sat_Weight As Single Percent_Fines As Single UCS_Class As String Description As String End Type Type Soil_Profile_Data 'Data for Soil Profile Description As String Start_Depth As Single End_Depth As Single NumSoils As Integer DepthGW As Single WeightGW As Single End Type

Sub ReadSoilProfile(j As Integer) 'Read data put into spreadsheet at each profile Dim wksSoil As Worksheet Dim soilcolumn As Integer, soilrow, i As Integer Set wksSoil = Worksheets("Soil Profile") soilcolumn = j + 1 'Read Profile Information With SoilProfiles(j).Description = wksSoil.Cells(6, soilcolumn).Start_Depth = wksSoil.Cells(7, soilcolumn).End_Depth = wksSoil.Cells(8, soilcolumn).NumSoils = wksSoil.Cells(9, soilcolumn).DepthGW = wksSoil.Cells(10, soilcolumn).WeightGW = wksSoil.Cells(11, soilcolumn) End With End Sub

 Selection. Splits the program’s flow into branches based on outcome of a logical condition.

Sub ifchecker() Dim i As Integer, j As Integer i = 1 j = 2 If i > j Then MsgBox ("I is bigger than J") Else MsgBox ("I is not bigger than J") End If End Sub

 Repetition. A means to implement instructions repeatedly.

Sub dataloops() ' dataloops Macro ' By R. Ray Dim sigmaz(1 To 30, 1 To 30) As Single 'a two dimensional array of single- 'precision Dim rowstep, colstep As Integer 'steps used to point to rows and columns Dim i, j As Integer MsgBox ("First write a row of xvalues“) For colstep = 1 To 30 Worksheets("Sheet1").Cells(1, colstep) = "xval " + CStr(colstep) 'write a row of ‘x values recall row-column notation Next colstep MsgBox ("Next, write a colum of y values") For rowstep = 1 To 30 Worksheets("Sheet1").Cells(rowstep, 1) = "yval " + CStr(rowstep) 'write a 'column of y values Next rowstep

MsgBox ("Now, populate 2-D matrix, then write it out on sheet") For i = 1 To 30 'outside loop For j = 1 To 30 'inside loop sigmaz(i, j) = 10 * i * j 'yes this is a fully loaded matrix Next j Next i 'We have the matrix, now write it out somewhere (choice is arbitrary, 'we'll start at 2,2) For colstep = 1 To 30 'outside loop For rowstep = 1 To 30 'inside loop Worksheets("Sheet1").Cells(colstep + 1, rowstep + 1) = sigmaz(colstep, rowstep) Next rowstep Next colstep MsgBox ("Done") End Sub

Modular Programming  The computer programs can be divided into subprograms, or modules, that can be developed and tested separately.  Modules should be as independent and self contained as possible.  Advantages to modular design are:  It is easier to understand the underlying logic of smaller modules  They are easier to debug and test  Facilitate program maintenance and modification  Allow you to maintain your own library of modules for later use

EXCEL  Is a spreadsheet that allow the user to enter and perform calculations on rows and columns of data.  When any value on the sheet is changed, entire calculation is updated, therefore, spreadsheets are ideal for “what if?” sorts of analysis.  Excel has some built in numerical capabilities including equation solving, curve fitting and optimization.  It also includes VBA as a macro language that can be used to implement numerical calculations.  It has several visualization tools, such as graphs and three dimensional plots.