1 / 27

ECIV 201 Computational Methods for Civil Engineers

ECIV 201 Computational Methods for Civil Engineers. Modeling, Computers, and Error Analysis. Richard P. Ray, Ph.D., P.E. Mathematical Modeling and Engineering Problem Solving. Requires understanding of engineering systems By observation and experiment Theoretical analysis and generalization

odin
Télécharger la présentation

ECIV 201 Computational Methods for Civil Engineers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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.

  3. A mathematical model is represented as a functional relationship of the form DependentIndependentForcing Variable = fVariables, 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

  4. Newton’s 2nd law of Motion • 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/s2)

  5. Formulation of Newton’s 2nd 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.

  6. 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:

  7. c FU FD m • 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

  8. Independent variable Dependent variable Parameters Forcing function

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

  10. 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. 1.13 becomes Increases = Decreases

  11. For steady-state incompressible fluid flow in pipes: Flow in = Flow out or 100 + 80 = 120 + Flow4 Flow4 = 60

  12. 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!

  13. 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)

  14. 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

  15. 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

  16. 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.

  17. 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

  18. 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

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

  20. 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

  21. Repetition. A means to implement instructions repeatedly.

  22. 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

  23. 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 + 2.2 * 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

  24. 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

  25. 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.

More Related