Alternative Boundary Condition Implementations for Crank Nicolson Solution to the Heat Equation

Similar documents
BTCS Solution to the Heat Equation

One Dimensional Convection: Interpolation Models for CFD

Finite Difference Methods (FDMs) 2

Open boundary conditions in numerical simulations of unsteady incompressible flow

Introduction to Finite Di erence Methods

Weighted Residual Methods

MTF071 Computational Fluid Dynamics of Turbulent

Overview of Convection Heat Transfer

Finite Difference Methods (FDMs) 1

Overview of Convection Heat Transfer

Weighted Residual Methods

1 Finite difference example: 1D implicit heat equation

Numerical Solutions to Partial Differential Equations

Applied Mathematics 205. Unit III: Numerical Calculus. Lecturer: Dr. David Knezevic

AMS 529: Finite Element Methods: Fundamentals, Applications, and New Trends

The Control-Volume Finite-Difference Approximation to the Diffusion Equation

Initial and Boundary Conditions

The method of lines (MOL) for the diffusion equation

Galerkin Finite Element Model for Heat Transfer

Problem set 3: Solutions Math 207B, Winter Suppose that u(x) is a non-zero solution of the eigenvalue problem. (u ) 2 dx, u 2 dx.

Finite Difference Method for PDE. Y V S S Sanyasiraju Professor, Department of Mathematics IIT Madras, Chennai 36

Boundary conditions. Diffusion 2: Boundary conditions, long time behavior

Salinity Calibration fit with Matlab

1 Introduction. J.-L. GUERMOND and L. QUARTAPELLE 1 On incremental projection methods

Finite Difference Methods for Boundary Value Problems

Module 7: The Laplace Equation

A High-Order Discontinuous Galerkin Method for the Unsteady Incompressible Navier-Stokes Equations

Introduction to PDEs and Numerical Methods: Exam 1

FTCS Solution to the Heat Equation

A Review of Linear Algebra

MATH 333: Partial Differential Equations

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

arxiv: v2 [math.na] 11 Jun 2018

High-order finite volume method for curved boundaries and non-matching domain-mesh problems

A Bound-Preserving Fourth Order Compact Finite Difference Scheme for Scalar Convection Diffusion Equations

Weak form of Boundary Value Problems. Simulation Methods in Acoustics

Chapter 4. Two-Dimensional Finite Element Analysis

An Efficient Algorithm Based on Quadratic Spline Collocation and Finite Difference Methods for Parabolic Partial Differential Equations.

Lecture Notes on Numerical Schemes for Flow and Transport Problems

Ritz Method. Introductory Course on Multiphysics Modelling

Direct Numerical Simulation of Two-Phase Flows with phase change

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

Finite Difference Methods for

Chapter 5. Formulation of FEM for Unsteady Problems

Approximations of diffusions. Mathématiques appliquées (MATH0504-1) B. Dewals, Ch. Geuzaine

Method of Lines. Received April 20, 2009; accepted July 9, 2009

Numerical Methods for PDEs

Time-dependent variational forms

AM 205: lecture 14. Last time: Boundary value problems Today: Numerical solution of PDEs

Partial Differential Equations (PDEs) and the Finite Difference Method (FDM). An introduction

A CCD-ADI method for unsteady convection-diffusion equations

Numerical Solutions to Partial Differential Equations

Chapter 5 HIGH ACCURACY CUBIC SPLINE APPROXIMATION FOR TWO DIMENSIONAL QUASI-LINEAR ELLIPTIC BOUNDARY VALUE PROBLEMS

1 Goal: Use Mass Balances to Predict Control Corrections

Finite-Elements Method 2

Numerical Solution of f(x) = 0

On the Discretization Time-Step in the Finite Element Theta-Method of the Discrete Heat Equation

Code: 101MAT4 101MT4B. Today s topics Finite-difference method in 2D. Poisson equation Wave equation

Quaternion Cubic Spline

Using Green s functions with inhomogeneous BCs

Mat1062: Introductory Numerical Methods for PDE

Numerical Algorithms for Visual Computing II 2010/11 Example Solutions for Assignment 6

Numerical Solutions to PDE s

Universität des Saarlandes. Fachrichtung 6.1 Mathematik

ME Computational Fluid Mechanics Lecture 5

Lecture Notes on Numerical Schemes for Flow and Transport Problems

GREEN S IDENTITIES AND GREEN S FUNCTIONS

LECTURE 14: DEVELOPING THE EQUATIONS OF MOTION FOR TWO-MASS VIBRATION EXAMPLES

Introduction. Finite and Spectral Element Methods Using MATLAB. Second Edition. C. Pozrikidis. University of Massachusetts Amherst, USA

AMS527: Numerical Analysis II

On finite element methods for 3D time dependent convection diffusion reaction equations with small diffusion

1. Partial differential equations. Chapter 12: Partial Differential Equations. Examples. 2. The one-dimensional wave equation

Partial Differential Equations

Study of Forced and Free convection in Lid driven cavity problem

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

Overview of Convection Heat Transfer

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

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Numerical Solutions to Partial Differential Equations

Numerical Methods for Partial Differential Equations

Numerical Solutions to Partial Differential Equations

Time stepping methods

8 A pseudo-spectral solution to the Stokes Problem

Applications of the Maximum Principle

CSL361 Problem set 4: Basic linear algebra

Chapter 5. Numerical Methods: Finite Differences

1D heat conduction problems

A Fifth Order Flux Implicit WENO Method

A fast and well-conditioned spectral method: The US method

