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 - 300 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

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

Image of the Page - 300 -

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

Text of the Page - 300 -

300 9 SolvingPartialDifferentialEquations Fig. 9.2 Time steps used by the Runge-Kutta-Fehlberg method: error tolerance 10−3 (left) and 10−6 (right) step.Abovewe indicatedhowtouse theadaptiveRunge-Kutta-Fehlberg4-5solver. While theΔt correspondingto the Forward Euler method requiresover 8000steps for a simulation, we started theRKFehlbergmethod with 100 times this time step and in the end it required just slightly more than 2500 steps, using the default tolerance parameters. Lowering the tolerance did not save any significant amount ofcomputationalwork.Figure 9.2 showsa comparisonof the lengthofall the time steps for two values of the tolerance. We see that the influence of the tolerance is minor in this computationalexample, so it seems that theblow-updue to instability iswhatgovernsthetimestepsize.Thenicefeatureofthisadaptivemethodis thatwe can just specifywhenwewant the solution to becomputed,and themethodfigures outon itsownwhat time step thathas tobeusedbecauseof stability restrictions. Wehaveseenhoweasyit is toapplysophisticatedmethodsforODEstothisPDE example.We shall take theuse ofOdespyonestep further in the nextsection. 9.2.7 ImplicitMethods A major problem with the stability criterion (9.15) is that the time step becomes very small if Δx is small. For example, halving Δx requires four times as many time steps and eight times the work. Now, with N = 40, which is a reasonable resolution for the test problem above, the computations are very fast. What takes time, is the visualization on the screen, but for that purpose one can visualize only a subset of the time steps. However, there are occasions when you need to take larger time steps with the diffusion equation, especially if interest is in the long- term behavioras t →∞. You must then turn to implicit methods for ODEs. These methodsrequire thesolutionsof linearsystems, if theunderlyingPDEis linear,and systemsofnonlinearalgebraicequations if theunderlyingPDE isnon-linear. The simplest implicit method is the Backward Euler scheme, which puts no restrictionsonΔt for stability, butobviously,a largeΔt leads to inaccurate results. TheBackwardEuler schemeforascalar ODEu′ =f(u,t) reads un+1 −un Δt =f(un+1,tn+1).
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