Seite - 182 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Bild der Seite - 182 -
Text der Seite - 182 -
182 5 SolvingPartialDifferentialEquations
Remarks In 2D and 3Dproblems, where theCPU time to compute a solution of
PDEcanbehoursanddays, it isvery important toutilize symmetryaswedoabove
to reduce the sizeof theproblem.
Also note the remarks inExercise 5.6 about the constant areaunder theu.x;t/
curve: here, the area is 0.5 andu ! 0:5 as t ! 0:5 (if themesh is sufficiently
fine -onewill get convergence to smaller values for small if themesh is notfine
enoughtoproperly resolvea thin-shaped initial condition).
Exercise5.9:Computesolutionsas t !1
Manydiffusionproblems reach a stationary time-independent solution as t ! 1.
ThemodelproblemfromSect. 5.1.4 isoneexamplewhereu.x;t/D s.t/D const
for t !1.Whenudoesnotdependon time, thediffusionequation reduces to
ˇu00.x/Df.x/;
inonedimension, and
ˇr2uDf.x/;
in2Dand3D.This is the famousPoisson equation,or iff D 0, it is knownas the
Laplaceequation. In this limit t !1, there isnoneed foran initial condition,but
theboundaryconditionsare the sameas for thediffusionequation.
Wenowconsideraone-dimensionalproblem
u00.x/D0; x2 .0;L/; u.0/DC; u0.L/D0; (5.38)
which is known as a two-point boundary value problem. This is nothing but the
stationary limit of the diffusion problem in Sect. 5.1.4. How canwe solve such
a stationaryproblem(5.38)? The simplest strategy,whenwealreadyhavea solver
for the corresponding time-dependent problem, is to use that solver and simulate
until t !1,whichinpracticemeansthatu.x;t/nolongerchangesintime(within
some tolerance).
A nice feature of implicitmethods like theBackwardEuler scheme is that one
can takeonevery long time step to “infinity”andproduce the solutionof (5.38).
a) Let(5.38)bevalidatmeshpointsxi inspace,discretizeu00byafinitedifference,
andsetupasystemofequationsfor thepointvaluesui,i D0;:: :;N ,whereui
is theapproximationatmeshpointxi.
b) Showthat if t !1 in (5.16) - (5.18), it leads to thesameequationsas ina).
c) Demonstrate, by runningaprogram, that youcan takeone large time stepwith
theBackwardEuler schemeandcompute the solutionof (5.38). Thesolution is
veryboringsince it is constant:u.x/DC.
Filename:rod_stationary.py.
Remarks If the interest is in the stationary limit of a diffusion equation, one can
either solve theassociatedLaplaceorPoissonequationdirectly,oruseaBackward
Euler schemefor the time-dependentdiffusionequationwithavery long timestep.
Using a ForwardEuler schemewith small time steps is typically inappropriate in
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python
- Titel
- Programming for Computations – Python
- Untertitel
- A Gentle Introduction to Numerical Simulations with Python
- Autoren
- Svein Linge
- Hans Petter Langtangen
- Verlag
- Springer Open
- Datum
- 2016
- Sprache
- englisch
- Lizenz
- CC BY-NC 4.0
- ISBN
- 978-3-319-32428-9
- Abmessungen
- 17.8 x 25.4 cm
- Seiten
- 248
- Schlagwörter
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Kategorie
- Informatik