7 views

Uploaded by jirihav

- Math 110 Practice Test Chapter 7 Answers
- FEM LAB TASK 1
- Parameter Estimation and Inverse Problems
- NIT Syllabus
- Changing CEs
- 10.5-10
- Trabajo
- Demo
- Assignment#2
- Resolução do Problema Proposto por Bento de Jesus Caraça - Rodrigo R. Gonçalez
- 02_finite_differences.ppt
- Meem5800 r02 Aem Summer 2016
- Assignment#2 Report
- Finite Diff
- Finite Elements Using Flex Pde
- LAB 3 (soalan) v2
- Chap-3 CFD
- femppt-130313204553-phpapp01.ppt
- Abs Numerical Simulation Cable Systems
- stokesforce(6)

You are on page 1of 5

The conduction of heat and diusion of a chemical happen to be modeled by the same dierential equation. The reason for this is that they both involve similar processes. Heat conduction occurs when hot, fast moving molecules bump into slower molecules and transfer some of their energy. In a solid this involves moles of molecules all moving in dierent, nearly random ways, but the net eect is that the energy eventually spreads itself out over a larger region. The diusion of a chemical in a gas or liquid simliarly involves large numbers of molecules moving in dierent, nearly random ways. These molecules eventually spread out over a larger region. In three dimensions, the equation that governs both of these processes is the heat/diusion equation ut = cu , where c is the coecient of conduction or diusion, and u(x, y, z) = uxx + uyy + uzz . The symbol in this context is called the Laplacian. If there is also a heat/chemical source, then it is incorporated a function g(x, y, z, t) in the equation as ut = cu + g. In some problems the z dimension is irrelevent, either because the object in question is very thin, or u does not change in the z direction. In this case the equation is ut = cu = c(uxx + uyy ). Finally, in some cases only the x direction matters. In this case the equation is just ut = cuxx , or ut = cuxx + g(x, t), if there is a heat source represented by a function g(x, t). In this lecture we will learn a straight-forward technique for solving (35.1) and (35.2). It is very similar to the nite dierence method we used for nonlinear boundary value problem in the previous lecture. It is worth mentioning a related equation ut = c(u ) for > 1, (35.2) (35.1)

124

125

which is called the porus-media equation. This equation models diusion in a solid, but porus, material, such as sandstone or an earthen structure. We will not solve this equation numerically, but the methods introduced here would work. Many equations that involve 1 time derivative and 2 spatial derivatives are parabolic and the methods introduced in this lecture will work for most of them.

The one dimensional heat/diusion equation ut = cuxx , has two independent variables, t and x, and so we have to discretize both. Since we are considering 0 x L, we subdivide [0, L] into m equal subintervals, i.e. let h = L/m and (x0 , x1 , x2 , . . . , xm1 , xm ) = (0, h, 2h, . . . , L h, L). Similarly, if we are interested in solving the equation on an interval of time [0, T ], let k = T /n and (t0 , t1 , t2 , . . . , tn1 , tn ) = (0, k, 2k, . . . , T k, T ). We will then denote the approximate solution at the grid points by uij u(xi , tj ). The equation ut = cuxx can then be replaced by the dierence equations c ui,j+1 ui,j = 2 (ui1,j 2ui,j + ui+1,j ). (35.3) k h Here we have used the forward dierence for ut and the central dierence for uxx . This equation can be solved for ui,j+1 to produce ui,j+1 = rui1,j + (1 2r)ui,j + rui+1,j for 1 i m 1, 0 j n 1, where r= (35.4)

ck . (35.5) h2 The formula (35.4) allows us to calculate all the values of u at step j + 1 using the values at step j. Notice that ui,j+1 depends on ui,j , ui1,j and ui+1,j . That is u at grid point i depends on its previous value and the values of its two nearest neighbors at the previous step (see Figure 35.1).

Initial Condition

To solve the partial dierential equation (35.1) or (35.2) we need an initial condition. This represents the state of the system when we begin, i.e. the initial temperature distribution or initial concentration prole. This is represented by u(x, 0) = f (x). To implement this in a program we let ui,0 = f (xi ).

