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

Commit

Permalink
Merge branch 'debug' into IO
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Oct 8, 2021
2 parents e198daa + a51584b commit 4e2cc70
Show file tree
Hide file tree
Showing 91 changed files with 140,798 additions and 1,584 deletions.
34 changes: 8 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ SWIFTEST_MODULES = swiftest_globals.f90 \
swiftest_operators.f90 \
lambda_function.f90\
swiftest_classes.f90 \
encounter_classes.f90 \
fraggle_classes.f90 \
whm_classes.f90 \
rmvs_classes.f90 \
Expand Down Expand Up @@ -98,6 +99,11 @@ fast:
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make fastdir
cd $(SWIFTEST_HOME)/src/encounter; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make fastdir
cd $(SWIFTEST_HOME)/src/fraggle; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
Expand Down Expand Up @@ -232,6 +238,7 @@ 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/encounter; 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*
Expand All @@ -257,29 +264,4 @@ clean:
cd $(COLLRESOLVE_HOME); rm -rf autom4te.cache aux Makefile stamp-h1 configure config.status config.h config.log aclocal.m4 lib* *.in *.o *.lo cambioni2019/*.o cambioni2019/*.lo


force:

#******************************************************************************
#
# Author(s) : David E. Kaufmann
#
# Revision Control System (RCS) Information
#
# Source File : $RCSfile: Makefile,v $
# Full Path : $Source: /d1/kaufmann/development/RCS/Makefile,v $
# Revision : $Revision: 0.1 $
# Date : $Date: 2003/04/15 22:56:34 $
# Programmer : $Author: kaufmann $
# Locked By : $Locker: kaufmann $
# State : $State: Exp $
#
# Modification History:
#
# $Log: Makefile,v $
# Revision 0.1 2003/04/15 22:56:34 kaufmann
# Initial implementation
#
#
#******************************************************************************


force:
9 changes: 4 additions & 5 deletions Makefile.Defines
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ GMEM = -fsanitize-address-use-after-scope -fstack-check -fsanitize=bounds-stri
GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries
GPRODUCTION = -O2 -ffree-line-length-none $(GPAR)


#FFLAGS = $(IDEBUG) #$(SIMDVEC) $(PAR)
#FFASTFLAGS = $(IDEBUG) #$(SIMDVEC) $(PAR)
FSTRICTFLAGS = $(IPRODUCTION) $(STRICTREAL) $(OPTREPORT) #$(ADVIXE_FLAGS)
FFLAGS = $(IPRODUCTION) -fp-model=fast $(OPTREPORT) #$(ADVIXE_FLAGS)
#FFLAGS = $(IDEBUG) $(SIMDVEC) $(PAR)
#FFASTFLAGS = $(IDEBUG) $(SIMDVEC) $(PAR)
FSTRICTFLAGS = $(IPRODUCTION) $(STRICTREAL) $(OPTREPORT) #$(ADVIXE_FLAGS)
FFLAGS = $(IPRODUCTION) -fp-model=fast $(OPTREPORT) #$(ADVIXE_FLAGS)
FORTRAN = ifort
AR = xiar

Expand Down
Binary file modified examples/rmvs_swifter_comparison/1pl_1tp_encounter/cb.swiftest.in
Binary file not shown.
26 changes: 19 additions & 7 deletions examples/rmvs_swifter_comparison/1pl_1tp_encounter/init_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
swiftest_pl = "pl.swiftest.in"
swiftest_tp = "tp.swiftest.in"
swiftest_cb = "cb.swiftest.in"
swiftest_bin = "bin.swiftest.dat"
swiftest_bin = "bin.swiftest.nc"
swiftest_enc = "enc.swiftest.dat"

MU2KG = swiftest.MSun
Expand All @@ -39,8 +39,8 @@
rmax = 1000.0

npl = 1
plid = 2
tpid = 100
plid = 1
tpid = 2

radius = np.double(4.25875607065041e-05)
Gmass = np.double(0.00012002693582795244940133)
Expand All @@ -60,7 +60,7 @@
#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,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)
Expand All @@ -85,7 +85,7 @@
print(f'TP_IN {swifter_tp}')
print(f'IN_TYPE ASCII')
print(f'ISTEP_OUT {iout:d}')
print(f'ISTEP_DUMP {iout:d}')
print(f'ISTEP_DUMP {10*iout:d}')
print(f'BIN_OUT {swifter_bin}')
print(f'OUT_TYPE REAL8')
print(f'OUT_FORM XV')
Expand All @@ -106,9 +106,19 @@
sys.stdout = sys.__stdout__

#Now make Swiftest files
NAMELEN = 32
cbname = "Sun"
plname = "Planet"
tpname = "TestParticle"

cbname = cbname.ljust(NAMELEN)
plname = plname.ljust(NAMELEN)
tpname = tpname.ljust(NAMELEN)

cbfile = FortranFile(swiftest_cb, 'w')
Msun = np.double(1.0)
cbfile.write_record(0)
cbfile.write_record(cbname)
cbfile.write_record(np.double(GMSun))
cbfile.write_record(np.double(rmin))
cbfile.write_record(np.double(swiftest.J2Sun))
Expand All @@ -119,6 +129,7 @@
plfile.write_record(npl)

plfile.write_record(plid)
plfile.write_record(plname)
plfile.write_record(p_pl[0])
plfile.write_record(p_pl[1])
plfile.write_record(p_pl[2])
Expand All @@ -133,6 +144,7 @@
ntp = 1
tpfile.write_record(ntp)
tpfile.write_record(tpid)
tpfile.write_record(tpname)
tpfile.write_record(p_tp[0])
tpfile.write_record(p_tp[1])
tpfile.write_record(p_tp[2])
Expand All @@ -154,8 +166,8 @@
print(f'ISTEP_OUT {iout:d}')
print(f'ISTEP_DUMP {iout:d}')
print(f'BIN_OUT {swiftest_bin}')
print(f'OUT_TYPE REAL8')
print(f'OUT_FORM XV')
print(f'OUT_TYPE NETCDF_DOUBLE')
print(f'OUT_FORM XVEL')
print(f'OUT_STAT REPLACE')
print(f'RHILL_PRESENT yes')
print(f'CHK_CLOSE yes')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ PL_IN pl.swiftest.in
TP_IN tp.swiftest.in
IN_TYPE REAL8
ISTEP_OUT 1
ISTEP_DUMP 1
BIN_OUT bin.swiftest.dat
OUT_TYPE REAL8
OUT_FORM XV
ISTEP_DUMP 10
BIN_OUT bin.swiftest.nc
OUT_TYPE NETCDF_DOUBLE
OUT_FORM XVEL
OUT_STAT REPLACE
RHILL_PRESENT yes
CHK_CLOSE yes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
2 ! Planet input file generated using init_cond.py
1 39.476926408897625196
0 39.476926408897625196
0.0 0.0 0.0
0.0 0.0 0.0
2 0.00012002693582795244940133 0.010044724833237892
1 0.00012002693582795244940133 0.010044724833237892
4.25875607065041e-05
1.0 0.0 0.0
0.0 6.283185307179586 0.0
Binary file modified examples/rmvs_swifter_comparison/1pl_1tp_encounter/pl.swiftest.in
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1
100
2
1.01 0.0 0.0
0.0 6.252003053624663 0.0
Binary file modified examples/rmvs_swifter_comparison/1pl_1tp_encounter/tp.swiftest.in
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/rmvs_swifter_comparison/8pl_16tp_encounters/cb.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0
Sun
0.00029591220819207774
0.004650467260962157
4.7535806948127355e-12
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0
Sun
0.00029591220819207774
0.004650467260962157
4.7535806948127355e-12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
swiftest_input = "param.swiftest.in"
swiftest_pl = "pl.swiftest.in"
swiftest_cb = "cb.swiftest.in"
swiftest_bin = "bin.swiftest.dat"
swiftest_bin = "bin.swiftest.nc"
swiftest_enc = "enc.swiftest.dat"
swiftest_disc = "discard.swiftest.out"

Expand All @@ -27,14 +27,13 @@
sim.param['DT'] = 1.0
sim.param['TSTOP'] = 365.25e2
sim.param['ISTEP_OUT'] = 10
sim.param['ISTEP_DUMP'] = 10
sim.param['CHK_QMIN_COORD'] = "HELIO"
sim.param['CHK_QMIN'] = swiftest.RSun / swiftest.AU2M
sim.param['CHK_QMIN_RANGE'] = f"{swiftest.RSun / swiftest.AU2M} 1000.0"
sim.param['CHK_RMIN'] = swiftest.RSun / swiftest.AU2M
sim.param['CHK_RMAX'] = 1000.0
sim.param['CHK_EJECT'] = 1000.0
sim.param['OUT_FORM'] = "XV"
sim.param['IN_FORM'] = "XV"
sim.param['OUT_STAT'] = "UNKNOWN"
sim.param['GR'] = 'NO'
sim.param['CHK_CLOSE'] = 'YES'
Expand Down Expand Up @@ -68,10 +67,11 @@
dims = ['time', 'id', 'vec']
tp = []
t = np.array([0.0])
sim.param['OUT_FORM'] = "XV"
clab, plab, tlab = swio.make_swiftest_labels(sim.param)

# For each planet, we will initialize a pair of test particles. One on its way in, and one on its way out. We will also initialize two additional particles that don't encounter anything
tpnames = np.arange(101, 101 + ntp)
tpnames = np.arange(npl + 1, npl + 1 + ntp)
tpxv1 = np.empty((6))
tpxv2 = np.empty((6))

Expand Down Expand Up @@ -120,6 +120,7 @@
sim.ds = xr.combine_by_coords([sim.ds, tpds])
swio.swiftest_xr2infile(sim.ds, sim.param)

sim.param['ISTEP_DUMP'] = 1000
sim.param['PL_IN'] = swiftest_pl
sim.param['TP_IN'] = tpin
sim.param['CB_IN'] = swiftest_cb
Expand All @@ -128,6 +129,7 @@
sim.param['DISCARD_OUT'] = swiftest_disc
sim.save(swiftest_input)

sim.param['ISTEP_DUMP'] = 10
sim.param['PL_IN'] = swifter_pl
sim.param['TP_IN'] = tpin
sim.param['BIN_OUT'] = swifter_bin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
! VERSION Swifter parameter file converted from Swiftest
T0 0.0
TSTOP 9500.0
TSTOP 36525.0
DT 1.0
ISTEP_OUT 100
ISTEP_DUMP 100
ISTEP_OUT 10
ISTEP_DUMP 10
OUT_FORM XV
OUT_TYPE REAL8
OUT_STAT UNKNOWN
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
! VERSION Swiftest parameter input
T0 0.0
TSTOP 9500.0
TSTOP 36525.0
DT 1.0
ISTEP_OUT 100
ISTEP_DUMP 100
ISTEP_OUT 10
ISTEP_DUMP 1000
OUT_FORM XV
OUT_TYPE REAL8
OUT_TYPE NETCDF_DOUBLE
OUT_STAT UNKNOWN
IN_TYPE ASCII
PL_IN pl.swiftest.in
TP_IN tp.in
CB_IN cb.swiftest.in
BIN_OUT bin.swiftest.dat
BIN_OUT bin.swiftest.nc
CHK_QMIN 0.004650467260962157
CHK_RMIN 0.004650467260962157
CHK_RMAX 1000.0
Expand All @@ -21,6 +21,7 @@ CHK_QMIN_RANGE 0.004650467260962157 1000.0
MU2KG 1.988409870698051e+30
TU2S 86400
DU2M 149597870700.0
IN_FORM XV
ENC_OUT enc.swiftest.dat
EXTRA_FORCE NO
DISCARD_OUT discard.swiftest.out
Expand All @@ -32,3 +33,4 @@ ROTATION NO
TIDES NO
ENERGY NO
GR NO
ENCOUNTER_CHECK SORTSWEEP
48 changes: 24 additions & 24 deletions examples/rmvs_swifter_comparison/8pl_16tp_encounters/pl.in
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
8
1 4.9125474498983623693e-11 0.0014751244935834097723
Mercury 4.9125474498983623693e-11 0.0014751310862809727629
1.6306381826061645943e-05
-0.37723213134178928962 0.033583006382262102496 0.037347605390151236704
-0.008342765357522348782 -0.026815373891535949219 -0.0014259978126226569104
2 7.243452483873646905e-10 0.006759064884572926305
0.3145650549772632254 -0.2555573396958932264 -0.04973776595957409008
0.012185837286798669593 0.023148338651330341298 0.0007738432831418731988
Venus 7.243452483873646905e-10 0.006759109593536554028
4.0453784346544178454e-05
-0.48772324783973242113 -0.53438159383885197595 0.020810210727290629623
0.014797158412775200664 -0.013730742274988789325 -0.0010423161661001279551
3 8.9970113821660187435e-10 0.01004492566381686821
0.387431535393453097 -0.615766685385218282 -0.030807691817795201245
0.016984136843969918629 0.010701026081884959518 -0.00083320727407271925197
Earth 8.9970113821660187435e-10 0.010044870735102664462
4.25875607065040958e-05
0.75635861236241797023 -0.674672320414933413 2.9482164814591560215e-05
0.0111724732704936106226 0.0127745538308708106445 -6.4922715710692383536e-07
4 9.549535102761465607e-11 0.007246661019460395855
1.0001792791661539006 0.06668748161964906107 -6.9475367832576531254e-06
-0.0014241429939451050266 0.01710181935138167103 -8.172724609833309663e-07
Mars 9.549535102761465607e-11 0.0072464333631564068194
2.265740805092889601e-05
-1.6298746849997449715 0.3207423054955682029 0.04670239471945906301
-0.0021807443711779391643 -0.012535287802970449672 -0.00020920945169970240392
5 2.825345908631354893e-07 0.3552709189640263194
-1.6139182001611360739 -0.2770999554367851725 0.033781809741611629194
0.0028882147021094439938 -0.01259648691593238945 -0.00033483851552870507427
Jupiter 2.825345908631354893e-07 0.3552700143333522151
0.00046732617030490929307
4.173466317007961557 -2.8016935252076420326 -0.081737437087388009616
0.0041198995131368296857 0.0066275220486694394126 -0.000119701756809504006665
6 8.459715183006415395e-08 0.43765971211410006393
4.3561675102222698897 -2.483239946173660062 -0.0871477099729481286
0.0036506744364301680662 0.006918211883976329267 -0.00011041076017508120262
Saturn 8.459715183006415395e-08 0.4376659280804963441
0.00038925687730393611812
6.414531809550852337 -7.603234575912382276 -0.12309230194363039723
0.0039583234912346160553 0.003591394820962775982 -0.00021992254044702681153
7 1.2920249163736673626e-08 0.4696151691794380732
6.598405456116825718 -7.431912424938192707 -0.13338632598447389133
0.0038655905358352319993 0.0036985431667748399145 -0.00021809450985937309415
Uranus 1.2920249163736673626e-08 0.4697589307107089155
0.00016953449859497231466
14.779979482167510341 13.088063528768900667 -0.14289732557134240953
-0.0026326202792006140295 0.002767798188238951903 4.424098699891899271e-05
8 1.5243589003230834323e-08 0.7813830605782720197
14.6556082971347603205 13.217600500105490369 -0.14081174740381419141
-0.0026597608840880260402 0.0027443623966001309648 4.4507838529215151932e-05
Neptune 1.5243589003230834323e-08 0.78153946280858775143
0.000164587904124493665
29.57093474400743105 -4.53865809805519671 -0.5880859062837571205
0.00046012900387533010914 0.0031291067120909890273 -7.4950441013985698475e-05
29.592188021966471467 -4.391525979010755698 -0.5916011673528802639
0.0004442402958062029259 0.0031318140342659721298 -7.463341927949002162e-05
Loading

0 comments on commit 4e2cc70

Please sign in to comment.