1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Computational Physics - M. Jensen Episode 2 Part 6 pptx

20 391 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 20
Dung lượng 340,74 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

However, before leaving this topic entirely, we’ll dwelve into the problems of the pendulum, from almost harmonic oscillations to chaotic motion!. In order to maintain the motion against

Trang 1

L

C R

Figure 14.3: Simple RLC circuit with a voltage sourceV

Most oscillatory motion in nature does decrease until the displacement becomes zero We call such a motion for damped and the system is said to be dissipative rather than conservative Con-sidering again the simple block sliding on a plane, we could try to implement such a dissipative behavior through a drag force which is proportional to the first derivative ofx, i.e., the velocity

We can then expand Eq (14.50) to

d 2

x

dt 2

2

0

dx

dt

where is the damping coefficient, being a measure of the magnitude of the drag term

We could however counteract the dissipative mechanism by applying e.g., a periodic external force

and we rewrite Eq (14.58) as

d 2

x

dt 2

2

0

dx

dt

Although we have specialized to a block sliding on a surface, the above equations are rather general for quite many physical systems

If we replacexby the chargeQ, with the resistanceR, the velocity with the currentI, the inductanceLwith the massm, the spring constant with the inverse capacitanceCand the force

F with the voltage dropV, we rewrite Eq (14.60) as

L d 2

Q

dt 2 + Q

C + R dQ

dt

The circuit is shown in Fig 14.3

How did we get there? We have defined an electric circuit which consists of a resistance with voltage drop , a capacitor with voltage drop and an inductor with voltage

Trang 2

mg mass m length l

pivot

θ

Figure 14.4: A simple pendulum

dropLdI=dt The circuit is powered by an alternating voltage source and using Kirchhoff’s law, which is a consequence of energy conservation, we have

and using

I = dQ

dt

we arrive at Eq (14.61)

This section was meant to give you a feeling of the wide range of applicability of the methods

we have discussed However, before leaving this topic entirely, we’ll dwelve into the problems

of the pendulum, from almost harmonic oscillations to chaotic motion!

Consider a pendulum with massm at the end of a rigid rod of length l attached to say a fixed frictionless pivot which allows the pendulum to move freely under gravity in the vertical plane

as illustrated in Fig 14.4

The angular equation of motion of the pendulum is again given by Newton’s equation, but now as a nonlinear differential equation

ml d 2



Trang 3

with an angular velocity and acceleration given by

v = l d

dt

and

a = l d 2



dt 2

For small angles, we can use the approximation

sin()  :

and rewrite the above differential equation as

d 2



dt 2

= g

l

which is exactly of the same form as Eq (14.50) We can thus check our solutions for small values ofagainst an analytical solution The period is now

T = 2

p

l=g

We do however expect that the motion will gradually come to an end due a viscous drag torque acting on the pendulum In the presence of the drag, the above equation becomes

ml d 2



dt 2 +  d

dt

where is now a positive constant parameterizing the viscosity of the medium in question In order to maintain the motion against viscosity, it is necessary to add some external driving force

We choose here, in analogy with the discussion about the electric circuit, a periodic driving force The last equation becomes then

ml d 2



dt 2 +  d

dt

withAand !two constants representing the amplitude and the angular frequency respectively The latter is called the driving frequency

If we now define

!

0

= p

the so-called natural frequency and the new dimensionless quantities

^

t = !

0

^

! =

!

Trang 4

and introducing the quantityQ, called the quality factor,

Q = mg

!

0



and the dimensionless amplitude

^

A = A

mg

(14.75)

we can rewrite Eq (14.70) as

d 2



dt + 1

Q d

dt + sin() =

^

^

!

^

This equation can in turn be recast in terms of two coupled first-order differential equations

as follows

d

dt

and

d^ v

dt

=

^ v

Q sin() +

^

^

!

^

These are the equations to be solved The factorQ represents the number of oscillations of the undriven system that must occur before its energy is significantly reduced due to the viscous drag The amplitude ^

Ais measured in units of the maximum possible gravitational torque while

^

! is the angular frequency of the external torque measured in units of the pendulum’s natural frequency

Another simple example is that of e.g., a compass needle that is free to rotate in a periodically reversing magnetic field perpendicular to the axis of the needle The equation is then

d 2



dt 2

=



I B

0

where is the angle of the needle with respect to a fixed axis along the field,is the magnetic moment of the needle,Iits moment of inertia andB

0and!the amplitude and angular frequency

of the magnetic field respectively

14.7 Physics Project: the pendulum

Although the solution to the equations for the pendulum can only be obtained through numerical efforts, it is always useful to check our numerical code against analytic solutions For small angles, we havesin   and our equations become

d

Trang 5

d^ v

dt

=

^ v

Q

 +

^

^

!

^

