Practical Course Scientific Computing and Visualization

Similar documents
Fluid flow I: The potential function

Laplace's equation: the potential between parallel plates

COURSE Iterative methods for solving linear systems

Iterative Methods for Solving A x = b

Lecture # 3 Orthogonal Matrices and Matrix Norms. We repeat the definition an orthogonal set and orthornormal set.

Finite Difference Methods for Boundary Value Problems

Fluid flow II: The stream function

Finite Difference Methods (FDMs) 1

6. Iterative Methods for Linear Systems. The stepwise approach to the solution...

Review: From problem to parallel algorithm

CLASS NOTES Models, Algorithms and Data: Introduction to computing 2018

Bindel, Fall 2016 Matrix Computations (CS 6210) Notes for

Lecture 18 Classical Iterative Methods

Deterministic Operations Research, ME 366Q and ORI 391 Chapter 2: Homework #2 Solutions

SOLVING ELLIPTIC PDES

Linear Algebra (Review) Volker Tresp 2018

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

A Hybrid Method for the Wave Equation. beilina

CKY & Earley Parsing. Ling 571 Deep Processing Techniques for NLP January 13, 2016

Optimal Interface Conditions for an Arbitrary Decomposition into Subdomains

Lecture Note 7: Iterative methods for solving linear systems. Xiaoqun Zhang Shanghai Jiao Tong University

CLASSICAL ITERATIVE METHODS

The Conjugate Gradient Method

Numerical Solution Techniques in Mechanical and Aerospace Engineering

