-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit, working function call
- Loading branch information
0 parents
commit 7968e3e
Showing
5 changed files
with
304 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.ipynb_checkpoints | ||
|
||
main | ||
|
||
*.o | ||
*.mod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Makefile for generic_rk project | ||
|
||
current_dir = $(shell pwd) | ||
SRC=$(current_dir)/src | ||
OBJ=$(current_dir)/obj | ||
BIN=$(current_dir)/bin | ||
|
||
# Compiler | ||
FF = gfortran | ||
FFLAGS = -Wall -std=f2008 -Wextra -fPIC -fmax-errors=1 -Wimplicit-interface | ||
# Debug flags: | ||
FFLAGS += -O0 -g -fcheck=all -fbacktrace #-ffpe-trap=zero,overflow,underflow | ||
# Release flags: | ||
# FFLAGS += -O3 -march=native -ffast-math -funroll-loops | ||
|
||
FLIBS = -lblas -llapack | ||
|
||
.DEFAULT_GOAL := $(BIN)/main | ||
|
||
# Dependencies of main program | ||
objects=$(OBJ)/misc.o | ||
|
||
# Modules | ||
$(OBJ)/misc.o: $(SRC)/misc.f90 | ||
$(FF) $(FFLAGS) -J$(OBJ) -c -o $@ $< | ||
|
||
# Main program | ||
$(OBJ)/main.o: $(SRC)/main.f90 $(objects) | ||
$(FF) $(FFLAGS) -I$(OBJ) -c -o $@ $< | ||
$(BIN)/main: $(OBJ)/main.o $(objects) | ||
$(FF) $(FFLAGS) -o $@ $+ $(FLIBS) | ||
|
||
clean: | ||
rm -f $(OBJ)/*.o $(OBJ)/*.mod $(BIN)/main | ||
|
||
run: $(BIN)/main | ||
$(BIN)/main |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
program main | ||
use iso_fortran_env, only: wp => real64 | ||
use misc, only: myfun | ||
implicit none | ||
|
||
integer :: ii | ||
real(wp) :: t, y, dy | ||
|
||
t = 0_wp | ||
y = 0_wp | ||
|
||
dy = myfun(t, y) | ||
|
||
print *, t, y, dy | ||
|
||
end program main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module misc | ||
use iso_fortran_env, only: wp => real64 | ||
implicit none | ||
|
||
contains | ||
|
||
elemental function myfun(t, y) result(dy) | ||
real(wp), intent(in) :: t, y | ||
real(wp) :: dy | ||
|
||
dy = cos(t) | ||
|
||
return | ||
end function myfun | ||
|
||
end module misc |