Boundary Value Problems and Partial Differential Equations (PDEs)

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

Finite Element Method CHAPTER 4: FEM FOR TRUSSES
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
Programming Tips: While Loops and Comparisons 1Daniel Baur / Numerical Methods for Chemical Engineerse Daniel Baur ETH Zurich, Institut für Chemie- und.
Differential Equations
P. Venkataraman Mechanical Engineering P. Venkataraman Rochester Institute of Technology DETC2012 – 70343: A Robust Technique for Lumped Parameter Inverse.
Solving Equations How to Solve Them
ECON 397 Macroeconometrics Cunningham
Addition 1’s to 20.
25 seconds left…...
Week 1.
Chemical Reaction Engineering (CRE) is the field that studies the rates and mechanisms of chemical reactions and the design of the reactors in which they.
State Variables.
Fixed-Bed Reactor for studying the Kinetics of Methane Oxidation on Supported Palladium Objectives: 1.The general goal is to understand: a)the influence.
Fixed point iterations and solution of non-linear functions
Introduction to Matlab 7
Introduction Process Simulation.
ORDINARY DIFFERENTIAL EQUATIONS (ODE)
Partial Differential Equations (PDEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Daniel Baur ETH Zurich, Institut für Chemie-
Numerical Differentiation and Quadrature (Integration) 1Daniel Baur / Numerical Methods for Chemical Engineers / Numerical Quadrature Daniel Baur ETH Zurich,
Parabolic Partial Differential Equations
© 2014 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 15.
Ordinary Differential Equations
Systems of Linear Equations
Linear Systems of Equations Ax = b Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften ETH Hönggerberg/
MANE 4240 & CIVL 4240 Introduction to Finite Elements Introduction to differential equations Prof. Suvranu De.
Non Linear Regression Y i = f(  x i ) +  i Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften.
PARTIAL DIFFERENTIAL EQUATIONS
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Partial differential equations Function depends on two or more independent variables This is a very simple one - there are many more complicated ones.
Ordinary Differential Equations (ODEs)
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
The Finite Difference Method This section presents a quick overview bout the finite difference method. This method can be used to solve any partial differential.
DIFFERENTIAL EQUATIONS, INTEGRATION, POLYNOMIALS, RANDOM NUMBERS MEKANIKA SOFTWARE SEMINARS.
Systems of Linear Equations Iterative Methods
BsysE595 Lecture Basic modeling approaches for engineering systems – Summary and Review Shulin Chen January 10, 2013.
1 Tips for solving Project 1 Reactor SO 3 SO 2 +O 2.
© 2014 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 23.
Chapter 9: Differential Analysis of Fluid Flow SCHOOL OF BIOPROCESS ENGINEERING, UNIVERSITI MALAYSIA PERLIS.
© 2015 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 31.
Scientific Computing Partial Differential Equations Poisson Equation.
Basic Probability (Chapter 2, W.J.Decoursey, 2003) Objectives: -Define probability and its relationship to relative frequency of an event. -Learn the basic.
Boundary Value Problems and Least Squares Minimization
© 2015 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 33.
© 2014 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 23.
Solution of a Partial Differential Equations using the Method of Lines
Solving an elliptic PDE using finite differences Numerical Methods for PDEs Spring 2007 Jim E. Jones.
Quadrature rules 1Michael Sokolov / Numerical Methods for Chemical Engineers / Numerical Quadrature Michael Sokolov ETH Zurich, Institut für Chemie- und.
Numerical Differentiation and Quadrature (Integration)
Modelling & Simulation of Chemical Engineering Systems Department of Chemical Engineering King Saud University 501 هعم : تمثيل الأنظمة الهندسية على الحاسب.
Solution of Nonlinear Functions
© 2014 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 30.
Ordinary Differential Equations (ODEs) 1Michael Sokolov / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Michael Sokolov ETH Zurich, Institut.
Recap Cubic Spline Interpolation Multidimensional Interpolation Curve Fitting Linear Regression Polynomial Regression The Polyval Function The Interactive.
Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory # Discretization Methods Topics Equations and The Goal Brief overview.
Generalized Finite Element Methods
Partial Derivatives bounded domain Its boundary denoted by
Boundary-Value Problems in Rectangular Coordinates
© 2015 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 33.
Solving Partial Differential Equation Numerically Pertemuan 13 Matakuliah: S0262-Analisis Numerik Tahun: 2010.
© 2016 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 38.
Heterogeneous Catalysis: Kinetics in Porous Catalyst Particles
Process and System Characterization Describe and characterize transport and transformation phenomena based reactor dynamics ( 반응공학 ) – natural and engineered.
A First Course on Kinetics and Reaction Engineering
Objective Numerical methods Finite volume.
13. Reactor Engineering: Reactor Design
Presentation transcript:

Boundary Value Problems and Partial Differential Equations (PDEs) Daniel Baur ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften ETH Hönggerberg / HCI F128 – Zürich E-Mail: daniel.baur@chem.ethz.ch http://www.morbidelli-group.ethz.ch/education/index Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Boundary Value Problems (BVP) for ODEs Problem definition: Find a solution for a system of ODEs Subject to the boundary conditions (BCs): The total number of BCs has to be equal to the number of equations! Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Shooting Method A first approach is to transform the BVP into an initial value problem (IVP), by guessing the missing initial conditions and using the BC to refine the guess, until convergence is reached This way, the same algorithms as for IVPs can be used, but the convergence can be very problematic Too high: reduce initial velocity! Target Too low: increase initial velocity! Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Collocation Method A more sophisticated approach is the collocation method; it is based on approximating the unknown function with a sum of polynomials multiplied with unknown coefficients The coefficients are determined by forcing the approximated solution to satisfy the ODE at a number of points equal to the number of coefficients Matlab has a built-in function bvp4c which implements this method; it can also solve singular value problems Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Example of a BVP Consider a tubular reactor We can model it as a plug flow reactor (PFR) with back-mixing by using the following partial differential equation Dax is the (effective) axial dispersion coefficient [m2/s], v is the linear flow velocity [m/s] and n is the reaction order cin cout L Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Tubular Reactor: Dimensionless Form Let us cast the model in dimensionless form by defining Where Pe is the Peclet and Da is the Damköhler number The numerical solution of a problem is usually much simpler if it is dimensionless (most variables will range from 0 to 1). Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Steady State Assumption, Boundary Conditions By assuming steady state, the time variable vanishes and we get an ODE This equation is subject to the Danckwerts BCs (mass balance over inlet, continuous profile at the outlet) Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Transformation into a first order ODE bvp4c solves first order ODEs, so if we remember the «trick» and transform our ODE, we get And the boundary conditions Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Partial Differential Equations Problem definition: In a partial differential equation (PDE), the solution depends on more than one independent variable, e.g. space and time The function is usually subject to both inital conditions and boundary conditions In our example plus the Danckwerts BCs which apply at all times Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Characterization of Second Order PDEs Second order PDEs take the general form where A, B and C are coefficients that may depend on x and y These PDEs fall in one of the following categories B2 – AC < 0: Elliptic PDE B2 – AC = 0: Parabolic PDE B2 – AC > 0: Hyperbolic PDE There are specialized solvers for some types of PDEs, hence knowing its category can be useful for solving a PDE Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Numerical Solution of PDEs In general, it can be very difficult to solve PDEs numerically One approach is to discretize all but one dimension of the solution; this way a system of ODEs is obtained that can be solved more easily Note that these ODE systems are usually very stiff There are different ways of discretizing a dimension, for example the collocation method we saw earlier Sophisticated algorithms refine the discretization in places where the solution is still inaccurate Matlab has a built-in solver for parabolic and elliptic PDEs in two dimensions, pdepe Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Unsteady State Tubular Reactor Let us consider the start-up of a tubular reactor, i.e. We can easily see that this is always a parabolic PDE (B = C = 0), hence the Matlab solver is applicable Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Method of Finite Differences We can apply the so-called finite differences method, if we remember numerical differentiation Also, we can easily derive a similar expression for the second order derivative Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Method of Finite Differences (Continued) The PDE for the start-up of the tubular reactor reads Applying the method of finite differences, we get where Δz = 1/N is the discretization step, N being the number of grid points If we number the grid points with i = 1...N, we get Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Method of Finite Differences (Continued) What happens at the boundaries u1 and uN? One possibility is to invent pseudo grid-points u0 and uN+1 that fulfill the boundary conditions In our case Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Method of Finite Differences (Continued) Rearranging the equations gives us With the initial conditions and «boundary conditions» Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Assignment 1 Solve the dimensionless tubular reactor using bvp4c for 50 different values of the Peclet number between 0.01 and 100 and for a reaction of first and second order In both cases use Da = 1 Plot the conversion at the end of the reactor (1-cA/cin) vs. Peclet for both reaction orders; Also plot the ratio between the conversions of the first order and second order reaction What is better for these reactions, a lot of back-mixing (Pe small, CSTR) or ideal plug flow (Pe large, PFR)? What influence does the reaction order have overall and at low or high Peclet numbers? Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Usage of bvp4c bvp4c uses a call of the form sol = bvp4c(@ode_fun, @bc_fun, solinit, options); ode_fun is a function taking as inputs a scalar t and a vector y, returning as an output dy / dt bc_fun is a function taking as inputs vectors where the boundary conditions are evaluated, returning as output the residual at the boundary solinit initializes the solution by using solinit = bvpinit(range, @initfun) options is an options structure resulting from options = bvpset('FJacobian', @jac_fun) sol is a struct containing the solution and other parameters Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Usage of bvp4c (Continued) In our case use the following function dy = ode_fun(t,y,...) function res = bc_fun(ya,yb,...) function J = jac_fun(t,y,...) Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Assignment 2 Use pdepe to solve the startup of the tubular reactor. Consider only the first order reaction with Pe = 100 and Da = 1. Plot the conversion at the end of the reactor vs. dimensionless time. At what time does the solution reach steady state, i.e. how many reactor volumes of solvent will you need? Compare the solution to what you have found in assignment 1, if the difference is smaller than 0.1%, assume that steady state has been reached. Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Usage of pdepe pdepe uses the following syntax sol = pdepe(m,@pde_fun,@ic_fun,@bc_fun,xmesh,tspan); m is a parameter that describes the symmetry of the problem (slab = 0, cylindrical = 1, spherical = 2); in our case slab, so m = 0 @pde_fun is a function that describes the PDE in this form: @ic_fun is a function that takes as input a vector x and returns the initial conditions at t = 0 @bc_fun is a function that describes the boundary conditions, taking as an input xl, ul, xr, ur and t, returning the BCs in a form: that is, pl, ql, pr and qr Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE

Usage of pdepe (Continued) In our case, use the following 4 Variable Inputs 5 Variable Inputs Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE