forst try

This commit is contained in:
tTh 2022-11-24 00:52:13 +01:00
parent 8535ba09d9
commit 1cb5dc13bb
4 changed files with 77 additions and 0 deletions

2
GravityField/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
essai

8
GravityField/Makefile Normal file
View File

@ -0,0 +1,8 @@
#
# Fortraneries by tTh - Gravity Field
#
GFOPT = -Wall -Wextra -g -time
essai: essai.f90 Makefile
gfortran $(GFOPT) $< -o $@

5
GravityField/README.md Normal file
View File

@ -0,0 +1,5 @@
# Gravity Field
Some crude experiments to make fancy picture of a useless gravaity field.
Expect bug party.

62
GravityField/essai.f90 Normal file
View File

@ -0,0 +1,62 @@
program essai
implicit none
integer :: ix, iy
real :: fx, fy
real :: foo, bar, maxi, mini
maxi = 0.0
mini = 9e9
do ix=1, 2000
fx = real(ix)
do iy=1, 2000
fy = real(iy)
foo = rdist(fx, fy, 222.22, 765.432)
bar = gravity(foo, 1337.0)
maxi = max(maxi, bar)
mini = min(mini, bar)
enddo
enddo
print *, "dist : ", mini, maxi
contains !------------------------------------------
function gravity(distance, masse)
real, intent(in) :: distance, masse
real :: gravity
real :: computed
if (distance .LT. 0.010) then
computed = 0.0
else
computed = masse / (distance ** 2)
endif
gravity = computed
end function
!------------------------------------------
function rdist(ax, ay, bx, by)
real, intent(in) :: ax, ay, bx, by
real :: rdist
real :: rx, ry
rx = real(ax-bx)
ry = real(ay-by)
rdist = sqrt( (rx*rx) + (ry*ry) )
end function
!------------------------------------------
!------------------------------------------
end program