diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..876874d --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ + +FC = gfortran +FLAGS = -O3 # -fbounds-check +TARGET = test + +SOURCES = $(wildcard *.f90) +OBJS = $(SOURCES:.f90=.o) + +%.o: %.f90 + $(FC) $(FLAGS) -c $< + +all: $(OBJS) + $(FC) -o $(TARGET) $(OBJS) $(LIBS) + +clean: + rm *.o *.mod $(TARGET) + +include make.dep diff --git a/README.md b/README.md new file mode 100644 index 0000000..98bcc99 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# ode diff --git a/caotic_pendulum.f90 b/caotic_pendulum.f90 new file mode 100644 index 0000000..61d72a5 --- /dev/null +++ b/caotic_pendulum.f90 @@ -0,0 +1,69 @@ +module caotic_pendulum + use precision + use functions + use solvers + implicit none + + real(dp), parameter :: pi = 3.14159265358979323846264338327_dp + real(dp), parameter :: eps = 1.d-10 + +contains + + subroutine solve(Nstep, Nperiods, x0, v0) + integer, intent(in) :: Nstep, Nperiods + real(dp), intent(in) :: x0, v0 + + real(dp) :: t, tfin, ttrans, dt, err + real(dp), allocatable :: u(:), u0(:), uex(:) + integer :: Ntot, Ntrans, id, id2 + integer :: i + + dt = 2.0_dp*pi/(w*real(Nstep, dp)) + + Ntot = Nstep*Nperiods + tfin = Ntot*dt + Ntrans = int(Nperiods*0.0) + ttrans = Nstep*Ntrans*dt + + write(*,*) 'dt=',dt + + allocate(u0(2)) + allocate(uex(2)) + u0 = (/x0, v0/) + u = u0 + t = 0.0_dp + + do while (t