1D Heat equation and a finite-difference solver

Similar documents
Numerical Solutions to Partial Differential Equations

5. FVM discretization and Solution Procedure

2. Conservation of Mass

25. Chain Rule. Now, f is a function of t only. Expand by multiplication:

FINITE DIFFERENCES. Lecture 1: (a) Operators (b) Forward Differences and their calculations. (c) Backward Differences and their calculations.

Introduction to Partial Differential Equations

Fluid Animation. Christopher Batty November 17, 2011

Solution Methods. Steady State Diffusion Equation. Lecture 04

Finite Difference Methods for

Math background. Physics. Simulation. Related phenomena. Frontiers in graphics. Rigid fluids

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

2. FLUID-FLOW EQUATIONS SPRING 2019

Math 212-Lecture 8. The chain rule with one independent variable

Diffusion of a density in a static fluid

Problem Set 4 Issued: Wednesday, March 18, 2015 Due: Wednesday, April 8, 2015

Modeling using conservation laws. Let u(x, t) = density (heat, momentum, probability,...) so that. u dx = amount in region R Ω. R

Scientific Computing: An Introductory Survey

Lecture II: Vector and Multivariate Calculus

Lecture V: The game-engine loop & Time Integration

An Overview of Fluid Animation. Christopher Batty March 11, 2014

Introduction to Heat and Mass Transfer. Week 9

Computational Fluid Dynamics Prof. Dr. SumanChakraborty Department of Mechanical Engineering Indian Institute of Technology, Kharagpur

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 9

How to Use Calculus Like a Physicist

Divergence Theorem December 2013

1 Introduction to MATLAB

Conservation of Mass. Computational Fluid Dynamics. The Equations Governing Fluid Motion

Lecture IV: Time Discretization

Mathematics Qualifying Exam Study Material

Divergence Theorem Fundamental Theorem, Four Ways. 3D Fundamental Theorem. Divergence Theorem

Summary of free theory: one particle state: vacuum state is annihilated by all a s: then, one particle state has normalization:

Ideas from Vector Calculus Kurt Bryan

Introduction to Heat and Mass Transfer. Week 8

Module 3: BASICS OF CFD. Part A: Finite Difference Methods

1. Consider the initial value problem: find y(t) such that. y = y 2 t, y(0) = 1.

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

Finite Difference Methods (FDMs) 2

SKMM 3023 Applied Numerical Methods

Advection / Hyperbolic PDEs. PHY 604: Computational Methods in Physics and Astrophysics II

2.3. Quantitative Properties of Finite Difference Schemes. Reading: Tannehill et al. Sections and

Diffusion / Parabolic Equations. PHY 688: Numerical Methods for (Astro)Physics

1.061 / 1.61 Transport Processes in the Environment

2 Equations of Motion

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 13

Basics on Numerical Methods for Hyperbolic Equations

ENGI Partial Differentiation Page y f x

CURVILINEAR MOTION: RECTANGULAR COMPONENTS (Sections )

16.4. Power Series. Introduction. Prerequisites. Learning Outcomes

Advection, Conservation, Conserved Physical Quantities, Wave Equations

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 7

Numerical Analysis and Computer Science DN2255 Spring 2009 p. 1(8)

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

n 1 f n 1 c 1 n+1 = c 1 n $ c 1 n 1. After taking logs, this becomes

CURVILINEAR MOTION: GENERAL & RECTANGULAR COMPONENTS

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

Scattering amplitudes and the Feynman rules

Thermal Analysis Contents - 1

X i t react. ~min i max i. R ij smallest. X j. Physical processes by characteristic timescale. largest. t diff ~ L2 D. t sound. ~ L a. t flow.

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 20

Numerical Solution Techniques in Mechanical and Aerospace Engineering

q t = F q x. (1) is a flux of q due to diffusion. Although very complex parameterizations for F q

Integration in the Complex Plane (Zill & Wright Chapter 18)

Definition 5.1. A vector field v on a manifold M is map M T M such that for all x M, v(x) T x M.

CURVILINEAR MOTION: GENERAL & RECTANGULAR COMPONENTS

Differential Equations

