Numerical Marine Hydrodynamics Summary

Similar documents
2.29 Numerical Fluid Mechanics Spring 2015 Lecture 13

Characteristic finite-difference solution Stability of C C (CDS in time/space, explicit): Example: Effective numerical wave numbers and dispersion

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 4

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF MATHEMATICS ACADEMIC YEAR / EVEN SEMESTER QUESTION BANK

Preface. 2 Linear Equations and Eigenvalue Problem 22

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 2

SOLUTION OF EQUATION AND EIGENVALUE PROBLEMS PART A( 2 MARKS)

Department of Mathematics California State University, Los Angeles Master s Degree Comprehensive Examination in. NUMERICAL ANALYSIS Spring 2015

NUMERICAL METHODS FOR ENGINEERING APPLICATION

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 9

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

AIMS Exercise Set # 1

Numerical Mathematics

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Index. C 2 ( ), 447 C k [a,b], 37 C0 ( ), 618 ( ), 447 CD 2 CN 2

Applied Numerical Analysis

CS 257: Numerical Methods

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination December, 2015 BCS-054 : COMPUTER ORIENTED NUMERICAL TECHNIQUES

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 7

A THEORETICAL INTRODUCTION TO NUMERICAL ANALYSIS

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 20

Exact and Approximate Numbers:

Numerical Marine Hydrodynamics

Numerical Methods for Engineers. and Scientists. Applications using MATLAB. An Introduction with. Vish- Subramaniam. Third Edition. Amos Gilat.

M.SC. PHYSICS - II YEAR

Fundamental Numerical Methods for Electrical Engineering

Fourth Order RK-Method

Name of the Student: Unit I (Solution of Equations and Eigenvalue Problems)

NUMERICAL MATHEMATICS AND COMPUTING

NUMERICAL METHODS USING MATLAB

Numerical Methods in Physics and Astrophysics

LECTURES IN BASIC COMPUTATIONAL NUMERICAL ANALYSIS

Math 411 Preliminaries

Numerical methods. Examples with solution

Exam in TMA4215 December 7th 2012

Review for Exam 2 Ben Wang and Mark Styczynski

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

ECE539 - Advanced Theory of Semiconductors and Semiconductor Devices. Numerical Methods and Simulation / Umberto Ravaioli

x n+1 = x n f(x n) f (x n ), n 0.

Today s class. Linear Algebraic Equations LU Decomposition. Numerical Methods, Fall 2011 Lecture 8. Prof. Jinbo Bi CSE, UConn

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

ME Computational Fluid Mechanics Lecture 5

Computational Methods. Systems of Linear Equations

Numerical Methods for Engineers and Scientists

JACOBI S ITERATION METHOD

Index. higher order methods, 52 nonlinear, 36 with variable coefficients, 34 Burgers equation, 234 BVP, see boundary value problems

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

Numerical Methods in Physics and Astrophysics

Numerical Analysis. A Comprehensive Introduction. H. R. Schwarz University of Zürich Switzerland. with a contribution by

Part IB Numerical Analysis

Computation Fluid Dynamics

MATHEMATICAL METHODS INTERPOLATION

NUMERICAL COMPUTATION IN SCIENCE AND ENGINEERING

Introd uction to Num erical Analysis for Eng ineers

Numerical Analysis Comprehensive Exam Questions

Lecture 9 Approximations of Laplace s Equation, Finite Element Method. Mathématiques appliquées (MATH0504-1) B. Dewals, C.

1. Nonlinear Equations. This lecture note excerpted parts from Michael Heath and Max Gunzburger. f(x) = 0

Virtual University of Pakistan

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Partial Differential Equations

Review Higher Order methods Multistep methods Summary HIGHER ORDER METHODS. P.V. Johnson. School of Mathematics. Semester

Examination paper for TMA4125 Matematikk 4N

Mathematics for Engineers. Numerical mathematics

MTH603 FAQ + Short Questions Answers.

PARTIAL DIFFERENTIAL EQUATIONS

Ordinary Differential Equations

