Implementing Finite Volume Methods

Slides:



Advertisements
Similar presentations
P. Venkataraman Mechanical Engineering P. Venkataraman Rochester Institute of Technology DETC2013 – 12269: Continuous Solution for Boundary Value Problems.
Advertisements

Session: Computational Wave Propagation: Basic Theory Igel H., Fichtner A., Käser M., Virieux J., Seriani G., Capdeville Y., Moczo P.  The finite-difference.
Finite element method – basis functions 1 Finite Elements: Basis functions 1-D elements  coordinate transformation  1-D elements  linear basis functions.
Boundary Element Method (BEM) Zoran Ilievski Wednesday 28 th June, 2006 HG 6.96 (TU/e)
CSE351/ IT351 Modeling And Simulation Choosing a Mesh Model Dr. Jim Holten.
Normal Mode Analysis of the Chesapeake Bay. USNA 13FEB05 Trident: Grant I. Gillary Advisers: Professor Reza Malek-Madani Assistant Professor Kevin McIlhany.
CE An Intro Problem—will lead to first homework Fluid is contained in along square duct, see cross section below, three faces of the duct are kept.
Stokes’ Theorem Divergence Theorem
I i row1 row2 row3 row4 col1 col2 col3 col4 a. Grid b. Mesh c. Cloud A control volume solution based on an unstructured mesh (Linear Triangular Elements)
Types of Governing equations
Scalar and Vector Fields
PHY 042: Electricity and Magnetism
Numerical methods for PDEs PDEs are mathematical models for –Physical Phenomena Heat transfer Wave motion.
© 2011 Autodesk Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the.
ME 231 Thermofluid Mechanics I Navier-Stokes Equations.
Chapter 9: Differential Analysis of Fluid Flow SCHOOL OF BIOPROCESS ENGINEERING, UNIVERSITI MALAYSIA PERLIS.
Discontinuous Galerkin Methods and Strand Mesh Generation
1 EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu
A conservative FE-discretisation of the Navier-Stokes equation JASS 2005, St. Petersburg Thomas Satzger.
C GasparAdvances in Numerical Algorithms, Graz, Fast interpolation techniques and meshless methods Csaba Gáspár Széchenyi István University, Department.
Discontinuous Galerkin Methods for Solving Euler Equations Andrey Andreyev Advisor: James Baeder Mid.
Finite Deference Method
Stable, Circulation- Preserving, Simplicial Fluids Sharif Elcott, Yiying Tong, Eva Kanso, Peter Schröder, and Mathieu Desbrun.
Elliptic PDEs and the Finite Difference Method
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 8 - Chapter 29.
1 EEE 431 Computational Methods in Electrodynamics Lecture 3 By Dr. Rasime Uyguroglu.
© Fluent Inc. 11/24/2015J1 Fluids Review TRN Overview of CFD Solution Methodologies.
Darryl Michael/GE CRD Fields and Waves Lesson 3.6 ELECTROSTATICS - Numerical Simulation.
Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory # Discretization Methods Topics Equations and The Goal Brief overview.
Elliptic PDEs and Solvers
1 LECTURE 6 Stability of Parabolic PDEs. 2 Aim of Lecture Last week we discussed Parabolic PDEs –Looked at Explicit and Implicit Methods –Advantages and.
Lecture Objectives: - Numerics. Finite Volume Method - Conservation of  for the finite volume w e w e l h n s P E W xx xx xx - Finite volume.
Implementing Finite Volume Methods 1.  Continue on Finite Volume Methods for Elliptic Equations  Finite Volumes in Two-Dimensions  Poisson’s Equation.
Vector Analysis 15 Copyright © Cengage Learning. All rights reserved.
Part 8 - Chapter 29.
EEE 431 Computational Methods in Electrodynamics
Boyce/DiPrima 10th ed, Ch 6.2: Solution of Initial Value Problems Elementary Differential Equations and Boundary Value Problems, 10th edition, by William.
Boyce/DiPrima 10th ed, Ch 10.8: Laplace’s Equation Elementary Differential Equations and Boundary Value Problems, 10th edition, by William E. Boyce and.
Formulas for Lengths, Areas and Volumes
Chapter 9: Differential Analysis of Fluid Flow
1 Divergence Theorem. 2 Understand and use the Divergence Theorem. Use the Divergence Theorem to calculate flux. Objectives Total flux change = (field.
Uniqueness Theorem vanishes on S vanishes in V
Chapter 2. Mathematical Expression of Conduction
Curl and Divergence.
© Fluent Inc. 1/10/2018L1 Fluids Review TRN Solution Methods.
Objective Review Reynolds Navier Stokes Equations (RANS)
Partial Differential Equations
Copyright © Cengage Learning. All rights reserved.
Finite Volume Method for Unsteady Flows
ME/AE 339 Computational Fluid Dynamics K. M. Isaac Topic2_PDE
Vanishing Potential from Two Point Charges
Copyright © Cengage Learning. All rights reserved.
topic13_grid_generation
Change of Variables in Multiple Integrals
13 VECTOR CALCULUS.
Introduction: A review on static electric and magnetic fields
Numerical Integration:
6.5 Taylor Series Linearization
topic13_grid_generation
topic13_grid_generation
topic4: Implicit method, Stability, ADI method
Finite element method.
Copyright © Cengage Learning. All rights reserved.
PHY 712 Electrodynamics 9-9:50 AM MWF Olin 105 Plan for Lecture 3:
Copyright © Cengage Learning. All rights reserved.
Centre of Gravity, Centre of Mass & Centroid
PHY 712 Electrodynamics 9-9:50 AM MWF Olin 105 Plan for Lecture 3:
An optimized implicit finite-difference scheme for the two-dimensional Helmholtz equation Zhaolun Liu Next, I will give u an report about the “”
1st semester a.y. 2018/2019 – November 22, 2018
Presentation transcript:

Implementing Finite Volume Methods 1 1

Continue on Finite Volume Methods for Elliptic Equations Finite Volumes in Two-Dimensions Poisson’s Equation Boundary Conditions Neumann Dirichlet Using Excel 2 2

Nodes placed at centre of control volumes 2-Dimensional grid development same as 1D. Note that the boundaries are on the control volume surfaces. [In the pictures, dotted lines represent control volumes, solid lines represent node adjacencies/data dependencies.] Control Volumes Control Volumes Nodes placed at centre of control volumes 3 3

Grid Generation - Similar as One-Dimension Use grid spacing h (=Dx) in x direction and k (= Dy) in y Consider Poisson's Equation Control Volume P S W N E e w s n h k ∂ 2 𝑢 ∂ 𝑥 2 + ∂ 2 𝑢 ∂ 𝑦 2 +𝑔=0 4 4

For an area A enclosed by the surface S, and vector field variable v, the DIVERGENCE theorem states: Let The Divergence theorem can be used on the Laplace equation for the scalar field u. Or 𝐴 ∇. 𝑣 𝑑𝐴 = 𝑆 𝑣 . 𝑛 𝑑𝑆 S A 𝑣 = ∂𝑢 ∂𝑥 , ∂𝑢 ∂𝑦 =∇𝑢 𝐴 ∇.(∇𝑢)𝑑𝐴 = 𝑆 ∇𝑢. 𝑛 𝑑𝑆 𝐴 ∂ 2 𝑢 ∂ 𝑥 2 + ∂ 2 𝑢 ∂ 𝑦 2 𝑑𝐴 = 𝑆 ∂𝑢 ∂𝑥 𝑛 𝑥 + ∂𝑢 ∂𝑦 𝑛 𝑦 𝑑𝑆 5 5

Using the divergence theorem it can be shown that: The first order derivatives can be approximated by: 𝑥𝑦 ∂ 2 𝑢 ∂ 𝑥 2 + ∂ 2 𝑢 ∂ 𝑦 2 +𝑔 𝑑𝑥𝑑𝑦 =  ∂𝑢 ∂𝑥  𝑒 −  ∂𝑢 ∂𝑥  𝑤 𝑘+  ∂𝑢 ∂𝑦  𝑛 −  ∂𝑢 ∂𝑦  𝑠 ℎ+𝑔ℎ𝑘=0  ∂𝑢 ∂𝑥  𝑒 = 𝑈 𝐸 − 𝑈 𝑃 ℎ  ∂𝑢 ∂𝑥  𝑤 = 𝑈 𝑃 − 𝑈 𝑊 ℎ  ∂𝑢 ∂𝑦  𝑛 = 𝑈 𝑁 − 𝑈 𝑃 𝑘  ∂𝑢 ∂𝑦  𝑠 = 𝑈 𝑃 − 𝑈 𝑆 𝑘 P S W N E e w s n 6 6

Therefore at each node we have the following algebraic equations that represent the Poisson equation. 𝐴 𝑃 𝑈 𝑃 = 𝐴 𝐸 𝑈 𝐸 + 𝐴 𝑊 𝑈 𝑊 + 𝐴 𝑁 𝑈 𝑁 + 𝐴 𝑆 𝑈 𝑆 +𝑆 𝐴 𝐸 = 𝐴 𝑊 = 𝑘 ℎ 𝐴 𝑁 = 𝐴 𝑆 = ℎ 𝑘 𝐴 𝑃 = 𝐴 𝐸 + 𝐴 𝑊 + 𝐴 𝑁 + 𝐴 𝑆 𝑆=𝑔ℎ𝑘 P S W N E e w s n h k 7 7

It is normal to write Ap in this way, rather than, say The equation on the previous slide is in the standard form for finite volumes schemes It is normal to write Ap in this way, rather than, say This is because, if you use other volume shapes, such as triangles, rectangles or a mixture, the same sort of results (e.g. that Ap is the sum of the other coefficients) still hold 𝐴 𝑃 =2  𝑘 ℎ + ℎ 𝑘  8 8

The divergence theorem gives: Example: at north boundary  ∂𝑢 ∂𝑥  𝑒 −  ∂𝑢 ∂𝑥  𝑤 𝑘+  ∂𝑢 ∂𝑦  𝑛 −  ∂𝑢 ∂𝑦  𝑠 ℎ+𝑔ℎ𝑘=0 ∂𝑢 ∂𝑦 =𝛼  ∂𝑢 ∂𝑥  𝑒 = 𝑈 𝐸 − 𝑈 𝑃 ℎ  ∂𝑢 ∂𝑥  𝑤 = 𝑈 𝑃 − 𝑈 𝑊 ℎ  ∂𝑢 ∂𝑦  𝑛 =𝛼  ∂𝑢 ∂𝑦  𝑠 = 𝑈 𝑃 − 𝑈 𝑆 𝑘 9 9

Therefore at each node on the north boundary we have 𝐴 𝑃 𝑈 𝑃 = 𝐴 𝐸 𝑈 𝐸 + 𝐴 𝑊 𝑈 𝑊 + 𝐴 𝑆 𝑈 𝑆 +𝑆 𝐴 𝐸 = 𝐴 𝑊 = 𝑘 ℎ , 𝐴 𝑆 = ℎ 𝑘 𝐴 𝑃 = 𝐴 𝐸 + 𝐴 𝑊 + 𝐴 𝑆 𝑆=𝑔ℎ𝑘+ℎ𝛼 10 10

Similarly at each node on the east boundary, if Similar on other boundaries, but the signs are reversed (south) (west)  ∂𝑢 ∂𝑥  𝑒 =𝛽 𝐴 𝑃 𝑈 𝑃 = 𝐴 𝑊 𝑈 𝑊 + 𝐴 𝑁 𝑈 𝑁 + 𝐴 𝑆 𝑈 𝑆 +𝑆 𝐴 𝑊 = 𝑘 ℎ , 𝐴 𝑁 = 𝐴 𝑆 = ℎ 𝑘 𝐴 𝑃 = 𝐴 𝑊 + 𝐴 𝑁 + 𝐴 𝑆 𝑆=𝑔ℎ𝑘+𝑘𝛽 𝑆=𝑔ℎ𝑘−ℎ𝛼 𝑆=𝑔ℎ𝑘−𝑘𝛽 11 11

The divergence theorem gives: Example: at east boundary  ∂𝑢 ∂𝑥  𝑒 −  ∂𝑢 ∂𝑥  𝑤 𝑘+  ∂𝑢 ∂𝑦  𝑛 −  ∂𝑢 ∂𝑦  𝑠 ℎ+𝑔ℎ𝑘=0 𝑢=𝜇 Boundary P h k  ∂𝑢 ∂𝑥  𝑒 = 𝜇− 𝑈 𝑃 0.5h  ∂𝑢 ∂𝑥  𝑤 = 𝑈 𝑃 − 𝑈 𝑊 ℎ  ∂𝑢 ∂𝑦  𝑛 = 𝑈 𝑁 − 𝑈 𝑃 𝑘  ∂𝑢 ∂𝑦  𝑠 = 𝑈 𝑃 − 𝑈 𝑆 𝑘 𝑢=𝜇 12 12

Therefore at each node on the east boundary we have 𝐴 𝑃 𝑈 𝑃 = 𝐴 𝑊 𝑈 𝑊 + 𝐴 𝑁 𝑈 𝑁 + 𝐴 𝑆 𝑈 𝑆 +𝑆 𝐴 𝑊 = 𝑘 ℎ , 𝐴 𝑁 = 𝐴 𝑆 = ℎ 𝑘 𝐴 𝑃 =2 𝑘 ℎ + 𝐴 𝑊 + 𝐴 𝑁 + 𝐴 𝑆 𝑆=𝑔ℎ𝑘+2 𝑘 ℎ 𝜇 13 13

Similarly at each node on the north boundary, if 𝑢=𝜂 𝐴 𝑃 𝑈 𝑃 = 𝐴 𝐸 𝑈 𝐸 + 𝐴 𝑊 𝑈 𝑊 + 𝐴 𝑆 𝑈 𝑆 +𝑆 𝐴 𝐸 = 𝐴 𝑊 = 𝑘 ℎ , 𝐴 𝑆 = ℎ 𝑘 𝐴 𝑃 =2 ℎ 𝑘 + 𝐴 𝐸 + 𝐴 𝑊 + 𝐴 𝑆 𝑆=𝑔ℎ𝑘+2 ℎ 𝑘 𝜂 14 14

At each internal node k h 𝐴 𝑃 𝑈 𝑃 = 𝐴 𝐸 𝑈 𝐸 + 𝐴 𝑊 𝑈 𝑊 + 𝐴 𝑁 𝑈 𝑁 + 𝐴 𝑆 𝑈 𝑆 +𝑆 𝐴 𝐸 = 𝐴 𝑊 = 𝑘 ℎ 𝐴 𝑁 = 𝐴 𝑆 = ℎ 𝑘 𝐴 𝑃 = 𝐴 𝐸 + 𝐴 𝑊 + 𝐴 𝑁 + 𝐴 𝑆 𝑆=𝑔ℎ𝑘 P S W N E e w s n h k 15 15

P k h Can use transformations of source term to calculate BCs Remove the boundary term(s) A[B]=0 where [B]=N,S,E or W Neumann (+east or –west) (+north or –south) Dirichlet (u = UB) (east or west) (north or south) 𝑆→𝑆± ∂𝑢 ∂𝑥 𝑘 𝑆→𝑆± ∂𝑢 ∂𝑦 ℎ Boundary P h k 𝐴 𝑃 → 𝐴 𝑃 +2 𝑘 ℎ 𝑆→𝑆+2 𝑘 ℎ 𝑈 𝐵 𝐴 𝑃 → 𝐴 𝑃 +2 ℎ 𝑘 𝑆→𝑆+2 ℎ 𝑘 𝑈 𝐵 16 16

Disadvantages: Need to use structured mesh. May not be conservative. Finite Difference: Approximate derivatives at each node via a difference formula derived from Taylor series expansions on a regular grid. Advantages: Easy to implement. Easy to obtain higher order derivatives. Disadvantages: Need to use structured mesh. May not be conservative. Finite Volume: Approximate first order derivatives on the faces of each control volume. Advantages: Can use unstructured meshes. Conservative. Disadvantage: Difficult to obtain higher order derivatives. 17 17

Mesh nodes are at the centre of each cell (e.g. for at ) There are no known boundary cell values (even if a boundary value for u is known – different from Finite Differences) Work out general formula, copy to all cells and apply boundary transformations 𝛥𝑥 2 , 3Δx 2 ,… 0<𝑥<1 18 18

Consider the Poisson equation on the following domain: Using h = k = 0.5, g = 2, program the FV method in Excel [class demo] ∂𝑢 ∂𝑦 =0 (0,0) (0,5) (3,2) (3,3) (7,2) (7,3) (10,0) (10,5) ∂𝑢 ∂𝑦 =0 ∂𝑢 ∂𝑥 =0 ∂𝑢 ∂𝑥 =0 ∂𝑢 ∂𝑥 =−5 𝑢=50 ∂𝑢 ∂𝑦 =0 ∂𝑢 ∂𝑦 =0 ∂ 2 𝑢 ∂ 𝑥 2 + ∂ 2 𝑢 ∂ 𝑦 2 +𝑔=0 19 19

At each internal node (see slide 15) So in general However, may be sensible to retain g, h, k in the formula so we can modify the Excel file easily (see example) 𝐴 𝐸 = 𝐴 𝑊 = 𝑘 ℎ = 0.5 0.5 =1 𝐴 𝑁 = 𝐴 𝑆 = ℎ 𝑘 = 0.5 0.5 =1 𝐴 𝑃 = 𝐴 𝐸 + 𝐴 𝑊 + 𝐴 𝑁 + 𝐴 𝑆 =1+1+1+1=4 𝑆=𝑔ℎ𝑘=2×0.5×0.5=0.5 𝑈 𝑃 = 1 4  𝑈 𝐸 + 𝑈 𝑊 + 𝑈 𝑁 + 𝑈 𝑆 +0.5 20 20

At the West boundary we have Neumann BCs ∂𝑢 ∂𝑥 =−5 At the West boundary we have Neumann BCs Use general formula (slide 15) but apply boundary transformations (slide 16) but (transformation) (transformation) So in general on West boundary 𝐴 𝐸 = 𝑘 ℎ = 0.5 0.5 =1 𝐴 𝑊 =0 𝐴 𝑁 = 𝐴 𝑆 = ℎ 𝑘 = 0.5 0.5 =1 𝐴 𝑃 = 𝐴 𝐸 + 𝐴 𝑊 + 𝐴 𝑁 + 𝐴 𝑆 =1+0+1+1=3 𝑆=𝑔ℎ𝑘=2×0.5×0.5=0.5 𝑆→𝑆− ∂𝑢 ∂𝑥 𝑘=0. 5− −5 ×0 .5=3 𝑈 𝑃 = 1 3  𝑈 𝐸 + 𝑈 𝑁 + 𝑈 𝑆 +3 21 21

At the East boundary we have Dirichlet BCs u=50 Use general formula (slide 15) but apply boundary transformations (slide 16) but (transformation) (transformation) So in general on East boundary 𝐴 𝑊 = 𝐴 𝑁 = 𝐴 𝑆 = 0.5 0.5 =1 𝐴 𝐸 =0 𝐴 𝑃 = 𝐴 𝐸 + 𝐴 𝑊 + 𝐴 𝑁 + 𝐴 𝑆 =1+0+1+1=3 𝐴 𝑃 → 𝐴 𝑃 +2 𝑘 ℎ =3+2 0.5 0.5 =5 𝑆=𝑔ℎ𝑘=2×0.5×0.5=0.5 𝑆→𝑆+2 𝑘 ℎ 𝑈 𝐵 =0.5+2 0.5 0.5 50=100.5 𝑈 𝑃 = 1 5  𝑈 𝑊 + 𝑈 𝑁 + 𝑈 𝑆 +100.5 22 22

At the East boundary we have Dirichlet BCs u=50 At the South boundary we have Neumann BCs but (S & E transformation) (E transformation) (S transformation) So for bottom right hand corner ∂𝑢 ∂𝑦 =0 𝐴 𝑊 = 𝐴 𝑁 = 0.5 0.5 =1 𝐴 𝑆 = 𝐴 𝐸 =0 𝐴 𝑃 = 𝐴 𝐸 + 𝐴 𝑊 + 𝐴 𝑁 + 𝐴 𝑆 =0+1+1+0=2 𝐴 𝑃 → 𝐴 𝑃 +2 𝑘 ℎ =2+2 0.5 0.5 =4 𝑆=𝑔ℎ𝑘=2×0.5×0.5=0.5 𝑆→𝑆+2 𝑘 ℎ 𝑈 𝐵 =0.5+2 0.5 0.5 50=100.5 𝑆→𝑆− ∂𝑢 ∂𝑦 ℎ=100.5−0×0.5=100.5 𝑈 𝑃 = 1 4  𝑈 𝑊 + 𝑈 𝑁 +100.5 23 23

24 24