mec3456-2013-lecture01

Upload: alex-franklin

Post on 14-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 MEC3456-2013-Lecture01

    1/38

    DepartmentofMechanicalEngineeringMonashUniversity

    MEC3456 Engineering Computational Analysis

    Lecture 01 Introduction

  • 7/30/2019 MEC3456-2013-Lecture01

    2/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    My detailsDr. Zhe LiuRoom 219, Building 82 (New Horizons)Phone 990 53627

    EMAIL:[email protected]

    Available consultation hours:

    Monday: 2pm-5pm

  • 7/30/2019 MEC3456-2013-Lecture01

    3/38

    What is Engineering computing?

    In general, engineers arerequired to relate physicalphenomena to mathematicalmodels.

    An example is to design theracing car to obtain the

    optimal aerodynamicperformance.

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

  • 7/30/2019 MEC3456-2013-Lecture01

    4/38

    What is Engineering computing?

    A mathematical model is broadly defined as a formulationor equation that expresses the essential feature of aphysical system.

    Often it is difficult to get an analytical solution. A computer model is thus required to solve the

    mathematical models, often, repetitively.

    Solving simultaneous equations Solving ordinary or partial differential equations integration

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Dependent

    variables= f

    independent

    variables

    , parameters,

    forcing

    function

  • 7/30/2019 MEC3456-2013-Lecture01

    5/38

    Why do this project?

    Why would an engineer use a computer to solveproblems?

    Problem may be difficult to test in practice High precision required Economic concerns Fast results required Many models to test

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    ComputerScien:stslearnhowtoprogram

    Theyhavenotlearntabout

    ThermodynamicsSolidMechanicsFluidMechanicsKinema:cs

  • 7/30/2019 MEC3456-2013-Lecture01

    6/38

    Why do this subject?

    Computer can model where experiments cantventure

    (e.g., crack propagation and dislocation motion)

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Abraham F. F. et.al. PNAS;2002;99:5783-5787

  • 7/30/2019 MEC3456-2013-Lecture01

    7/38

    Why do this subject?

    Computer model can predict(e.g., weather forecast)

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

  • 7/30/2019 MEC3456-2013-Lecture01

    8/38

    Why do this subject?

    Today, 97 of the top 100 industrial companiesinvest in engineering simulation as a key strategyto win in a globally competitive environment.

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

  • 7/30/2019 MEC3456-2013-Lecture01

    9/38

    How? Hardware

    Manufacturer --- IBM Location --- Lawrence Livermore National Laboratory, California, US Funded by --- National Nuclear Security Administration as part

    of the Advanced Simulation and Computing Program (ASC)

    Processors and speed ---A total of 1,572,864 cores;16.32 petaflop/s Power consumption --- 7.890 MW.

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Theworldfastestcomputer:Sequoia http://www.top500.org/

  • 7/30/2019 MEC3456-2013-Lecture01

    10/38

    How? Hardware

    Victorian Life SciencesComputation Initiative

    Processors and speed:65,536 cores; 65 TB of RAM;

    690,197 GFlop/s

    Power consumption: 328.75 kW Application:

    Life science and medical scienceresearch

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    FastestcomputerinAustralia:AVOCA 31th on the top 500 list

    In 2013, ANU will have a newsupercomputer manufactured byJapanese ICT and Fujitsu performingat 1.2TFlop/s.

  • 7/30/2019 MEC3456-2013-Lecture01

    11/38

    How? Software/Programming

    Computer program are merelya set ofinstructions that direct the computer toperform certain tasks.

    Simple information representation Advanced information representation Input/output Mathematical formulas Logic representation Modular programming

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

  • 7/30/2019 MEC3456-2013-Lecture01

    12/38

    How? Software/Programming

    To program, we will use a computer packagecalled MATLAB

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    MATLAisspecificallydesignedforscien:ficandengineeringresearch

    ItisveryaccurateatmodelingItisveryeasytovisualizeyourdata

  • 7/30/2019 MEC3456-2013-Lecture01

    13/38

    Unit Overview

    In this unit, you will learn how to use computerto do the followings

    Finding roots of functions/interpolation Numerical Integrate and Numerical Differentiation Solving O.D.E.s

    Initial-value problems Boundary-value problems

    Solving P.D.E.s 1D. Problem 2D. Problem

    Fourier analysis

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    We will focus on

    Techniques to solve problemsAccuracy of the technique Stability of the technique Efficiency of the technique

  • 7/30/2019 MEC3456-2013-Lecture01

    14/38

    Unit Overview

    At the end of this unit, you will be able to Problem solving Programming A critical approach to a complex problems

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

  • 7/30/2019 MEC3456-2013-Lecture01

    15/38

    Unit Overview: Ideas and Attitudes

    IdeasComputational solutions:

    Having errors May never get an answer May take a long time to obtain May be complex

    Attitudes Confidence in writing/using/developing codes

    Be critical of numerical results they may be wrong

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

  • 7/30/2019 MEC3456-2013-Lecture01

    16/38

    Unit Overview

    Lectures

    Interpolation and root finding (3 lectures) Open and close methods Newton & Lagrange interpolation Cubic spline Higher dimensional interpolation

    Numerical integration Newton-Cotes technique Richardson/Romberg technique Gauss quadrature

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

  • 7/30/2019 MEC3456-2013-Lecture01

    17/38

    Unit Overview

    Lectures

    Solution of ODE (8 lectures) Runge-Kutta method Multi-step method Implicit method Initial and boundary value problems Eigenvalue problem

    Solution of PDE (11 lectures) Finite difference method Finite element method

    Fourier analysis (2 lectures)

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

  • 7/30/2019 MEC3456-2013-Lecture01

    18/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    TextbooksOne prescribed textbook

    Several other textbooks will also be used in this course

    NumericalMethodsfor

    Engineers,

    Chapra&Canale,6thedi:on

    McGraw-Hill.

    Largenumberofengineering-

    relatedmethodsdetailed.

    Virtuallynoprogramming,but

    substan:altheory.

  • 7/30/2019 MEC3456-2013-Lecture01

    19/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    AppliedNumericalMethodswith

    MatlabforEngineersandScien:sts,

    StevenC.Chapra,McGrawHill,2005.

    Thistextisgoodbecauseitmarries

    bothMATLAprogrammingandtheapplica:onofNumericalMethods.

    Recommended texts and readings

    NumericalMethodsinEngineering

    withMatlab,

    Kiusalaas,CambridgeUniversity,2005.

    Thistextisalsogoodbecauseit

    marriesbothMATLAprogramming

    andtheapplica:onofNumerical

    Methods.

  • 7/30/2019 MEC3456-2013-Lecture01

    20/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    Recommended texts and readingsNumericalMethods,

    J.FairesandR.Burden

    3rdEd.ThomsonBrooks/Cole,2003

    Anexcellenttextbook.Goesintoalotofdetail,someprogramming-usesthe

    "Maple"programminglanguage.

    NumericalRecipesinC,

    Flannery,Ve_erling,Press&Teukolsky.

    (alsoavailableinPascal,C++andFortran.)

    Explana:ons&codeforawiderangeof

    numericalalgorithms.Advanced

    techniques.

  • 7/30/2019 MEC3456-2013-Lecture01

    21/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    How do I deliver this subject Lectures(in class, three hours per week, recorded

    videos uploaded online after lectures)

    Tutorial questionsrelated to computer lab practices Computer labs(2 hours per week) --- instruction

    videos posted online before computer labs.

  • 7/30/2019 MEC3456-2013-Lecture01

    22/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    Assessment and feedback Final exam paper and in class quiz (70%)

    Four in-class quiz (2%) will cover the main topics: root-findingand interpolation, numerical integration, ODE, and PDE.

    Computer lab attendance and reports (30%) Attendance accounts 2%, and lab reports contribute 28% Laboratories will start in the 2nd weekof semester The first laboratory is a MATLAB tutorial, and will not be

    assessed.

    Every two weeks, you submit lab reports in pair by Friday 5pm(week 3, 5, 7, 10, and 12), e.g., lab report 1 and 2 submitted onweek 3, lab report 3 and 4 submitted on week 5, and so on.

  • 7/30/2019 MEC3456-2013-Lecture01

    23/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    Online lecture notesand other readings Lecture notes will be online (Moodle) one week before the

    courses

    Also, several articles and links to topics of interestarranged by lecture topic.

  • 7/30/2019 MEC3456-2013-Lecture01

    24/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    Tutorial Questions and Solutions Several practical questions of math derivation and hand

    calculations for each topic.

  • 7/30/2019 MEC3456-2013-Lecture01

    25/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    Students must attend computer laboratory session assigned viaAllocate+ system. Please contact me ASAP to report any clashes.

    Lab questions will be available on Moodle. An instruction video will be provided before the lab session. You are suggested to read the laboratory handout and watch the

    instruction video prior to arriving at the laboratory class.

    Computer laboratories

  • 7/30/2019 MEC3456-2013-Lecture01

    26/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    Computer laboratory contents

  • 7/30/2019 MEC3456-2013-Lecture01

    27/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Unit Overview

    Feedbacks Lecture contents

    You are welcome to ask questions during/after thelectures.

    Every week, office hours on Monday from 2pm to 5pm(Room 219, New Horizons Building)

    Moodle online forum. Computer labs: programming and lab reports

    You are welcome to ask me and our demonstrators duringthe lab sessions.

    Comments will be provided in you marked lab reports.Any disagreements related to report marks will be

    discussed during the lab session.

  • 7/30/2019 MEC3456-2013-Lecture01

    28/38

    DepartmentofMechanicalEngineeringMonashUniversity

    Lecture 01 computational error

  • 7/30/2019 MEC3456-2013-Lecture01

    29/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Computational Error

    Although the numerical technique yields estimatethat close to the exact analytical solution, there wasa discrepancy or error.

    There are two types of computational errors in ournumerical models.

    Round-off error (induced by hardware) Truncation error (induced by algorithm)

  • 7/30/2019 MEC3456-2013-Lecture01

    30/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Round-off Error

    How do computer store numbers?

    Computer handles two types of numerical data Integer (fixed point numbers)

    E.g., 0, -21, 973,

    Real number (floating point numbers)E.g., 0.921, 0.2491

    10

    -1

    IEEE binary floating point arithmetic standard 754-1985 The manner of a real number expressed and stored in computer

    memory (b=2 for binary number system)

  • 7/30/2019 MEC3456-2013-Lecture01

    31/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Round-off Error

    How computer store numbers?

    Typically, real number is stored 32 bit (single precision) in acomputer. This is only enough to maintain 7-8 significantfigures within between 10-40 to 1040

    The typical relative error is called machine accuracy (m) The machine accuracy of a 32bit computer is about:

    m ~ 310-8

    Round-off error is accumulative. Every time a floating pointarithmetic operation is performed an error will be introducedof size m.

  • 7/30/2019 MEC3456-2013-Lecture01

    32/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Round-off Error

    How round-off error develop?

    These errors mostly add up randomly. AfterNoperations theerror is typically approximately

    Total error =N1/2m

    However, it is possible that these errors could all be of thesame sign and then the error estimate is:

    Total error =Nm

  • 7/30/2019 MEC3456-2013-Lecture01

    33/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Round-off Error

    How round-off error develop?

    Some arithmetic operations will result in significant loss ofaccuracy.

    For example, the adding a small number 0.0010 to a largenumber 4000

    The subtraction two nearly equal floating point numbers

    0.4000 i104

    0.0000001 i104

    0.4000001 i104

    Forahypothe:calcomputerwith

    4-digitman:ssa,thefinalresultis

    0.4000104

    x =b b

    2 4ac

    2a

    Thiswillproducebig

    errorsifb2>>4ac

  • 7/30/2019 MEC3456-2013-Lecture01

    34/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Truncation Error

    Truncation errors are those that results from using anapproximation in place of an exact mathematical formula.

    Truncation error is due to the algorithm used. Thinktruncation in terms of the removal of higher-order

    terms in a Taylors series expansion.

    In this course, we will keep using a discrete method toapproximate a continuous problem (e.g., numericaldifferentiation)

    In the limit of using more and more terms, or points, orintervals, the approximation should become increasinglyaccurate.

    f(xi+1) = f(xi )+ f '(xi )(xi+1 xi ) + f ''(xi )(xi+1 xi )2+ ...

  • 7/30/2019 MEC3456-2013-Lecture01

    35/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Stability of the Solution Technique

    Another important issue isSTABILITY.

    This is associated with the interaction between the round-off error and the numerical algorithm.

    Any error that exists at some stage of the solution process ismagnified (usually exponentially) so that after a certainstage the error swamps the solution and the approximationis meaningless.

    We will later look at ways to determine the stabilityproperties of a given method.

  • 7/30/2019 MEC3456-2013-Lecture01

    36/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Examples

    A round-off error

    Consider the simple program snippet in MATLAB:

    pi =3.141592653589793238462643;

    MATLAB will only store the underlined digits

    fprintf('%30.25f\n',pi)

    with output:

    3.1415926535897931000000000

    The digits underlined are incorrect.

    More digits than

    are stored in

    pi

  • 7/30/2019 MEC3456-2013-Lecture01

    37/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Examples

    A truncation error

    Consider the Taylor series expansion of ln(1+x)

    y(x) = ln(1+ x) =(1)

    i+1

    ix

    i

    i

    = x 1

    2

    x2+1

    3

    x3

    1

    4

    x4+1

    5

    x51

    6

    x6+ ...

    y(x)

    y(0.5) = 0.5

    y(0.5) = ln(1+ 0.5) = 0.405465108

    TheTRUNCATIONerroristrue-approxima:on

    =0.4054651080.5 =-0.094534892(23%)

  • 7/30/2019 MEC3456-2013-Lecture01

    38/38

    Outline

    Whatis

    engineering

    compu:ng?

    Whydothisobject?

    How?

    Hardware SoBware/programming

    Unitoverview

    LectureTextbookAssessmentComputa:onal

    errors

    Roundofferror

    Trunca:onerror

    Summary

    In this lecture, we have learned What is engineering computational analysis? computer

    models to solve mathematical equations numerically.

    Why do we need this object? It can provide informationthat cant be provided by experiments and theory.

    How to do it? the topic of this unit! Numerical errors

    Round-off error (induced by hardware) Truncation error (induced by algorithm)

    In the next lecture, I will give you a brief introduction ofMATLAB.