Chapter Two: Numerical Methods for Elliptic PDEs. 1 Finite Difference Methods for Elliptic PDEs

The Solution of Linear Systems AX = B

Math 471 (Numerical methods) Chapter 3 (second half). System of equations

LU Factorization. Marco Chiarandini. DM559 Linear and Integer Programming. Department of Mathematics & Computer Science University of Southern Denmark

Kasetsart University Workshop. Multigrid methods: An introduction

you expect to encounter difficulties when trying to solve A x = b? 4. A composite quadrature rule has error associated with it in the following form

Solving PDEs with PGI CUDA Fortran Part 4: Initial value problems for ordinary differential equations

BASIC EXAM ADVANCED CALCULUS/LINEAR ALGEBRA

Differential Equations

Computational Methods

Numerical Analysis Preliminary Exam 10 am to 1 pm, August 20, 2018

NUMERICAL METHODS. lor CHEMICAL ENGINEERS. Using Excel', VBA, and MATLAB* VICTOR J. LAW. CRC Press. Taylor & Francis Group

Direct Methods for solving Linear Equation Systems

MATH3018 & MATH6141 Numerical Methods. Dr. Ian Hawke Content provided under a Creative Commons attribution license, CC-BY Ian Hawke.

Unit I (Testing of Hypothesis)

Numerical Marine Hydrodynamics

Iterative Methods. Splitting Methods

Numerical Methods. Scientists. Engineers

Finite Differences for Differential Equations 28 PART II. Finite Difference Methods for Differential Equations

MA3232 Numerical Analysis Week 9. James Cooley (1926-)

FINITE-DIMENSIONAL LINEAR ALGEBRA

Iterative Methods for Ax=b

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations

5. Hand in the entire exam booklet and your computer score sheet.

Numerical Methods I Solving Nonlinear Equations

Implicitly Defined High-Order Operator Splittings for Parabolic and Hyperbolic Variable-Coefficient PDE Using Modified Moments

Scientific Computing: An Introductory Survey

Chapter 9 Implicit Methods for Linear and Nonlinear Systems of ODEs

LINEAR SYSTEMS (11) Intensive Computation

INTRODUCTION TO COMPUTATIONAL MATHEMATICS

Preliminary Examination in Numerical Analysis

Transcription:

Numerical Marine Hydrodynamics Summary Fundamentals of Digital Computing Error Analysis Roots of Non-linear Equations Systems of Linear Equations Gaussian Elimination Iterative Methods Optimization, Curve Fitting Interpolation Numerical Integration Numerical Differentiation Ordinary Differential Equations Initial Value Problems Boundary Value Problems Partial Differential Equations Finite Element and Spectral Methods Boundary Integral Panel Methods

Digital Computer Models V Continuum Model R x w = dx dt Differential Equation Difference Equation Differentiation Integration System of Equations Discrete Model t m x n t x Linear System of Equations Eigenvalue Problems Solving linear equations m n n Non-trivial Solutions Root finding Accuracy and Stability => Convergence

Error Analysis Number Representation Addition and Subtraction Absolute Error Shift mantissa of largest number Relative Error Result has exponent of largest number Absolute Error Relative Error Multiplication and Division Unbounded Relative Error Bounded

Recursion Heron s Device a=26; n=10; g=1; MATLAB script Numerically evaluate square-root % Number of Digits heron.m dig=5; sq(1)=g; for i=2:n sq(i)= 0.5*radd(sq(i-1),a/sq(i-1),dig); Initial guess Test end hold off plot([0 n],[sqrt(a) sqrt(a)],'b') hold on plot(sq,'r') plot(a./sq,'r-.') plot((sq-sqrt(a))/sqrt(a),'g') grid on Mean of guess and its reciprocal Recursion Algorithm

Spherical Bessel Functions Generation by Recurrence Relations Forward Recurrence Forward Recurrence Unstable Backward Recurrence Miller s algorithm N ~ x+20 Stable

