FORTRAN 90 How to plot the Poincaré section?

In summary, the conversation discussed writing a Fortran 90 program to simulate the Duffing oscillator, setting the driving force to a small value, observing the unstable equilibrium, and adjusting parameters to observe a limit cycle. It also mentioned plotting a Poincaré section of the solution in the state space at certain time intervals. The Poincaré section is a cross section of the solution in the state space, and the crossings are not equally spaced in time when the oscillations are displaying interesting behaviors.
  • #1
youngfreedman
Hi all,

I'm writing a fortran 90 program to simulate the Duffing oscillator. I have it working and have produced a cos wave which I expected for D (the driving force) being set to 0. Here's the code:

  1. program rungekutta
  2. implicit none
  3. integer, parameter :: dp = selected_real_kind(15,300)
  4. integer :: i, n
  5. real(kind=dp) z, y, t, A, C, D, B, omega, h
  6. open(unit=100, file="rungekutta.dat",status='replace')
  7. n = 0
  8. !constants
  9. omega = 1.0_dp
  10. A = 0.0_dp
  11. B = -1.0_dp
  12. C = 0.0_dp
  13. D = 0.0_dp
  14. y = 1.0_dp
  15. z = 0.0_dp
  16. t = 0.0_dp
  17. do i=1,999
  18. call rk2(z, y, t, n)
  19. n = n + 1.0_dp
  20. write(100,*) z, y
  21. end do

  22. contains
  23. subroutine rk2(z, y, t, n) !subroutine to implement runge-kutta algorithm
  24. implicit none
  25. integer, parameter :: dp = selected_real_kind(15,300)
  26. integer, intent(inout) :: n
  27. real(kind=dp) :: k1y, k1z, k2y, k2z, y, z, t
  28. h = 0.1_dp
  29. t = n*h
  30. k1y = dydt(y,z,t)*h
  31. k1z = dzdt(y,z,t)*h
  32. k2z = dzdt(y + (0.5_dp*k1y), z + (0.5_dp*k1z), t + (0.5_dp*h))*h
  33. k2y = dydt(y, z +(0.5_dp*k1z), t)*h
  34. y = y + k2y
  35. z = z + k2z
  36. end subroutine

  37. !2nd order ODE split into 2 for coupled Runge-Kutta, useful to define 2 functions
  38. function dzdt(y,z,t)
  39. real(kind=dp) :: y, z, t, dzdt
  40. dzdt = -A*y**3.0_dp + B*y - C*z + D*sin(omega*t)
  41. end function

  42. function dydt(y,z,t)
  43. real(kind=dp) :: z, dydt, y, t
  44. dydt = z
  45. end function
  46. end program
So next I need to set the value for the driving force D to a small value and set it at the unstable equilibrium. What does that mean? How do I set it at the "unstable equilibrium"? Is that just y=0?

My second question is about the limit cycle. What does this look like? What should I expect? The question says to adjust the parameters until I observe one, but I don't know what one looks like. I've tried googling it but can't find anything useful.

Finally, and most importantly (as it asks me to do this often), it asks me to plot the Poincaré section. To do this, I have to take snap shots of the phase-space diagram at certain time intervals such that t*omega = 2*n*pi, n = 0,1,2,3... How do I do this, and what should it look like?
 
Physics news on Phys.org
  • #2
youngfreedman said:
Finally, and most importantly (as it asks me to do this often), it asks me to plot the Poincaré section. To do this, I have to take snap shots of the phase-space diagram at certain time intervals such that t*omega = 2*n*pi, n = 0,1,2,3... How do I do this, and what should it look like?

A Poincaré section of a solution to a differential equation is a cross section of the solution in the state space. The times that a solution crosses the subspace chosen for the Poincaré section are not equally spaced in general.

The Poincaré sections I've seen for the Duffing equation are of the dependent variable and its first derivative when the second derivative crosses a certain value, often zero. These crossings probably won't be exactly equally spaced in time when the oscillations are displaying interesting behaviors.
 

What is FORTRAN 90?

FORTRAN 90 is a programming language commonly used in scientific and engineering fields. It is an extension of the original FORTRAN language and was released in 1991. It is a high-level language that is designed to be efficient for numerical computations and has a strong focus on array processing.

What is a Poincaré section?

A Poincaré section is a type of graphical representation used in dynamical systems to study the behavior of a system at a fixed point in time. It is created by plotting the points of intersection of a higher dimensional system with a lower dimensional surface, such as a plane.

How do I plot a Poincaré section in FORTRAN 90?

To plot a Poincaré section in FORTRAN 90, you will need to use a combination of programming techniques, such as loops and conditional statements, along with a plotting library, such as Gnuplot or Matplotlib. It is important to have a good understanding of the underlying mathematical concepts and equations related to the dynamical system you are studying.

What are the benefits of using FORTRAN 90 for plotting Poincaré sections?

FORTRAN 90 is a powerful and efficient language that is specifically designed for scientific and numerical computations. It has built-in features for handling arrays and complex mathematical operations, making it well-suited for plotting Poincaré sections. Additionally, FORTRAN 90 has a long-standing history in scientific computing and has a large community of users and resources available for support.

Are there any limitations to using FORTRAN 90 for plotting Poincaré sections?

While FORTRAN 90 is a powerful language, it may not be the best choice for all types of programming tasks. It may have a steeper learning curve for those unfamiliar with the language, and it may not have the same level of graphics capabilities as other languages specifically designed for data visualization. However, with the right skills and knowledge, FORTRAN 90 can still be a powerful tool for plotting Poincaré sections.

Similar threads

  • Advanced Physics Homework Help
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
950
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
11
Views
14K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Programming and Computer Science
Replies
6
Views
2K
  • Calculus and Beyond Homework Help
Replies
9
Views
2K
Back
Top