Consider a 1-D stationary state diffusion-type equation, which we will call the generalized diffusion equation from now on:



Similar documents
8.5 UNITARY AND HERMITIAN MATRICES. The conjugate transpose of a complex matrix A, denoted by A*, is given by

Recurrence. 1 Definitions and main statements

v a 1 b 1 i, a 2 b 2 i,..., a n b n i.

where the coordinates are related to those in the old frame as follows.

What is Candidate Sampling

1 Example 1: Axis-aligned rectangles

This circuit than can be reduced to a planar circuit

Support Vector Machines

PERRON FROBENIUS THEOREM

Luby s Alg. for Maximal Independent Sets using Pairwise Independence

benefit is 2, paid if the policyholder dies within the year, and probability of death within the year is ).

Loop Parallelization

Faraday's Law of Induction

Linear Circuits Analysis. Superposition, Thevenin /Norton Equivalent circuits

BERNSTEIN POLYNOMIALS

NMT EE 589 & UNM ME 482/582 ROBOT ENGINEERING. Dr. Stephen Bruder NMT EE 589 & UNM ME 482/582

Laws of Electromagnetism

1. Fundamentals of probability theory 2. Emergence of communication traffic 3. Stochastic & Markovian Processes (SP & MP)

Conversion between the vector and raster data structures using Fuzzy Geographical Entities

Rotation Kinematics, Moment of Inertia, and Torque

Least Squares Fitting of Data

1. Measuring association using correlation and regression

Computational Fluid Dynamics II

Calculation of Sampling Weights

Description of the Force Method Procedure. Indeterminate Analysis Force Method 1. Force Method con t. Force Method con t

Fisher Markets and Convex Programs

Lecture 2: Single Layer Perceptrons Kevin Swingler

Time Domain simulation of PD Propagation in XLPE Cables Considering Frequency Dependent Parameters

Lecture 3: Force of Interest, Real Interest Rate, Annuity

Institute of Informatics, Faculty of Business and Management, Brno University of Technology,Czech Republic

Hedging Interest-Rate Risk with Duration

Numerical Methods 數 值 方 法 概 說. Daniel Lee. Nov. 1, 2006

An Alternative Way to Measure Private Equity Performance

Finite difference method

DEFINING %COMPLETE IN MICROSOFT PROJECT

HÜCKEL MOLECULAR ORBITAL THEORY

Logistic Regression. Lecture 4: More classifiers and classes. Logistic regression. Adaboost. Optimization. Multiple class classification

Ring structure of splines on triangulations

The OC Curve of Attribute Acceptance Plans

Point cloud to point cloud rigid transformations. Minimizing Rigid Registration Errors

SIMPLE LINEAR CORRELATION

A frequency decomposition time domain model of broadband frequency-dependent absorption: Model II

Calibration and Linear Regression Analysis: A Self-Guided Tutorial

Module 2 LOSSLESS IMAGE COMPRESSION SYSTEMS. Version 2 ECE IIT, Kharagpur

4 Cosmological Perturbation Theory

L10: Linear discriminants analysis

Immersed interface methods for moving interface problems

Vision Mouse. Saurabh Sarkar a* University of Cincinnati, Cincinnati, USA ABSTRACT 1. INTRODUCTION

Logistic Regression. Steve Kroon

Section C2: BJT Structure and Operational Modes

21 Vectors: The Cross Product & Torque

The Mathematical Derivation of Least Squares

How Sets of Coherent Probabilities May Serve as Models for Degrees of Incoherence

THE METHOD OF LEAST SQUARES THE METHOD OF LEAST SQUARES

Brigid Mullany, Ph.D University of North Carolina, Charlotte