Error Propagation Absolute Errors Function of one variable Δx = x - x Δy~f (x)δx General Error Propagation Formula x x

Error Propagation Condition Number y = f(x) x x y y x = x(1 + α) y = y(1 + β) Problem Condition Number Problem ill-conditioned Error cancellation example Well-conditioned problem

Roots of Nonlinear Equations General Method Example: Cube root Non-linear Equation Goal: Converging series Rewrite Problem Example % f(x) = x^3 - a = 0 % g(x) = x + C*(x^3 - a) cube.m a=2; n=10; g=1.0; C=-0.1; sq(1)=g; for i=2:n sq(i)= sq(i-1) + C*(sq(i-1)^3 -a); end hold off plot([0 n],[a^(1./3.) a^(1/3.)],'b') hold on plot(sq,'r') plot( (sq-a^(1./3.))/(a^(1./3.)),'g') grid on Iteration

Roots of Nonlinear Equations General Method Convergence Mean-value Theorem y y=x y=g(x) Convergent x 1 x 0 x Convergence y y=g(x) y=x > Divergent x x 0 1 x

Systems of Linear Equations Gaussian Elimination Reduction Step k Reduction Step n-1 Back-Substitution

Systems of Linear Equations Gaussian Elimination Reduction Step k Partial Pivoting by Columns New Row k Pivotal Elements New Row i Required at each step!

Partial Pivoting Full Systems of Linear Equations Gaussian Elimination Numerical Stability Equilibrate system of equations Pivoting by Columns Simple book-keeping Solution vector in original order Pivoting Does not require equilibration Pivoting by both row and columns More complex book-keeping Solution vector re-ordered Partial Pivoting is simplest and most common Neither method guarantees stability

Systems of Linear Equations Gaussian Elimination How to Ensure Numerical Stability System of equations must be well conditioned Investigate condition number Tricky, because it requires matrix inversion (next class) Consistent with physics E.g. don t couple domains that are physically uncoupled Consistent units E.g. don t mix meter and μm in unknowns Dimensionless unknowns Normalize all unknowns consistently Equilibration and Partial Pivoting, or Full Pivoting

Systems of Linear Equations Gaussian Elimination Multiple Right-hand Sides k Reduction Step k Computation Count Reduction Step k Operations Total Computation Count Reduction k n n-k Reduction for each right-hand side inefficient. However, RHS may be result of iteration and unknown a priori (e.g. Euler s method) -> LU Factorization p Back Substitution

Systems of Linear Equations LU Factorization The coefficient Matrix A is decomposed as where and is a lower triangular matrix is an upper triangular matrix Then the solution is performed in two simple steps 1. 2. Forward substitution Back substitution How to determine and?

Linear Systems of Equations Error Analysis Vector and Matrix Norm Perturbed Right-hand Side Properties Subtract original equation Relative Error Magnification Condition Number

Linear Systems of Equations Iterative Methods Sparse, Full-bandwidth Systems Rewrite Equations 0 x x 0 x 0 0 x 0 x 0 x x 0 0 x x 0 x Iterative, Recursive Methods 0 0 0 Jacobi s Method 0 0 0 Gauss-Seidels s Method

Linear Systems of Equations Iterative Methods Convergence Jacobi s Method Iteration Matrix form Iteration Matrix form Decompose Coefficient Matrix Convergence Analysis with / Note: NOT LU-factorization / Sufficient Convergence Condition Numerical Mari ne Hydrodynamics Lecture 24

Linear Systems of Equations Iterative Methods Sufficient Convergence Condition Stop Criterion for Iteration +_ Jacobi s Method Sufficient Convergence Condition Diagonal Dominance

Least Square Approximation Linear Measurement Model n model parameters m measurements Overdetermined System m measurements n unknowns m > n Least Square Solution Minimize Residual Norm m n

Least Square Approximation Theorem A Proof q.e.d ) Normal Equation Symmetric n x n matrix. Nonsingular if columns of A are linearly independent