PHYS 410/555 Computational Physics Solution of Non Linear Equations (a.k.a. Root Finding) (Reference Numerical Recipes, 9.0, 9.1, 9.

Implementation of Implicit Solution Techniques for Non-equilibrium Hypersonic Flows

Algebra C Numerical Linear Algebra Sample Exam Problems

12 CHAPTER 1. PRELIMINARIES Lemma 1.3 (Cauchy-Schwarz inequality) Let (; ) be an inner product in < n. Then for all x; y 2 < n we have j(x; y)j (x; x)

Handout 8 MATLAB Code for the Projection Method and BC Details for the Lid-Driven Cavity Problem

CME342 Parallel Methods in Numerical Analysis. Matrix Computation: Iterative Methods II. Sparse Matrix-vector Multiplication.

A simple FEM solver and its data parallelism

Modelling and implementation of algorithms in applied mathematics using MPI

Background. Background. C. T. Kelley NC State University tim C. T. Kelley Background NCSU, Spring / 58

1. Fast Iterative Solvers of SLE

Scientific Computing II

9. Iterative Methods for Large Linear Systems

Review of matrices. Let m, n IN. A rectangle of numbers written like A =

The Conjugate Gradient Method

MATH 3511 Lecture 1. Solving Linear Systems 1

A discrete magnetostatic solver in Matlab/Octave

Sparse Matrices and Iterative Methods

6. Multigrid & Krylov Methods. June 1, 2010

Sparse Linear Systems. Iterative Methods for Sparse Linear Systems. Motivation for Studying Sparse Linear Systems. Partial Differential Equations

Spring 2014: Computational and Variational Methods for Inverse Problems CSE 397/GEO 391/ME 397/ORI 397 Assignment 4 (due 14 April 2014)

Numerical Programming I (for CSE)

An Heuristic Finite Difference Scheme on Irregular Plane Regions

Lecture 1: Introduction to Sublinear Algorithms

RESEARCH ARTICLE. A strategy of finding an initial active set for inequality constrained quadratic programming problems

Solving the Convection Diffusion Equation on Distributed Systems

Finite Math - J-term Section Systems of Linear Equations in Two Variables Example 1. Solve the system

FEM and Sparse Linear System Solving

Image Reconstruction And Poisson s equation

Math 304 (Spring 2010) - Lecture 2

Next topics: Solving systems of linear equations

Linear Systems of Equations. ChEn 2450

Module 2: Reflecting on One s Problems

Design and Modeling of Fluid Power Systems ME 597/ABE Lecture 7

The embedded finite difference method for the Poisson equation in a domain with an irregular boundary and Dirichlet boundary conditions

Two-Dimensional Unsteady Flow in a Lid Driven Cavity with Constant Density and Viscosity ME 412 Project 5

Chapter 4 No. 4.0 Answer True or False to the following. Give reasons for your answers.

Chapter 5. Methods for Solving Elliptic Equations

1 Non-negative Matrix Factorization (NMF)

Properties of Matrices and Operations on Matrices

RBF-FD Approximation to Solve Poisson Equation in 3D

Gaussian Elimination for Linear Systems

Indefinite and physics-based preconditioning

Poisson Equation in 2D

Iterative Methods. Splitting Methods

Rotated Outer-Inner Iterative Schemes for The Solution of Burgers Equation

Signatures of GL n Multiplicity Spaces

Non-Equidistant Particle-In-Cell for Ion Thruster Plumes

AMS526: Numerical Analysis I (Numerical Linear Algebra for Computational and Data Sciences)

Computational Linear Algebra

LECTURES IN BASIC COMPUTATIONAL NUMERICAL ANALYSIS

Introduction. Math 1080: Numerical Linear Algebra Chapter 4, Iterative Methods. Example: First Order Richardson. Strategy

Lecture 3. 1 Polynomial-time algorithms for the maximum flow problem

Numerical Linear Algebra

Math 1080: Numerical Linear Algebra Chapter 4, Iterative Methods

Review Solutions, Exam 2, Operations Research

Consider the following example of a linear system:

Proximal Gradient Descent and Acceleration. Ryan Tibshirani Convex Optimization /36-725

Linear Algebra (Review) Volker Tresp 2017

Numerical Methods I: Numerical linear algebra

Linear Algebra. Brigitte Bidégaray-Fesquet. MSIAM, September Univ. Grenoble Alpes, Laboratoire Jean Kuntzmann, Grenoble.

Motivation: Sparse matrices and numerical PDE's

General Exam Part II, Fall 1998 Quantum Mechanics Solutions

Chapter 7 Iterative Techniques in Matrix Algebra

Iterative methods for Linear System

Lecture 4 Orthonormal vectors and QR factorization

Algorithm-Hardware Co-Optimization of Memristor-Based Framework for Solving SOCP and Homogeneous QCQP Problems

Final Exam. 1 True or False (15 Points)

MASSACHUSETTS INSTITUTE OF TECHNOLOGY DEPARTMENT OF MECHANICAL ENGINEERING CAMBRIDGE, MASSACHUSETTS NUMERICAL FLUID MECHANICS FALL 2011

Matrices handling in PDEs resolution with MATLAB R

Iterative Methods and Multigrid

First example, moments of inertia. I m,n = m i r 2 i m,n. m i r i,m r i,n. Symmetric second rank tensor x. i =1

Numerical solution of the 2-D Poisson equation on an irregular domain with Robin boundary conditions

Sparsity. The implication is that we would like to find ways to increase efficiency of LU decomposition.

K.S. Kang. The multigrid method for an elliptic problem on a rectangular domain with an internal conductiong structure and an inner empty space

Matrix Assembly in FEA

CHAPTER 2 EXTRACTION OF THE QUADRATICS FROM REAL ALGEBRAIC POLYNOMIAL

Transcription:

May 3, 24 Page 1 of 18

1 gridpoints for pressure p: j i p, p 1, p 2, p 3, p 4, p,1 p 1,1 p 2,1 p 3,1 p 4,1 p,2 p 1,2 p 2,2 p 3,2 p 4,2 p,3 p 1,3 p 2,3 p 3,3 p 4,3 p,4 p 1,4 p 2,4 p 3,4 p 4,4 Page 2 of 18

2 j Definitions: A = 1 δy, B = 1 δy, C = 1 δx, D = 1 δx, E = 1 δy 2, F = 1 δx 2, G = 2 δx 2 2 δy 2 discrete Poisson equation for p (n+1) (red points): p i+1,j 2p i 1,j + p i 1,j δx 2 equation (i, j): i + p i,j+1 2p i,j + p i,j 1 δy 2 = RHS i,j E p i,j 1 + F p i 1,j + G p i,j + F p i+1,j + E p i,j+1 = RHS i,j Page 3 of 18

j Definitions: A = 1 δy, B = 1 δy, C = 1 δx, D = 1 δx, E = 1 δy 2, F = 1 δx 2, G = 2 δx 2 2 δy 2 boundary conditions (blue points): p 1,j p,j =, δx p i,1 p i, =, δy i p imax+1,j p imax,j = δx for all j = 1,, jmax, p i,jmax+1 p i,jmax = δy for all i = 1,, imax equation (, j): C p,j + D p 1,j =, equation (imax + 1, j): D p imax,j + Cp imax+1,j =, equation (i, ): A p i, + B p i,1 =, equation (i, jmax + 1): B p i,jmax + A p i,jmax+1 = Page 4 of 18

j Definitions: A = 1 δy, B = 1 δy, C = 1 δx, D = 1 δx, E = 1 δy 2, F = 1 δx 2, G = 2 δx 2 2 δy 2 unused corner points (green points): equation (, ): p, =, equation (imax + 1, ): p imax+1, =, equation (, jmax + 1): p,jmax+1 =, equation (imax + 1, jmax + 1): p imax+1,jmax+1 = i (as the values of these points are never used, you can replace by any other value) Page 5 of 18

3 Resulting System of Linear j A = 1 δy, B = 1 δy, C = 1 δx, D = 1 δx, 1 δy 2, F = E = G = 2 δx 2 2 δy 2 i 1 p, A B p 1, A B p 2, A B p 3, 1 p 4, C D p,1 p 1,1 RHS 1,1 p 2,1 RHS 2,1 p 3,1 RHS 3,1 D C p 4,1 C D p,2 p 1,2 RHS 1,2 p 2,2 = RHS 2,2 p 3,2 RHS 3,2 D C p 4,2 C D p,3 p 1,3 RHS 1,3 p 2,3 RHS 2,3 p 3,3 RHS 3,3 D C p 4,3 1 p,4 B A p 1,4 B A p 2,4 B A p 3,4 1 p 4,4 1 δx 2 Page 6 of 18

4 Reduced System of Linear Values to be computed: pressure at red points, thus reduce SLE 1) neglect p,, p imax+1,, p,jmax+1, and p imax+1,jmax+1 (never needed) 2) seperate boundary conditions from the rest of the SLE: p 1, p 1,1 p 2, p 2,1 p 3, p 3,1 p,1 p 1,1 p 4,1 p 3,1 p,2 = p 1,2, p 4,2 p 3,2 p,3 p 1,3 p 1,4 p 3,3 p 2,4 p 1,3 p 3,4 p 3,3 Page 7 of 18

