Web-Books
in the Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Page - 297 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

Page - 297 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Image of the Page - 297 -

Image of the Page - 297 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Text of the Page - 297 -

9.2 FiniteDifferenceMethods 297 Fig. 9.1 Unstable simulation of the temperature in a rod The -i option specifies the naming of the plot files, and -r specifies the number of frames per second in the movie. On Mac, run ffmpeg instead of avconvwith the same options. Other video formats, such as MP4, WebM, and Ogg can also be produced: Terminal Terminal> ffmpeg -i tmp_%04d.png -r 4 -vcodec libx264 movie.mp4 Terminal> ffmpeg -i tmp_%04d.png -r 4 -vcodec libvpx movie.webm Terminal> ffmpeg -i tmp_%04d.png -r 4 -vcodec libtheora movie.ogg An Unstable Solution The results of a simulation start out as seen from the two snapshots in Fig.9.1. We see that the solution definitely looks wrong. The temperature is expected to be smooth, not having such a saw-tooth shape. We say that this solution is unstable, meaning that it does not display the same characteristics as the true, physical solution. Even though we tested the code carefullyin theprevioussection, itdoesnotseemtoworkforaphysicalapplication! Why Is the Solution Unstable? The problem is thatΔt is too large, making the solutionunstable. It turnsout that theForwardEuler time integrationmethodputsa restrictionon thesize ofΔt. For theheat equationand the way we havediscretized it, this restrictioncanbeshowntobe [14] Δt≤ Δx 2 2β . (9.15) Thisiscalledastabilitycriterion.Withthechosenparameters,(9.15)tellsusthat the upper limit isΔt =0.9527439,which is smaller thanour choiceabove.Rerunning
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Title
Programming for Computations – Python
Subtitle
A Gentle Introduction to Numerical Simulations with Python 3.6
Volume
Second Edition
Authors
Svein Linge
Hans Petter Langtangen
Publisher
Springer Open
Date
2020
Language
English
License
CC BY 4.0
ISBN
978-3-319-32428-9
Size
17.8 x 25.4 cm
Pages
356
Keywords
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Category
Informatik
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python