From 8e30cb8d4c1caffc2d877bec6975f1539fc193d3 Mon Sep 17 00:00:00 2001 From: Thomas Albers Raviola Date: Sun, 21 Apr 2024 21:51:54 +0200 Subject: * Initial commit --- .gitignore | 3 +++ Makefile | 29 +++++++++++++++++++++++++++++ README.md | 0 src/common.f90 | 5 +++++ src/integral.f90 | 22 ++++++++++++++++++++++ src/main.f90 | 7 +++++++ src/simulation.f90 | 4 ++++ 7 files changed, 70 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 README.md create mode 100644 src/common.f90 create mode 100644 src/integral.f90 create mode 100644 src/main.f90 create mode 100644 src/simulation.f90 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2d9b02 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/* +nbody +plan.org diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bfeae34 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +NAME = nbody +TARGET = $(NAME) + +FC = gfortran + +SRC = common.f90\ + simulation.f90\ + integral.f90\ + main.f90 + +OBJ = $(SRC:%.f90=build/%.o) +MOD = $(SRC:%.f90=build/%.mod) + +FFLAGS = -std=f2018 +LDFLAGS = + +MOD_DIR = build + +all : $(TARGET) + +$(TARGET) : $(OBJ) + $(FC) $(LDFLAGS) -J$(MOD_DIR) $(OBJ) -o $@ + +build/%.o : src/%.f90 + $(FC) $(FFLAGS) -J$(MOD_DIR) -c $< -o $@ + +.PHONY : clean +clean : + rm -rf build/* $(TARGET) diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/src/common.f90 b/src/common.f90 new file mode 100644 index 0000000..9bffb5f --- /dev/null +++ b/src/common.f90 @@ -0,0 +1,5 @@ +module common + use, intrinsic :: iso_fortran_env, only : real64, stdout => output_unit + public + integer, parameter :: dp = 8 +end module common diff --git a/src/integral.f90 b/src/integral.f90 new file mode 100644 index 0000000..859d880 --- /dev/null +++ b/src/integral.f90 @@ -0,0 +1,22 @@ +module integral + use common, only : dp + implicit none + + public + + interface + real(dp) pure function ivp_func(t, y) + import :: dp + real(dp), intent(in) :: t, y + end function ivp_func + ! module procedure :: rk4 + end interface +contains + real(dp) function rk4 (x) result(y) + real(dp), intent(in) :: x + y = x + end function rk4 + + ! pure function rk4() + ! end function rk4 +end module integral diff --git a/src/main.f90 b/src/main.f90 new file mode 100644 index 0000000..4610008 --- /dev/null +++ b/src/main.f90 @@ -0,0 +1,7 @@ +program nbody + use common + use simulation + implicit none + + write (stdout, '(a)') 'Hello World!' +end program nbody diff --git a/src/simulation.f90 b/src/simulation.f90 new file mode 100644 index 0000000..bb5c408 --- /dev/null +++ b/src/simulation.f90 @@ -0,0 +1,4 @@ +module simulation + implicit none + +end module simulation -- cgit v1.2.3