126

tj+1

ui,j+1

T

tj

xi1

xi

xi+1

Figure 35.1: The value at grid point i depends on its previous values and the previous values of its nearest neighbors.

Boundary Conditions

To solve the partial dierential equation (35.1) or (35.2) we also need boundary conditions. Just as in the previous section we will have to specify something about the ends of the domain, i.e. at x = 0 and x = L. One possibility is xed boundary conditions, which we can implement just as we did for the ODE boundary value problem. A second possibility is called variable boundary conditions. This is represented by timedependent functions, u(0, t) = g1 (t) and u(L, t) = g2 (t). In a heat problem, g1 and g2 would represent heating or cooling applied to the ends. These are easily implemented in a program by letting u0,j = g1 (tj ) and um,j = g2 (tj ). A third possibility is insulating boundary conditions, which we also did for the ODE boundary value problem. To implement this condition, we need to copy values from inside the region to ctional points just outside the region. See Figure 35.2 for an illustration.

127

z z z z j

tj+1

T s T s T s d d d d d d d d d z dz dz dj T s T s T s d d d d d d d d d z dz dz dj T s T s T s d d d d d d d d d z dz dz dj

tj

xm1

xm

xm+1

Figure 35.2: Illustration of information ow for the explicit method with an insulated boundary condition. The open circles are the ctional points and the curved arrows represent copying the value.

Implementation

The following program (also available on the web page) implements the explicit method. It incorporates variable boundary conditions at both ends. To run it you must dene functions f , g1 and g2 . Notice that the main loop has only one line. The values of u are kept as a matrix. It is often convenient to dene a matrix of the right dimension containing all zeros, and then ll in the calculated values as the program runs. Run this program using L = 2, T = 20, f (x) = .5x, g1 (t) = 0, and g2 (t) = cos(t). Note that g1 (t) must be input as g1 = inline(0*t).

128

function [t x u] = myheat(f,g1,g2,L,T,m,n,c) % function [t x u] = myheat(f,g1,g2,L,T,m,n,c) % solve u_t = c u_xx for 0<=x<=L, 0<=t<=T % BC: u(0, t) = g1(t); u(L,t) = g2(t) % IC: u(x, 0) = f(x) % Inputs: % f -- inline function for IC % g1,g2 -- inline functions for BC % L -- length of rod % T -- length of time interval % m -- number of subintervals for x % n -- number of subintervals for t % c -- rate constant in equation % Outputs: % t -- vector of time points % x -- vector of x points % u -- matrix of the solution, u(i,j)~=u(x(i),t(j)) h r x t = = = = L/m; k = T/n; c*k/h^2; rr = 1 - 2*r; linspace(0,L,m+1); linspace(0,T,n+1);

%Set up the matrix for u: u = zeros(m+1,n+1); % assign initial conditions u(:,1) = f(x); % assign boundary conditions u(1,:) = g1(t); u(m+1,:) = g2(t); % find solution at remaining time steps for j = 1:n u(2:m,j+1) = r*u(1:m-1,j) + rr*u(2:m,j) + r*u(3:m+1,j); end % plot the results mesh(x,t,u)

Exercises

35.1 Modify the program myheat.m to have an insulated boundary at x = L (rather than u(L, t) = g2 (t)). Run the program with L = 2, T = 20, c = .5, g1 (t) = sin(t) and f (x) = sin(x/4). Set m = 20 and experiment with n. Get a plot when the program is stable and one when it isnt. Turn in your program and plots.

