Seite - 261 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Bild der Seite - 261 -
Text der Seite - 261 -
8.4 Oscillating1DSystems:ASecondOrderODE 261
U_0 = 1
V_0 = 0
T = 12*np.pi
dt = T/5000.
u, v, t = EulerCromer(f=f, s=s, F=F, m=m, T=T,
U_0=U_0, V_0=V_0, dt=dt)
plot_u(u, t)
Theplot_u function is a collection of plot commands for plottingu(t), or a part
of it. Figure 8.30 shows the effect of the bu′ term: we have oscillations with (an
approximate)period2π, as expected,but the amplitude is efficientlydamped.
Remarkaboutworkingwitha scaledproblem
Instead of setting b = 0.3 and m = k = U0 = 1 as fairly “unlikely”
physicalvalues, it wouldbebetter to scale the equationmu′′+bu′+ku=0.
This means that we introduce dimensionless independent and dependent
variables:
t¯= t
tc , u¯= u
uc ,
where tc anduc arecharacteristicsizesoftimeanddisplacement,respectively,
such that t¯ and u¯ have their typical size around unity (which minimizes
rounding errors). In the present problem, we can choose uc = U0 and
tc =√m/k. This gives the following scaled (or dimensionless) problem for
thedimensionlessquantity u¯(t¯):
d2u¯
dt¯2 +βdu¯
dt¯ + u¯=0, u¯(0)=1, u¯′(0)=0, β= b√
mk .
The striking fact is that there is only one physical parameter in this
problem: the dimensionless number β. Solving this problem corre-
sponds to solving the original problem (with dimensions) with the
parameters m = k = U0 = 1 and b = β. However, solving
the dimensionless problem is more general: if we have a solution
u¯(t¯;β), we can find the physical solution of a range of problems
since
u(t)=U0u¯(t √ k/m;β).
As long as β is fixed, we can find u for any U0, k, and m from
the above formula! In this way, a time consuming simulation can
be done only once, but still provide many solutions. This demon-
strates the power of working with scaled or dimensionless prob-
lems.
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