Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'IO'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Sep 10, 2021
2 parents 89aede5 + 5220791 commit ac782a6
Show file tree
Hide file tree
Showing 107 changed files with 27,004 additions and 14,786 deletions.
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
#******************************************************************************

SWIFTEST_MODULES = swiftest_globals.f90 \
swiftest_operators.f90 \
lambda_function.f90\
walltime_classes.f90 \
swiftest_classes.f90 \
swiftest_operators.f90 \
fraggle_classes.f90 \
whm_classes.f90 \
rmvs_classes.f90 \
helio_classes.f90 \
Expand All @@ -57,13 +59,13 @@ SWIFTEST_MODULES = swiftest_globals.f90 \

include Makefile.Defines

MODULES = $(SWIFTEST_MODULES) $(USER_MODULES)
MODULES = $(SWIFTEST_MODULES) $(USER_MODULES)

.PHONY : all mod lib libdir drivers bin clean force

% : %.f90 force
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include $< -o $@ \
-L$(SWIFTEST_HOME)/lib -lswiftest
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $< -o $@ \
-L$(SWIFTEST_HOME)/lib -lswiftest -L$(NETCDF_FORTRAN_HOME)/lib -lnetcdf -lnetcdff
$(INSTALL_PROGRAM) $@ $(SWIFTEST_HOME)/bin
rm -f $@

Expand All @@ -75,7 +77,7 @@ all:

mod:
cd $(SWIFTEST_HOME)/src/modules/; \
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -c $(MODULES); \
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include -c $(MODULES); \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o; \
$(INSTALL_DATA) *.mod *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.mod *.smod
Expand All @@ -91,7 +93,7 @@ lib:
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make libdir
cd $(SWIFTEST_HOME)/src/fragmentation; \
cd $(SWIFTEST_HOME)/src/fraggle; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
Expand All @@ -111,6 +113,11 @@ lib:
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make libdir
cd $(SWIFTEST_HOME)/src/netcdf; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make libdir
cd $(SWIFTEST_HOME)/src/obl; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
Expand Down Expand Up @@ -168,7 +175,7 @@ lib:
make libdir

