440 Geophysics: Heat flow with finite differences



Similar documents
1 Finite difference example: 1D implicit heat equation

1 Two-dimensional heat equation with FD

Finite Difference Approach to Option Pricing

Euler s Method and Functions

The Heat Equation. Lectures INF2320 p. 1/88

An Introduction to Partial Differential Equations

Feature Commercial codes In-house codes

Numerical Analysis Lecture Notes

Introduction to the Finite Element Method

Diffusion: Diffusive initial value problems and how to solve them

Module 1 : Conduction. Lecture 5 : 1D conduction example problems. 2D conduction

BINOMIAL OPTIONS PRICING MODEL. Mark Ioffe. Abstract

Numerical Methods for Differential Equations

Figure 1 - Unsteady-State Heat Conduction in a One-dimensional Slab

Second Order Linear Partial Differential Equations. Part I

CS Software Engineering for Scientific Computing. Lecture 16: Particle Methods; Homework #4

Model Order Reduction for Linear Convective Thermal Flow

Iterative Solvers for Linear Systems

Parabolic Equations. Chapter 5. Contents Well-Posed Initial-Boundary Value Problem Time Irreversibility of the Heat Equation

SECTION VI: FLOOD ROUTING. Consider the watershed with 6 sub-basins. Q 1 = Q A + Q B (Runoff from A & B)

Scientic Computing 2013 Computer Classes: Worksheet 11: 1D FEM and boundary conditions

7. DYNAMIC LIGHT SCATTERING 7.1 First order temporal autocorrelation function.

Scientific Programming

WEEK #3, Lecture 1: Sparse Systems, MATLAB Graphics

Advanced CFD Methods 1

OPTION PRICING WITH PADÉ APPROXIMATIONS

Including thermal effects in CFD simulations

VARIANCE REDUCTION TECHNIQUES FOR IMPLICIT MONTE CARLO SIMULATIONS

The mhr model is described by 30 ordinary differential equations (ODEs): one. ion concentrations and 23 equations describing channel gating.

Pricing Barrier Options under Local Volatility

An Introduction to Applied Mathematics: An Iterative Process

1 Completeness of a Set of Eigenfunctions. Lecturer: Naoki Saito Scribe: Alexander Sheynis/Allen Xue. May 3, The Neumann Boundary Condition

Heavy Parallelization of Alternating Direction Schemes in Multi-Factor Option Valuation Models. Cris Doloc, Ph.D.

N 1. (q k+1 q k ) 2 + α 3. k=0

Lecture 16 - Free Surface Flows. Applied Computational Fluid Dynamics

Introduction to the Finite Element Method (FEM)

An Introduction to Core-conductor Theory

SOLUTION OF Partial Differential Equations. (PDEs)

Domain decomposition techniques for interfacial discontinuities

Physics of the Atmosphere I

Introduction to Finite Difference Methods

CONSERVATION LAWS. See Figures 2 and 1.

Fourth-Order Compact Schemes of a Heat Conduction Problem with Neumann Boundary Conditions

Multi-Block Gridding Technique for FLOW-3D Flow Science, Inc. July 2004

5.4 The Heat Equation and Convection-Diffusion

Numerical Resolution Of The Schrödinger Equation

To give it a definition, an implicit function of x and y is simply any relationship that takes the form:

Thermodynamics: Lecture 2

Pricing Barrier Option Using Finite Difference Method and MonteCarlo Simulation

Numerical PDE methods for exotic options

INTEGRAL METHODS IN LOW-FREQUENCY ELECTROMAGNETICS

Black Scholes Option Valuation for Scientific Computing Students

ABSTRACT FOR THE 1ST INTERNATIONAL WORKSHOP ON HIGH ORDER CFD METHODS

- momentum conservation equation ρ = ρf. These are equivalent to four scalar equations with four unknowns: - pressure p - velocity components

Parallel 3D Image Segmentation of Large Data Sets on a GPU Cluster

ME6130 An introduction to CFD 1-1

Computational Geometry Lab: FEM BASIS FUNCTIONS FOR A TETRAHEDRON

Interactive comment on A simple 2-D inundation model for incorporating flood damage in urban drainage planning by A. Pathirana et al.

Introduction. 1.1 Motivation. Chapter 1

Does Black-Scholes framework for Option Pricing use Constant Volatilities and Interest Rates? New Solution for a New Problem

Interactive simulation of an ash cloud of the volcano Grímsvötn

Heat Transfer and Energy

MEL 807 Computational Heat Transfer (2-0-4) Dr. Prabal Talukdar Assistant Professor Department of Mechanical Engineering IIT Delhi

Chapter 9 Partial Differential Equations

TWO-DIMENSIONAL FINITE ELEMENT ANALYSIS OF FORCED CONVECTION FLOW AND HEAT TRANSFER IN A LAMINAR CHANNEL FLOW

Numerical Solution of Differential Equations

Stability of Evaporating Polymer Films. For: Dr. Roger Bonnecaze Surface Phenomena (ChE 385M)

Problem Set 5 Due: In class Thursday, Oct. 18 Late papers will be accepted until 1:00 PM Friday.