PV Generation in the Boundary Layer

Notation Nodes are data points at which functional values are available or at which you wish to compute functional values At the nodes fx i

Soft Bodies. Good approximation for hard ones. approximation breaks when objects break, or deform. Generalization: soft (deformable) bodies

JUST THE MATHS UNIT NUMBER INTEGRATION APPLICATIONS 10 (Second moments of an arc) A.J.Hobson

MATH 3150: PDE FOR ENGINEERS FINAL EXAM (VERSION D) 1. Consider the heat equation in a wire whose diffusivity varies over time: u k(t) 2 x 2

THEODORE VORONOV DIFFERENTIABLE MANIFOLDS. Fall Last updated: November 26, (Under construction.)

Introduction to Environment System Modeling

This is a Gaussian probability centered around m = 0 (the most probable and mean position is the origin) and the mean square displacement m 2 = n,or

Discrete Projection Methods for Incompressible Fluid Flow Problems and Application to a Fluid-Structure Interaction

G : Statistical Mechanics

Lecture Notes on Numerical Schemes for Flow and Transport Problems

PDE Solvers for Fluid Flow

Preliminary Examination in Numerical Analysis

Convection and buoyancy oscillation

Introduction to Fluid Dynamics

14.7 The Divergence Theorem

x 2 y = 1 2. Problem 2. Compute the Taylor series (at the base point 0) for the function 1 (1 x) 3.

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 5

3 Generation and diffusion of vorticity

Multi-physics Modeling Using Cellular Automata

The Finite Volume Mesh

Chain Rule. MATH 311, Calculus III. J. Robert Buchanan. Spring Department of Mathematics

Burgers equation - a first look at fluid mechanics and non-linear partial differential equations

Introduction to multiscale modeling and simulation. Explicit methods for ODEs : forward Euler. y n+1 = y n + tf(y n ) dy dt = f(y), y(0) = y 0

Problem Set Number 01, MIT (Winter-Spring 2018)

Modeling, Simulating and Rendering Fluids. Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan

The Finite Difference Method

Lecture Notes 6: Dynamic Equations Part A: First-Order Difference Equations in One Variable

Laplace Transforms Chapter 3

First-Order Differential Equations

THE WAVE EQUATION. d = 1: D Alembert s formula We begin with the initial value problem in 1 space dimension { u = utt u xx = 0, in (0, ) R, (2)

Galerkin Finite Element Model for Heat Transfer

Strauss PDEs 2e: Section Exercise 2 Page 1 of 6. Solve the completely inhomogeneous diffusion problem on the half-line

Introduction to numerical schemes

Getting started: CFD notation

Transcription:

1D Heat equation and a finite-difference solver Guillaume Riflet MARETEC IST 1 The advection-diffusion equation The original concept applied to a property within a control volume from which is derived the integral advection-diffusion equation states as {Rate of change in time} = {Ingoing Outgoing fluxes} + {Created Destroyed}. 1) Annotated in a correct mathematical encapsulation, equation 1 yields d P d = P v n) ds K P n) ds + Sc Sk) d, 2) where P is the transported property concentration, v is the advecting field, K is the diffusivity coefficient, is the surface of the control volume, n is the outward normal to the control surface and Sc and Sk are the source and sink terms, respectively. The first term on the right hand side RHS) of equation 2 states ingoing and outgoing fluxes due to advection, the second term in the RHS states ingoing and outgoing fluxes due to diffusion, and the last term on the RHS accounts for source and sink terms. the Note that Fick s law, K P, is applied to mathematically describe diffusion [1]. By resorting to the divergence theorem, stating that the divergence of a vector field inside any finite gaussian volume is equal to its flux through the boundary of the volume, i.e..e d = E n ds, 3) 1