3) remaining SLE for inner grid points: p 1, p 2, p 3, p,1 p 1,1 p 2,1 p 3,1 p 4,1 p,2 p 1,2 p 2,2 p 3,2 p 4,2 p,3 p 1,3 p 2,3 p 3,3 p 4,3 p 1,4 p 2,4 p 3,4 RHS 1,1 RHS 2,1 RHS 3,1 RHS 1,2 = RHS 2,2 RHS 3,2 RHS 1,3 RHS 2,3 RHS 3,3 Page 8 of 18

5 1) set boundary values (blue points) 2) solve the (quadratic) system of linear equations (for the pressure values at red points): G F E p 1,1 RHS 1,1 Ep 1, F p,1 F G F E p 2,1 RHS 2,1 Ep 2, F G E p 3,1 RHS 3,1 Ep 3, F p 4,1 E G F E p 1,2 RHS 1,2 F p,2 p 2,2 = RHS 2,2 E F G E p 3,2 RHS 3,2 F p 4,2 E G F p 1,3 RHS 1,3 F p,3 Ep 1,4 E F G F p 2,3 RHS 2,3 Ep 2,4 E F G p 3,3 RHS 3,3 F p 4,3 Ep 3,4 Remark: values at boundary (blue) points are transported to the right hand side as their are no longer unknown after step 1)!!! Use an iterative solver! Page 9 of 18

6 General Treatment of SLEs starting point: A x = b decomposition of A: A = B + D (B + D) x = b D x = b B x iteration: D x i+1 = b B x i or D x i+1 = D x i + b A x i Page 1 of 18