n + d + q = 24 and.05n +.1d +.25q = 2 { n + d + q = 24 (3) n + 2d + 5q = 40 (2)

Imperial College London

"Research Note" APPLICATION OF CHARGE SIMULATION METHOD TO ELECTRIC FIELD CALCULATION IN THE POWER CABLES *

Implementation of Deutsch's Algorithm Using Mathcad

The Noether Theorems: from Noether to Ševera

Mean Molecular Weight

Section 5.4 Annuities, Present Value, and Amortization

Extending Probabilistic Dynamic Epistemic Logic

Chapter 12 Inductors and AC Circuits

A hybrid global optimization algorithm based on parallel chaos optimization and outlook algorithm

SIMULATION OF THERMAL AND CHEMICAL RELAXATION IN A POST-DISCHARGE AIR CORONA REACTOR

Application of Quasi Monte Carlo methods and Global Sensitivity Analysis in finance

Compiling for Parallelism & Locality. Dependence Testing in General. Algorithms for Solving the Dependence Problem. Dependence Testing

CHAPTER 14 MORE ABOUT REGRESSION

5.74 Introductory Quantum Mechanics II

Chapter 6 Inductance, Capacitance, and Mutual Inductance

Actuator forces in CFD: RANS and LES modeling in OpenFOAM

Goals Rotational quantities as vectors. Math: Cross Product. Angular momentum

Answer: A). There is a flatter IS curve in the high MPC economy. Original LM LM after increase in M. IS curve for low MPC economy

Modelling of Hot Water Flooding

HALL EFFECT SENSORS AND COMMUTATION

A Novel Methodology of Working Capital Management for Large. Public Constructions by Using Fuzzy S-curve Regression

Causal, Explanatory Forecasting. Analysis. Regression Analysis. Simple Linear Regression. Which is Independent? Forecasting

Chapter 4 ECONOMIC DISPATCH AND UNIT COMMITMENT

Multiple stage amplifiers

1. Math 210 Finite Mathematics

Addendum to: Importing Skill-Biased Technology

The Full-Wave Rectifier

Simple Interest Loans (Section 5.1) :

CHAPTER 5 RELATIONSHIPS BETWEEN QUANTITATIVE VARIABLES

Finite Math Chapter 10: Study Guide and Solution to Problems

Lecture 3: Annuity. Study annuities whose payments form a geometric progression or a arithmetic progression.

1 What is a conservation law?

Forecasting the Demand of Emergency Supplies: Based on the CBR Theory and BP Neural Network

Quantization Effects in Digital Filters

SPEE Recommended Evaluation Practice #6 Definition of Decline Curve Parameters Background:

Traffic State Estimation in the Traffic Management Center of Berlin

How To Understand The Results Of The German Meris Cloud And Water Vapour Product

Production. 2. Y is closed A set is closed if it contains its boundary. We need this for the solution existence in the profit maximization problem.

SUMMARY. Topology optimization, buckling, eigenvalue, derivative, structural optimization 1. INTRODUCTION

Transcription:

Chapter 1 Boundary value problems Numercal lnear algebra technques can be used for many physcal problems. In ths chapter we wll gve some examples of how these technques can be used to solve certan boundary value problems that occur n physcs. 1.1 A 1-D generalzed dffuson equaton Consder a 1-D statonary state dffuson-type equaton, whch we wll call the generalzed dffuson equaton from now on: d ( D(x dy(x + K(x y(x = q(x (1.1 where D(x > 0 s the dffuson coeffcent, K(x > 0 s some gven functon (ts meanng wll be elucdated later and q(x > 0 s a source functon. To solve ths problem, we have to specfy a fnte doman x left x x rght and gve the boundary condtons. For problems of ths knd (dffuson-lke there are two classcal types of boundary condtons that are usually mposed: Drchlet boundary condton: Here you smply specfy the value of the functon y(x at the boundary/boundares. Neumann boundary condton: Here you specfy the value of the dervatve of y(x at the boundary/boundares. but one can also specfy a mxture of the two. A second order ordnary dfferental equaton (ODE requres two boundary condtons. They could n prncple be specfed both at one sde (ether x = x left or x = x rght or one at each sde. The latter wll turn out to be the best (and usually physcally most reasonable choce. But n the lecture course we have so far not encountered methods of soluton that can deal wth boundary condtons mposed at both ends of the doman. We have so far only dealt wth problems that can be ntegrated n tme or space from one poston (e.g. x = x left to the other (e.g. x = x rght, whch requres us to mpose all boundary condtons at the startng pont. In ths chapter we deal wth methods to handle problems whch requre us to mpose boundary condtons at opposte sdes of the doman. Such problem are called boundary value problems. 1

1.1.1 The dscretzed verson of the equaton To solve ths equaton numercally, we have to defne a grd n x,.e. a dscrete set of samplng ponts x wth = 1 N. We often regard these ponts as the centers of cells. These cells have cell walls located between the x samplng ponts. Usually ther locaton are denoted wth x +1/2, where the + 1/2 s just meant to say between and + 1 and equvalently x 1/2, where the 1/2 s just meant to say between 1 and. We can then defne the cell walls to be located at: x +1/2 = 1 2 (x + x +1 x 1/2 = 1 2 (x 1 + x (1.2 In a computer we cannot use half ntegers as array ndces, so we wll have to defne for nstance the varables: xc[1] xc[n]: The cell center postons x. x[1] x[n+1]: The cell wall postons x 1/2. Note that for N cells we have N +1 walls! Now let s make a regularly spaced grd: x = x left + ( 1/2 (1.3 x 1/2 = x left + ( 1 (1.4 where = 1 N. We place our varables on the x postons. Frst dervatves of some functon f(x at the x ±1/2 postons: ( df = f +1 f = f +1 f (1.5 x +1 x +1/2 Ths expresson s accurate to second order n (you can verfy ths by usng a Taylor expanson of the true functon f(x around x = x. Lkewse we can express the frst dervatve of f(x at the x poston s: ( df = f +1 f 1 = f +1 f 1 x +1 x 1 2 (1.6 whch s also second order accurate. The second dervatve of f(x at the x = x poston can be found by takng the dervatve of Eq. (1.5: ( d 2 f 2 = 1 [ (df +1/2 ( ] df = f +1 2f + f 1 (1.7 1/2 2 In Eq. (1.1, however, we have to not just take the second dervatve, but the dervatve of some functon D(x tmes a dervatve: ( [ d D(x df ] [ = 1 ( ( ] df df D +1/2 D 1/2 +1/2 1/2 = 1 [ ( ( ] (1.8 f+1 f f f 1 D +1/2 D 1/2 2

Usng these defntons we can dscretze Eq. (1.1: [ ( ( ] 1 y y 1 y+1 y D 1/2 D +1/2 + K y = q (1.9 We now must fnd a way to solve ths equaton numercally. We wll frst look at the shootng method, but soon after we wll dscuss a better (more stable method based on a trdagonal matrx equaton. Note: Eq. (1.9 s already the fully defned dscretzed verson of Eq. (1.1, whch s second order accurate n. If you would nstead wsh to ntegrate Eq. (1.1 usng e.g. Runge-Kutta, then that Runge-Kutta procedure tself wll defne a dscretzaton. Here, however, we wll smply stck to the second order dscretzaton of Eq. (1.9. 1.1.2 Dscrete versons of Drchlet or Neumann boundary condtons Whle Eq. (1.9 defnes the dscrete verson of the ODE, the dscrete versons of the boundary condtons have to be specfed separately. For a Drchlet boundary condton (let s take the left boundary as an example we smply replace Eq. (1.9 for = 1 wth y 1 = y left (1.10 A Neumann boundary condton would replace Eq. (1.9 for = 1 wth and lkewse for the rght boundary. y 2 y 1 = y left (1.11 1.1.3 The shootng method One way to solve Eq. (1.9 s to use the shootng method. Consder a case when we wsh to mpose Drchlet boundary condtons at both ends: y(x left = y 0 and y(x rght = y 1. We could n prncple make an ntal guess for the dervatve y left at x = x left, and then, together wth y(x left = y 0, ntegrate from x left to x rght. Usually we wll then obtan a value of y(x rght that s not equal to y 1. But we can now adjust our ntal guess of y left and redo the ntegraton, agan comparng the resultng y(x rght wth what we want t to be (y 1. By usng a clever scheme for adjustng the guess of y left to obtan values of y(x rght that are closer and closer to the desred value y 1 we eventually obtan the soluton we seek. Ths s the shootng method. It allows us to use any of the numercal ntegraton schemes we learned before (Euler, Numerov, Runge-Kutta etc to ntegrate the equaton from x left to x rght. All we need to do s develop a clever method for adjustng our guess for y left. One way to do ths s to create a functon f(ξ, wth ξ beng our guess for y left, where f(ξ = y(x rght y 1 for the gven value of ξ. We can then use any off-the-shelf root-fndng routne (such as the zbrent( routne of Numercal Recpes to fnd the value for ξ for whch f(ξ = 0. The functon y(x obtaned for that value of ξ s then the soluton. Ths method works well for the classc dffuson equaton: d ( D(x dy(x 3 = q(x (1.12

whch s the generalzed dffuson equaton wth K(x = 0. But f K(x > 0 then ths shootng method dverges hopelessly! You can verfy ths, for nstance, wth the smple example of x left = 10, x rght = 10, D(x = 1, q(x = 1 and K(x = 1 wth boundary condtons at x = x left of y(x left = 1 and y left = 1. Ths yelds y(x rght 2.5 10 8. The shootng method may stll work, but t s far less relable when the equaton tends to dverge so quckly. Moreover, the precson of the choce of the value of y left requred to meet the boundary condton at x = x rght may be hgher than the float or double precson arthmatc can deal wth. 1.1.4 Why does the shootng method often fal? Consder the followng verson of the above generalzed dffuson equaton: 1 d 2 y(x = y(x q(x (1.13 3 2 Ths s an equaton that often appears n the theory of radatve transfer: the dffuse movement of radaton through opaque meda, e.g. clouds n the Earth s atmosphere. To see why the shootng method tends to create dvergences, we can rewrte ths equaton nto the form of two coupled frst order dfferental equatons: In matrx form: d dy(x dz(x ( y = z = 3z(x (1.14 = q(x y(x (1.15 ( 0 3 1 0 ( y z + ( 0 q (1.16 The matrx has egenvalues λ = ± 3. Evdently t has one negatve and one postve egenvalue. We already know that an equaton of the type dy/ = λy dverges f you ntegrate from left to rght f λ > 0. Snce we have at least one such dvergng egenvalue, ths must exponentally dverge! Ths s the cause of the problem. In fact, ntegratng n the opposte drecton won t help: there, also, there s a dvergng component. By the way (as a sde-note: If you try to do the same analyss (.e. splttng the second order equaton nto a matrx equaton of frst order to the classc dffuson equaton (Eq. 1.12 you wll encounter a defectve matrx: A matrx for whch no complete set of Egenvectors exsts. Exercse: verfy ths. Lesson: The above analyss of a system s dvergng or convergng egencomponents does not always apply; but often t does. In ths partcular case of a classc dffuson equaton the shoothng method works fne. 1.1.5 Castng the problem nto a matrx equaton Clearly, for problems for whch the shootng method fals, we must fnd an alternatve method: one n whch we can mpose one boundary condton on one sde and one on the other sde from the start. Ths can be done by constructng the matrx equaton correspondng to Eq. (1.9 and ts boundary condtons. We defne the N-dmensonal vectors y and q as y = (y 1, y 2,, y N 1, y N T q = (q 1, q 2,, q N 1, q N T (1.17 4

We now want to construct an N N matrx A such that the equaton A y = q (1.18 (where s the matrx-vector product represents Eq. (1.9 wth the correspondng boundary condtons. You can see that Eq. (1.9 for some contans y 1, y and y +1, but no other y-values. And the Drchlet or Neumann boundary condtons only nvolve y 1 and y 2 (for the left boundary and y N 1 and y N (for the rght boundary. In other words: the matrx A s a trdagonal matrx: b 1 c 1 0 0 0 0 0 0 a 2 b 2 c 2 0 0 0 0 0 0 a 3 b 3 c 3 0 0 0 0 A =........ (1.19 0 0 0 0 a N 2 b N 2 c N 2 0 0 0 0 0 0 a N 1 b N 1 c N 1 0 0 0 0 0 0 a N b N The matrx elements and rght-hand-sde elements can be found from Eq. (1.9. For 2 N 1 we have a b = D 1/2 2 (1.20 = D 1/2 + D +1/2 2 + K (1.21 c = D +1/2 2 (1.22 r = q (1.23 Now suppose we put a Neumann boundary condton on the left sde and a Drchlet boundary condton on the rght sde. We then get: b 1 = 1/ (1.24 c 1 = 1/ (1.25 r 1 = y left (1.26 a N = 0 (1.27 b N = 1 (1.28 r N = y rght (1.29 We can now use a trdagonal matrx equaton solver (see exercses to solve ths system of equatons. Ths mmedately gves us our soluton, because we have a lnear problem. 1.2 Heat conducton The generalzed dffuson equaton has many applcatons. One of them s heat transport. It s an every-day experence that heat tends to move from hot regons to cooler regons. One can express ths quanttatvely as F( x = D( x T( x (1.30 5

where x s the spatal poston vector and F( x s the heat flux and D( x the heat conductvty coeffcent (whch we allow to vary n space. Consder now a source functon q( x. The statonary-state conservaton of energy now reads: In 1-D ths equaton becomes F( x = [D( x T( x] = q( x (1.31 d ( D(x dt(x = q(x (1.32 We can now solve ths usng the above matrx equaton. In the exercse class we wll work out an explct example. 1.3 2-D Dffuson problem So what about a 2-D heat conducton problem? The equaton s d ( dt(x, y D(x, y d ( dt(x, y D(x, y = q(x, y (1.33 dy dy Let us, for smplcty, take D(x, y = D =constant, so that the equaton becomes ( d 2 T(x, y D + d2 T(x, y = q(x, y (1.34 2 dy 2 How do we cast ths nto matrx form? Let us frst defne a grd n x and y: We have x wth 1 N and y j wth 1 j M. We construct both the x and y grds n the same way as we dd for the 1-D case (Secton 1.1.1. We thus have an N M grd. We wsh to solve for T,j. In order to be able to make a matrx equaton for ths, we must defne a large vector z: z = (T 1,1,, T N,1, T 1,2,, T N,2,,, T 1,M 1,, T N,M 1, T 1,M,, T N,M T (1.35.e. a vector wth NM components. So for a grd of 20 30 (.e. N = 20, M = 30 we have a vector of 600 components: z 1, z 600. We also create a vector r for the rght-hand-sde of the equaton: r = (q 1,1,, q N,1, q 1,2,, q N,2,,, q 1,M 1,, q N,M 1, q 1,M,, q N,M T (1.36 We then want to construct a matrx A such that A z = r (1.37 s the matrx-equaton correspondng to Eq. (1.34. It turns out that, lke the case of a trdagonal matrx, also here most of the elements of the matrx A are zero, except for some specal locatons. However, n ths case the matrx s not trdagonal anymore. It s trdagonal wth sdebands : A k,k = 4D/ 2 (1.38 A k+1,k = D/ 2 (1.39 A k 1,k = D/ 2 (1.40 A k+n,k = D/ 2 (1.41 A k N,k = D/ 2 (1.42 6

for k = + (j 1N wth 2 N 1 and 2 j M 1. The boundary condtons have to be specfed all around the doman,.e. at all y j for x = x 1, all y j for x = x N, all x for y j = y 1 and all x for y j = y M. In spte of the fact that also ths matrx A has mostly 0-elements (t s a so-called sparse matrx, the presence of the sde-bands now makes t less easy to solve the matrx equaton than for a trdagonal matrx. So we are forced back to the LU-decomposton method. But for very large N and M ths may become extremely computatonally expensve. Fortunately there s a whole class of methods that can solve such sparse matrx equatons relatvely effcently even for large NM. Most of these are based on teraton. Some famous methods are GMRES, BCG, BCGSTAB. We wll not go nto these methods here. It s just mportant to remember that for large mult-dmensonal problems, the correspondng matrx equatons usually are very large sparse matrx equatons that requre such specal methods such as GMRES, BCG or BCGSTAB to be solved wthn reasonable tme. Note that n a smlar manner one can do to 3-D. Ths adds two more sde bands, even further away from the dagonal. 1.4 The Cable Equaton The cable equaton s a smple model of sgnal propagaton through neuronal fbres (dendrtes/axons. The model s related to the telegraph equaton for sgnal propagaton through electrc wres. The model descrbes a neuronal fbre as a cylnder of radus a contanng ntracellular flud (cytosol. The surface of the cylnder conssts of two membranes, the phospholpd blayer, that act as a capactance that can store charge. We wrte the capactance per unt surface of the par of membranes as c m (unt: Farad/m 2. The blayer s a reasonably good nsulator, but not perfect. It has a certan resstance tmes unt surface r m (unt: Ohm m 2. Ths means that some of the current that flows through the fbre can leak out sdeways through the double membrane of the fbre. Let us call ths current-per-untsurface m (unt: Ampère/m 2, and defne t postve for current flowng out of the fbre. Let us defne the voltage at the nsde of the blayer as V whle the voltage outsde the blayer as 0. Ohm s law then states m = V r m (1.43 If V changes wth tme, then part of ths current s consumed n readjustng the charge n the capactor. Ths s called the dsplacement current, whch we wll wrte as d : d = c m V t (1.44 The remander of m s actual current from the cytosol to the outsde of the fbre,.e. ths s the leakng current l : l = m d (1.45 Now let us look at how a current moves along the cylnder. Defne the current n the cylnder as I(x, t, where x s the coordnate along the cylnder and t s tme, and I > 0 for current flowng toward postve x. Defne the resstance along the cable as R. If we frst assume that there s no loss through the membranes r m = and that the membranes 7

have zero capacty c m = 0, then we can look at a steady-state stuaton. The voltage V (x and current I must obey V (x = RI (1.46 x where I(x = I =constant. However, wth the membrane capactance and fnte resstance the equaton becomes more complex. Let us ntroduce the current through the membrane per unt length of cable I m, as well as I l and I d as I m = 2πa m I l = 2πa l I d = 2πa d (1.47 the capactance per unt length of cable C m as and the membrane resstance tmes unt length of cable R m as C m = 2πa c m (1.48 R m = r m 2πa (1.49 We can then wrte the contnuty equaton for I(x (gnorng the / t term as I(x x = I l = I d I m = C m V t V R m (1.50 and nsertng Eq. (1.46 we obtan 1 2 V R x = C V 2 m t + V (1.51 R m where we wrte V nstead of V (x, t just for clarty of the equaton. Ths equaton s called the cable equaton. We can make ths equaton dmensonless by ntroducng a length scale λ = R m /R and a tme scale τ = C m R m. Then the equaton becomes 1.4.1 Statonary state solutons For a steady-state stuaton the cable equaton becomes λ 2 2 V x 2 = τ V t + V (1.52 λ 2 2 V x 2 = V (1.53 whch s, for the choce λ = 1/ 3 dentcal to the dffuson equaton for radatve transfer, Eq. (1.13 wth q(x = 0. So also for the cable equaton we expect that a shootng method approach wll fal, so we need to solve a matrx equaton nstead. Ths goes perfectly analogous to what we dd n Secton 1.1.5. 8

1.4.2 Tme-dependent solutons A straghtforward dscretzaton of the cable equaton for tme-dependent Euler ntegraton reads τ V n+1 V n = λ 2V +1 n 2V n + V 1 n V n t 2 (1.54 where V n s the potental at poston and tme step n. Fndng V n+1 n ths manner can work, but only f t τ 2 /λ 2. For t τ 2 /λ 2 ths drect forward Euler ntegraton becomes numercally volently unstable! It means that one may need to do very many tme steps, meanng a computatonally expensve ntegraton. An often-used trck to speed up the calculaton s to rewrte the equaton n the followng way: τ V n+1 V n n+1 n+1 = λ 2V+1 2V + V 1 n+1 V n+1 t 2 (1.55.e. take as the rght-hand-sde the future varables nstead of the current ones. Puttng all future varables to the left and all current ones to the rght, we obtan τ V n+1 t n+1 λ 2V+1 n+1 2V + V n+1 1 + V n+1 2 = τ V n t (1.56 whch can be cast nto a matrx equaton and solved for V n+1. In other words, the matrx equaton gves us the values of V at the next tme step. Ths s called mplct ntegraton (or mplct dfferencng of the partal dfferental equaton. It turns out that wth ths method the ntegraton s numercally stable, even for relatvely large t. 1.5 Afterword In ths chapter we have dealt wth lnear boundary value problems. However, n practce, many boundary value problems are non-lnear. Nevertheless one can use the same methods as above, but now n an teratve scheme. For each teraton we wrte the vector y = y prev + δy, where y prev s the vector y from the prevous teraton. We then lnearze the equatons n δy and solve for δy. We wll not go nto detal on ths, because the prncples are dentcal to those of Newton-Raphson teraton for root-fndng. 9