1 The advection-diffusion equation 2 being the gaussian volume, its boundary, E the vector field, and E n its flux through the boundary. n is defined as the external normal unit vector to the boundary. Hence, by applying equation3) to equation2), the finite volume formulation of equation 4) is obtained: d P d = v P ) d K P ) d + Sc Sk) d. 4) By resorting to the Leibniz integration rule, d d fx, t) fx, t)d = d, which is true as long as the integral volume and consequently x) is held fixed in time, in one hand. By joining all the integrals in into a single integral on the other, equation 4 yields { } P + v P ) + K P ) Sc + Sk d = 0. Since the above integral holds zero for all gaussian volume, then its integrand must be zero, thus yielding the differential equation of advectiondiffusion: P + v P ) + K P ) Sc + Sk = 0. 5) A few comments: first, the control volume is held fixed in time. Second, the time derivative applied to a function varying in time only in its explicit component such as P x, t)), may be annotated as a partial derivative,, without loss of generality. Third, the total derivative and the partial derivative are related by the Leibniz chain rule, d P xt), t) = P xt 0), t) + d xt) P xt 0 ), t 0 ) x + d yt) P xt 0 ), t 0 ) y + d zt) P xt 0 ), t 0 ). z

1 The advection-diffusion equation 3 If dx = 0, then the partial derivative equals the total derivative, which is the case of P within the fixed volume. By noting that equation 5 returns v P ) = v P + P v, P + v P + P v + K P ) Sc + Sk = 0. By noting that the material derivative is defined by equation 5 finally yields D Dt + v, DP + P v + K P ) Sc + Sk = 0. Dt In incompressible fluids we have v = 0, hence in such case DP + K P ) Sc + Sk = 0. 6) Dt Thus, to sum up, equation 2) is the integral equation of advection and diffusion with source and sink terms) in flux form, equation 4) is the integral equation of advection-diffusion in volume form, equation 5) is the differential equation of advection-diffusion where the advective field is the velocity of the fluid particles relative to a fixed reference frame) and equation 6) is the differential equation of advection-diffusion for an incompressible fluid. 1.1 The 1D Heat-equation The 1D heat equation consists of property P as being temperature T or heat applying for the unidimensional case of differential equation 5). The tridimensional case with a decay or sink term writes T + µ T ) + k T = 0, 7) where µ is the diffusivity coefficient and k is the decay coefficient. In the problem, only the 1D equation is relevant: T T µ 2 + k T = 0. 8) x2 This equation admits solutions under certain initial values and certain boundary conditions google wikipedia heat equation).

2 Finite-difference solvers 4 2 Finite-difference solvers In order to solve numerically equations like equation 8), it is necessary to discretize the derivative operators. After discretizing the derivative operators, it is also useful to have an estimate of the error of the solution. When one knows its analytical solution, then it suffices to compute the RMS root mean square error) in order to know exactly what is the error. However, often, numerical solvers are used because there are no known analytical solution to the PDE partial differential equation), thus there is no alternative but to estimate the error. A traditional approach consists in using constant discrete time steps and constant discrete spatial steps dx combined with the Taylor serie expansion definition of analytical functions [2]. The Taylor serie expansion of an analytical real function forward in its variable coordinate is f t + ) = f n) t) )n 9) n! n=0 and backward in its variable coordinate is f t ) = f n) t) )n. 10) n! 2.1 Explicit method n=0 The Taylor series in equation 9) expanded up to the second order with third order error), f t + ) = ft) + f t) + f t) )2 2 + o ) 3). 11) A first derivative approximation may be obtained from equation 11, f t) = f t + ) f t) + o ). 12) The first derivative approximation in equation 12) yields first order error. This numerical method is often referred to as the explicit method or the forward in time method. Note that o) 3 ) = o) 2 ), o) = o ) = o), are general properties of truncature error operator.

2 Finite-difference solvers 5 2.2 Implicit method Likewise, the Taylor series in equation 10) expanded up to the second order with third order error) yields, f t ) = ft) + f t) ) + f t) )2 2 + o ) 3). 13) A first derivative approximation may be obtained from equation 13, f t) = f t) f t ) + o ). 14) This numerical method is referred to as the implicit method or the backward in time method and is also first order error. 2.3 Mid-point method By subtracting equation 13) from equation 11), the mid-point method is obtained: ft + ) ft ) = f t) 2 + o ) 3), 15) f t) = ft + ) ft ) 2 + o ) 2). 16) Equation 16) is referred to as the mid-point method and has a second order error. 2.4 Second derivative discretization By summing equation 13) from equation 11), a discretization of the second derivative is obtained: ft + ) + ft ) = 2 ft) + f t) ) 2 + o ) 4). 17) Note that the third order terms in the forward and backward Taylor series expansion cancel out. In fact, every odd order term are cancelled when summing the forward and backward Taylor series expansion, whereas its the even terms that are cancelled when subtracting the backward Taylor series from the forward Taylor series. Thus, equation 17) yields f t) = ft + ) 2 ft) + ft ) ) 2 + o ) 2). 18)