libdir:
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -c *.f90; \
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include -c *.f90; \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \
$(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.smod
Expand All @@ -188,12 +195,13 @@ clean:
cd $(SWIFTEST_HOME)/src/modules; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/discard; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/drift; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/fragmentation; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/fraggle; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/gr; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/helio; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/io; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/kick; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/main; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/netcdf; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/obl; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/operators; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/orbel; rm -f Makefile.Defines Makefile *.gc*
Expand Down
8 changes: 4 additions & 4 deletions Makefile.Defines
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ ADVIXE_FLAGS = -g -O2 -qopt-report=5 -vec -vecabi=cmdtarget -simd -shared-intel
VTUNE_FLAGS = -g -O2 -vec -simd -shared-intel -qopenmp -debug inline-debug-info -parallel-source-info=2 -parallel -DTBB_DEBUG -DTBB_USE_THREADING_TOOLS -qopenmp -fp-model no-except -mp1 -xhost -traceback
#Be sure to set the environment variable KMP_FORKJOIN_FRAMES=1 for OpenMP debuging in vtune

IDEBUG = -O0 -nogen-interfaces -no-pie -no-ftz -fpe-all=0 -g -traceback -mp1 -fp-model strict -fpe0 -debug all -align all -pad -ip -prec-div -prec-sqrt -assume protect-parens -CB -no-wrap-margin -init=snan,arrays
IDEBUG = -O0 -init=snan,arrays -nogen-interfaces -no-pie -no-ftz -fpe-all=0 -g -traceback -mp1 -fp-model strict -fpe0 -debug all -align all -pad -ip -prec-div -prec-sqrt -assume protect-parens -CB -no-wrap-margin
STRICTREAL = -fp-model strict -fp-model no-except -prec-div -prec-sqrt -assume protect-parens
SIMDVEC = -simd -xhost -align all -assume contiguous_assumed_shape -vecabi=cmdtarget -prec-div -prec-sqrt -assume protect-parens
PAR = -qopenmp #-parallel #Something goes wrong in SyMBA at the moment with auto-paralellization enabled
HEAPARR = -heap-arrays 1048576
OPTREPORT = -qopt-report=5
IPRODUCTION = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(PAR) $(SIMDVEC) $(HEAPARR)
IPRODUCTION = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(PAR) $(SIMDVEC) $(HEAPARR)

#gfortran flags
GDEBUG = -g -Og -fbacktrace -fbounds-check -ffree-line-length-none
GPAR = -fopenmp #-ftree-parallelize-loops=4
GMEM = -fsanitize=undefined -fsanitize=address -fsanitize=leak
GMEM = -fsanitize-address-use-after-scope -fstack-check -fsanitize=bounds-strict -fsanitize=undefined -fsanitize=signed-integer-overflow -fsanitize=object-size -fstack-protector-all
GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries
GPRODUCTION = -O3 -ffree-line-length-none $(GPAR)

Expand All @@ -73,7 +73,7 @@ FORTRAN = ifort

#FORTRAN = gfortran
#FFLAGS = $(GDEBUG) $(GMEM) $(GPAR)
#FFLAGS = $(GPRODUCTION)
#FFLAGS = $(GPRODUCTION) -g -fbacktrace #-fcheck=all #-Wall
AR = ar

# DO NOT include in CFLAGS the "-c" option to compile object only
Expand Down
2 changes: 1 addition & 1 deletion examples/helio_gr_test/cb.swiftest.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0
Sun
39.476926408897626
0.004650467260962157
4.7535806948127355e-12
Expand Down
9 changes: 5 additions & 4 deletions examples/helio_gr_test/init_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
sim.param['PL_IN'] = "pl.swiftest.in"
sim.param['TP_IN'] = "tp.swiftest.in"
sim.param['CB_IN'] = "cb.swiftest.in"
sim.param['BIN_OUT'] = "bin.swiftest.dat"
sim.param['ENC_OUT'] = "enc.swiftest.dat"
sim.param['BIN_OUT'] = "bin.swiftest.nc"

sim.param['MU2KG'] = swiftest.MSun
sim.param['TU2S'] = swiftest.YR2S
Expand All @@ -22,9 +21,11 @@
sim.param['CHK_RMIN'] = swiftest.RSun / swiftest.AU2M
sim.param['CHK_RMAX'] = 1000.0
sim.param['CHK_EJECT'] = 1000.0
sim.param['OUT_FORM'] = "EL"
sim.param['OUT_STAT'] = "UNKNOWN"
sim.param['RHILL_PRESENT'] = "NO"
sim.param['IN_FORM'] = "EL"
sim.param['OUT_FORM'] = "XVEL"
sim.param['OUT_TYPE'] = "NETCDF_DOUBLE"
sim.param['RHILL_PRESENT'] = "YES"
sim.param['GR'] = 'YES'

bodyid = {
Expand Down
8 changes: 4 additions & 4 deletions examples/helio_gr_test/param.swifter.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ TSTOP 1000.0
DT 0.0006844626967830253
ISTEP_OUT 1461
ISTEP_DUMP 1461
OUT_FORM EL
OUT_TYPE REAL8
OUT_FORM XVEL
OUT_TYPE NETCDF_DOUBLE
OUT_STAT UNKNOWN
IN_TYPE ASCII
PL_IN pl.swifter.in
TP_IN tp.swifter.in
BIN_OUT bin.swifter.dat
ENC_OUT enc.swifter.dat
CHK_QMIN 0.004650467260962157
CHK_RMIN 0.004650467260962157
CHK_RMAX 1000.0
CHK_EJECT 1000.0
CHK_QMIN_COORD HELIO
CHK_QMIN_RANGE 0.004650467260962157 1000.0
ENC_OUT enc.swifter.dat
EXTRA_FORCE NO
BIG_DISCARD NO
CHK_CLOSE YES
RHILL_PRESENT NO
RHILL_PRESENT YES
C 63241.07708426628
J2 4.7535806948127355e-12
J4 -2.2473967953572827e-18
15 changes: 7 additions & 8 deletions examples/helio_gr_test/param.swiftest.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ TSTOP 1000.0
DT 0.0006844626967830253
ISTEP_OUT 1461
ISTEP_DUMP 1461
OUT_FORM EL
OUT_TYPE REAL8
OUT_FORM XVEL
OUT_TYPE NETCDF_DOUBLE
OUT_STAT UNKNOWN
IN_TYPE ASCII
PL_IN pl.swiftest.in
TP_IN tp.swiftest.in
CB_IN cb.swiftest.in
BIN_OUT bin.swiftest.dat
ENC_OUT enc.swiftest.dat
BIN_OUT bin.swiftest.nc
CHK_QMIN 0.004650467260962157
CHK_RMIN 0.004650467260962157
CHK_RMAX 1000.0
Expand All @@ -22,15 +21,15 @@ CHK_QMIN_RANGE 0.004650467260962157 1000.0
MU2KG 1.988409870698051e+30
TU2S 31557600.0
DU2M 149597870700.0
IN_FORM EL
ENC_OUT enc.dat
EXTRA_FORCE NO
DISCARD_OUT discard.out
BIG_DISCARD NO
CHK_CLOSE YES
RHILL_PRESENT NO
RHILL_PRESENT YES
FRAGMENTATION NO
ROTATION NO
TIDES NO
ENERGY NO
GR YES
YARKOVSKY NO
YORP NO
MTINY 0.0
50 changes: 25 additions & 25 deletions examples/helio_gr_test/pl.swifter.in
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
9
0 39.476926408897625196
0 39.476926408897626
0.0 0.0 0.0
0.0 0.0 0.0
1 6.5537098095653139645e-06
1 6.5537098095653139645e-06 0.001475131156288637831
1.6306381826061645943e-05
-0.30949970210807342674 0.1619004125820537876 0.041620272188990829754
-6.8742992150644793847 -8.672423996611946485 -0.078109307586001638286
2 9.663313399581537916e-05
-0.0361820239646683528 -0.46276010580341980782 -0.034496398006472611675
8.183688458560222766 -0.27616682338432374386 -0.7732476400340904169
2 9.663313399581537916e-05 0.0067590747715647875607
4.0453784346544178454e-05
-0.5567137338251560985 -0.46074173273652380134 0.02580196630219121906
4.6580776303108450487 -5.726444072926637749 -0.3473859047161406309
3 0.000120026935827952453094
0.04707194870345993154 -0.7255425078625500346 -0.012673782840571969424
7.3226765098927520106 0.45143529808423807744 -0.4163607714267330732
3 0.000120026935827952453094 0.01004493295891520948
4.25875607065040958e-05
0.6978790186886838498 -0.73607603319120218366 3.261671020506711323e-05
4.4579240279134950613 4.300011122687349501 -0.00022055769049333364448
4 1.2739802010675941456e-05
0.9784182446151709067 -0.2394545623617302943 7.8432240502479141865e-06
1.3916805835822199726 6.0802455505175572043 -0.00029695052429473289775
4 1.2739802010675941456e-05 0.007246527815634877893
2.265740805092889601e-05
-1.617661473167097963 0.38314370807747849534 0.04771055403546069218
-0.98751874613118001086 -4.5371239937302254657 -0.07086074102213555221
5 0.037692251088985676735
-1.64827450584581503 -0.04818173529735803734 0.039422108862210397673
0.3393812176064170994 -4.672429323734897043 -0.1062469093563351878
5 0.037692251088985676735 0.3552712221482522291
0.00046732617030490929307
4.1527454588897487753 -2.8347492039446908763 -0.081136554176388195336
1.5225069137843642898 2.4087104911325327961 -0.044067446366273183833
6 0.011285899820091272997
4.2888079225575648223 -2.6068082746690541818 -0.08512743586621877856
1.4000629754656241179 2.4876377693334669565 -0.04165606656604725836
6 0.011285899820091272997 0.4376655756331854547
0.00038925687730393611812
6.39471595410062843 -7.621162747287802297 -0.121992225877669294154
1.4493167787574136286 1.3075474785896286071 -0.08039429377859412155
7 0.0017236589478267730203
6.528501376442308768 -7.4981197287393284157 -0.12945412016904539465
1.4250071771025915456 1.33599992135721594 -0.07992159012428249671
7 0.0017236589478267730203 0.46970222329693796102
0.00016953449859497231466
14.793135356927480828 13.074218343364380601 -0.14311846037737518955
-0.9605086875596024784 1.0118431725941020164 0.016148779866732710198
8 0.0020336100526728302319
14.703390521074780395 13.168120788311910019 -0.14161196287363458923
-0.96768368440931795183 1.0056701102995595347 0.01621895610074016891
8 0.0020336100526728302319 0.78148373992374883156
0.000164587904124493665
29.568629894896030663 -4.5543028991960081697 -0.58771107137394917874
0.16867624969736024011 1.1427992197933557251 -0.027387722828706092838
29.584136736556288838 -4.4478894754775319953 -0.5902566603324214123
0.16448791459483679965 1.1435219564135608914 -0.027304639012640681262
48 changes: 24 additions & 24 deletions examples/helio_gr_test/pl.swiftest.in
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
8
1 6.5537098095653139645e-06
Mercury 6.5537098095653139645e-06 0.001475131156288637831
1.6306381826061645943e-05
-0.30949970210807342674 0.1619004125820537876 0.041620272188990829754
-6.8742992150644793847 -8.672423996611946485 -0.078109307586001638286
2 9.663313399581537916e-05
0.38709993253896590737 0.20562614632859010921 7.0036272314159866426
48.303648911363737284 29.187750438580689405 192.22398026813181104
Venus 9.663313399581537916e-05 0.0067590747715647875607
4.0453784346544178454e-05
-0.5567137338251560985 -0.46074173273652380134 0.02580196630219121906
4.6580776303108450487 -5.726444072926637749 -0.3473859047161406309
3 0.000120026935827952453094
0.7233249152313999675 0.006782779674600277614 3.3945084679511872139
76.62172192899298295 55.11871576732421829 141.51944714681908977
Earth 0.000120026935827952453094 0.01004493295891520948
4.25875607065040958e-05
0.6978790186886838498 -0.73607603319120218366 3.261671020506711323e-05
4.4579240279134950613 4.300011122687349501 -0.00022055769049333364448
4 1.2739802010675941456e-05
1.0000207198983319667 0.01667731166077134064 0.0027576432734417160447
175.55813761562768605 287.40166532678227895 245.00485341438161413
Mars 1.2739802010675941456e-05 0.007246527815634877893
2.265740805092889601e-05
-1.617661473167097963 0.38314370807747849534 0.04771055403546069218
-0.98751874613118001086 -4.5371239937302254657 -0.07086074102213555221
5 0.037692251088985676735
1.5236922769560579116 0.093361659829406723476 1.8479133359077690724
49.490611477105659333 286.70751815915190264 210.36775515565921069
Jupiter 0.037692251088985676735 0.3552712221482522291
0.00046732617030490929307
4.1527454588897487753 -2.8347492039446908763 -0.081136554176388195336
1.5225069137843642898 2.4087104911325327961 -0.044067446366273183833
6 0.011285899820091272997
5.203523661489898977 0.04851833897394460665 1.3035686835324369337
100.51671881401649955 273.38319313278452682 318.65986979714938343
Saturn 0.011285899820091272997 0.4376655756331854547
0.00038925687730393611812
6.39471595410062843 -7.621162747287802297 -0.121992225877669294154
1.4493167787574136286 1.3075474785896286071 -0.08039429377859412155
7 0.0017236589478267730203
9.581904852310625387 0.052236260603057811658 2.486258128114103183
113.595257336893098454 335.64742317800698856 225.92836894588160135
Uranus 0.0017236589478267730203 0.46970222329693796102
0.00016953449859497231466
14.793135356927480828 13.074218343364380601 -0.14311846037737518955
-0.9605086875596024784 1.0118431725941020164 0.016148779866732710198
8 0.0020336100526728302319
19.238019712529130345 0.0442880601027018303 0.770350326736000679
74.09520891350530292 95.7524345508490029 236.07863258800219342
Neptune 0.0020336100526728302319 0.78148373992374883156
0.000164587904124493665
29.568629894896030663 -4.5543028991960081697 -0.58771107137394917874
0.16867624969736024011 1.1427992197933557251 -0.027387722828706092838
30.291369954344219195 0.013531244039650480379 1.7689741418447819665
131.74449502957048708 245.89296040993210113 334.5035290478779757
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@
p_tp = np.array([atp, 0.0, 0.0], dtype=np.double)
v_tp = np.array([0.0, vtp, 0.0], dtype=np.double)

Rhill = np.double(apl * 0.0100447248332378922085)
rhill = np.double(apl * 0.0100447248332378922085)

#Make Swifter files
plfile = open(swifter_pl, 'w')
print(npl+1, f'! Planet input file generated using init_cond.py',file=plfile)
print(1,GMSun,file=plfile)
print('0.0 0.0 0.0',file=plfile)
print('0.0 0.0 0.0',file=plfile)
print(plid,"{:.23g}".format(Gmass),Rhill, file=plfile)
print(plid,"{:.23g}".format(Gmass),rhill, file=plfile)
print(radius, file=plfile)
print(*p_pl, file=plfile)
print(*v_pl, file=plfile)
Expand Down Expand Up @@ -126,7 +126,7 @@
plfile.write_record(v_pl[1])
plfile.write_record(v_pl[2])
plfile.write_record(Gmass)
plfile.write_record(Rhill)
plfile.write_record(rhill)
plfile.write_record(radius)
plfile.close()
tpfile = FortranFile(swiftest_tp, 'w')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@

for i in pl.id:
pli = pl.sel(id=i)
rstart = 2 * np.double(pli['Radius']) # Start the test particles at a multiple of the planet radius away
vstart = 1.5 * np.sqrt(2 * np.double(pli['GMass']) / rstart) # Start the test particle velocities at a multiple of the escape speed
rstart = 2 * np.double(pli['radius']) # Start the test particles at a multiple of the planet radius away
vstart = 1.5 * np.sqrt(2 * np.double(pli['Gmass']) / rstart) # Start the test particle velocities at a multiple of the escape speed
xvstart = np.array([rstart / np.sqrt(2.0), rstart / np.sqrt(2.0), 0.0, vstart, 0.0, 0.0])
# The positions and velocities of each pair of test particles will be in reference to a planet
plvec = np.array([np.double(pli['px']),
np.double(pli['py']),
np.double(pli['pz']),
np.double(pli['vx']),
np.double(pli['vy']),
np.double(pli['vz'])])
plvec = np.array([np.double(pli['xhx']),
np.double(pli['xhy']),
np.double(pli['xhz']),
np.double(pli['vhx']),
np.double(pli['vhy']),
np.double(pli['vhz'])])
tpxv1 = plvec + xvstart
tpxv2 = plvec - xvstart
p1.append(tpxv1[0])
Expand Down
Loading

0 comments on commit ac782a6

Please sign in to comment.