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

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

Image of the Page - 261 -

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

Text of the Page - 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.
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