3 Discretizing the heat equation 6 3 Discretizing the heat equation The idea is to discretize the heat equation 8) with a numerical scheme forward in time and centred in space FTCS). Thus by using the scheme in equation 12) to the time derivative and by using the numerical scheme in equation 18) to second-derivative in space, equation 8) becomes, in its algebraic form: T x, t + t) T x, t) = t T x + x, t) 2 T x, t) + T x x, t) µ x 2 k T x, t), 19) which in turn yields or even yet, T x, t + t) = T x, t) + µ t T x + x, t) 2 T x, t) + T x x, t)) x2 k t T x, t), 20) T x, t + t) = µ t T x + x, t) x2 + 1 k t 2 µ t ) x 2 T x, t) + µ t T x x, t). 21) x2 The numerical scheme is defined positive and physically realist) if and only if every coefficient affected to T x + x, t), T x, t) and T x x, t) is positive. Which is the case in equation 21) as long as 3.1 the grid 1 k t 2 µ t 1. 22) x2 Consider an even spaced bi-dimensional grid evolving over space by increments of x and over time by increments of t. Each grid point is indexed by integers i in space and n in time. The spatial axis of the grid represents the heated bar. The time axis of the grid represents the temporal evolution

3 Discretizing the heat equation 7 of the heat in the bar. Thus, given the values of temperature in the bar for all values of index i at a given instant n, Ti n, the temperature in the next time instant is Ti n+1 is deduced from equation 21), T n+1 i = Dif Ti+1 n + 1 k t 2 Dif) Ti n + Dif Ti 1, n 23) where, by definition, Dif µ t x 2. 3.2 Boundary conditions For boundary conditions, a null diffusive flux is considered as the heated bar is adiabatically insulated from the environment), thus a special scheme must be considered at the boundary grid points for i = 1 and i = Ni where Ni is the total number of grid points in the spatial axis. i = 1 T1 n+1 = Dif T2 n + 1 k t Dif) T1 n, i = Ni T n+1 Ni = 1 k t Dif) TNi n + Dif TNi 1. n Notice how the central diffusive flux coefficient was cut by half at the boundaries when compared with equation 23). Indeed the net diffusive flux is represented by an ingoing diffusive flux represented by the terms T i+1 and T i 1, and by an outgoing diffusive flux represented by the term T i. Thus, the outgoing diffusive represents the amount of heat from T i that flows to both the neighbour grid points i + 1 and i 1. At the boundaries, however, the outgoing diffusive flux flows to only one neighbouring grid point, thus cutting in half the diffusion that occurs. 3.3 Initial condition Equation 23) calculates T n+1 as a function of T n. Thus, at some point, T 1 needs to be defined. It s called the initial condition. The initial condition will describe an initial state of the modelled bar. 3.4 Continuous emission Suppose that there s an heat source at some point near the bar. This heat source will input heat continuously in the bar. A possible way to model a continuous emission is as follows: first, the regular diffusivity-decay algorithm is employed, T n+1 i = Dif Ti+1 n + 1 k t 2 Dif) Ti n + Dif Ti 1, n

3 Discretizing the heat equation 8 Then, the continous source term C is added at the given grid point, say i = p, Ti n+1 = Ti n+1 i p Ti n+1 = Ti n+1 + C t i = p. References [1] Chapra, S. C. Surface water-quality modeling. Mcgraw-hill Series In Water Resources And Environmental Engineering 1997). [2] Fletcher, C. A. J., and Srinivas, K. Computational Techniques for Fluid Dynamics 1. Springer, 1991.