Web-Books
im Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Seite - 305 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

Seite - 305 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Bild der Seite - 305 -

Bild der Seite - 305 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Text der Seite - 305 -

9.3 Exercises 305 3. Thebackward2-stepmethodwithΔt=0.01 Choose the modelproblemfromSect.9.2.4. Filename:rod_BE_vs_B2Step.py. Exercise9.4:ExploreAdaptiveand Implicit Methods WeconsiderthesameproblemasinExercise9.2.Nowwewant toexploretheuseof adaptiveandimplicitmethodsfromOdespytosee if theyaremoreefficient than the ForwardEulermethod.AssumethatyouwanttheaccuracyprovidedbytheForward Eulermethodwith its maximumΔt value.Since thereexistsananalytical solution, youcancomputeanerrormeasure that summarizes theerror inspaceand timeover thewholesimulation: E= √ ΔxΔt ∑ i ∑ n (Uni −uni )2 . Here,Uni is theexactsolution.UsetheOdespypackagetorunthefollowingimplicit andadaptivesolvers: 1. BackwardEuler 2. Backward2Step 3. RKFehlberg Experiment to see if you can use larger time steps than what is required by the ForwardEulermethodandget solutionswith thesameorderofaccuracy. Hint Toavoidoscillationsin thesolutionswhenusingtheRKFehlbergmethod, the rtol andatolparameters toRKFFehlbergmust be set no larger than 0.001 and 0.0001,respectively.Youcanprintoutsolver_RKF.t_alltoseeall the timesteps usedbytheRKFehlbergsolver(ifsolver is theRKFehlbergobject).Youcanthen compare thenumberof timestepswithwhat is requiredby theothermethods. Filename:ground_temp_adaptive.py. Exercise9.5: Investigate theθ Rule a) The Crank-Nicolson method for ODEs is very popular when combined with diffusionequations.Fora linearODEu′ =au it reads un+1 −un Δt = 1 2 (aun+aun+1). Apply the Crank-Nicolson method in time to the ODE system for a one- dimensionaldiffusionequation. Identify the linear system tobesolved.
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Titel
Programming for Computations – Python
Untertitel
A Gentle Introduction to Numerical Simulations with Python 3.6
Band
Second Edition
Autoren
Svein Linge
Hans Petter Langtangen
Verlag
Springer Open
Datum
2020
Sprache
englisch
Lizenz
CC BY 4.0
ISBN
978-3-319-32428-9
Abmessungen
17.8 x 25.4 cm
Seiten
356
Schlagwörter
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Kategorie
Informatik
Web-Books
Bibliothek
Datenschutz
Impressum
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python