These equations are linear in the angleand are similar to those of the sliding block or the RLC circuit With given initial conditions^ v

0 and

0 they can be solved analytically to yield

h



0

^

A(1 ! ^ 2

(1 ! ^

2 2

+^ ! 2

=Q 2 i

e

=2Q

q

1 1

4Q 2

+

h

^

v

0 +



0

2Q

^

A(1 3!

2

)=2Q

(1 ! ^

2 2

+^ ! 2

=Q 2 i

e

=2Q

sin(

q

1 1

4Q 2

 ) +

^

A(1 ! ^ 2

^

!)+

^

!

Q sin(^ !)

(1 ! ^

2 2

+^ ! 2

=Q 2

;

and

^

h

^ v

0

^

A^ ! 2

=Q

(1 ! ^

2 2

+^ ! 2

=Q 2 i

e

=2Q

q

1 1

4Q 2

h



0

+

^0

2Q

^

A[(1 ! ^ 2

^

! 2

=Q 2

(1 ! ^

2 2

+^ ! 2

=Q 2 i

e

=2Q

sin(

q

1 1

4Q 2

) +

^

!

^

A[ (1 ! ^

2

)sin(^ !)+

^

!

Q

^

!)℄

(1 ! ^

2 2

+^ ! 2

=Q 2

;

withQ > 1=2 The first two terms depend on the initial conditions and decay exponentially in time If we wait long enough for these terms to vanish, the solutions become independent of the initial conditions and the motion of the pendulum settles down to the following simple orbit in phase space

(t) =

^

A(1 ! ^

2

^

!) +

^

!

Q sin( !) ^

(1 ! ^ 2

) 2

+ ! ^ 2

=Q 2

and

^ v(t) =

^

!

^

A[ (1 ! ^

2

)sin( ! ^ ) +

^

!

Q

^

!)℄

(1 ! ^ 2

) 2

+ ! ^ 2

=Q 2

tracing the closed phase-space curve





~

A



2

+



^ v

^

!

~

A



2

with

~

A =

^

A

p

(1 ! ^ 2

) 2

+ ! ^ 2

=Q 2

This curve forms an ellipse whose principal axes areandv ^ This curve is closed, as we will see from the examples below, implying that the motion is periodic in time, the solution repeats itself exactly after each periodT = 2=^ ! Before we discuss results for various frequencies, quality factors and amplitudes, it is instructive to compare different numerical methods In Fig 14.5 we show the angleas function of timefor the case withQ = 2,! ^ = 2=3and ^

A = 0:5 The length

is set equal to1m and mass of the pendulum is set equal to 1kg The inital velocity isv ^

0

= 0

and

0

= 0:01 Four different methods have been used to solve the equations, Euler’s method from Eq (14.17), Euler-Richardson’s method in Eqs (14.32)-(14.33) and finally the fourth-order Runge-Kutta scheme RK4 We note that after few time steps, we obtain the classical harmonic

Trang 6

motion We would have obtained a similar picture if we were to switch off the external force,

^

A = 0 and set the frictional damping to zero, i.e., Q = 0 Then, the qualitative picture is that

of an idealized harmonic oscillation without damping However, we see that Euler’s method performs poorly and after a few steps its algorithmic simplicity leads to results which deviate considerably from the other methods In the discussion hereafter we will thus limit ourselves to

-3 -2 -1 0 1 2 3



t=2

RK4

Euler

Halfstep

hardson

Figure 14.5: Plot of as function of time withQ = 2, ! ^ = 2=3and ^

A = 0:5 The mass and length of the pendulum are set equal to1 The initial velocity isv ^

0

= 0and 

0

= 0:01 Four different methods have been used to solve the equations, Euler’s method from Eq (14.17), the half-step method, Euler-Richardson’s method in Eqs (14.32)-(14.33) and finally the fourth-order Runge-Kutta scheme RK4 OnlyN = 100 integration points have been used for a time interval

t 2 [0; 10℄

present results obtained with the fourth-order Runge-Kutta method

The corresponding phase space plot is shown in Fig 14.6, for the same parameters as in

Fig ?? We observe here that the plot moves towards an ellipse with periodic motion This

stable phase-space curve is called a periodic attractor It is called attractor because, irrespective

of the initial conditions, the trajectory in phase-space tends asymptotically to such a curve in the limit ! 1 It is called periodic, since it exhibits periodic motion in time, as seen from Fig ??.

In addition, we should note that this periodic motion shows what we call resonant behavior since the the driving frequency of the force approaches the natural frequency of oscillation of the pendulum This is essentially due to the fact that we are studying a linear system, yielding the well-known periodic motion The non-linear system exhibits a much richer set of solutions and these can only be studied numerically

In order to go beyond the well-known linear approximation we change the initial conditions

to say but keep the other parameters equal to the previous case The curve for is

Trang 7

-0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8

v



Figure 14.6: Phase-space curve of a linear damped pendulum withQ = 2,! ^ = 2=3and ^

A = 0:5 The inital velocity isv ^

0

= 0and

0

= 0:01

shown in Fig 14.7 This curve demonstrates that with the above given sets of parameters, after a certain number of periods, the phase-space curve stabilizes to the same curve as in the previous case, irrespective of initial conditions However, it takes more time for the pendulum to establish

a periodic motion and when a stable orbit in phase-space is reached the pendulum moves in accordance with the driving frequency of the force The qualitative picture is much the same as previously The phase-space curve displays again a final periodic attractor

If we now change the strength of the amplitude to ^

A = 1:35we see in Fig ?? thatas func-tion of time exhibits a rather different behavior from Fig 14.6, even though the initial contidifunc-tions and all other parameters except ^

Aare the same

If we then plot only the phase-space curve for the final orbit, we obtain the following figure

We will explore these topics in more detail in Section 14.8 where we extende our discussion to the phenomena of period doubling and its link to chaotic motion

The program used to obtain the results discussed above is presented here The program solves the pendulum equations for any angle  with an external force t) It employes several methods for solving the two coupled differential equations, from Euler’s method to adaptive size methods coupled with fourth-order Runge-Kutta It is straightforward to apply this program to other systems which exhibit harmonic oscillations or change the functional form of the external force

# i n c l u d e < s t d i o h>

Trang 8

-0.6 -0.4 -0.2 0 0.2 0.4 0.6

v



Figure 14.7: Plot ofas function of time withQ = 2,! ^ = 2=3and ^

A = 0:5 The mass of the pendulum is set equal to1kg and its length to 1 m The inital velocity is^ v

0

= 0and

0

= 0:3

-8 -6 -4 -2 0 2 4 6 8



t=2

Figure 14.8: Phase-space curve withQ = 2,! ^ = 2=3and ^

A = 1:35 The mass of the pendulum

is set equal to1kg and its lengthl = 1m The inital velocity is^ v

0

= 0and

0

= 0:3

Trang 9

-8 -6 -4 -2 0 2 4 6 8

v



Figure 14.9: Phase-space curve for the attractor withQ = 2,! ^ = 2=3and ^

A = 1:35 The inital velocity isv ^

0

= 0and

0

= 0:3

# i n c l u d e < i o s t r e a m h >

# i n c l u d e < math h>

# i n c l u d e < f s t r e a m h>

/

D i f f e r e n t m e t h o d s f o r s o l v i n g ODEs a r e p r e s e n t e d

We a r e s o l v i n g t h e f o l l o w i n g e q a t i o n :

ml( p h i ) ’ ’ + v i s c o s i t y( p h i ) ’ + mgs i n ( p h i ) = Ac o s ( omegat )

I f you w ant t o s o l v e s i m i l a r e q u a t i o n s w i t h o t h e r v a l u e s you h a v e t o

r e w r i t e t h e m e t h o d s ’ d e r i v a t i v e s ’ and ’ i n i t i a l i s e ’ and c h a n g e t h e

v a r i a b l e s i n t h e p r i v a t e

p a r t o f t h e c l a s s P endulum

A t f i r s t we r e w r i t e t h e e q u a t i o n u s i n g t h e f o l l o w i n g d e f i n i t i o n s :

omega_0 = s q r t ( gl )

t _ r o o f = omega_0t

o m e g a _ r o o f = omega / omega_0

Q = ( mg ) / ( omega_0r e i b )

A _ r o o f = A / ( mg )

and we g e t a d i m e n s i o n l e s s e q u a t i o n

Trang 10

( p h i ) ’ ’ + 1 / Q( p h i ) ’ + s i n ( p h i ) = A _ r o o fc o s ( o m e g a _ r o o ft _ r o o f )

T h i s e q u a t i o n can be w r i t t e n a s tw o e q u a t i o n s o f f i r s t o r d e r :

( p h i ) ’ = v

( v ) ’ = v /Q s i n ( p h i ) + A _ r o o fc o s ( o m e g a _ r o o ft _ r o o f )

A l l n u m e r i c a l m e t h o d s a r e a p p l i e d t o t h e l a s t tw o e q u a t i o n s

The a l g o r i t h m s a r e t a k e n f r o m t h e book " An i n t r o d u c t i o n t o c o m p u t e r

s i m u l a t i o n m e t h o d s "

/

c l a s s p e n d e l u m

{

p r i v a t e:

d o u b l e Q , A _roof , omega_0 , o m e g a _ r o o f , g ; / /

d o u b l e y [ 2 ] ; / / f o r t h e i n i t i a l v a l u e s o f p h i and v

i n t n ; / / how many s t e p s

d o u b l e d e l t a _ t , d e l t a _ t _ r o o f ;

p u b l i c:

v o i d d e r i v a t i v e s (d ou b le,d o u b l e,d o u b l e) ;

v o i d i n i t i a l i s e ( ) ;

v o i d e u l e r ( ) ;

v o i d e u l e r _ c r o m e r ( ) ;

v o i d m i d p o i n t ( ) ;

v o i d e u l e r _ r i c h a r d s o n ( ) ;

v o i d h a l f _ s t e p ( ) ;

v o i d r k 2 ( ) ; / / r u n g e k u t t a s e c o n d o r d e r

v o i d r k 4 _ s t e p (d ou b le ,d o u b l e,d o u b l e,d o u b l e) ; / / we n e e d i t i n

f u n c t i o n r k 4 ( ) and a s c ( )

v o i d r k 4 ( ) ; / / r u n g e k u t t a f o u r t h o r d e r

v o i d a s c ( ) ; / / r u n g e k u t t a f o u r t h o r d e r w i t h a d a p t i v e s t e p s i z e

c o n t r o l

} ;

v o i d p e n d e l u m : : d e r i v a t i v e s (d o u b l e t , d o u b l e i n , d o u b l e o u t )

{ / Here we a r e c a l c u l a t i n g t h e d e r i v a t i v e s a t ( d i m e n s i o n l e s s ) t i m e t

’ i n ’ a r e t h e v a l u e s o f p h i and v , w h i c h a r e u s e d f o r t h e

c a l c u l a t i o n

The r e s u l t s a r e g i v e n t o ’ o u t ’ /

o u t [ 0 ] = i n [ 1 ] ; / / o u t [ 0 ] = ( p h i ) ’ = v

i f(Q)

o u t [1]= i n [ 1 ] / ( (d o u b l e)Q) s i n ( i n [ 0 ] ) + A _ r o o fc o s ( o m e g a _ r o o ft ) ; / /

Trang 11

o u t [ 1 ] = ( p h i ) ’ ’

e l s e

o u t [1]= s i n ( i n [ 0 ] ) + A _ r o o fc o s ( o m e g a _ r o o ft ) ; / / o u t [ 1 ] = ( p h i ) ’ ’

}

v o i d p e n d e l u m : : i n i t i a l i s e ( )

{

d o u b l e m, l , omega , A , v i s c o s i t y , p h i _ 0 , v_0 , t _ e n d ;

c o u t <<" S l v i g t e d i f f r e t i a e q t i o o f t e p e n u l u ! \ n ";

c o u t <<" W e h a e a p n d u u m w t h m a s m , l n t l T e w h a e a

p r i o i f r e w t a m p i t d e A a d o m g \ n ;

c o u t <<" F r t h r m r e t h r e i a v i s o u s d a o e f i i e n n ";

c o u t <<" T h e i n t i l o n d t i n s a t t = 0 a e p h _ a n v _ 0 n ";

c o u t <<" M a s m : ";

c i n >>m;

c o u t <<" l e n t l : ";

c i n >> l ;

c o u t <<" o m e a o t e f o e : ";

c i n >>omega ;

c o u t <<" a p l i u d o f t h f o r e : ";

c i n >>A ;

c o u t <<" T h e v l e o f t h v i s o u s d r g o n t a t ( v i s o s i y ) : ";

c i n >> v i s c o s i t y ;

c o u t <<" p h i 0 : ";

c i n >>y [ 0 ] ;

c o u t <<" v _ 0 : ";

c i n >>y [ 1 ] ;

c o u t <<" N u m e o t m s e s o r i n t g r a i o s e p : ;

c i n >>n ;

c o u t <<" F i n l t i e s t e s a m u t i p u m o p i : ;

c i n >> t _ e n d ;

t _ e n d = a c o s ( 1 ) ;

g = 9 8 1 ;

/ / We n e e d t h e f o l l o w i n g v a l u e s :

omega_0 = s q r t ( g / ( (d o u b l e) l ) ) ; / / omega o f t h e p e n d u l u m

i f ( v i s c o s i t y ) Q= mg / ( (d o u b l e) omega_0v i s c o s i t y ) ;

e l s e Q = 0 ; / / c a l c u l a t i n g Q

A _ r o o f =A / ( (d o u b l e)mg ) ;

o m e g a _ r o o f =omega / ( ( d o u b l e) omega_0 ) ;

d e l t a _ t _ r o o f =omega_0t _ e n d / ( (d o u b l e) n ) ; / / d e l t a _ t w i t h o u t

d i m e n s i o n

d e l t a _ t = t _ e n d / ( (d o u b l e) n ) ;

}

Ngày đăng: 07/08/2014, 12:22

TỪ KHÓA LIÊN QUAN