The one dimensional heat equation: Neumann and Robin boundary conditions

correct-choice plot f(x) and draw an approximate tangent line at x = a and use geometry to estimate its slope comment The choices were:

Notes for AA214, Chapter 7. T. H. Pulliam Stanford University

Differential Relations for Fluid Flow. Acceleration field of a fluid. The differential equation of mass conservation

Method of Green s Functions

Abaqus/CFD Sample Problems. Abaqus 6.10

Lecture 3 Fluid Dynamics and Balance Equa6ons for Reac6ng Flows

Computational Physics

POISSON AND LAPLACE EQUATIONS. Charles R. O Neill. School of Mechanical and Aerospace Engineering. Oklahoma State University. Stillwater, OK 74078

Finite cloud method: a true meshless technique based on a xed reproducing kernel approximation

5 Numerical Differentiation

Hydrodynamics of stellar explosions

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 10

Lecture 21 Integration: Left, Right and Trapezoid Rules

Finite Element Method

SIXTY STUDY QUESTIONS TO THE COURSE NUMERISK BEHANDLING AV DIFFERENTIALEKVATIONER I

CAE -Finite Element Method

The continuous and discrete Fourier transforms

Numerical Methods for Differential Equations

240EQ014 - Transportation Science

6 Scalar, Stochastic, Discrete Dynamic Systems

Spatial Data Analysis

Numerical Solution of Differential Equations

4. Introduction to Heat & Mass Transfer

Numerical Methods for Differential Equations

Coupling Forced Convection in Air Gaps with Heat and Moisture Transfer inside Constructions

CFD Application on Food Industry; Energy Saving on the Bread Oven

Transcription:

440 Geophysics: Heat flow with finite differences Thorsten Becker, University of Southern California, 03/2005 Some physical problems, such as heat flow, can be tricky or impossible to solve analytically in any but the simplest situations. This is why we use numerical methods to model system behavior. All numerical methods suffer from general limitations, such as finite accuracy (resolution) and stability (robustness against blowing up ). This means that you will have to proceed carefully when using computers to get answers for geophysical problems, always being aware of the simplifications and approximations. However, with (nowadays) basic computer tools, you can solve relevant problems. For example, you may estimate the temperature distribution around a dike intrusion as a function of time and space, and this distribution will be reflected in the geological record. One method used to solve certain kinds of partial differential equations numerically is by finite differences (FD). Consider the heat flow equation in one dimension: T t = κ 2 T x 2 + H ρc p. (1) where T is temperature, κ thermal diffusivity, H volumetric heat production rate, ρ density, and c p heat capacity. T dependence on space, x, and time t is implied, but κ is assumed constant for eq. (1). Should the conductivity, k, be a function of x instead, we would have had to write 1 ρc p x (k(x) x T ) instead of κ 2 T for the heat flow term, since κ = k x 2 ρc p. In any numerical scheme, one has to discretize the spatial domain, and go from a continuous medium to individual points (or elements for the other main numerical scheme, finite elements). Let s subdivide the model region of extent 0...L in x direction into n nodes so that the i-th location is x i = x 0 + (i 1), (3) with (2) = L/(n 1), (4) which gives a range for x from x i=1 = 0 (for x 0 = 0) to x i=n = L. A larger number of nodes n therefore gives you finer spatial resolution,. What FD does then is approximate the / t and / x (as in eq. (1)) by finite differences between nodes, as opposed to infinitesimal partial derivatives in a continuum. Say, you need / x at x i, then you could approximate it from forward differences using the slope from the function value f (x i ) at x i to the next node at x i+1 = x i + like x (x i) f = f (x i+1) f (x i ). (5) This will be useful when you don t have a x i 1 node, as on the left domain boundary. Alternatively, you could use

backward differences where x (x i) b x = f (x i) f (x i 1 ), (6) for instance at the right domain boundary. However, it turns out that in general the best approximation to / x error-wise is by central differences. Those are obtained by averaging f x and b x such that x (x i) c x = x f + b x 2 = f (x i+1) f (x i 1 ). (7) 2 If we need second-order derivatives, those can be obtained from the finite difference between f and b x as 2 f x 2 (x i) c x 2 = x f b x = f (x i+1) 2 f (x i ) + f (x i 1 ) () 2. (8) (To be precise, the second order difference eq. (8) is properly derived by computing central differences of a forward difference at node x i+1/2 and a backward difference at node x i 1/2. This distinction can be important for k(x) type problems.) With those approximate finite differences at hand, we can now rewrite eq. (1). For simplicity, we will take κ constant and H = 0. The simplest way of rewriting the diffusion equation is by a Forward Time, Centered Space (FTCS) scheme f t T (x i,t j ) = κ c x 2 T (x i,t j ) (9) T (x i,t j+1 ) T (x i,t j ) κ ( = T (xi+1 t () 2,t j ) 2T (x i,t j ) + T (x i 1,t j ) ). (10) Time therefore needs to be discretized as well, and we have used i indices for space, and j for time, i.e. the temperature at time t j+1 = t j + t is T (x i,t j+1 ). We can march an initial solution at time t j forward by a time step t as T (x i,t j+1 ) = T (x i,t j ) + T = T (x i,t j ) + κ t () 2 ( T (xi+1,t j ) 2T (x i,t j ) + T (x i 1,t j ) ). (11) Because the incremental change of temperature from t j to t j+1, T, can be directly determined from the old temperature solution at t j, this method is called explicit. While FTCS is a really bad idea for advection problems (the method blows up), it is an OK (not the most efficient) approach for our diffusion problem, under certain conditions. Those stability conditions will be explored in class (see appendix). The general solution strategy for any heat flow, finite difference problem is thus to define an initial condition for T (x,t = 0), and boundary conditions (BCs) for the domain, i.e. at x = 0 and x = L. The latter are typically either constant temperature T = C (Dirichlet BC), or constant heat flow, T / x = C (Neumann BC). Then, discretize the spatial dimension, initialize the T i, j variables, and march the solution forward in time according to eq. (11) with some adequately chosen t. The following is a Matlab computer program (a script, actually) written by my post-doc Boris Kaus which illustrates these concepts. We will go over this in detail in class, but the script is included here for completeness. A percent sign,, is a comment, the rest are program instructions. 2

