2 Dimensional Plots of Gravitational Potential
In these examples we are studying the universal law of gravitation.  These diagrams show the gravitational potential field due to a center point (in purple) on the surrounding 2 dimensional space.  A potential field represents the energy another particle would have if it were introduced into this space.  The potential energy of any point on the graph is represented by the color at that point.  The data used for these diagrams was produced by program mj2 which is written in Fortran 90.  These diagrams were generated by the program Transform. 
Equation Visualized: 
  • V(x,y) = -G*Mc/r 
"r" = sqrt[(x-xc)2+(y-yc)2] is the distance between the center and a test mass, "xc" and "yc" are the coordinates of the center, "x" and "y" are the coordinates of the test mass, "V" is the gravitational potential, "G" is the universal gravitational constant, "Mc" is the mass at the center 
This diagram shows the raw data.  The edges are rough because there are gaps between data points.  Data points would have to be infinitely close to each other to create a perfectly smooth graph.
This is an interpolated diagram (Transform uses bilinear interpolation).  The edges are smooth because Transform fills in the holes between the raw data by estimating the values of the holes.
program mj2 
      use utility 
      implicit none  
      integer :: i, j 
      integer, parameter :: yd=50, xd=50 
      real :: g=6.67E-11, m=10, rad=1, xi, yi, r  
      real :: dx=1, dy=5 
      character*30 :: prompt = 'enter xi and yi' 
      real, dimension(xd) :: x 
      real, dimension(yd) :: y 
      real, dimension(xd,yd) :: v 
      print *, prompt 
      read (*,*) xi, yi 
      do i=1,xd 
      end do 
      do j=1,yd 
      end do 
      call write_asf(x,y,7) 
      do i=1, xd 
          do j=1, yd 
              If (r<rad) r=rad 
          end do 
      write (7,*) v(i,:) 
      end do 
      end program mj2 

module utility 
! this module contains subroutines for writing header files 
      subroutine write_asf(col,row,unitnum) 
! this subroutine writes ASCII special file headers 
! col contains column values and row contains row values 
! unitnum contains fortran unit number for output 
      real, dimension(:) :: col,row 
      integer :: unitnum 
      write (unit=unitnum,fmt=*) size(col), size(row) 
      write (unit=unitnum,fmt=*) 0,0 
      write (unit=unitnum,fmt=*) row 
      write (unit=unitnum,fmt=*) col 
      end subroutine write_asf 
      end module utility 

Back To Main Page