Example Island Survey Least Square Approximation Parameter estimation Measured Altitude Differences B E C D A F Points D, E, and F at sea level. Find altitude of inland points A, B, and C. Normal Equation A=[ [1 0 0-1 0-1]' [0 1 0 1-1 0]' [0 0 1 0 1 1]'] b=[1 2 3 1 2 1]'; C=A'*A c=a'*b % Least square solution z=inv(c)*c % Residual lstsq.m r=b-a*z rn=sqrt(r'*r) Residual Vector

Numerical Interpolation Lagrange Polynomials f(x) 1 k-3 k-2 k-1 k k+1 k+2 x Difficult to program Difficult to estimate errors Divisions are expensive Important for numerical integration

Lagrange Interpolation Numerical Integration Equidistant Sampling f(x) Integration Weights (Cote s Numbers) a b x Properties

Numerical Integration Trapezoidal Rule f(x) n=1 Simpson s Rule h x f(x) n=2 h h x

Gaussian Quadrature f(x) Trapezoidal Rule Exact Integration of const and linear f a b x f(x) a b x

Numerical Interpolation Triangular Families of Polynomials Ordered Polynimials Special form convenient for interpolation where Coefficients found by recursion

Numerical Interpolation Newton s Iteration Formula Standard triangular family of polynomials Newton s Computational Scheme Divided Differences 2 3

Numerical Interpolation Newton s Iteration Formula f(x) f(x) 1 2 3 4 x 0 1 x Numerical Marine Hydrodynamics Lecture 24

Numerical Interpolation Equidistant Newton Interpolation Equidistant Sampling Divided Differences Stepsize Implied Triangular Family of Polynomials Equidistant Sampling

Numerical Differentiation Second order f(x) n=2 Forward Difference Central Difference h h x Second Derivatives n=2 Forward Difference n=3 Central Difference

Ordinary Differential Equations Initial Value Problems Differential Equation Euler s Method Example Discretization Finite Difference (forward) Recurrence euler.m

Initial Value Problem Initial Value Problems Runge-Kutta Methods y 2 nd Order Runge-Kutta average x 4 th Order Runge-Kutta Predictor-corrector method Second-order RK methods b = ½, a = ½ : Heun s method b= 1, a = 0 : Midpoint method b =2/3, a = 1/3 : Ralston s Method Numerical Marine Hydrodynamics Lecture 24

Boundary Value Problems Finite Difference Methods Forced Vibration of a String f(x,t) Finite Difference x i Harmonic excitation f(x,t) = f(x) cos(ωt) y(x,t) Discrete Difference Equations Matrix Form Differential Equation Boundary Conditions Tridiagonal Matrix Symmetric, positive definite: No pivoting needed

Partial Differential Equations y φ (n) (x,y 2 ) Quasi-linear PDE A,B and C Constants φ (n) (x 1,y) φ (n) (x 2,y) Hyperbolic Parabolic Elliptic φ (n) (x,y 1 ) x

Partial Differential Equations Hyperbolic PDE Waves on a String t Initial Conditions Boundary Conditions u(0,t) u(l,t) Wave Solutions u(x,0), u t (x,0) x Typically Initial Value Problems in Time, Boundary Value Problems in Space Time-Marching Solutions Explicit Schemes Generally Stable

Partial Differential Equations Hyperbolic PDE Dimensionless Wave Speed t Explicit Finite Difference Scheme Stability Requirement u(0,t) u(l,t) j+1 j j-1 i-1 i i+1 u(x,0), u t (x,0) x

Waves on a String L=10; T=10; waveeq.m c=1.5; N=100; h=l/n; M=400; k=t/m; C=c*k/h Lf=0.5; x=[0:h:l]'; t=[0:k:t]; %fx=['exp(-0.5*(' num2str(l/2) '-x).^2/(' num2str(lf) ').^2)']; %gx='0'; fx='exp(-0.5*(5-x).^2/0.5^2).*cos((x-5)*pi)'; gx='0'; f=inline(fx,'x'); g=inline(gx,'x'); n=length(x); m=length(t); u=zeros(n,m); u(2:n-1,1)=f(x(2:n-1)); for i=2:n-1 u(i,2) = (1-C^2)*u(i,1) + k*g(x(i)) +C^2*(u(i-1,1)+u(i+1,1))/2; end for j=2:m-1 for i=2:n-1 u(i,j+1)=(2-2*c^2)*u(i,j) + C^2*(u(i+1,j)+u(i-1,j)) - u(i,j-1); end end Numerical Marine Hydrodynamics Lecture 24

Partial Differential Equations Parabolic PDE Heat Flow Equation Insulation Initial Condition Rod Boundary Conditions x = 0 u(0,t) = c 1 x = L u(l,t)=c 2 x κ Thermal conductivity σ Specific heat ρ Density u Temperature IVP in one dimension, BVP in the other Marching, Explicit or Implicit Schemes

Partial Differential Equations Parabolic PDE Dimensionless Flow Speed t Explicit Finite Difference Scheme ) Stability Requirement r <= 0.5 u(0,t)=g 1 (t) u(l,t)=g 2 (t) j+1 j j-1 i-1 i i+1 u(x,0) = f(x) x

Heat Flow Equation Explicit Finite Differences L=1; T=0.2; c=1; N=5; h=l/n; M=10; k=t/m; r=c^2*k/h^2 heat_fw.m x=[0:h:l]'; t=[0:k:t]; fx='4*x-4*x.^2'; g1x='0'; g2x='0'; f=inline(fx,'x'); g1=inline(g1x,'t'); g2=inline(g2x,'t'); n=length(x); m=length(t); u=zeros(n,m); u(2:n-1,1)=f(x(2:n-1)); u(1,1:m)=g1(t); u(n,1:m)=g2(t); for j=1:m-1 for i=2:n-1 u(i,j+1)=(1-2*r)*u(i,j) + r*(u(i+1,j)+u(i-1,j)); end end. figure(4) mesh(t,x,u); a=ylabel('x'); set(a,'fontsize',14); a=xlabel('t'); set(a,'fontsize',14); a=title(['forward Euler - r =' num2str(r)]); set(a,'fontsize',16);

Partial Differential Equations Elliptic PDE Laplace Equation y Finite Difference Scheme u(x,b) = f 2 (x) Boundary Conditions u(0,y)=g 1 (y) u(a,y)=g 2 (y) j+1 j j-1 Global Solution Required i-1 i i+1 u(x,0) = f 1 (x) x

Elliptic PDEs Iterative Schemes Finite Difference Scheme y Liebman Iterative Scheme u(x,b) = f 2 (x) SOR Iterative Scheme u(0,y)=g 1 (y) u(a,y)=g 2 (y) j+1 j j-1 Optimal SOR i-1 i i+1 u(x,0) = f 1 (x) x

Galerkin s Method Viscous Flow in Duct Remainder Inner product Analytical Integration x=[-1:h:1]'; y=[-1:h:1]; duct_galerkin.m n=length(x); m=length(y); u=zeros(n,m); Nt=5; for j=1:n xx(:,j)=x; yy(j,:)=y; end for i=1:2:nt for j=1:2:nt u=u+(8/pi^2)^2* (-1)^((i+j)/2-1)/(i*j*(i^2+j^2)) *cos(i*pi/2*xx).*cos(j*pi/2*yy); end end Galerkin Solution Flow Rate Numerical Marine Hydrody namics Lecture 24

Finite Elements 2-dimensional Elements 4 η = 1 3 ξ = 1 ξ = 1 B η ξ 1 η = 1 2 Figure by MIT OCW. Bilinear shape function on a rectangular grid Linear Interpolation Functions Figure by MIT OCW. Quadratic Interpolation Functions

Two-Dimensional Finite Elements Flow in Duct Finite Element Solution Integration by Parts Algebraic Equations

Potential Flow Boundary Integral Equations Green s Theorem n Green s Function Homogeneous Solution S V Boundary Integral Equation Discretized Integral Equation Linear System of Equations Panel Methods