One dimensional steady state diffusion, with and without source. Effective transfer coefficients

Finite Element Analysis Prof. Dr. B. N. Rao Department of Civil Engineering Indian Institute of Technology, Madras. Module - 01 Lecture - 16

Dual Reciprocity Boundary Element Method for Magma Ocean Simulations

Verification of Sound Absorption Characteristics Constituted Porous Structure

Explicit and implicit FEM-FCT algorithms with flux linearization

Higher-Order Difference and Higher-Order Splitting Methods for 2D Parabolic Problems with Mixed Derivatives

The family of Runge Kutta methods with two intermediate evaluations is defined by

Diffusion Processes. Lectures INF2320 p. 1/72

Homework 6 Math 309 Spring 2016

Getting started: CFD notation

Linear Regression Linear Least Squares

Transcription:

Alternative Boundary Condition Implementations for Crank Nicolson Solution to the Heat Equation ME 448/548 Notes Gerald Recktenwald Portland State University Department of Mechanical Engineering gerry@pdx.edu ME 448/548: Alternative BC Implementation for the Heat Equation

Overview. Goal is to allow Dirichlet, Neumann and mixed boundary conditions 2. Use ghost node formulation Preserve spatial accuracy of O( x 2 ) Preserve tridiagonal structure to the coefficient matrix 3. Implement in a code that uses the Crank-Nicolson scheme. 4. Demonstrate the technique on sample problems ME 448/548: Alternative BC Implementation for the Heat Equation page

Heat Transfer Boundary Conditions T w i = x = 2 3 Constant wall temperature, T w, is prescribed. The solution gives the internal temperatures and the wall heat flux, q w. q w i = x = 2 3 Constant wall heat flux, q w, is prescribed. The solution gives the internal temperatures temperatures and wall temperature, T w h, T i = x = 2 3 Convective boundary condition where h and T are prescribed. The solution gives the internal temperatures, the wall temperature, T w, and the wall heat flux, q w. ME 448/548: Alternative BC Implementation for the Heat Equation page 2

Convective Boundary Condition The general form of a convective boundary condition is u x = g + h u () x= This is also known as a Robin boundary condition or a boundary condition of the third kind. The simplistic implementation is to replace the derivative in Equation () with a one-sided difference u k+ 2 u k+ = g + h u k+ (2) x

Introduce a Ghost Node Imagine that there is a node û that is outside of the domain u u u 2 u 3... x x x x x 2 this node is used to enforce the boundary condition from Equation (). The value û does not explicitly appear in the numerical scheme. ME 448/548: Alternative BC Implementation for the Heat Equation page 4

Use the BC to compute û by extrapolation Use a central difference approximation at x = (x = x ) to impose the boundary condition. The value of û condition is u 2 û 2 x = g + h u. (3) consistent with the boundary Edge of physical domain u u 2... û = u 2 2 x(g + h u ). (4) x x x x x 2 ME 448/548: Alternative BC Implementation for the Heat Equation page 5

Equation for u Evaluate the finite difference form of the heat equation at x = x. u k+ u k t = θα 2u k+ + u k+ ] [ûk+ x 2 2 [ûk + ( θ)α 2uk + uk 2 x 2 ] Choose θ = /2 and use the formulas for û at time step k and time step k + u k+ u k t = θα x 2 [ u k+ 2 2 x(g k+ + h k+ u k+ ) 2u k+ + u k+ 2 ( θ)α + x 2 The terms in boxes are from the boundary condition [ u k 2 2 x(gk + hk uk ) 2uk + uk 2 ] ] ME 448/548: Alternative BC Implementation for the Heat Equation page 6

Rearrange the Equation for u Algebraically rearranging the preceding equation gives where a u k+ + b u k+ 2 = d (5) a = t + 2θα x2( + xhk+ ) (6) b = 2θα (7) x [ 2 ] 2( θ)α d = ( + xh k t x 2 ) u k (8) 2( θ)α + u k x 2 2 2α [ ] θg k+ + ( θ)g k x These equations define the terms for the first row in the system of equations ME 448/548: Alternative BC Implementation for the Heat Equation page 7

Data structure for implementing alternative BC in the Matlab code Store the boundary condition specification in a 2 3 matrix. The first row has data for x = and the second row has data for x = L. The first column is a flag with the boundary condition type. ubc = Type Value Value 2 Type Value Value 2 b = at the x = boundary and b = 2 at the x = L boundary ubc(b, ) = : u(x b ) = value ubc(b, 2) = value of u at boundary ubc(b, 3) = not used ubc(b, ) = 2: u/ x xb = g + hu(x b ) ubc(b, 2) = g ubc(b, 3) = h ME 448/548: Alternative BC Implementation for the Heat Equation page 8

Verification: Solve the toy problem on half of the domain The toy problem used to test the codes u t = α 2 u x 2 t >, x L u(, t) = u(l, t) = ; u(x, ) = sin(πx/l) only needs to be solved on one half of the domain u t = u α 2 t >, x L/2 x 2 u u(, t) = ; x = L/2 u(x, ) = sin(πx/l) u t = u α 2 t >, L/2 x L x 2 u x = u(l, t) = ; L/2 u(x, ) = sin(πx/l) ME 448/548: Alternative BC Implementation for the Heat Equation page 9

Verification: Solve the toy problem on half of the domain Output of democnbc.5 IC CN Exact.5 IC CN Exact u.5.5..2.3.4 x.5.6.7.8.9 x ME 448/548: Alternative BC Implementation for the Heat Equation page