Computational Modeling

Download Computational Modeling

Post on 14-Oct-2014

929 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

<p>Computational Modeling with Methods and AnalysisR. E. White Department of Mathematics North Carolina State University white@math.ncsu.edu Updated on May 12, 2003 To Be Published by CRC Press in 2003</p> <p>ii</p> <p>ContentsPreface Introduction 1 Discrete Time-Space Models 1.1 Newton Cooling Models . . . . . . . . . . . 1.2 Heat Diusion in a Wire . . . . . . . . . . . 1.3 Diusion in a Wire with Little Insulation . 1.4 Flow and Decay of a Pollutant in a Stream 1.5 Heat and Mass Transfer in Two Directions . 1.6 Convergence Analysis . . . . . . . . . . . . ix xi 1 1 9 17 25 32 42 51 51 59 68 77 86 91 99 99 107 116 122 130 138 145 145 152 160 166 171</p> <p>. . . . . .</p> <p>. . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>. . . . . . . . . . . . . . . . . . . . . . .</p> <p>2 Steady State Discrete Models 2.1 Steady State and Triangular Solves . . . . . . . 2.2 Heat Diusion and Gauss Elimination . . . . . 2.3 Cooling Fin and Tridiagonal Matrices . . . . . 2.4 Schur Complement and Domain Decomposition 2.5 Convergence to Steady State . . . . . . . . . . 2.6 Convergence to Continuous Model . . . . . . . 3 Poisson Equation Models 3.1 Steady State and Iterative Methods . . . . 3.2 Heat Transfer in 2D Fin and SOR . . . . . 3.3 Fluid Flow in a 2D Porous Medium . . . . . 3.4 Ideal Fluid Flow . . . . . . . . . . . . . . . 3.5 Deformed Membrane and Steepest Descent 3.6 Conjugate Gradient Method . . . . . . . . . 4 Nonlinear and 3D Models 4.1 Nonlinear Problems in One Variable 4.2 Nonlinear Heat Transfer in a Wire . 4.3 Nonlinear Heat Transfer in 2D . . . 4.4 Steady State 3D Heat Diusion . . . 4.5 Time Dependent 3D Diusion . . . . iii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .</p> <p>iv 4.6</p> <p>CONTENTS High Performance Computations in 3D . . . . . . . . . . . . . . . 180 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 189 197 204 213 219 228 237 237 244 249 258 263 268 275 275 282 288 294 301 307 313 313 318 323 328 333 339 345 345 350 356 360 365 372 379 381</p> <p>5 Epidemics, Images and Money 5.1 Epidemics and Dispersion . . . . . . 5.2 Epidemic Dispersion in 2D . . . . . . 5.3 Image Restoration . . . . . . . . . . 5.4 Restoration in 2D . . . . . . . . . . . 5.5 Option Contract Models . . . . . . . 5.6 Black-Scholes Model for Two Assets</p> <p>6 High Performance Computing 6.1 Vector Computers and Matrix Products 6.2 Vector Computations for Heat Diusion 6.3 Multiprocessors and Mass Transfer . . . 6.4 MPI and IBM/SP . . . . . . . . . . . . 6.5 MPI and Matrix Products . . . . . . . . 6.6 MPI and 2D Models . . . . . . . . . . . 7 Message Passing Interface 7.1 Basic MPI Subroutines . 7.2 Reduce and Broadcast . 7.3 Gather and Scatter . . . 7.4 Grouped Data Types . . 7.5 Communicators . . . . . 7.6 Foxs Algorithm for AB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .</p> <p>8 Classical Methods for Ax = d 8.1 Gauss Elimination . . . . . . . . . . 8.2 Symmetric Positive Denite Matrices 8.3 Domain Decomposition and MPI . . 8.4 SOR and P-regular Splittings . . . . 8.5 SOR and MPI . . . . . . . . . . . . . 8.6 Parallel ADI Schemes . . . . . . . . 9 Krylov Methods for Ax = d 9.1 Conjugate Gradient Method 9.2 Preconditioners . . . . . . . 9.3 PCG and MPI . . . . . . . 9.4 Least Squares . . . . . . . . 9.5 GMRES . . . . . . . . . . . 9.6 GMRES(m) and MPI . . . References Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .</p> <p>List of Figures1.1.1 Temperature versus Time . . . . . . . . . . . . . 1.1.2 Steady State Temperature . . . . . . . . . . . . . 1.1.3 Unstable Computation . . . . . . . . . . . . . . . 1.2.1 Diusion in a Wire . . . . . . . . . . . . . . . . . 1.2.2 Time-Space Grid . . . . . . . . . . . . . . . . . . 1.2.3 Temperature versus Time-Space . . . . . . . . . . 1.2.4 Unstable Computation . . . . . . . . . . . . . . . 1.2.5 Steady State Temperature . . . . . . . . . . . . . 1.3.1 Diusion in a Wire with csur = .0000 and .0005 . 1.3.2 Diusion in a Wire with n = 5 and 20 . . . . . . 1.4.1 Polluted Stream . . . . . . . . . . . . . . . . . . 1.4.2 Concentration of Pollutant . . . . . . . . . . . . 1.4.3 Unstable Concentration Computation . . . . . . 1.5.1 Heat or Mass Entering or Leaving . . . . . . . . 1.5.2 Temperature at Final Time . . . . . . . . . . . . 1.5.3 Heat Diusing Out a Fin . . . . . . . . . . . . . 1.5.4 Concentration at the Final Time . . . . . . . . . 1.5.5 Concentrations at Dierent Times . . . . . . . . 1.6.1 Euler Approximations . . . . . . . . . . . . . . . 2.1.1 Innite or None or One Solution(s) . . . 2.2.1 Gaussian Elimination . . . . . . . . . . . 2.3.1 Thin Cooling Fin . . . . . . . . . . . . . 2.3.2 Temperature for c = .1, .01, .001, .0001 2.6.1 Variable r = .1, .2 and .3 . . . . . . . . 2.6.2 Variable n = 4, 8 and 16 . . . . . . . . . 3.1.1 Cooling Fin with T = .05, .10 and .15 3.2.1 Diusion in Two Directions . . . . . . 3.2.2 Temperature and Contours of Fin . . . 3.2.3 Cooling Fin Grid . . . . . . . . . . . . 3.3.1 Incompressible 2D Fluid . . . . . . . . 3.3.2 Groundwater 2D Porous Flow . . . . . v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 7 7 11 13 15 15 16 22 23 26 30 31 34 37 38 40 41 45 52 64 69 75 94 95 105 108 113 114 117 118</p> <p>vi 3.3.3 Pressure for Two Wells . . . . . . 3.4.1 Ideal Flow About an Obstacle . . 3.4.2 Irrotational 2D Flow vx uy = 0 3.4.3 Flow Around an Obstacle . . . . 3.4.4 Two Paths to (x,y) . . . . . . . . 3.5.1 Steepest Descent norm(r) . . . . 3.6.1 Convergence for CG and PCG . . 4.2.1 Change in F1 . . . . . . . . . . 4.2.2 Temperatures for Variable c . . 4.4.1 Heat Diusion in 3D . . . . . . 4.4.2 Temperatures Inside a 3D Fin . 4.5.1 Passive Solar Storage . . . . . . 4.5.2 Slab is Gaining Heat . . . . . . 4.5.3 Slab is Cooling . . . . . . . . . 4.6.1 Domain Decompostion in 3D . 4.6.2 Domain Decomposition Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .</p> <p>LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 123 124 128 129 136 143 155 158 167 171 172 178 179 183 187 196 199 203 206 213 219 222 226 226 227 229 234 235 238 239 239 240 241 248 250 250 256 262 269 270</p> <p>5.1.1 Infected and Susceptible versus Space . 5.2.1 Grid with Articial Grid Points . . . . . 5.2.2 Infected and Susceptible at Time = 0.3 5.3.1 Three Curves with Jumps . . . . . . . . 5.3.2 Restored 1D Image . . . . . . . . . . . . 5.4.1 Restored 2D Image . . . . . . . . . . . . 5.5.1 Value of American Put Option . . . . . 5.5.2 P(S,T-t) for Variable Times . . . . . . . 5.5.3 Option Values for Variable Volatilities . 5.5.4 Optimal Exercise of an American Put . 5.6.1 American Put with Two Assets . . . . . 5.6.2 max(E1 + E2 S1 S2 , 0) . . . . . . . . 5.6.3 max(E1 S1 , 0) + max(E2 S2 , 0) . . . 6.1.1 von Neumann Computer . . . . . . . . 6.1.2 Shared Memory Multiprocessor . . . . 6.1.3 Floating Point Add . . . . . . . . . . . 6.1.4 Bit Adder . . . . . . . . . . . . . . . . 6.1.5 Vector Pipeline for Floating Point Add 6.2.1 Temperature in Fin at t = 60. . . . . . 6.3.1 Ring and Complete Multiprocessrs . . 6.3.2 Hypercube Multiprocessor . . . . . . . 6.3.3 Concentration at t = 17 . . . . . . . . 6.4.1 Fan-out Communication . . . . . . . 6.6.1 Space Grid with Four Subblocks . . . 6.6.2 Send and Recieve for Processors . . . . . . . . . . . . . . .</p> <p>7.2.1 A Fan-in Communication . . . . . . . . . . . . . . . . . . . . . . 282</p> <p>List of Tables1.6.1 Euler Errors at t = 10 . . . . . . . . . . . . . . . . . . . . . . . . 45 1.6.2 Errors for Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 1.6.3 Errors for Heat . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 2.6.1 Second Order Convergence . . . . . . . . . . . . . . . . . . . . . 97</p> <p>3.1.1 Variable SOR Parameter . . . . . . . . . . . . . . . . . . . . . . . 104 3.2.1 Convergence and SOR Parameter . . . . . . . . . . . . . . . . . 113 4.1.1 Quadratic Convergence . . . . . . . . . . . . . . . . . . . . . . . . 149 4.1.2 Local Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . 149 4.2.1 Newtons Rapid Convergence . . . . . . . . . . . . . . . . . . . . 158 6.1.1 Truth Table for Bit Adder . . . . . 6.1.2 Matrix-vector Computation Times 6.2.1 Heat Diusion Vector Times . . . . 6.3.1 Speedup and Eciency . . . . . . 6.3.2 HPF for 2D Diusion . . . . . . . 6.4.1 MPI Times for trapempi.f . . . . . 6.5.1 Matrix-vector Product mops . . . 6.5.2 Matrix-matrix Products mops . . 6.6.1 Processor Times for Diusion . . . 6.6.2 Processor Times for Pollutant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 243 246 252 254 262 265 268 272 273</p> <p>7.6.1 Fox Times (.001*sec.) . . . . . . . . . . . . . . . . . . . . . . . . 311 8.3.1 MPI Times for geddmpi.f . . . . . . . . . . . . . . . . . . . . . . 327 8.5.1 MPI Times for sorddmpi.f . . . . . . . . . . . . . . . . . . . . . . 338 9.3.1 MPI Times for cgssormpi.f . . . . . . . . . . . . . . . . . . . . . . 360 9.6.1 MPI Times for gmresmmpi.f . . . . . . . . . . . . . . . . . . . . . 376</p> <p>vii</p> <p>viii</p> <p>LIST OF TABLES</p> <p>PrefaceThis book evolved from the need to migrate computational science into undergraduate education. It is intended for students who have had basic physics, programming, matrices and multivariable calculus. The choice of topics in the book has been inuenced by Undergraduate Computational Engineering and Science Project (a United States Department of Energy funded eort), which was a series of meetings during the 1990s. These meetings focused on the nature and content for computational science undergraduate education. They were attended by a diverse group of science and engineering teachers and professionals, and the continuation of some of these activities can be found at the Krell Institute, http://www.krellinst.org. Variations of chapters 1-4 and 6 have been taught at North Carolina State University in fall semesters since 1992. The other four chapters were developed in 2002 and taught in the 2002-3 academic year. The department of mathematics at North Carolina State University has given me the time to focus on the challenge of introducing computational science materials into the undergraduate curriculum. The North Carolina Supercomputing Center, http://www.ncsc.org, has provided the students with valuable tutorials and computer time on supercomputers. Many students have made important suggestions, and Carol Cox Benzi contributed some course materials with the initial use of MATLAB. I thank my close friends who have listened to me talk about this eort, and especially Liz White who has endured the whole process with me. Bob White May 12, 2003</p> <p>ix</p> <p>x</p> <p>PREFACE</p> <p>IntroductionComputational science is a blend of applications, computations and mathematics. It is a mode of scientic investigation that supplements the traditional laboratory and theoretical methods of acquiring knowledge. This is done by formulating mathematical models whose solutions are approximated by computer simulations. By making a sequence of adjustments to the model and subsequent computations one can gain some insights into the application area under consideration. This text attempts to illustrate this process as a method for scientic investigation. Each section of the rst six chapters is motivated by a particular application, discrete or continuous model, numerical method, computer implementation and an assessment of what has been done. Applications include heat diusion to cooling ns and solar energy storage, pollutant transfer in streams and lakes, models of vector and multiprocessing computers, ideal and porous uid ows, deformed membranes, epidemic models with...</p>

Recommended

View more >