- Math 110 Practice Test Chapter 7 AnswersUploaded byMaria Veronica Gallego Buenaventura
- FEM LAB TASK 1Uploaded byHassan
- Parameter Estimation and Inverse ProblemsUploaded byjabirhussain
- NIT SyllabusUploaded byDivya Khan
- Changing CEsUploaded byBalaji Modepalli
- 10.5-10Uploaded byrdgloria
- TrabajoUploaded byJhon Espinoza Vara
- DemoUploaded byPeanut d. Destroyer
- Assignment#2Uploaded byseraj ibramem
- Resolução do Problema Proposto por Bento de Jesus Caraça - Rodrigo R. GonçalezUploaded byRodrigo Gonçalez
- 02_finite_differences.pptUploaded byCham Amirruddin
- Meem5800 r02 Aem Summer 2016Uploaded byAnonymous Zz1bV7H59y
- Assignment#2 ReportUploaded byseraj ibramem
- Finite DiffUploaded byKumar Prashant
- Finite Elements Using Flex PdeUploaded byJose Rene Salinas Canton
- LAB 3 (soalan) v2Uploaded byquiah89
- Chap-3 CFDUploaded byRashed Kaiser
- femppt-130313204553-phpapp01.pptUploaded bybhargav5508
- Abs Numerical Simulation Cable SystemsUploaded byStanislav Simonenko
- stokesforce(6)Uploaded byMalvado Aun Mas Malvado
- NM IMP QPUploaded byDineshkumar
- Cr08 09042803f-Final-9 Published CopyUploaded byMuhammad Rajibul Islam
- Effective.hamiltonian.iiUploaded byclaudsk97
- Important Journal.pone.0133507Uploaded byisele1977
- F.T_pdeUploaded byPeyton Shi
- steps into differential equations basics of differential equations.pdfUploaded byAngelo John R. Javinez
- Natural Boundary ConditionsUploaded bysobaseki1
- Tetrahedrons Sub8Uploaded byDaria Voznyak
- Wave EquationUploaded byWilson Lim
- 100book2Uploaded byEdu True

- Practical Aspects of Finite Element SimulationUploaded byMuriloMonteiro
- DNVGL-OS-E101-2015.pdfUploaded bymmhussai
- Non-API Tubing DimensionsUploaded byDian Sikumbang
- Calibration of AmmeterUploaded bypks_facebook
- Physical, Chemical and Energy Aspects of Underground Hydrogen StorageUploaded byench501
- hazardfieldtrippamphletgrp 7 1Uploaded byapi-316655010
- 01-SAIP-01Uploaded byKuppan Srinivasan
- Konftel300Wx UG ENGUploaded byRupesh Kumar
- Capacities of UB SectionsUploaded byRohan Karande
- Manual Switch OverTek OT 3407SVW UXUploaded byGuiadevoo Kovalski
- Current Affairs Today - Current Affairs 2015-2016Uploaded bySagarias Albus
- Level_6_Passage_7.pdfUploaded byPacurar Emma
- Asphalt Base CourseUploaded byAlex Din Colentina
- Standard for Wood Containers 2012Uploaded byCristina Garcia
- Updated Syllabus for ISRO Mech Scientist EngineerUploaded bySaravana_Kumar_350
- HakiemV4-RSRAN-WBTS-day-PM_11331-2018_12_31-13_46_36__907Uploaded byAbdelouahhab Jamai
- Project ReportUploaded byShyam Kumar Rastogi
- Yingli 250W Mono Data Shee1Uploaded byjhigz25
- High Frequency ABSUploaded byDANIEL_OLIVER_T
- Miscellaneous InsuranceUploaded byRavneet Kaur
- stodolaUploaded byGlenda Hernandez
- 1221703_634542062727217500Uploaded byRaj Kunwar Singh
- Emma 1997Uploaded byBhatara Ayi Meata
- Moon Mining - AdvancedUploaded bykaulet
- Biological_basis_of_personality.pdfUploaded byOzzyel Crowley
- Chapter One Notes-Behavioral EconomicsUploaded byDevin Isgro
- OMNI Spetember 1980Uploaded byterrythecensor
- Project Report LPGUploaded byPurnima Kumawat
- Crude_palm_oil_–_A_price_storm_is_brewing_28_04_12_11_31Uploaded byjwk
- Inside Lincoln MayUploaded byGCMedia