Page - 298 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Image of the Page - 298 -
Text of the Page - 298 -
298 9 SolvingPartialDifferentialEquations
thecase with aΔt equal toΔx2/(2β), indeedshowsa smoothevolutionofu(x,t).
Find the programrod_FE.pyand run it to see an animationof theu(x,t) function
on the screen.
Scalinganddimensionless quantities
Our setting of parameters required finding three physical properties of a
certain material. The time interval for simulation and the time step depend
cruciallyon thevalues forβ andL, whichcanvarysignificantly fromcase to
case.Often,wearemore interested inhowtheshapeofu(x,t)develops, than
in the actualu, x, and t values for a specific material. We can then simplify
thesettingofphysicalparametersby scaling theproblem.
Scalingmeansthatweintroducedimensionlessindependentanddependent
variables,heredenotedbyabar:
u¯= u−u ∗
uc−u∗, x¯= x
xc , t¯= t
tc ,
where uc is a characteristic size of the temperature, u∗ is some reference
temperature, while xc and tc are characteristic time and space scales. Here,
it is natural to chooseu∗ as the initial condition, and setuc to the stationary
(end) temperature. Then u¯∈ [0,1], starting at 0 and ending at 1 as t →∞.
The lengthL isxc, while choosing tc is more challenging, but one can argue
for tc =L2/β. Theresultingequationfor u¯ reads
∂u¯
∂t¯ = ∂ 2u¯
∂x¯2 , x¯∈ (0,1).
Note that in this equation, there are no physical parameters! In other words,
we have found a model that is independent of the length of the rod and the
material it ismadeof (!).
We can easily solve this equation with our program by setting β = 1,
L= 1, I(x)= 0, and s(t)= 1. It turns out that the total simulation time (to
“infinity”)canbetakenas1.2.Whenwehavethesolution u¯(x¯, t¯), thesolution
withdimensionKelvin,reflectingthetruetemperatureinourmedium,isgiven
by
u(x,t)=u∗+(uc−u∗)u¯(x/L,tβ/L2).
Through this formula we can quickly generate the solutions for a rod made
of aluminum, wood, or rubber—it is just a matter of plugging in the rightβ
value.
The power of scaling is to reduce the number of physical parameters in
a problem, and in the present case, we found one single problem that is
independentof thematerial (β) and the geometry(L).
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