lecture3 - From Gehard Ertl’s Chemistry Nobel Prize...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: From Gehard Ertl’s Chemistry Nobel Prize Lecture (2007) In catalysis experiment, CO = hares, O2 = lynxes Code for Euler approach… Declarations ! Euler method (forward-centered) for Lotka-Volterra IMPLICIT NONE INTEGER, PARAMETER :: Prec14=SELECTED_REAL_KIND(14) REAL(Kind=Prec14), PARAMETER :: dt=0.01d0 ! timestep REAL(Kind=Prec14), PARAMETER :: time=200.0d0 ! total simulation time REAL(Kind=Prec14), PARAMETER :: x0=0.1d0 ! initial x value REAL(Kind=Prec14), PARAMETER :: y0=0.2d0 ! initial y value REAL(Kind=Prec14), PARAMETER :: alpha1=1.0d0,alpha2=1.0d0,beta1=1.0d0,be REAL(Kind=Prec14) :: x,xn ! current population x, next population xn REAL(Kind=Prec14) :: y,yn ! current population y, next population yn REAL(Kind=Prec14) :: t ! current time INTEGER :: nsteps,n Execution part… nsteps=anint(time/dt) ! number of integration steps, integer value x=x0 ; y=x0 ! set initial populations x,y t=0.0d0 do n=1,nsteps t=t+dt ! step forward time t ! Integrate step using Euler xn=x+(alpha1*x-alpha2*x*y)*dt ! step forward x population yn=y+(beta1*x*y-beta2*y)*dt ! step forward y population x=xn y=yn ! Output time and x,y populations write(6,100) t,x,y enddo 100 format(f8.4,3f12.6) ! Format statement, f for floats, gives total number of columns and those after decimal point stop end Unstable results! Growth with Euler method inherently unstable ! Red=hares, Green=lynxes Midpoint method (2nd order Runge-Kutta) ! Integrate step using 2nd order Runge-Kutta xp=x+0.5d0*(alpha1*x-alpha2*x*y)*dt ! step forward x population yp=y+0.5d0*(beta1*x*y-beta2*y)*dt ! step forward y population xn=x+(alpha1*xp-alpha2*xp*yp)*dt ! step forward x population yn=y+(beta1*xp*yp-beta2*yp)*dt ! step forward y population Results appear to be stable, populations not growing without bound Red=hares, Green=lynxes ...
View Full Document

This note was uploaded on 08/08/2011 for the course PHZ 5156 taught by Professor Johnson,m during the Fall '08 term at University of Central Florida.

Ask a homework question - tutors are online