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 - 304 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

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

Bild der Seite - 304 -

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

Text der Seite - 304 -

304 9 SolvingPartialDifferentialEquations temperature has then fallen. We are interested in how the temperature varies down in thegroundbecauseof temperatureoscillationson thesurface. Assuming homogeneous horizontal properties of the ground, at least locally, and no variations of the temperature at the surface at a fixed point of time, we can neglect the horizontal variations of the temperature. Then a one-dimensional diffusion equation governs the heat propagationalong a vertical axis calledx. The surfacecorrespondstox=0andthex axispointdownwardsintotheground.There isnosourcetermintheequation(actually,if rocksinthegroundareradioactive,they emitheatandthatcanbemodeledbyasourceterm,but thiseffect isneglectedhere). Atsomedepthx=Lweassumethat theheatchangesinxvanish,so∂u/∂x=0 is an appropriate boundary condition at x = L. We assume a simple sinusoidal temperaturevariationat the surface: u(0,t)=T0+Ta sin ( 2π P t ) , whereP is the period, taken here as 24h (24 ·60 ·60s). Theβ coefficient may be set to 10−6 m2/s. Time is then measured in seconds. Set appropriate values forT0 andTa. a) Showthat thepresentproblemhasananalytical solutionof the form u(x,t)=A+Be−rx sin(ωt−rx), forappropriatevaluesofA,B, r, andω. b) Solve this heat propagation problem numerically for some days and animate the temperature. You may use the Forward Euler method in time. Plot both the numerical and analytical solution. As initial condition for the numerical solution, use the exact solution during program development, and when the curves coincide in the animation for all times, your implementation works, and you can then switch to a constant initial condition: u(x,0) = T0. For this latter initial condition, how many periods of oscillations are necessary before there is a good(visual)matchbetween thenumericalandexact solution(despite differencesat t=0)? Filename:ground_temp.py. Exercise9.3:CompareImplicit Methods An equally stable, but more accurate method than the Backward Euler scheme, is the so-called 2-step backward scheme, which for an ODE u′ = f(u,t) can be expressedby 3un+1−4un+un−1 2Δt =f(un+1,tn+1). TheOdespy packageoffers this methodasodespy.Backward2Step.Thepurpose of this exercise is tocompare threemethodsandanimate the threesolutions: 1. TheBackwardEulermethodwithΔt=0.001 2. Thebackward2-stepmethodwithΔt=0.001
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