7 a 1,1 x i+1 = x i + D 1 ( b A x i ) with D := a n,n a 1,1 a 1,1 a n,n a n,n x i+1 1 x i+1 n x i 1 x i n ( x i+1 ir = x i ir + 1 b ir a ir,ir = + b 1 b n ) n a ir,ic x i ir ic=1 a 1,1 a 1,n a n,1 a n,n x i 1 x i n Page 11 of 18

(): for(it=;it<=itmax;it++){ for(ir=1;ir<=n;ir++){ sum=; for(ic=1;ic<=n;ic++) sum = sum + a ir,ic u ic ; v ir = u ir + (b ir sum)/a ir,ir ; } for(ir=1;ir<=n;ir++) u ir = v ir ; } Page 12 of 18

8 a 1,1 x i+1 = x i + D 1 ( b A x i ) with D :=, a n,1 a n,n a 1,1 a n,1 a n,n a 1,1 x i+1 1 x i+1 n x i 1 a n,1 a n,n x i n ( x i+1 ir = x i ir + 1 b ir a ir,ir = + ir is=1 b 1 b n a ir,is x i+1 is a 1,1 a 1,n a n,1 a n,n ) n a ir,is x i is is=ir+1 x i 1 x i n Page 13 of 18

(): for(it=;it<=itmax;it++) for(ir=1;ir<=n;ir++){ sum=; for(ic=1;ic<=n;ic++) sum = sum + a ir,ic u ic ; u ir = u ir + (b ir sum)/a ir,ir ; } no storage of an intermediate result necessary!!!!! Page 14 of 18

9 ion) ( x i+1 ir = x i ir+ω 1 a ir,ir b ir ir is=1 a ir,isx i+1 is ) n is=ir+1 a ir,isx i is (ω [1; 2]) : for(it=;it<=itmax;it++) for(ir=1;ir<=n;ir++){ sum=; for(ic=1;ic<=n;ic++) sum = sum + a ir,ic u ic ; u ir = u ir + ω(b ir sum)/a ir,ir ; } Page 15 of 18

1 Remarks: G F E p 1,1 RHS 1,1 Ep 1, F p,1 F G F E p 2,1 RHS 2,1 Ep 2, F G E p 3,1 RHS 3,1 Ep 3, F p 4,1 E G F E p 1,2 RHS 1,2 F p,2 p 2,2 = RHS 2,2 E F G E p 3,2 RHS 3,2 F p 4,2 E G F p 1,3 RHS 1,3 F p,3 Ep 1,4 E F G F p 2,3 RHS 2,3 Ep 2,4 E F G p 3,3 RHS 3,3 F p 4,3 Ep 3,4 Only five entries per line of the discretization matrix matrix is not to be stored completely!!!! (else: storage cost O(n 2 )!!) Use discretization stencil instead : δy 2 δx 2 2(δx 2 + δy 2 ) δx 2 δy 2 The discretization stencil looks the same for all inner (red) points discretization stencil doesn t have to be stored for each grid point, but only once or can even be directly encoded (see the following algorithm) Page 16 of 18

11 SOR- for Our Code general algorithm our algorithm for(it=;it<=itmax;it++) for(ir=1;ir<=n;ir++){ } sum = ; for(ic=1;ic<=n;ic++) sum = sum+a ir,ic u ic ; u ir = u ir + ω a ir,ir (b ir sum); for(it=;it<=itmax;it++) for(i=1;i<=imax;i++) for(j=1;j<=jmax;j++){ sum = p i+1,j+p i 1,j } ( p i,j p i,j = p i,j ω δx 2 + p i,j+1 +p i,j 1 δy 2 2 δx 2 2 2 + ); 2 δx 2 δy 2 δy 2 (b i,j sum); Page 17 of 18

12 Termination Criterion Final it = ; res = 1; while(res>=eps && it < itmax){ res = ; it = it + 1; for(i=1;i<=imax;i++) for(j=1;j<=jmax;j++){ } r = b i,j p i+1,j + p i 1,j δx 2 p i,j = p i,j ω 2 2 r; δx 2 δy 2 res = res + r r; } res = res; p i,j+1 + p i,j 1 δy 2 + p i,j ( 2 δx + 2 ) ; 2 δy 2 Page 18 of 18