first real run, make a gif89a, need more tweaking
This commit is contained in:
@@ -6,7 +6,8 @@ module realfield
|
||||
implicit none
|
||||
|
||||
!-----------------------------------------------------------------------
|
||||
|
||||
! definition of structures
|
||||
!
|
||||
type massbody
|
||||
real :: posx, posy
|
||||
real :: mass = 1.0
|
||||
@@ -17,23 +18,20 @@ end type
|
||||
contains
|
||||
!-----------------------------------------------------------------------
|
||||
|
||||
function compute_gravity(ix, iy, body)
|
||||
|
||||
integer, intent(in) :: ix, iy
|
||||
function compute_gravity(fx, fy, body)
|
||||
real, intent(in) :: fx, fy
|
||||
type(massbody), intent(in) :: body
|
||||
real :: compute_gravity
|
||||
real :: rx, ry, dist
|
||||
|
||||
rx = real(ix) - body%posx
|
||||
ry = real(iy) - body%posy
|
||||
real :: rx, ry, dist
|
||||
|
||||
rx = fx - body%posx
|
||||
ry = fy - body%posy
|
||||
dist = sqrt( (rx*rx) + (ry*ry) )
|
||||
if (dist .LT. 0.15) then
|
||||
if (dist .LT. 4.50) then
|
||||
write (0, *) "dist too small ", dist
|
||||
compute_gravity = 0e0
|
||||
endif
|
||||
|
||||
compute_gravity = body%mass * (dist ** 2)
|
||||
compute_gravity = body%mass / (dist ** 2)
|
||||
|
||||
end function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user