1D Diffusion, explicit finite difference scheme Equation solved: dt/dt = kappa*(dˆ2 T/dxˆ2) using Forward Time Centered Space (FTCS) explicit method i.e. T(t_{i+1}) = T(t_i) + kappa * dt * (T(x_{j+1})-2*T(x_j)+T(x_{j-1})/dxˆ2; Matlab script by Boris Kaus, March 2005 clear all; Input parameters L = 1000; length of model domain in m W_dike = 100; Width of intruding dike T_bg = 1000; Background temperature [C] T_dike = 1300; Temperature of intruding dike kappa = 1e-6; Thermal diffusivity [mˆ2/s] dt = 1; Timestep in years Numerical parameters nx = 101; Number of gridpoints in x-direction num_time= 100; Number of timesteps year = 3600*24*365.25; Seconds/year dt = dt*year; Initialization dx = L/(nx-1); Spacing in x-direction x = -L/2:dx:L/2; Numerical grid in x-direction T = ones(1,nx)*t_bg; ind = find(abs(x)<w_dike/2); spatial region where dike is found T(ind) = T_dike; Initial temperature 3

Time loop for itime=1:num_time save old temperature T_old = T; Compute finite difference scheme ind = 2:nx-1; index array T2nd = (T(ind+1)-2*T(ind)+T(ind-1))/dxˆ2; dt/dxˆ2 T(ind) = kappa*dt*t2nd + T_old(ind); Set BC (constant temperature) T(1) = T_old(1); T(nx) = T_old(nx); end Plotting figure(1), clf plot(x,t) xlabel( Distance [m] ) ylabel( Temperature [ˆo C] ) title([ Time =,num2str(itime*dt/year), years ]) drawnow pause(1/10) The Matlab software allows you to write computer programs quickly, and plot the results easily. You can read more about the Matlab language at http://www.mathworks.com/access/helpdesk/ help/techdoc/matlab.html/. One nifty, yet sometimes perplexing, feature of Matlab is that it works with vectors. For instance, the lines dx = L/(nx-1); Spacing in x-direction x = -L/2:dx:L/2; Numerical grid in x-direction tell the program to actually make an array x = {x 1, x 2,..., x n } with nx elements x 1 = L/2, x 2 = L/2+dx, x 3 = L/2 + 2dx,..., x nx = L/2. More about that in class. 4

Addendum: stability of FTCS and more As you noticed from the exercises in class, there exists a stability criterion for which the FTCS scheme works stably for the diffusion problem. The criterion says that you have to choose the time step t small enough for a given spatial resolution and diffusivity κ so that t ()2 2κ holds. This condition can be derived by means of von Neumann stability analysis, and makes physical sense: t is of order of the characteristic diffusion time for numerical noise as determined by the grid spacing (note factor two). As you might have also noted, one needs to march the solution forward by a large number of time steps so that the essential processes of heat conduction can be captured if t is limited by the above criterion. This makes FTCS as an explicity method a bad idea if efficiency is required. One would therefore rather use implicit schemes (such as Crank-Nicholson), but we don t have the time to discuss these in class. If you want to read more about solving the heat conduction (or any diffusion) equation, you might start with, e.g., Press et al. (1993), sec. 19.2. For advection problems, see sec. 19.1 in that same cookbook text. If you need more detail and explanations, a great resource is Spiegelman (2004). Marc teaches what has to be an awesome class (judging from his lecture notes) at Columbia University on numerical modeling. His chapter 6 (http://www.ldeo. columbia.edu/ mspieg/mmm/diffusion.pdf) deals with diffusion problems. References Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P. (1993). Numerical Recipes in C: The Art of Scientific Computing. Cambridge University Press, Cambridge, 2 edition. Spiegelman, M. (2004). Myths and Methods in Modeling. Columbia University Course Lecture Notes, http://www.ldeo.columbia.edu/ mspieg/mmm/. (12) 5