From a993807cea83aced127f2a155b0f18facf853d96 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 24 Jun 2021 12:31:37 -0400 Subject: [PATCH] I decided that changing param.in to config.in was silly. It's best to keep changes like this to a minimum. So I refactored everything back to maintain consistency with earlier version of the codebase --- Makefile.Defines | 4 +- examples/restart/param.restart.in | 0 examples/rmvs_gr_test/init_cond.py | 2 +- .../{config.swiftest.in => param.swiftest.in} | 0 examples/rmvs_gr_test/particle_distance.ipynb | 4 +- .../rmvs_gr_test/swiftest_relativity.ipynb | 6 +- .../swifttest_rmvs_vs_swifter_rmvs.ipynb | 6 +- .../1pl_1tp_encounter/check_init_cond.ipynb | 6 +- .../1pl_1tp_encounter/init_cond.py | 2 +- .../{config.swiftest.in => param.swiftest.in} | 0 .../swiftest_rmvs_vs_swifter_rmvs.ipynb | 6 +- .../9pl_18tp_encounters/init_cond.py | 12 +- .../{config.swiftest.in => param.swiftest.in} | 0 .../swiftest_rmvs_vs_swifter_rmvs.ipynb | 6 +- .../swiftest_rmvs_vs_swifter_rmvs.ipynb | 6 +- examples/whm_gr_test/init_cond.py | 2 +- .../{config.swiftest.in => param.swiftest.in} | 0 .../whm_gr_test/swiftest_relativity.ipynb | 6 +- examples/whm_swifter_comparison/init_cond.py | 2 +- .../{config.swiftest.in => param.swiftest.in} | 0 .../whm_swiftest_vs_swifter.ipynb | 6 +- param.restart.in | 0 python/swifter2swiftest.py | 80 ++-- python/swiftestio/swiftestio.py | 194 ++++----- src/discard/discard.f90 | 52 +-- src/gr/gr.f90 | 2 +- src/helio/helio_drift.f90 | 16 +- src/helio/helio_getacch.f90 | 18 +- src/helio/helio_step.f90 | 30 +- src/io/io.f90 | 402 +++++++++--------- src/main/swiftest_driver.f90 | 40 +- src/modules/helio_classes.f90 | 42 +- src/modules/rmvs_classes.f90 | 20 +- src/modules/swiftest_classes.f90 | 154 +++---- src/modules/swiftest_globals.f90 | 6 +- src/modules/symba.f90 | 136 +++--- src/modules/whm_classes.f90 | 96 ++--- src/rmvs/rmvs_getacch.f90 | 24 +- src/rmvs/rmvs_setup.f90 | 8 +- src/rmvs/rmvs_step.f90 | 70 +-- src/setup/setup.f90 | 8 +- src/symba/symba_casedisruption.f90 | 10 +- src/symba/symba_casehitandrun.f90 | 4 +- src/symba/symba_caseresolve.f90 | 6 +- src/symba/symba_casesupercatastrophic.f90 | 8 +- src/symba/symba_discard_pl.f90 | 6 +- src/symba/symba_discard_sun_pl.f90 | 10 +- src/symba/symba_discard_tp.f90 | 2 +- src/symba/symba_fragmentation.f90 | 2 +- src/symba/symba_getacch.f90 | 4 +- src/symba/symba_getacch_eucl.f90 | 4 +- src/symba/symba_getacch_tp.f90 | 8 +- src/symba/symba_getacch_tp_eucl.f90 | 8 +- src/symba/symba_helio_getacch.f90 | 6 +- src/symba/symba_rearray.f90 | 4 +- src/symba/symba_set_initial_conditions.f90 | 8 +- src/symba/symba_step.f90 | 16 +- src/symba/symba_step_eucl.f90 | 6 +- src/symba/symba_step_helio.f90 | 4 +- src/symba/symba_step_helio_pl.f90 | 4 +- src/symba/symba_step_interp.f90 | 16 +- src/symba/symba_step_interp_eucl.f90 | 14 +- src/symba/symba_step_recur.f90 | 16 +- src/user/user_getacch.f90 | 4 +- src/whm/whm_drift.f90 | 16 +- src/whm/whm_getacch.f90 | 20 +- src/whm/whm_gr.f90 | 60 +-- src/whm/whm_setup.f90 | 10 +- src/whm/whm_step.f90 | 38 +- 69 files changed, 894 insertions(+), 894 deletions(-) create mode 100644 examples/restart/param.restart.in rename examples/rmvs_gr_test/{config.swiftest.in => param.swiftest.in} (100%) rename examples/rmvs_swifter_comparison/1pl_1tp_encounter/{config.swiftest.in => param.swiftest.in} (100%) rename examples/rmvs_swifter_comparison/9pl_18tp_encounters/{config.swiftest.in => param.swiftest.in} (100%) rename examples/whm_gr_test/{config.swiftest.in => param.swiftest.in} (100%) rename examples/whm_swifter_comparison/{config.swiftest.in => param.swiftest.in} (100%) create mode 100644 param.restart.in diff --git a/Makefile.Defines b/Makefile.Defines index b51a95a40..9aaf2c700 100644 --- a/Makefile.Defines +++ b/Makefile.Defines @@ -68,8 +68,8 @@ GPAR = -fopenmp -ftree-parallelize-loops=4 GMEM = -fsanitize=undefined -fsanitize=address -fsanitize=leak GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries -#FFLAGS = $(IDEBUG) $(HEAPARR) -FFLAGS = -init=snan,arrays -no-wrap-margin -fp-model strict -fp-model no-except -traceback -g $(OPTIMIZE) -O3 $(SIMDVEC) $(PAR) $(HEAPARR) +FFLAGS = $(IDEBUG) $(HEAPARR) +#FFLAGS = -init=snan,arrays -no-wrap-margin -fp-model strict -fp-model no-except -traceback -g $(OPTIMIZE) -O3 $(SIMDVEC) $(PAR) $(HEAPARR) FORTRAN = ifort #AR = xiar diff --git a/examples/restart/param.restart.in b/examples/restart/param.restart.in new file mode 100644 index 000000000..e69de29bb diff --git a/examples/rmvs_gr_test/init_cond.py b/examples/rmvs_gr_test/init_cond.py index b792ff998..7083997bc 100644 --- a/examples/rmvs_gr_test/init_cond.py +++ b/examples/rmvs_gr_test/init_cond.py @@ -148,7 +148,7 @@ swifter_bin = "bin.swifter.dat" swifter_enc = "enc.swifter.dat" - swiftest_input = "config.swiftest.in" + swiftest_input = "param.swiftest.in" swiftest_pl = "pl.swiftest.in" swiftest_tp = "tp.swiftest.in" swiftest_cb = "cb.swiftest.in" diff --git a/examples/rmvs_gr_test/config.swiftest.in b/examples/rmvs_gr_test/param.swiftest.in similarity index 100% rename from examples/rmvs_gr_test/config.swiftest.in rename to examples/rmvs_gr_test/param.swiftest.in diff --git a/examples/rmvs_gr_test/particle_distance.ipynb b/examples/rmvs_gr_test/particle_distance.ipynb index e9137e467..5286218d8 100644 --- a/examples/rmvs_gr_test/particle_distance.ipynb +++ b/examples/rmvs_gr_test/particle_distance.ipynb @@ -578,12 +578,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.swiftest.in\n" + "Reading Swiftest file param.swiftest.in\n" ] } ], "source": [ - "inparfile = \"config.swiftest.in\"\n", + "inparfile = \"param.swiftest.in\"\n", "paramfile = swio.read_swiftest_config(inparfile)\n", "swiftestdat = swio.swiftest2xr(paramfile)" ] diff --git a/examples/rmvs_gr_test/swiftest_relativity.ipynb b/examples/rmvs_gr_test/swiftest_relativity.ipynb index 3722de013..302934bc0 100644 --- a/examples/rmvs_gr_test/swiftest_relativity.ipynb +++ b/examples/rmvs_gr_test/swiftest_relativity.ipynb @@ -60,13 +60,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.gr.in\n" + "Reading Swiftest file param.gr.in\n" ] } ], "source": [ - "config_file_name = 'config.gr.in'\n", - "config = swio.read_swiftest_config(config_file_name)\n", + "param_file_name = 'param.gr.in'\n", + "config = swio.read_swiftest_config(param_file_name)\n", "swiftestdat = swio.swiftest2xr(config)" ] }, diff --git a/examples/rmvs_gr_test/swifttest_rmvs_vs_swifter_rmvs.ipynb b/examples/rmvs_gr_test/swifttest_rmvs_vs_swifter_rmvs.ipynb index 11517bdf0..4dbc0754d 100644 --- a/examples/rmvs_gr_test/swifttest_rmvs_vs_swifter_rmvs.ipynb +++ b/examples/rmvs_gr_test/swifttest_rmvs_vs_swifter_rmvs.ipynb @@ -39,13 +39,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.swiftest.in\n" + "Reading Swiftest file param.swiftest.in\n" ] } ], "source": [ - "config_file_name = 'config.swiftest.in'\n", - "config = swio.read_swiftest_config(config_file_name)\n", + "param_file_name = 'param.swiftest.in'\n", + "config = swio.read_swiftest_config(param_file_name)\n", "swiftestdat = swio.swiftest2xr(config)" ] }, diff --git a/examples/rmvs_swifter_comparison/1pl_1tp_encounter/check_init_cond.ipynb b/examples/rmvs_swifter_comparison/1pl_1tp_encounter/check_init_cond.ipynb index 90b5f693a..b8794b9f0 100644 --- a/examples/rmvs_swifter_comparison/1pl_1tp_encounter/check_init_cond.ipynb +++ b/examples/rmvs_swifter_comparison/1pl_1tp_encounter/check_init_cond.ipynb @@ -72,13 +72,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.swiftest.in\n" + "Reading Swiftest file param.swiftest.in\n" ] } ], "source": [ - "config_file_name = 'config.swiftest.in'\n", - "config = swio.read_swiftest_config(config_file_name)\n", + "param_file_name = 'param.swiftest.in'\n", + "config = swio.read_swiftest_config(param_file_name)\n", "swiftestdat = swio.swiftest2xr(config)" ] }, diff --git a/examples/rmvs_swifter_comparison/1pl_1tp_encounter/init_cond.py b/examples/rmvs_swifter_comparison/1pl_1tp_encounter/init_cond.py index 48ae3bc02..5b5f5e76e 100644 --- a/examples/rmvs_swifter_comparison/1pl_1tp_encounter/init_cond.py +++ b/examples/rmvs_swifter_comparison/1pl_1tp_encounter/init_cond.py @@ -71,7 +71,7 @@ swifter_bin = "bin.swifter.dat" swifter_enc = "enc.swifter.dat" -swiftest_input = "config.swiftest.in" +swiftest_input = "param.swiftest.in" swiftest_pl = "pl.swiftest.in" swiftest_tp = "tp.swiftest.in" swiftest_cb = "cb.swiftest.in" diff --git a/examples/rmvs_swifter_comparison/1pl_1tp_encounter/config.swiftest.in b/examples/rmvs_swifter_comparison/1pl_1tp_encounter/param.swiftest.in similarity index 100% rename from examples/rmvs_swifter_comparison/1pl_1tp_encounter/config.swiftest.in rename to examples/rmvs_swifter_comparison/1pl_1tp_encounter/param.swiftest.in diff --git a/examples/rmvs_swifter_comparison/1pl_1tp_encounter/swiftest_rmvs_vs_swifter_rmvs.ipynb b/examples/rmvs_swifter_comparison/1pl_1tp_encounter/swiftest_rmvs_vs_swifter_rmvs.ipynb index ce480827d..f6fdec6fd 100644 --- a/examples/rmvs_swifter_comparison/1pl_1tp_encounter/swiftest_rmvs_vs_swifter_rmvs.ipynb +++ b/examples/rmvs_swifter_comparison/1pl_1tp_encounter/swiftest_rmvs_vs_swifter_rmvs.ipynb @@ -39,13 +39,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.swiftest.in\n" + "Reading Swiftest file param.swiftest.in\n" ] } ], "source": [ - "config_file_name = 'config.swiftest.in'\n", - "config = swio.read_swiftest_config(config_file_name)\n", + "param_file_name = 'param.swiftest.in'\n", + "config = swio.read_swiftest_config(param_file_name)\n", "swiftestdat = swio.swiftest2xr(config)" ] }, diff --git a/examples/rmvs_swifter_comparison/9pl_18tp_encounters/init_cond.py b/examples/rmvs_swifter_comparison/9pl_18tp_encounters/init_cond.py index 776684e05..8715b2a36 100644 --- a/examples/rmvs_swifter_comparison/9pl_18tp_encounters/init_cond.py +++ b/examples/rmvs_swifter_comparison/9pl_18tp_encounters/init_cond.py @@ -8,7 +8,7 @@ import sys import xarray as xr -# Swiftest configuration file +# Swiftest paramuration file # Both codes use the same tp input file tpin = "tp.in" @@ -17,7 +17,7 @@ swifter_bin = "bin.swifter.dat" swifter_enc = "enc.swifter.dat" -swiftest_input = "config.swiftest.in" +swiftest_input = "param.swiftest.in" swiftest_pl = "pl.swiftest.in" swiftest_cb = "cb.swiftest.in" swiftest_bin = "bin.swiftest.dat" @@ -83,14 +83,14 @@ print(f'DU2M {DU2M}') print(f'TU2S {TU2S}') sys.stdout = sys.__stdout__ -config = swio.read_swiftest_config(swiftest_input) -ds = swio.solar_system_pl(config, tstart) +param = swio.read_swiftest_param(swiftest_input) +ds = swio.solar_system_pl(param, tstart) ntp = 18 dims = ['time', 'id', 'vec'] tp = [] t = np.array([0.0]) -clab, plab, tlab = swio.make_swiftest_labels(config) +clab, plab, tlab = swio.make_swiftest_labels(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) @@ -142,7 +142,7 @@ tpds = tpda.to_dataset(dim = 'vec') ds = xr.combine_by_coords([ds, tpds]) -swio.swiftest_xr2_infile(ds, config) +swio.swiftest_xr2_infile(ds, param) diff --git a/examples/rmvs_swifter_comparison/9pl_18tp_encounters/config.swiftest.in b/examples/rmvs_swifter_comparison/9pl_18tp_encounters/param.swiftest.in similarity index 100% rename from examples/rmvs_swifter_comparison/9pl_18tp_encounters/config.swiftest.in rename to examples/rmvs_swifter_comparison/9pl_18tp_encounters/param.swiftest.in diff --git a/examples/rmvs_swifter_comparison/9pl_18tp_encounters/swiftest_rmvs_vs_swifter_rmvs.ipynb b/examples/rmvs_swifter_comparison/9pl_18tp_encounters/swiftest_rmvs_vs_swifter_rmvs.ipynb index 56bf48a02..7079172eb 100644 --- a/examples/rmvs_swifter_comparison/9pl_18tp_encounters/swiftest_rmvs_vs_swifter_rmvs.ipynb +++ b/examples/rmvs_swifter_comparison/9pl_18tp_encounters/swiftest_rmvs_vs_swifter_rmvs.ipynb @@ -47,13 +47,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.swiftest.in\n" + "Reading Swiftest file param.swiftest.in\n" ] } ], "source": [ - "config_file_name = 'config.swiftest.in'\n", - "config = swio.read_swiftest_config(config_file_name)\n", + "param_file_name = 'param.swiftest.in'\n", + "config = swio.read_swiftest_config(param_file_name)\n", "swiftestdat = swio.swiftest2xr(config)" ] }, diff --git a/examples/rmvs_swifter_comparison/mars_ejecta/swiftest_rmvs_vs_swifter_rmvs.ipynb b/examples/rmvs_swifter_comparison/mars_ejecta/swiftest_rmvs_vs_swifter_rmvs.ipynb index 326e3c159..2ef9e28a5 100644 --- a/examples/rmvs_swifter_comparison/mars_ejecta/swiftest_rmvs_vs_swifter_rmvs.ipynb +++ b/examples/rmvs_swifter_comparison/mars_ejecta/swiftest_rmvs_vs_swifter_rmvs.ipynb @@ -39,13 +39,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.swiftest.in\n" + "Reading Swiftest file param.swiftest.in\n" ] } ], "source": [ - "config_file_name = 'config.swiftest.in'\n", - "config = swio.read_swiftest_config(config_file_name)\n", + "param_file_name = 'param.swiftest.in'\n", + "config = swio.read_swiftest_config(param_file_name)\n", "swiftestdat = swio.swiftest2xr(config)" ] }, diff --git a/examples/whm_gr_test/init_cond.py b/examples/whm_gr_test/init_cond.py index cbf520960..7904eb100 100644 --- a/examples/whm_gr_test/init_cond.py +++ b/examples/whm_gr_test/init_cond.py @@ -108,7 +108,7 @@ swifter_bin = "bin.swifter.dat" swifter_enc = "enc.swifter.dat" - swiftest_input = "config.swiftest.in" + swiftest_input = "param.swiftest.in" swiftest_pl = "pl.swiftest.in" swiftest_tp = "tp.swiftest.in" swiftest_cb = "cb.swiftest.in" diff --git a/examples/whm_gr_test/config.swiftest.in b/examples/whm_gr_test/param.swiftest.in similarity index 100% rename from examples/whm_gr_test/config.swiftest.in rename to examples/whm_gr_test/param.swiftest.in diff --git a/examples/whm_gr_test/swiftest_relativity.ipynb b/examples/whm_gr_test/swiftest_relativity.ipynb index 914122b06..0f753993c 100644 --- a/examples/whm_gr_test/swiftest_relativity.ipynb +++ b/examples/whm_gr_test/swiftest_relativity.ipynb @@ -41,13 +41,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.swiftest.in\n" + "Reading Swiftest file param.swiftest.in\n" ] } ], "source": [ - "config_file_name = 'config.swiftest.in'\n", - "config = swio.read_swiftest_config(config_file_name)\n", + "param_file_name = 'param.swiftest.in'\n", + "config = swio.read_swiftest_config(param_file_name)\n", "swiftestdat = swio.swiftest2xr(config)" ] }, diff --git a/examples/whm_swifter_comparison/init_cond.py b/examples/whm_swifter_comparison/init_cond.py index 32f6f375a..289f14f75 100644 --- a/examples/whm_swifter_comparison/init_cond.py +++ b/examples/whm_swifter_comparison/init_cond.py @@ -139,7 +139,7 @@ swifter_bin = "bin.swifter.dat" swifter_enc = "enc.swifter.dat" - swiftest_input = "config.swiftest.in" + swiftest_input = "param.swiftest.in" swiftest_pl = "pl.swiftest.in" swiftest_tp = "tp.swiftest.in" swiftest_cb = "cb.swiftest.in" diff --git a/examples/whm_swifter_comparison/config.swiftest.in b/examples/whm_swifter_comparison/param.swiftest.in similarity index 100% rename from examples/whm_swifter_comparison/config.swiftest.in rename to examples/whm_swifter_comparison/param.swiftest.in diff --git a/examples/whm_swifter_comparison/whm_swiftest_vs_swifter.ipynb b/examples/whm_swifter_comparison/whm_swiftest_vs_swifter.ipynb index c22d9cbe4..997defb80 100644 --- a/examples/whm_swifter_comparison/whm_swiftest_vs_swifter.ipynb +++ b/examples/whm_swifter_comparison/whm_swiftest_vs_swifter.ipynb @@ -41,13 +41,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "Reading Swiftest file config.swiftest.in\n" + "Reading Swiftest file param.swiftest.in\n" ] } ], "source": [ - "config_file_name = 'config.swiftest.in'\n", - "config = swio.read_swiftest_config(config_file_name)\n", + "param_file_name = 'param.swiftest.in'\n", + "config = swio.read_swiftest_config(param_file_name)\n", "swiftestdat = swio.swiftest2xr(config)" ] }, diff --git a/param.restart.in b/param.restart.in new file mode 100644 index 000000000..e69de29bb diff --git a/python/swifter2swiftest.py b/python/swifter2swiftest.py index 4f25daee6..8ba09e542 100644 --- a/python/swifter2swiftest.py +++ b/python/swifter2swiftest.py @@ -7,61 +7,61 @@ """ G = 6.6743E-11 # Universal gravitational constant in SI units -def read_config(config): +def read_param(param): # Read and parse old Swifter parameter file - swifterfile = config['swifterfile'] - swiftestfile = config['swiftestfile'] + swifterfile = param['swifterfile'] + swiftestfile = param['swiftestfile'] - # Read config.in file - print('Reading Swifter file ' + config['swifterfile']) + # Read param.in file + print('Reading Swifter file ' + param['swifterfile']) fold = open(swifterfile, 'r') swifterlines = fold.readlines() fold.close() for line in swifterlines: fields = line.split() if len(fields) > 0: - if ('PL_IN' == fields[0].upper()): config['PL_OLD'] = fields[1] - if ('TP_IN' == fields[0].upper()): config['TP_OLD'] = fields[1] - if ('CHK_CLOSE' == fields[0].upper()): config['CHK_CLOSE'] = fields[1].upper() - if ('RHILL_PRESENT'== fields[0].upper()): config['RHILL_PRESENT'] = fields[1].upper() - if ('J2' == fields[0].upper()): config['J2'] = float(fields[1]) - if ('J4' == fields[0].upper()): config['J4'] = float(fields[1]) - - print('Reading Swiftest file ' + config['swiftestfile']) + if ('PL_IN' == fields[0].upper()): param['PL_OLD'] = fields[1] + if ('TP_IN' == fields[0].upper()): param['TP_OLD'] = fields[1] + if ('CHK_CLOSE' == fields[0].upper()): param['CHK_CLOSE'] = fields[1].upper() + if ('RHILL_PRESENT'== fields[0].upper()): param['RHILL_PRESENT'] = fields[1].upper() + if ('J2' == fields[0].upper()): param['J2'] = float(fields[1]) + if ('J4' == fields[0].upper()): param['J4'] = float(fields[1]) + + print('Reading Swiftest file ' + param['swiftestfile']) fnew = open(swiftestfile, 'r') swiftestlines = fnew.readlines() for line in swiftestlines: fields = line.split() if len(fields) > 0: - if ('MU2KG' == fields[0].upper()): config['MU2KG'] = float(fields[1]) - if ('DU2M' == fields[0].upper()): config['DU2M'] = float(fields[1]) - if ('TU2S' == fields[0].upper()): config['TU2S'] = float(fields[1]) - if ('CB_IN' == fields[0].upper()): config['CB_NEW'] = fields[1] - if ('PL_IN' == fields[0].upper()): config['PL_NEW'] = fields[1] - if ('TP_IN' == fields[0].upper()): config['TP_NEW'] = fields[1] - if ('CHK_CLOSE' == fields[0].upper()): config['CHK_CLOSE_NEW'] = fields[1].upper() + if ('MU2KG' == fields[0].upper()): param['MU2KG'] = float(fields[1]) + if ('DU2M' == fields[0].upper()): param['DU2M'] = float(fields[1]) + if ('TU2S' == fields[0].upper()): param['TU2S'] = float(fields[1]) + if ('CB_IN' == fields[0].upper()): param['CB_NEW'] = fields[1] + if ('PL_IN' == fields[0].upper()): param['PL_NEW'] = fields[1] + if ('TP_IN' == fields[0].upper()): param['TP_NEW'] = fields[1] + if ('CHK_CLOSE' == fields[0].upper()): param['CHK_CLOSE_NEW'] = fields[1].upper() if __name__ == '__main__': - config = {'swifterfile' : "param.in", - 'swiftestfile': "config.in"} + param = {'swifterfile' : "param.in", + 'swiftestfile': "param.in"} - read_config(config) - MU2KG = config['MU2KG'] - DU2M = config['DU2M'] - TU2S = config['TU2S'] + read_param(param) + MU2KG = param['MU2KG'] + DU2M = param['DU2M'] + TU2S = param['TU2S'] - for key, val in config.items(): + for key, val in param.items(): print(key, val) GU = G / (DU2M ** 3 / (MU2KG * TU2S ** 2)) cbrad = 6.95700e8 / DU2M - plnew = open(config['PL_NEW'], 'w') - print(f'Writing out new PL file: {config["PL_NEW"]}') + plnew = open(param['PL_NEW'], 'w') + print(f'Writing out new PL file: {param["PL_NEW"]}') - with open(config['PL_OLD'], 'r') as plold: + with open(param['PL_OLD'], 'r') as plold: line = plold.readline() line = line.split("!")[0] # Ignore comments i_list = [i for i in line.split(" ") if i.strip()] @@ -81,7 +81,7 @@ def read_config(config): GMpl = float(i_list[1]) #print(f'{name} {GMpl} -> {GMpl / GU}') print(name, GMpl,file=plnew) - if config['CHK_CLOSE'] == 'YES': + if param['CHK_CLOSE'] == 'YES': line = plold.readline() i_list = [i for i in line.split(" ") if i.strip()] plrad = float(i_list[0]) @@ -104,10 +104,10 @@ def read_config(config): plold.close() plnew.close() - tpnew = open(config['TP_NEW'], 'w') + tpnew = open(param['TP_NEW'], 'w') - print(f'Writing out new TP file: {config["TP_NEW"]}') - with open(config['TP_OLD'], 'r') as tpold: + print(f'Writing out new TP file: {param["TP_NEW"]}') + with open(param['TP_OLD'], 'r') as tpold: line = tpold.readline() line = line.split("!")[0] # Ignore comments i_list = [i for i in line.split(" ") if i.strip()] @@ -138,18 +138,18 @@ def read_config(config): tpold.close() tpnew.close() - print(f'Writing out new CB file: {config["CB_NEW"]}') + print(f'Writing out new CB file: {param["CB_NEW"]}') # Write out new central body file - cbnew = open(config['CB_NEW'], 'w') + cbnew = open(param['CB_NEW'], 'w') print(f'GMsun = {GMsun} -> {GMsun / GU}') print(GMsun, file=cbnew) print(cbrad) print(cbrad, file=cbnew) - print(config['J2']) - print(config['J2'], file=cbnew) - print(config['J4']) - print(config['J4'], file=cbnew) + print(param['J2']) + print(param['J2'], file=cbnew) + print(param['J4']) + print(param['J4'], file=cbnew) cbnew.close() diff --git a/python/swiftestio/swiftestio.py b/python/swiftestio/swiftestio.py index e38a2cf04..c97af9792 100644 --- a/python/swiftestio/swiftestio.py +++ b/python/swiftestio/swiftestio.py @@ -109,22 +109,22 @@ def read_swifter_param(inparfile): return param -def read_swiftest_config(config_file_name): +def read_swiftest_param(param_file_name): """ - Reads in a Swiftest config.in file and saves it as a dictionary + Reads in a Swiftest param.in file and saves it as a dictionary Parameters ---------- - config_file_name : string + param_file_name : string File name of the input parameter file Returns ------- - config : dict + param : dict A dictionary containing the entries in the user parameter file """ - config = { - 'CONFIG_FILE_NAME' : config_file_name, + param = { + 'param_FILE_NAME' : param_file_name, 'NPLMAX' : -1, 'NTPMAX' : -1, 'T0' : 0.0, @@ -170,55 +170,55 @@ def read_swiftest_config(config_file_name): 'YORP' : 'NO', } - # Read config.in file - print(f'Reading Swiftest file {config_file_name}' ) - f = open(config_file_name, 'r') + # Read param.in file + print(f'Reading Swiftest file {param_file_name}' ) + f = open(param_file_name, 'r') swiftestlines = f.readlines() f.close() for line in swiftestlines: fields = line.split() if len(fields) > 0: - for key in config: - if (key == fields[0].upper()): config[key] = fields[1] + for key in param: + if (key == fields[0].upper()): param[key] = fields[1] #Special case of CHK_QMIN_RANGE requires a second input - if (config['CHK_QMIN_RANGE'] == fields[0].upper()): - config['QMIN_ALO'] = fields[1] - config['QMIN_AHI'] = fields[2] - - config['NPLMAX'] = int(config['NPLMAX']) - config['NTPMAX'] = int(config['NTPMAX']) - config['ISTEP_OUT'] = int(config['ISTEP_OUT']) - config['ISTEP_DUMP'] = int(config['ISTEP_DUMP']) - config['T0'] = float(config['T0']) - config['TSTOP'] = float(config['TSTOP']) - config['DT'] = float(config['DT']) - config['J2'] = float(config['J2']) - config['J4'] = float(config['J4']) - config['CHK_RMIN'] = float(config['CHK_RMIN']) - config['CHK_RMAX'] = float(config['CHK_RMAX']) - config['CHK_EJECT'] = float(config['CHK_EJECT']) - config['CHK_QMIN'] = float(config['CHK_QMIN']) - config['QMIN_ALO'] = float(config['QMIN_ALO']) - config['QMIN_AHI'] = float(config['QMIN_AHI']) - config['MTINY'] = float(config['MTINY']) - config['DU2M'] = float(config['DU2M']) - config['MU2KG'] = float(config['MU2KG']) - config['TU2S'] = float(config['TU2S']) - config['INV_C2'] = float(config['INV_C2']) - config['EXTRA_FORCE'] = config['EXTRA_FORCE'].upper() - config['BIG_DISCARD'] = config['BIG_DISCARD'].upper() - config['CHK_CLOSE'] = config['CHK_CLOSE'].upper() - config['FRAGMENTATION'] = config['FRAGMENTATION'].upper() - config['ROTATION'] = config['ROTATION'].upper() - config['TIDES'] = config['TIDES'].upper() - config['ENERGY'] = config['ENERGY'].upper() - config['GR'] = config['GR'].upper() - config['YORP'] = config['YORP'].upper() - - config['GU'] = GC / (config['DU2M']**3 / (config['MU2KG'] * config['TU2S']**2)) - config['INV_C2'] = einsteinC * config['TU2S'] / config['DU2M'] - config['INV_C2'] = config['INV_C2']**(-2) - return config + if (param['CHK_QMIN_RANGE'] == fields[0].upper()): + param['QMIN_ALO'] = fields[1] + param['QMIN_AHI'] = fields[2] + + param['NPLMAX'] = int(param['NPLMAX']) + param['NTPMAX'] = int(param['NTPMAX']) + param['ISTEP_OUT'] = int(param['ISTEP_OUT']) + param['ISTEP_DUMP'] = int(param['ISTEP_DUMP']) + param['T0'] = float(param['T0']) + param['TSTOP'] = float(param['TSTOP']) + param['DT'] = float(param['DT']) + param['J2'] = float(param['J2']) + param['J4'] = float(param['J4']) + param['CHK_RMIN'] = float(param['CHK_RMIN']) + param['CHK_RMAX'] = float(param['CHK_RMAX']) + param['CHK_EJECT'] = float(param['CHK_EJECT']) + param['CHK_QMIN'] = float(param['CHK_QMIN']) + param['QMIN_ALO'] = float(param['QMIN_ALO']) + param['QMIN_AHI'] = float(param['QMIN_AHI']) + param['MTINY'] = float(param['MTINY']) + param['DU2M'] = float(param['DU2M']) + param['MU2KG'] = float(param['MU2KG']) + param['TU2S'] = float(param['TU2S']) + param['INV_C2'] = float(param['INV_C2']) + param['EXTRA_FORCE'] = param['EXTRA_FORCE'].upper() + param['BIG_DISCARD'] = param['BIG_DISCARD'].upper() + param['CHK_CLOSE'] = param['CHK_CLOSE'].upper() + param['FRAGMENTATION'] = param['FRAGMENTATION'].upper() + param['ROTATION'] = param['ROTATION'].upper() + param['TIDES'] = param['TIDES'].upper() + param['ENERGY'] = param['ENERGY'].upper() + param['GR'] = param['GR'].upper() + param['YORP'] = param['YORP'].upper() + + param['GU'] = GC / (param['DU2M']**3 / (param['MU2KG'] * param['TU2S']**2)) + param['INV_C2'] = einsteinC * param['TU2S'] / param['DU2M'] + param['INV_C2'] = param['INV_C2']**(-2) + return param def swifter_stream(f, param): """ @@ -304,16 +304,16 @@ def swifter_stream(f, param): ntp, tpid, tvec.T, tlab -def make_swiftest_labels(config): +def make_swiftest_labels(param): tlab = [] - if config['OUT_FORM'] == 'XV': + if param['OUT_FORM'] == 'XV': tlab.append('px') tlab.append('py') tlab.append('pz') tlab.append('vx') tlab.append('vy') tlab.append('vz') - elif config['OUT_FORM'] == 'EL': + elif param['OUT_FORM'] == 'EL': tlab.append('a') tlab.append('e') tlab.append('inc') @@ -324,7 +324,7 @@ def make_swiftest_labels(config): plab.append('Mass') plab.append('Radius') clab = ['Mass', 'Radius', 'J_2', 'J_4'] - if config['ROTATION'] == 'YES': + if param['ROTATION'] == 'YES': clab.append('Ip_x') clab.append('Ip_y') clab.append('Ip_z') @@ -337,14 +337,14 @@ def make_swiftest_labels(config): plab.append('rot_x') plab.append('rot_y') plab.append('rot_z') - if config['TIDES'] == 'YES': + if param['TIDES'] == 'YES': clab.append('k2') clab.append('Q') plab.append('k2') plab.append('Q') return clab, plab, tlab -def swiftest_stream(f, config): +def swiftest_stream(f, param): """ Reads in a Swifter bin.dat file and returns a single frame of data as a datastream @@ -391,14 +391,14 @@ def swiftest_stream(f, config): Rcb = f.read_reals(np.float64) J2cb = f.read_reals(np.float64) J4cb = f.read_reals(np.float64) - if config['ROTATION'] == 'YES': + if param['ROTATION'] == 'YES': Ipcbx = f.read_reals(np.float64) Ipcby = f.read_reals(np.float64) Ipcbz = f.read_reals(np.float64) rotcbx = f.read_reals(np.float64) rotcby = f.read_reals(np.float64) rotcbz = f.read_reals(np.float64) - if config['TIDES'] == 'YES': + if param['TIDES'] == 'YES': k2cb = f.read_reals(np.float64) Qcb = f.read_reals(np.float64) if npl[0] > 0: @@ -411,14 +411,14 @@ def swiftest_stream(f, config): p6 = f.read_reals(np.float64) Mpl = f.read_reals(np.float64) Rpl = f.read_reals(np.float64) - if config['ROTATION'] == 'YES': + if param['ROTATION'] == 'YES': Ipplx = f.read_reals(np.float64) Ipply = f.read_reals(np.float64) Ipplz = f.read_reals(np.float64) rotplx = f.read_reals(np.float64) rotply = f.read_reals(np.float64) rotplz = f.read_reals(np.float64) - if config['TIDES'] == 'YES': + if param['TIDES'] == 'YES': k2pl = f.read_reals(np.float64) Qpl = f.read_reals(np.float64) if ntp[0] > 0: @@ -431,7 +431,7 @@ def swiftest_stream(f, config): t6 = f.read_reals(np.float64) cbid = np.array([0]) - clab, plab, tlab = make_swiftest_labels(config) + clab, plab, tlab = make_swiftest_labels(param) if npl > 0: pvec = np.vstack([p1,p2,p3,p4,p5,p6,Mpl,Rpl]) @@ -444,11 +444,11 @@ def swiftest_stream(f, config): tvec = np.empty((6,0)) tpid = np.empty(0) cvec = np.array([Mcb,Rcb,J2cb,J4cb]) - if config['ROTATION'] == 'YES': + if param['ROTATION'] == 'YES': cvec = np.vstack([cvec, Ipcbx, Ipcby, Ipcbz, rotcbx, rotcby, rotcbz]) if npl > 0: pvec = np.vstack([pvec, Ipplx, Ipply, Ipplz, rotplx, rotply, rotplz]) - if config['TIDES'] == 'YES': + if param['TIDES'] == 'YES': cvec = np.vstack([cvec,k2cb,Qcb]) if npl > 0: pvec = np.vstack([pvec,k2pl,Qpl]) @@ -483,14 +483,14 @@ def swifter2xr(param): ds = xr.combine_by_coords([plds, tpds]) return ds -def swiftest2xr(config): +def swiftest2xr(param): """ Converts a Swiftest binary data file into an xarray DataSet. Parameters ---------- - config : dict - Swiftest Configuration parameters + param : dict + Swiftest paramuration parameters Returns ------- @@ -501,10 +501,10 @@ def swiftest2xr(config): cb = [] pl = [] tp = [] - with FortranFile(config['BIN_OUT'], 'r') as f: + with FortranFile(param['BIN_OUT'], 'r') as f: for t, cbid, cvec, clab, \ npl, plid, pvec, plab, \ - ntp, tpid, tvec, tlab in swiftest_stream(f, config): + ntp, tpid, tvec, tlab in swiftest_stream(f, param): #Prepare frames by adding an extra axis for the time coordinate cbframe = np.expand_dims(cvec, axis=0) @@ -530,14 +530,14 @@ def swiftest2xr(config): ds = xr.combine_by_coords([cbds, plds, tpds]) return ds -def solar_system_pl(config, ephemerides_start_date): +def solar_system_pl(param, ephemerides_start_date): """ Initializes a Swiftest dataset containing the major planets of the Solar System at a particular data from JPL/Horizons Parameters ---------- - config : dict - Swiftest Configuration parameters. This method uses the unit conversion factors to convert from JPL's AU-day system into the system specified in the config file + param : dict + Swiftest paramuration parameters. This method uses the unit conversion factors to convert from JPL's AU-day system into the system specified in the param file ephemerides_start_date : string Date to use when obtaining the ephemerides in the format YYYY-MM-DD @@ -585,15 +585,15 @@ def solar_system_pl(config, ephemerides_start_date): } # Unit conversion factors - DCONV = AU2M / config['DU2M'] - VCONV = (AU2M / JD2S) / (config['DU2M'] / config['TU2S']) + DCONV = AU2M / param['DU2M'] + VCONV = (AU2M / JD2S) / (param['DU2M'] / param['TU2S']) THIRDLONG = np.longdouble(1.0) / np.longdouble(3.0) # Central body value vectors - GMcb = np.array([GMSunSI * config['TU2S']**2 / config['DU2M']**3]) - Rcb = np.array([RSun / config['DU2M']]) - J2RP2 = np.array([J2Sun * (RSun / config['DU2M'])**2]) - J4RP4 = np.array([J4Sun * (RSun / config['DU2M'])**4]) + GMcb = np.array([GMSunSI * param['TU2S']**2 / param['DU2M']**3]) + Rcb = np.array([RSun / param['DU2M']]) + J2RP2 = np.array([J2Sun * (RSun / param['DU2M'])**2]) + J4RP4 = np.array([J4Sun * (RSun / param['DU2M'])**4]) cbid = np.array([0]) cvec = np.vstack([GMcb, Rcb, J2RP2, J4RP4]) @@ -620,14 +620,14 @@ def solar_system_pl(config, ephemerides_start_date): pldata[key] = Horizons(id=val, id_type='majorbody', location='@sun', epochs={'start': ephemerides_start_date, 'stop': ephemerides_end_date, 'step': ephemerides_step}) - if config['OUT_FORM'] == 'XV': + if param['OUT_FORM'] == 'XV': p1.append(pldata[key].vectors()['x'][0] * DCONV) p2.append(pldata[key].vectors()['y'][0] * DCONV) p3.append(pldata[key].vectors()['z'][0] * DCONV) p4.append(pldata[key].vectors()['vx'][0] * VCONV) p5.append(pldata[key].vectors()['vy'][0] * VCONV) p6.append(pldata[key].vectors()['vz'][0] * VCONV) - elif config['OUT_FORM'] == 'EL': + elif param['OUT_FORM'] == 'EL': p1.append(pldata[key].elements()['a'][0] * DCONV) p2.append(pldata[key].elements()['e'][0]) p3.append(pldata[key].elements()['inc'][0] * np.pi / 180.0) @@ -647,7 +647,7 @@ def solar_system_pl(config, ephemerides_start_date): tp = [] t = np.array([0.0]) - clab, plab, tlab = make_swiftest_labels(config) + clab, plab, tlab = make_swiftest_labels(param) #Prepare frames by adding an extra axis for the time coordinate cbframe = np.expand_dims(cvec.T, axis=0) @@ -668,7 +668,7 @@ def solar_system_pl(config, ephemerides_start_date): ds = xr.combine_by_coords([cbds, plds]) return ds -def swiftest_xr2_infile(ds, config, framenum=-1): +def swiftest_xr2_infile(ds, param, framenum=-1): """ Writes a set of Swiftest input files from a single frame of a Swiftest xarray dataset @@ -678,8 +678,8 @@ def swiftest_xr2_infile(ds, config, framenum=-1): Dataset containing Swiftest n-body data in XV format framenum : int Time frame to use to generate the initial conditions. If this argument is not passed, the default is to use the last frame in the dataset. - config : dict - Swiftest Configuration parameters. This method uses the names of the cb, pl, and tp files from the configuration + param : dict + Swiftest paramuration parameters. This method uses the names of the cb, pl, and tp files from the paramuration Returns ------- @@ -696,16 +696,16 @@ def swiftest_xr2_infile(ds, config, framenum=-1): J2 = np.double(cb['J_2']) J4 = np.double(cb['J_4']) - if config['IN_TYPE'] == 'ASCII': + if param['IN_TYPE'] == 'ASCII': # Swiftest Central body file - cbfile = open(config['CB_IN'], 'w') + cbfile = open(param['CB_IN'], 'w') print(GMSun, file=cbfile) print(RSun, file=cbfile) print(J2, file=cbfile) print(J4, file=cbfile) cbfile.close() - plfile = open(config['PL_IN'], 'w') + plfile = open(param['PL_IN'], 'w') print(pl.id.count().values, file=plfile) for i in pl.id: pli = pl.sel(id=i) @@ -716,7 +716,7 @@ def swiftest_xr2_infile(ds, config, framenum=-1): plfile.close() # TP file - tpfile = open(config['TP_IN'], 'w') + tpfile = open(param['TP_IN'], 'w') print(tp.id.count().values, file=tpfile) for i in tp.id: tpi = tp.sel(id=i) @@ -724,7 +724,7 @@ def swiftest_xr2_infile(ds, config, framenum=-1): print(tpi['px'].values, tpi['py'].values, tpi['pz'].values, file=tpfile) print(tpi['vx'].values, tpi['vy'].values, tpi['vz'].values, file=tpfile) tpfile.close() - elif config['IN_TYPE'] == 'REAL8': + elif param['IN_TYPE'] == 'REAL8': # Now make Swiftest files cbfile = FortranFile(swiftest_cb, 'w') Msun = np.double(1.0) @@ -758,7 +758,7 @@ def swiftest_xr2_infile(ds, config, framenum=-1): tpfile.write_record(v_tp[1]) tpfile.write_record(v_tp[2]) else: - print(f"{config['IN_TYPE']} is an unknown file type") + print(f"{param['IN_TYPE']} is an unknown file type") if __name__ == '__main__': workingdir = '/Users/daminton/git/swiftest/examples/rmvs_swifter_comparison/9pl_18tp_encounters/' @@ -766,17 +766,17 @@ def swiftest_xr2_infile(ds, config, framenum=-1): #param = read_swifter_param(inparfile) #param['BIN_OUT'] = workingdir + param['BIN_OUT'] - config_file_name = workingdir + 'config.swiftest.in' - config = read_swiftest_config(config_file_name) - config['BIN_OUT'] = workingdir + config['BIN_OUT'] - ds = solar_system_pl(config, '2020-06-17') + param_file_name = workingdir + 'param.swiftest.in' + param = read_swiftest_param(param_file_name) + param['BIN_OUT'] = workingdir + param['BIN_OUT'] + ds = solar_system_pl(param, '2020-06-17') ds - #swiftestdat = swiftest2xr(config) - config['CB_IN'] = workingdir + 'cb_test.in' - config['PL_IN'] = workingdir + 'pl_test.in' - config['TP_IN'] = workingdir + 'tp_test.in' - swiftest_xr2_infile(ds, config) + #swiftestdat = swiftest2xr(param) + param['CB_IN'] = workingdir + 'cb_test.in' + param['PL_IN'] = workingdir + 'pl_test.in' + param['TP_IN'] = workingdir + 'tp_test.in' + swiftest_xr2_infile(ds, param) #swifterdat = swifter2xr(param) #print(swiftestdat['a']) #print(swiftestdf.head()) diff --git a/src/discard/discard.f90 b/src/discard/discard.f90 index f46f802d0..513a59122 100644 --- a/src/discard/discard.f90 +++ b/src/discard/discard.f90 @@ -1,7 +1,7 @@ submodule (swiftest_classes) s_discard use swiftest contains - module subroutine discard_system(self, config) + module subroutine discard_system(self, param) !! author: David A. Minton !! !! Check to see if particles should be discarded based on their positions relative to the massive bodies @@ -10,36 +10,36 @@ module subroutine discard_system(self, config) !! Adapted from Hal Levison's Swift routine discard.f implicit none class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters if (self%tp%nbody == 0) return select type(self) class is (whm_nbody_system) - associate(cb => self%cb, pl => self%pl, tp => self%tp, t => config%t, dt => config%dt, & + associate(cb => self%cb, pl => self%pl, tp => self%tp, t => param%t, dt => param%dt, & msys => self%msys, discards => self%tp_discards, & ntp => self%tp%nbody, ldiscard => self%tp%ldiscard) - if ((config%rmin >= 0.0_DP) .or. (config%rmax >= 0.0_DP) .or. & - (config%rmaxu >= 0.0_DP) .or. ((config%qmin >= 0.0_DP) .and. (config%qmin_coord == "BARY"))) then + if ((param%rmin >= 0.0_DP) .or. (param%rmax >= 0.0_DP) .or. & + (param%rmaxu >= 0.0_DP) .or. ((param%qmin >= 0.0_DP) .and. (param%qmin_coord == "BARY"))) then call pl%h2b(cb) if (ntp > 0) call tp%h2b(cb) end if - if ((config%rmin >= 0.0_DP) .or. (config%rmax >= 0.0_DP) .or. (config%rmaxu >= 0.0_DP)) then - if (ntp > 0) call tp%discard_sun(cb, config, t, msys) + if ((param%rmin >= 0.0_DP) .or. (param%rmax >= 0.0_DP) .or. (param%rmaxu >= 0.0_DP)) then + if (ntp > 0) call tp%discard_sun(cb, param, t, msys) end if - if (config%qmin >= 0.0_DP .and. ntp > 0) call tp%discard_peri(cb, pl, config, t, msys) - if (config%lclose .and. ntp > 0) call tp%discard_pl(pl, t, dt) + if (param%qmin >= 0.0_DP .and. ntp > 0) call tp%discard_peri(cb, pl, param, t, msys) + if (param%lclose .and. ntp > 0) call tp%discard_pl(pl, t, dt) if (any(tp%ldiscard(1:ntp))) then ! Spill the discards to the spill list call tp%spill(discards, ldiscard) - call self%write_discard(config, discards) + call self%write_discard(param, discards) end if end associate end select return end subroutine discard_system - module subroutine discard_sun_tp(self, cb, config, t, msys) + module subroutine discard_sun_tp(self, cb, param, t, msys) !! author: David A. Minton !! !! Check to see if test particles should be discarded based on their positions relative to the Sun @@ -51,7 +51,7 @@ module subroutine discard_sun_tp(self, cb, config, t, msys) ! Arguments class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object - class(swiftest_configuration), intent(in) :: config !! configuration parameters + class(swiftest_parameters), intent(in) :: param !! parameters parameters real(DP), intent(in) :: t !! Current simulation tim real(DP), intent(in) :: msys !! Total system mass ! Internals @@ -59,21 +59,21 @@ module subroutine discard_sun_tp(self, cb, config, t, msys) real(DP) :: energy, vb2, rb2, rh2, rmin2, rmax2, rmaxu2 associate(tp => self, ntp => self%nbody) - rmin2 = max(config%rmin * config%rmin, cb%radius * cb%radius) - rmax2 = config%rmax**2 - rmaxu2 = config%rmaxu**2 + rmin2 = max(param%rmin * param%rmin, cb%radius * cb%radius) + rmax2 = param%rmax**2 + rmaxu2 = param%rmaxu**2 do i = 1, ntp if (tp%status(i) == ACTIVE) then rh2 = dot_product(tp%xh(:, i), tp%xh(:, i)) - if ((config%rmax >= 0.0_DP) .and. (rh2 > rmax2)) then + if ((param%rmax >= 0.0_DP) .and. (rh2 > rmax2)) then tp%status(i) = DISCARDED_RMAX write(*, *) "Particle ", tp%name(i), " too far from sun at t = ", t tp%ldiscard(i) = .true. - else if ((config%rmin >= 0.0_DP) .and. (rh2 < rmin2)) then + else if ((param%rmin >= 0.0_DP) .and. (rh2 < rmin2)) then tp%status(i) = DISCARDED_RMIN write(*, *) "Particle ", tp%name(i), " too close to sun at t = ", t tp%ldiscard(i) = .true. - else if (config%rmaxu >= 0.0_DP) then + else if (param%rmaxu >= 0.0_DP) then rb2 = dot_product(tp%xb(:, i), tp%xb(:, i)) vb2 = dot_product(tp%vb(:, i), tp%vb(:, i)) energy = 0.5_DP * vb2 - msys / sqrt(rb2) @@ -90,7 +90,7 @@ module subroutine discard_sun_tp(self, cb, config, t, msys) return end subroutine discard_sun_tp - module subroutine discard_peri_tp(self, cb, pl, config, t, msys) + module subroutine discard_peri_tp(self, cb, pl, param, t, msys) !! author: David A. Minton !! !! Check to see if a test particle should be discarded because its perihelion distance becomes too small @@ -102,7 +102,7 @@ module subroutine discard_peri_tp(self, cb, pl, config, t, msys) class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object class(swiftest_pl), intent(inout) :: pl !! Swiftest massive body object - class(swiftest_configuration), intent(in) :: config !! configuration parameters + class(swiftest_parameters), intent(in) :: param !! parameters parameters real(DP), intent(in) :: t !! Current simulation tim real(DP), intent(in) :: msys !! Total system mass ! Internals @@ -111,13 +111,13 @@ module subroutine discard_peri_tp(self, cb, pl, config, t, msys) real(DP) :: r2 real(DP), dimension(NDIM) :: dx - associate(tp => self, ntp => self%nbody, npl => pl%nbody, qmin_coord => config%qmin_coord) + associate(tp => self, ntp => self%nbody, npl => pl%nbody, qmin_coord => param%qmin_coord) if (lfirst) then call util_hills(npl, pl) - call util_peri(lfirst, ntp, tp, cb%Gmass, msys, config%qmin_coord) + call util_peri(lfirst, ntp, tp, cb%Gmass, msys, param%qmin_coord) lfirst = .false. else - call util_peri(lfirst, ntp, tp, cb%Gmass, msys, config%qmin_coord) + call util_peri(lfirst, ntp, tp, cb%Gmass, msys, param%qmin_coord) do i = 1, ntp if (tp%status(i) == ACTIVE) then if (tp%isperi(i) == 0) then @@ -128,9 +128,9 @@ module subroutine discard_peri_tp(self, cb, pl, config, t, msys) if (r2 <= (pl%rhill(j))**2) ih = 0 end do if (ih == 1) then - if ((tp%atp(i) >= config%qmin_alo) .and. & - (tp%atp(i) <= config%qmin_ahi) .and. & - (tp%peri(i) <= config%qmin)) then + if ((tp%atp(i) >= param%qmin_alo) .and. & + (tp%atp(i) <= param%qmin_ahi) .and. & + (tp%peri(i) <= param%qmin)) then tp%status(i) = DISCARDED_PERI write(*, *) "Particle ", tp%name(i), " perihelion distance too small at t = ", t tp%ldiscard(i) = .true. diff --git a/src/gr/gr.f90 b/src/gr/gr.f90 index 134038d5a..d50968ad1 100644 --- a/src/gr/gr.f90 +++ b/src/gr/gr.f90 @@ -14,7 +14,7 @@ real(DP) :: rmag, rdotv, vmag2 integer(I4B) :: i - associate(n => self%nbody, msun => cb%Gmass, vbsun => cb%vb, xbsun => cb%xb, mu => self%mu, c2 => config%inv_c2, & + associate(n => self%nbody, msun => cb%Gmass, vbsun => cb%vb, xbsun => cb%xb, mu => self%mu, c2 => param%inv_c2, & xb => self%xb, vb => self%vb) if (n == 0) return do i = 1, n diff --git a/src/helio/helio_drift.f90 b/src/helio/helio_drift.f90 index e03ff98bf..15b2ce94a 100644 --- a/src/helio/helio_drift.f90 +++ b/src/helio/helio_drift.f90 @@ -1,7 +1,7 @@ submodule (helio_classes) s_helio_drift use swiftest contains - module subroutine helio_drift_pl(self, cb, config, dt) + module subroutine helio_drift_pl(self, cb, param, dt) !! author: David A. Minton !! !! Loop through massive bodies and call Danby drift routine @@ -13,7 +13,7 @@ module subroutine helio_drift_pl(self, cb, config, dt) ! Arguments class(helio_pl), intent(inout) :: self !! Helio test particle data structure class(swiftest_cb), intent(inout) :: cb !! Helio central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: dt !! Stepsize ! Internals integer(I4B) :: i !! Loop counter @@ -33,12 +33,12 @@ module subroutine helio_drift_pl(self, cb, config, dt) iflag(:) = 0 allocate(dtp(npl)) - if (config%lgr) then + if (param%lgr) then do i = 1,npl rmag = norm2(xh(:, i)) vmag2 = dot_product(vb(:, i), vb(:, i)) energy = 0.5_DP * vmag2 - mu(i) / rmag - dtp(i) = dt * (1.0_DP + 3 * config%inv_c2 * energy) + dtp(i) = dt * (1.0_DP + 3 * param%inv_c2 * energy) end do else dtp(:) = dt @@ -95,7 +95,7 @@ module subroutine helio_drift_linear_pl(self, cb, dt, pt) end subroutine helio_drift_linear_pl - module subroutine helio_drift_tp(self, cb, config, dt) + module subroutine helio_drift_tp(self, cb, param, dt) !! author: David A. Minton !! !! Loop through test particles and call Danby drift routine @@ -106,7 +106,7 @@ module subroutine helio_drift_tp(self, cb, config, dt) ! Arguments class(helio_tp), intent(inout) :: self !! Helio test particle data structure class(swiftest_cb), intent(inout) :: cb !! Helio central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: dt !! Stepsize ! Internals integer(I4B) :: i !! Loop counter @@ -127,12 +127,12 @@ module subroutine helio_drift_tp(self, cb, config, dt) iflag(:) = 0 allocate(dtp(ntp)) - if (config%lgr) then + if (param%lgr) then do i = 1,ntp rmag = norm2(xh(:, i)) vmag2 = dot_product(vh(:, i), vh(:, i)) energy = 0.5_DP * vmag2 - mu(i) / rmag - dtp(i) = dt * (1.0_DP + 3 * config%inv_c2 * energy) + dtp(i) = dt * (1.0_DP + 3 * param%inv_c2 * energy) end do else dtp(:) = dt diff --git a/src/helio/helio_getacch.f90 b/src/helio/helio_getacch.f90 index 0ac8de225..14fd76b4a 100644 --- a/src/helio/helio_getacch.f90 +++ b/src/helio/helio_getacch.f90 @@ -1,7 +1,7 @@ submodule (helio_classes) s_helio_getacch use swiftest contains - module subroutine helio_getacch_pl(self, cb, config, t) + module subroutine helio_getacch_pl(self, cb, param, t) !! author: David A. Minton !! !! Compute heliocentric accelerations of massive bodies @@ -12,7 +12,7 @@ module subroutine helio_getacch_pl(self, cb, config, t) ! Arguments class(helio_pl), intent(inout) :: self !! Helio massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time ! Internals logical, save :: lmalloc = .true. @@ -26,17 +26,17 @@ module subroutine helio_getacch_pl(self, cb, config, t) self%ahi(:,2:npl) = 0.0_DP call helio_getacch_int_pl(self, t) !end if - !if (config%loblatecb) call self%obl_acc(cb) TODO: Fix this + !if (param%loblatecb) call self%obl_acc(cb) TODO: Fix this !else self%ah(:,:) = self%ahi(:,:) !end if - if (config%lextra_force) call self%user_getacch(cb, config, t) + if (param%lextra_force) call self%user_getacch(cb, param, t) end associate return end subroutine helio_getacch_pl - module subroutine helio_getacch_tp(self, cb, pl, config, t, xh) + module subroutine helio_getacch_tp(self, cb, pl, param, t, xh) !! author: David A. Minton !! !! Compute heliocentric accelerations of test particles @@ -48,7 +48,7 @@ module subroutine helio_getacch_tp(self, cb, pl, config, t, xh) class(helio_tp), intent(inout) :: self !! Helio test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree class(whm_pl), intent(inout) :: pl !! WHM massive body particle data structure. - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), dimension(:,:), intent(in) :: xh !! Heliocentric positions of planets ! Internals @@ -64,10 +64,10 @@ module subroutine helio_getacch_tp(self, cb, pl, config, t, xh) self%ahi(:,:) = 0.0_DP call helio_getacch_int_tp(self, pl, t, xh) !end if - !if (config%loblatecb) call self%obl_acc(cb) TODO: Fix this + !if (param%loblatecb) call self%obl_acc(cb) TODO: Fix this self%ah(:,:) = self%ahi(:,:) - if (config%lextra_force) call self%user_getacch(cb, config, t) - if (config%lgr) call self%gr_getacch(cb, config) + if (param%lextra_force) call self%user_getacch(cb, param, t) + if (param%lgr) call self%gr_getacch(cb, param) end associate return end subroutine helio_getacch_tp diff --git a/src/helio/helio_step.f90 b/src/helio/helio_step.f90 index d31781e45..df92c58c1 100644 --- a/src/helio/helio_step.f90 +++ b/src/helio/helio_step.f90 @@ -1,7 +1,7 @@ submodule(helio_classes) s_helio_step use swiftest contains - module subroutine helio_step_system(self, config) + module subroutine helio_step_system(self, param) !! author: David A. Minton !! !! Step massive bodies and and active test particles ahead in heliocentric coordinates @@ -11,7 +11,7 @@ module subroutine helio_step_system(self, config) implicit none ! Arguments class(helio_nbody_system), intent(inout) :: self !! Helio nbody system object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters select type(cb => self%cb) class is (helio_cb) @@ -19,13 +19,13 @@ module subroutine helio_step_system(self, config) class is (helio_pl) select type(tp => self%tp) class is (helio_tp) - associate(ntp => tp%nbody, npl => pl%nbody, t => config%t, dt => config%dt) + associate(ntp => tp%nbody, npl => pl%nbody, t => param%t, dt => param%dt) call pl%set_rhill(cb) call tp%set_beg_end(xbeg = pl%xh) - call pl%step(cb, config, t, dt) + call pl%step(cb, param, t, dt) if (ntp > 0) then call tp%set_beg_end(xend = pl%xh) - call tp%step(cb, pl, config, t, dt) + call tp%step(cb, pl, param, t, dt) end if end associate end select @@ -34,7 +34,7 @@ module subroutine helio_step_system(self, config) return end subroutine helio_step_system - module subroutine helio_step_pl(self, cb, config, t, dt) + module subroutine helio_step_pl(self, cb, param, t, dt) !! author: David A. Minton !! !! Step massive bodies ahead Democratic Heliocentric method @@ -45,7 +45,7 @@ module subroutine helio_step_pl(self, cb, config, t, dt) ! Arguments class(helio_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Helio central body particle data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), intent(in) :: dt !! Stepsize ! Internals @@ -61,10 +61,10 @@ module subroutine helio_step_pl(self, cb, config, t, dt) lfirst = .false. end if call self%lindrift(cb, dth, ptbeg) - call self%getacch(cb, config, t) + call self%getacch(cb, param, t) call self%kickvb(dth) - call self%drift(cb, config, dt) - call self%getacch(cb, config, t + dt) + call self%drift(cb, param, dt) + call self%getacch(cb, param, t + dt) call self%kickvb(dth) call self%lindrift(cb, dth, ptend) call self%vb2vh(cb) @@ -73,7 +73,7 @@ module subroutine helio_step_pl(self, cb, config, t, dt) end subroutine helio_step_pl - module subroutine helio_step_tp(self, cb, pl, config, t, dt) + module subroutine helio_step_tp(self, cb, pl, param, t, dt) !! author: David A. Minton !! !! Step active test particles ahead using Democratic Heliocentric method @@ -85,7 +85,7 @@ module subroutine helio_step_tp(self, cb, pl, config, t, dt) class(helio_tp), intent(inout) :: self !! Helio test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure class(whm_pl), intent(inout) :: pl !! WHM massive body data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), intent(in) :: dt !! Stepsize ! Internals @@ -101,10 +101,10 @@ module subroutine helio_step_tp(self, cb, pl, config, t, dt) lfirst = .false. end if call self%lindrift(dth, self%ptbeg) - call self%getacch(cb, pl, config, t, self%xbeg) + call self%getacch(cb, pl, param, t, self%xbeg) call self%kickvb(dth) - call self%drift(cb, config, dt) - call self%getacch(cb, pl, config, t + dt, self%xend) + call self%drift(cb, param, dt) + call self%getacch(cb, pl, param, t + dt, self%xend) call self%kickvb(dth) call self%lindrift(dth, self%ptend) call self%vb2vh(vbcb = -self%ptend) diff --git a/src/io/io.f90 b/src/io/io.f90 index e8017223d..b0a188d35 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -1,7 +1,7 @@ submodule (swiftest_classes) s_io use swiftest contains - module subroutine io_config_reader(self, unit, iotype, v_list, iostat, iomsg) + module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg) !! author: The Purdue Swiftest Team - David A. Minton, Carlisle A. Wishard, Jennifer L.L. Pouplin, and Jacob R. Elliott !! !! Read in parameters for the integration @@ -9,11 +9,11 @@ module subroutine io_config_reader(self, unit, iotype, v_list, iostat, iomsg) !! e.g. read(unit,'(DT)') param !! as the newline characters are ignored in the input file when compiled in ifort. !! - !! Adapted from David E. Kaufmann's Swifter routine io_init_config.f90 - !! Adapted from Martin Duncan's Swift routine io_init_config.f + !! Adapted from David E. Kaufmann's Swifter routine io_init_param.f90 + !! Adapted from Martin Duncan's Swift routine io_init_param.f implicit none ! Arguments - class(swiftest_configuration), intent(inout) :: self !! Collection of configuration parameters + class(swiftest_parameters), intent(inout) :: self !! Collection of parameters parameters integer, intent(in) :: unit !! File unit number character(len=*), intent(in) :: iotype !! Dummy argument passed to the input/output procedure contains the text from the char-literal-constant, prefixed with DT. !! If you do not include a char-literal-constant, the iotype argument contains only DT. @@ -27,7 +27,7 @@ module subroutine io_config_reader(self, unit, iotype, v_list, iostat, iomsg) logical :: mtiny_set = .false. !! Is the mtiny value set? integer(I4B) :: ilength, ifirst, ilast !! Variables used to parse input file character(STRMAX) :: line !! Line of the input file - character (len=:), allocatable :: line_trim,config_name, config_value !! Strings used to parse the config file + character (len=:), allocatable :: line_trim,param_name, param_value !! Strings used to parse the param file character(*),parameter :: linefmt = '(A)' !! Format code for simple text string integer(I4B) :: integrator !! Symbolic name of integrator being used @@ -40,108 +40,108 @@ module subroutine io_config_reader(self, unit, iotype, v_list, iostat, iomsg) if ((ilength /= 0)) then ifirst = 1 ! Read the pair of tokens. The first one is the parameter name, the second is the value. - config_name = io_get_token(line_trim, ifirst, ilast, iostat) - if (config_name == '') cycle ! No parameter name (usually because this line is commented out) - call util_toupper(config_name) + param_name = io_get_token(line_trim, ifirst, ilast, iostat) + if (param_name == '') cycle ! No parameter name (usually because this line is commented out) + call util_toupper(param_name) ifirst = ilast + 1 - config_value = io_get_token(line_trim, ifirst, ilast, iostat) - select case (config_name) + param_value = io_get_token(line_trim, ifirst, ilast, iostat) + select case (param_name) case ("NPLMAX") - read(config_value, *) self%nplmax + read(param_value, *) self%nplmax case ("NTPMAX") - read(config_value, *) self%ntpmax + read(param_value, *) self%ntpmax case ("T0") - read(config_value, *) self%t0 + read(param_value, *) self%t0 t0_set = .true. case ("TSTOP") - read(config_value, *) self%tstop + read(param_value, *) self%tstop tstop_set = .true. case ("DT") - read(config_value, *) self%dt + read(param_value, *) self%dt dt_set = .true. case ("CB_IN") - self%incbfile = config_value + self%incbfile = param_value case ("PL_IN") - self%inplfile = config_value + self%inplfile = param_value case ("TP_IN") - self%intpfile = config_value + self%intpfile = param_value case ("IN_TYPE") - call util_toupper(config_value) - self%in_type = config_value + call util_toupper(param_value) + self%in_type = param_value case ("ISTEP_OUT") - read(config_value, *) self%istep_out + read(param_value, *) self%istep_out case ("BIN_OUT") - self%outfile = config_value + self%outfile = param_value case ("OUT_TYPE") - call util_toupper(config_value) - self%out_type = config_value + call util_toupper(param_value) + self%out_type = param_value case ("OUT_FORM") - call util_toupper(config_value) - self%out_form = config_value + call util_toupper(param_value) + self%out_form = param_value case ("OUT_STAT") - call util_toupper(config_value) - self%out_stat = config_value + call util_toupper(param_value) + self%out_stat = param_value case ("ISTEP_DUMP") - read(config_value, *) self%istep_dump + read(param_value, *) self%istep_dump case ("CHK_CLOSE") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T') self%lclose = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T') self%lclose = .true. case ("CHK_RMIN") - read(config_value, *) self%rmin + read(param_value, *) self%rmin case ("CHK_RMAX") - read(config_value, *) self%rmax + read(param_value, *) self%rmax case ("CHK_EJECT") - read(config_value, *) self%rmaxu + read(param_value, *) self%rmaxu case ("CHK_QMIN") - read(config_value, *) self%qmin + read(param_value, *) self%qmin case ("CHK_QMIN_COORD") - call util_toupper(config_value) - self%qmin_coord = config_value + call util_toupper(param_value) + self%qmin_coord = param_value case ("CHK_QMIN_RANGE") - read(config_value, *) self%qmin_alo + read(param_value, *) self%qmin_alo ifirst = ilast + 1 - config_value = io_get_token(line, ifirst, ilast, iostat) - read(config_value, *) self%qmin_ahi + param_value = io_get_token(line, ifirst, ilast, iostat) + read(param_value, *) self%qmin_ahi case ("ENC_OUT") - self%encounter_file = config_value + self%encounter_file = param_value case ("EXTRA_FORCE") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T') self%lextra_force = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T') self%lextra_force = .true. case ("BIG_DISCARD") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T' ) self%lbig_discard = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T' ) self%lbig_discard = .true. case ("FRAGMENTATION") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == "T") self%lfragmentation = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == "T") self%lfragmentation = .true. case ("MU2KG") - read(config_value, *) self%MU2KG + read(param_value, *) self%MU2KG case ("TU2S") - read(config_value, *) self%TU2S + read(param_value, *) self%TU2S case ("DU2M") - read(config_value, *) self%DU2M + read(param_value, *) self%DU2M case ("MTINY") - read(config_value, *) self%mtiny + read(param_value, *) self%mtiny mtiny_set = .true. case ("ENERGY") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T') self%lenergy = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T') self%lenergy = .true. case ("ROTATION") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T') self%lrotation = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T') self%lrotation = .true. case ("TIDES") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T') self%ltides = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T') self%ltides = .true. case ("GR") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T') self%lgr = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T') self%lgr = .true. case ("YARKOVSKY") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T') self%lyarkovsky = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T') self%lyarkovsky = .true. case ("YORP") - call util_toupper(config_value) - if (config_value == "YES" .or. config_value == 'T') self%lyorp = .true. + call util_toupper(param_value) + if (param_value == "YES" .or. param_value == 'T') self%lyorp = .true. case default - write(iomsg,*) "Unknown parameter -> ",config_name + write(iomsg,*) "Unknown parameter -> ",param_name iostat = -1 return end select @@ -305,18 +305,18 @@ module subroutine io_config_reader(self, unit, iotype, v_list, iostat, iomsg) iostat = 0 return - end subroutine io_config_reader + end subroutine io_param_reader - module subroutine io_config_writer(self, unit, iotype, v_list, iostat, iomsg) + module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg) !! author: David A. Minton !! !! Dump integration parameters to file !! - !! Adapted from David E. Kaufmann's Swifter routine io_dump_config.f90 - !! Adapted from Martin Duncan's Swift routine io_dump_config.f + !! Adapted from David E. Kaufmann's Swifter routine io_dump_param.f90 + !! Adapted from Martin Duncan's Swift routine io_dump_param.f implicit none ! Arguments - class(swiftest_configuration),intent(in) :: self !! Collection of configuration parameters + class(swiftest_parameters),intent(in) :: self !! Collection of parameters parameters integer, intent(in) :: unit !! File unit number character(len=*), intent(in) :: iotype !! Dummy argument passed to the input/output procedure contains the text from the char-literal-constant, prefixed with DT. !! If you do not include a char-literal-constant, the iotype argument contains only DT. @@ -394,19 +394,19 @@ module subroutine io_config_writer(self, unit, iotype, v_list, iostat, iomsg) !write(unit, Lfmt) "YORP", self%lyorp return - end subroutine io_config_writer + end subroutine io_param_writer - module subroutine io_dump_config(self, config_file_name, t, dt) + module subroutine io_dump_param(self, param_file_name, t, dt) !! author: David A. Minton !! !! Dump integration parameters to file !! - !! Adapted from David E. Kaufmann's Swifter routine io_dump_config.f90 - !! Adapted from Martin Duncan's Swift routine io_dump_config.f + !! Adapted from David E. Kaufmann's Swifter routine io_dump_param.f90 + !! Adapted from Martin Duncan's Swift routine io_dump_param.f implicit none ! Arguments - class(swiftest_configuration),intent(in) :: self !! Output collection of parameters - character(len=*), intent(in) :: config_file_name !! Parameter input file name (i.e. param.in) + class(swiftest_parameters),intent(in) :: self !! Output collection of parameters + character(len=*), intent(in) :: param_file_name !! Parameter input file name (i.e. param.in) real(DP),intent(in) :: t !! Current simulation time real(DP),intent(in) :: dt !! Step size ! Internals @@ -414,16 +414,16 @@ module subroutine io_dump_config(self, config_file_name, t, dt) integer(I4B) :: ierr !! Error code character(STRMAX) :: error_message !! Error message in UDIO procedure - open(unit = LUN, file = config_file_name, status='replace', form = 'FORMATTED', iostat =ierr) + open(unit = LUN, file = param_file_name, status='replace', form = 'FORMATTED', iostat =ierr) if (ierr /=0) then write(*,*) 'Swiftest error.' - write(*,*) ' Could not open dump file: ',trim(adjustl(config_file_name)) + write(*,*) ' Could not open dump file: ',trim(adjustl(param_file_name)) call util_exit(FAILURE) end if !! todo: Currently this procedure does not work in user-defined derived-type input mode !! due to compiler incompatabilities - !write(LUN,'(DT)') config + !write(LUN,'(DT)') param call self%writer(LUN, iotype = "none", v_list = [0], iostat = ierr, iomsg = error_message) if (ierr /= 0) then write(*,*) trim(adjustl(error_message)) @@ -432,9 +432,9 @@ module subroutine io_dump_config(self, config_file_name, t, dt) close(LUN) return - end subroutine io_dump_config + end subroutine io_dump_param - module subroutine io_dump_swiftest(self, config, t, dt, msg) + module subroutine io_dump_swiftest(self, param, t, dt, msg) !! author: David A. Minton !! !! Dump massive body data to files @@ -444,7 +444,7 @@ module subroutine io_dump_swiftest(self, config, t, dt, msg) implicit none ! Arguments class(swiftest_base), intent(inout) :: self !! Swiftest base object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Stepsize character(*), optional, intent(in) :: msg !! Message to display with dump operation @@ -456,11 +456,11 @@ module subroutine io_dump_swiftest(self, config, t, dt, msg) select type(self) class is(swiftest_cb) - dump_file_name = trim(adjustl(config%incbfile)) + dump_file_name = trim(adjustl(param%incbfile)) class is (swiftest_pl) - dump_file_name = trim(adjustl(config%inplfile)) + dump_file_name = trim(adjustl(param%inplfile)) class is (swiftest_tp) - dump_file_name = trim(adjustl(config%intpfile)) + dump_file_name = trim(adjustl(param%intpfile)) end select open(unit = iu, file = dump_file_name, form = "UNFORMATTED", status = 'replace', iostat = ierr) if (ierr /= 0) then @@ -468,13 +468,13 @@ module subroutine io_dump_swiftest(self, config, t, dt, msg) write(*, *) " Unable to open binary dump file " // dump_file_name call util_exit(FAILURE) end if - call self%write_frame(iu, config, t, dt) + call self%write_frame(iu, param, t, dt) close(LUN) return end subroutine io_dump_swiftest - module subroutine io_dump_system(self, config, t, dt, msg) + module subroutine io_dump_system(self, param, t, dt, msg) !! author: David A. Minton !! !! Dumps the state of the system to files in case the simulation is interrupted. @@ -483,50 +483,50 @@ module subroutine io_dump_system(self, config, t, dt, msg) implicit none ! Arguments class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Stepsize character(*), optional, intent(in) :: msg !! Message to display with dump operation ! Internals - class(swiftest_configuration), allocatable :: dump_config !! Local configuration variable used to configuration change input file names + class(swiftest_parameters), allocatable :: dump_param !! Local parameters variable used to parameters change input file names !! to dump file-specific values without changing the user-defined values integer(I4B), save :: idx = 1 !! Index of current dump file. Output flips between 2 files for extra security !! in case the program halts during writing - character(len=:), allocatable :: config_file_name + character(len=:), allocatable :: param_file_name real(DP) :: tfrac - allocate(dump_config, source=config) - config_file_name = trim(adjustl(DUMP_CONFIG_FILE(idx))) - dump_config%incbfile = trim(adjustl(DUMP_CB_FILE(idx))) - dump_config%inplfile = trim(adjustl(DUMP_PL_FILE(idx))) - dump_config%intpfile = trim(adjustl(DUMP_TP_FILE(idx))) - dump_config%out_form = XV - dump_config%out_stat = 'APPEND' - call dump_config%dump(config_file_name,t,dt) + allocate(dump_param, source=param) + param_file_name = trim(adjustl(DUMP_param_FILE(idx))) + dump_param%incbfile = trim(adjustl(DUMP_CB_FILE(idx))) + dump_param%inplfile = trim(adjustl(DUMP_PL_FILE(idx))) + dump_param%intpfile = trim(adjustl(DUMP_TP_FILE(idx))) + dump_param%out_form = XV + dump_param%out_stat = 'APPEND' + call dump_param%dump(param_file_name,t,dt) - call self%cb%dump(dump_config, t, dt) - if (self%pl%nbody > 0) call self%pl%dump(dump_config, t, dt) - if (self%tp%nbody > 0) call self%tp%dump(dump_config, t, dt) + call self%cb%dump(dump_param, t, dt) + if (self%pl%nbody > 0) call self%pl%dump(dump_param, t, dt) + if (self%tp%nbody > 0) call self%tp%dump(dump_param, t, dt) idx = idx + 1 if (idx > NDUMPFILES) idx = 1 ! Print the status message (format code passed in from main driver) - tfrac = (t - config%t0) / (config%tstop - config%t0) + tfrac = (t - param%t0) / (param%tstop - param%t0) write(*,msg) t, tfrac, self%pl%nbody, self%tp%nbody return end subroutine io_dump_system - module function io_get_args(integrator, config_file_name) result(ierr) + module function io_get_args(integrator, param_file_name) result(ierr) !! author: David A. Minton !! - !! Reads in the name of the configuration file. + !! Reads in the name of the parameters file. implicit none ! Arguments integer(I4B) :: integrator !! Symbolic code of the requested integrator - character(len=:), allocatable :: config_file_name !! Name of the input configuration file + character(len=:), allocatable :: param_file_name !! Name of the input parameters file ! Result integer(I4B) :: ierr !! I/O error cod ! Internals @@ -564,7 +564,7 @@ module function io_get_args(integrator, config_file_name) result(ierr) write(*,*) trim(adjustl(arg1)) // ' is not a valid integrator.' ierr = -1 end select - config_file_name = trim(adjustl(arg2)) + param_file_name = trim(adjustl(arg2)) end if else call get_command_argument(1, arg1, status = ierr_arg1) @@ -626,7 +626,7 @@ module function io_get_token(buffer, ifirst, ilast, ierr) result(token) return end function io_get_token - module subroutine io_read_body_in(self, config) + module subroutine io_read_body_in(self, param) !! author: The Purdue Swiftest Team - David A. Minton, Carlisle A. Wishard, Jennifer L.L. Pouplin, and Jacob R. Elliott !! !! Read in either test particle or massive body data @@ -636,7 +636,7 @@ module subroutine io_read_body_in(self, config) implicit none ! Arguments class(swiftest_body), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters ! Internals integer(I4B), parameter :: LUN = 7 !! Unit number of input file integer(I4B) :: iu = LUN @@ -649,16 +649,16 @@ module subroutine io_read_body_in(self, config) ! Select the appropriate polymorphic class (test particle or massive body) select type(self) class is (swiftest_pl) - infile = config%inplfile + infile = param%inplfile is_pl = .true. class is (swiftest_tp) - infile = config%intpfile + infile = param%intpfile is_pl = .false. end select ierr = 0 - is_ascii = (config%in_type == 'ASCII') - select case(config%in_type) + is_ascii = (param%in_type == 'ASCII') + select case(param%in_type) case(ASCII_TYPE) open(unit = iu, file = infile, status = 'old', form = 'FORMATTED', iostat = ierr) read(iu, *, iostat = ierr) nbody @@ -668,19 +668,19 @@ module subroutine io_read_body_in(self, config) select type(self) class is (swiftest_pl) read(iu, *, iostat = ierr) self%name(i), val - self%mass(i) = real(val / config%GU, kind=DP) + self%mass(i) = real(val / param%GU, kind=DP) self%Gmass(i) = real(val, kind=DP) - if (config%lclose) then + if (param%lclose) then read(iu, *, iostat = ierr) self%radius(i) if (ierr /= 0 ) exit else self%radius(i) = 0.0_DP end if - if (config%lrotation) then + if (param%lrotation) then read(iu, iostat = ierr) self%Ip(:, i) read(iu, iostat = ierr) self%rot(:, i) end if - if (config%ltides) then + if (param%ltides) then read(iu, iostat = ierr) self%k2(i) read(iu, iostat = ierr) self%Q(i) end if @@ -699,11 +699,11 @@ module subroutine io_read_body_in(self, config) read(iu, iostat = ierr) nbody call self%setup(nbody) if (nbody > 0) then - call self%read_frame(iu, config, XV, t, ierr) + call self%read_frame(iu, param, XV, t, ierr) self%status(:) = ACTIVE end if case default - write(*,*) trim(adjustl(config%in_type)) // ' is an unrecognized file type' + write(*,*) trim(adjustl(param%in_type)) // ' is an unrecognized file type' ierr = -1 end select close(iu) @@ -715,7 +715,7 @@ module subroutine io_read_body_in(self, config) return end subroutine io_read_body_in - module subroutine io_read_cb_in(self, config) + module subroutine io_read_cb_in(self, param) !! author: David A. Minton !! !! Reads in central body data @@ -725,7 +725,7 @@ module subroutine io_read_cb_in(self, config) implicit none ! Arguments class(swiftest_cb), intent(inout) :: self - class(swiftest_configuration), intent(inout) :: config + class(swiftest_parameters), intent(inout) :: param ! Internals integer(I4B), parameter :: LUN = 7 !! Unit number of input file integer(I4B) :: iu = LUN @@ -735,78 +735,78 @@ module subroutine io_read_cb_in(self, config) real(QP) :: val ierr = 0 - is_ascii = (config%in_type == 'ASCII') + is_ascii = (param%in_type == 'ASCII') if (is_ascii) then - open(unit = iu, file = config%incbfile, status = 'old', form = 'FORMATTED', iostat = ierr) + open(unit = iu, file = param%incbfile, status = 'old', form = 'FORMATTED', iostat = ierr) read(iu, *, iostat = ierr) val self%Gmass = real(val, kind=DP) - self%mass = real(val / config%GU, kind=DP) + self%mass = real(val / param%GU, kind=DP) read(iu, *, iostat = ierr) self%radius read(iu, *, iostat = ierr) self%j2rp2 read(iu, *, iostat = ierr) self%j4rp4 - if (config%lrotation) then + if (param%lrotation) then read(iu, *, iostat = ierr) self%Ip(:) read(iu, *, iostat = ierr) self%rot(:) end if - if (config%ltides) then + if (param%ltides) then read(iu, *, iostat = ierr) self%k2 read(iu, *, iostat = ierr) self%Q end if else - open(unit = iu, file = config%incbfile, status = 'old', form = 'UNFORMATTED', iostat = ierr) - call self%read_frame(iu, config, XV, t, ierr) + open(unit = iu, file = param%incbfile, status = 'old', form = 'UNFORMATTED', iostat = ierr) + call self%read_frame(iu, param, XV, t, ierr) end if close(iu) if (ierr /= 0) then - write(*,*) 'Error opening massive body initial conditions file ',trim(adjustl(config%incbfile)) + write(*,*) 'Error opening massive body initial conditions file ',trim(adjustl(param%incbfile)) call util_exit(FAILURE) end if - if (self%j2rp2 /= 0.0_DP) config%loblatecb = .true. + if (self%j2rp2 /= 0.0_DP) param%loblatecb = .true. return end subroutine io_read_cb_in - module subroutine io_read_config_in(self, config_file_name) + module subroutine io_read_param_in(self, param_file_name) !! author: David A. Minton !! !! Read in parameters for the integration !! - !! Adapted from David E. Kaufmann's Swifter routine io_init_config.f90 - !! Adapted from Martin Duncan's Swift routine io_init_config.f + !! Adapted from David E. Kaufmann's Swifter routine io_init_param.f90 + !! Adapted from Martin Duncan's Swift routine io_init_param.f implicit none ! Arguments - class(swiftest_configuration),intent(out) :: self !! Input collection of configuration parameters - character(len=*), intent(in) :: config_file_name !! Parameter input file name (i.e. param.in) + class(swiftest_parameters),intent(out) :: self !! Input collection of parameters parameters + character(len=*), intent(in) :: param_file_name !! Parameter input file name (i.e. param.in) ! Internals integer(I4B), parameter :: LUN = 7 !! Unit number of input file integer(I4B) :: ierr = 0 !! Input error code character(STRMAX) :: error_message !! Error message in UDIO procedure ! Read in name of parameter file - write(*, *) 'Configuration data file is ', trim(adjustl(config_file_name)) + write(*, *) 'parameters data file is ', trim(adjustl(param_file_name)) write(*, *) ' ' 100 format(A) - open(unit = LUN, file = config_file_name, status = 'old', iostat = ierr) + open(unit = LUN, file = param_file_name, status = 'old', iostat = ierr) if (ierr /= 0) then write(*,*) 'Swiftest error: ', ierr - write(*,*) ' Unable to open file ',trim(adjustl(config_file_name)) + write(*,*) ' Unable to open file ',trim(adjustl(param_file_name)) call util_exit(FAILURE) end if !! todo: Currently this procedure does not work in user-defined derived-type input mode !! as the newline characters are ignored in the input file when compiled in ifort. - !read(LUN,'(DT)', iostat= ierr, iomsg = error_message) config + !read(LUN,'(DT)', iostat= ierr, iomsg = error_message) param call self%reader(LUN, iotype= "none", v_list = [self%integrator], iostat = ierr, iomsg = error_message) if (ierr /= 0) then - write(*,*) 'Swiftest error reading ', trim(adjustl(config_file_name)) + write(*,*) 'Swiftest error reading ', trim(adjustl(param_file_name)) write(*,*) ierr,trim(adjustl(error_message)) call util_exit(FAILURE) end if return - end subroutine io_read_config_in + end subroutine io_read_param_in module function io_read_encounter(t, name1, name2, mass1, mass2, radius1, radius2, & xh1, xh2, vh1, vh2, encounter_file, out_type) result(ierr) @@ -858,7 +858,7 @@ module function io_read_encounter(t, name1, name2, mass1, mass2, radius1, radius return end function io_read_encounter - module subroutine io_read_frame_body(self, iu, config, form, t, ierr) + module subroutine io_read_frame_body(self, iu, param, form, t, ierr) !! author: David A. Minton !! !! Reads a frame of output of either test particle or massive body data to the binary output file @@ -870,7 +870,7 @@ module subroutine io_read_frame_body(self, iu, config, form, t, ierr) ! Arguments class(swiftest_body), intent(inout) :: self !! Swiftest particle object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters character(*), intent(in) :: form !! Input format code ("XV" or "EL") real(DP), intent(out) :: t !! Simulation time integer(I4B), intent(out) :: ierr !! Error code @@ -896,9 +896,9 @@ module subroutine io_read_frame_body(self, iu, config, form, t, ierr) select type(self) class is (swiftest_pl) ! Additional output if the passed polymorphic object is a massive body read(iu, iostat = ierr) self%Gmass(1:n) - self%mass(1:n) = self%Gmass / config%GU + self%mass(1:n) = self%Gmass / param%GU read(iu, iostat = ierr) self%radius(1:n) - if (config%lrotation) then + if (param%lrotation) then read(iu, iostat = ierr) self%Ip(1, 1:n) read(iu, iostat = ierr) self%Ip(2, 1:n) read(iu, iostat = ierr) self%Ip(3, 1:n) @@ -906,7 +906,7 @@ module subroutine io_read_frame_body(self, iu, config, form, t, ierr) read(iu, iostat = ierr) self%rot(2, 1:n) read(iu, iostat = ierr) self%rot(3, 1:n) end if - if (config%ltides) then + if (param%ltides) then read(iu, iostat = ierr) self%k2(1:n) read(iu, iostat = ierr) self%Q(1:n) end if @@ -921,7 +921,7 @@ module subroutine io_read_frame_body(self, iu, config, form, t, ierr) return end subroutine io_read_frame_body - module subroutine io_read_frame_cb(self, iu, config, form, t, ierr) + module subroutine io_read_frame_cb(self, iu, param, form, t, ierr) !! author: David A. Minton !! !! Reads a frame of output of central body data to the binary output file @@ -932,21 +932,21 @@ module subroutine io_read_frame_cb(self, iu, config, form, t, ierr) ! Arguments class(swiftest_cb), intent(inout) :: self !! Swiftest central body object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters character(*), intent(in) :: form !! Input format code ("XV" or "EL") real(DP), intent(out) :: t !! Simulation time integer(I4B), intent(out) :: ierr !! Error cod read(iu, iostat = ierr) self%Gmass - self%mass = self%Gmass / config%GU + self%mass = self%Gmass / param%GU read(iu, iostat = ierr) self%radius read(iu, iostat = ierr) self%j2rp2 read(iu, iostat = ierr) self%j4rp4 - if (config%lrotation) then + if (param%lrotation) then read(iu, iostat = ierr) self%Ip(:) read(iu, iostat = ierr) self%rot(:) end if - if (config%ltides) then + if (param%ltides) then read(iu, iostat = ierr) self%k2 read(iu, iostat = ierr) self%Q end if @@ -958,7 +958,7 @@ module subroutine io_read_frame_cb(self, iu, config, form, t, ierr) return end subroutine io_read_frame_cb - module subroutine io_read_frame_system(self, iu, config, form, t, ierr) + module subroutine io_read_frame_system(self, iu, param, form, t, ierr) !! author: The Purdue Swiftest Team - David A. Minton, Carlisle A. Wishard, Jennifer L.L. Pouplin, and Jacob R. Elliott !! !! Read a frame (header plus records for each massive body and active test particle) from a output binary file @@ -966,7 +966,7 @@ module subroutine io_read_frame_system(self, iu, config, form, t, ierr) ! Arguments class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters character(*), intent(in) :: form !! Input format code ("XV" or "EL") real(DP), intent(out) :: t !! Current simulation time integer(I4B), intent(out) :: ierr !! Error code @@ -975,7 +975,7 @@ module subroutine io_read_frame_system(self, iu, config, form, t, ierr) iu = BINUNIT if (lfirst) then - open(unit = iu, file = config%outfile, status = 'OLD', form = 'UNFORMATTED', iostat = ierr) + open(unit = iu, file = param%outfile, status = 'OLD', form = 'UNFORMATTED', iostat = ierr) lfirst = .false. if (ierr /= 0) then write(*, *) "Swiftest error:" @@ -983,17 +983,17 @@ module subroutine io_read_frame_system(self, iu, config, form, t, ierr) return end if end if - ierr = io_read_hdr(iu, t, self%pl%nbody, self%tp%nbody, config%out_form, config%out_type) + ierr = io_read_hdr(iu, t, self%pl%nbody, self%tp%nbody, param%out_form, param%out_type) if (ierr /= 0) then write(*, *) "Swiftest error:" write(*, *) " Binary output file already exists or cannot be accessed" return end if - call self%cb%read_frame(iu, config, form, t, ierr) + call self%cb%read_frame(iu, param, form, t, ierr) if (ierr /= 0) return - call self%pl%read_frame(iu, config, form, t, ierr) + call self%pl%read_frame(iu, param, form, t, ierr) if (ierr /= 0) return - call self%tp%read_frame(iu, config, form, t, ierr) + call self%tp%read_frame(iu, param, form, t, ierr) return end subroutine io_read_frame_system @@ -1034,7 +1034,7 @@ module function io_read_hdr(iu, t, npl, ntp, out_form, out_type) result(ierr) return end function io_read_hdr - module subroutine io_read_initialize_system(self, config) + module subroutine io_read_initialize_system(self, param) !! author: David A. Minton !! !! Wrapper method to initialize a basic Swiftest nbody system from files @@ -1042,18 +1042,18 @@ module subroutine io_read_initialize_system(self, config) implicit none ! Arguments class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters - call self%cb%initialize(config) - call self%pl%initialize(config) - call self%tp%initialize(config) + call self%cb%initialize(param) + call self%pl%initialize(param) + call self%tp%initialize(param) call self%set_msys() call self%pl%set_mu(self%cb) call self%tp%set_mu(self%cb) end subroutine io_read_initialize_system - module subroutine io_write_discard(self, config, discards) + module subroutine io_write_discard(self, param, discards) !! author: David A. Minton !! !! Write out information about discarded test particle @@ -1063,7 +1063,7 @@ module subroutine io_write_discard(self, config, discards) implicit none ! Arguments class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters class(swiftest_body), intent(inout) :: discards !! Swiftest discard object ! Internals integer(I4B), parameter :: LUN = 40 @@ -1077,41 +1077,41 @@ module subroutine io_write_discard(self, config, discards) character(*), parameter :: PLNAMEFMT = '(I8, 2(1X, E23.16))' class(swiftest_body), allocatable :: pltemp - associate(t => config%t, config => config, nsp => discards%nbody, dxh => discards%xh, dvh => discards%vh, & + associate(t => param%t, param => param, nsp => discards%nbody, dxh => discards%xh, dvh => discards%vh, & dname => discards%name, dstatus => discards%status) - if (config%out_stat == 'APPEND' .or. (.not.lfirst)) then + if (param%out_stat == 'APPEND' .or. (.not.lfirst)) then open(unit = LUN, file = DISCARD_FILE, status = 'OLD', position = 'APPEND', form = 'FORMATTED', iostat = ierr) - else if (config%out_stat == 'NEW') then + else if (param%out_stat == 'NEW') then open(unit = LUN, file = DISCARD_FILE, status = 'NEW', form = 'FORMATTED', iostat = ierr) - else if (config%out_stat == 'REPLACE') then + else if (param%out_stat == 'REPLACE') then open(unit = LUN, file = DISCARD_FILE, status = 'REPLACE', form = 'FORMATTED', iostat = ierr) else - write(*,*) 'Invalid status code',trim(adjustl(config%out_stat)) + write(*,*) 'Invalid status code',trim(adjustl(param%out_stat)) call util_exit(FAILURE) end if lfirst = .false. - if (config%lgr) then + if (param%lgr) then select type(discards) class is (whm_tp) - call discards%gr_pv2vh(config) + call discards%gr_pv2vh(param) end select end if - write(LUN, HDRFMT) t, nsp, config%lbig_discard + write(LUN, HDRFMT) t, nsp, param%lbig_discard do i = 1, nsp write(LUN, NAMEFMT) sub, dname(i), dstatus(i) write(LUN, VECFMT) dxh(1, i), dxh(2, i), dxh(3, i) write(LUN, VECFMT) dvh(1, i), dvh(2, i), dvh(3, i) end do - if (config%lbig_discard) then + if (param%lbig_discard) then associate(npl => self%pl%nbody, pl => self%pl, GMpl => self%pl%Gmass, & Rpl => self%pl%radius, name => self%pl%name, xh => self%pl%xh) - if (config%lgr) then + if (param%lgr) then allocate(pltemp, source = pl) select type(pltemp) class is (whm_pl) - call pltemp%gr_pv2vh(config) + call pltemp%gr_pv2vh(param) allocate(vh, source = pltemp%vh) end select deallocate(pltemp) @@ -1185,7 +1185,7 @@ module subroutine io_write_encounter(t, name1, name2, mass1, mass2, radius1, rad end subroutine io_write_encounter - module subroutine io_write_frame_body(self, iu, config, t, dt) + module subroutine io_write_frame_body(self, iu, param, t, dt) !! author: David A. Minton !! !! Write a frame of output of either test particle or massive body data to the binary output file @@ -1197,14 +1197,14 @@ module subroutine io_write_frame_body(self, iu, config, t, dt) ! Arguments class(swiftest_body), intent(in) :: self !! Swiftest particle object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Step size associate(n => self%nbody) if (n == 0) return write(iu) self%name(1:n) - select case (config%out_form) + select case (param%out_form) case (EL) write(iu) self%a(1:n) write(iu) self%e(1:n) @@ -1224,7 +1224,7 @@ module subroutine io_write_frame_body(self, iu, config, t, dt) class is (swiftest_pl) ! Additional output if the passed polymorphic object is a massive body write(iu) self%Gmass(1:n) write(iu) self%radius(1:n) - if (config%lrotation) then + if (param%lrotation) then write(iu) self%Ip(1, 1:n) write(iu) self%Ip(2, 1:n) write(iu) self%Ip(3, 1:n) @@ -1232,7 +1232,7 @@ module subroutine io_write_frame_body(self, iu, config, t, dt) write(iu) self%rot(2, 1:n) write(iu) self%rot(3, 1:n) end if - if (config%ltides) then + if (param%ltides) then write(iu) self%k2(1:n) write(iu) self%Q(1:n) end if @@ -1242,7 +1242,7 @@ module subroutine io_write_frame_body(self, iu, config, t, dt) return end subroutine io_write_frame_body - module subroutine io_write_frame_cb(self, iu, config, t, dt) + module subroutine io_write_frame_cb(self, iu, param, t, dt) !! author: David A. Minton !! !! Write a frame of output of central body data to the binary output file @@ -1253,7 +1253,7 @@ module subroutine io_write_frame_cb(self, iu, config, t, dt) ! Arguments class(swiftest_cb), intent(in) :: self !! Swiftest central body object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Step size @@ -1261,7 +1261,7 @@ module subroutine io_write_frame_cb(self, iu, config, t, dt) write(iu) self%radius write(iu) self%j2rp2 write(iu) self%j4rp4 - if (config%lrotation) then + if (param%lrotation) then write(iu) self%Ip(1) write(iu) self%Ip(2) write(iu) self%Ip(3) @@ -1269,7 +1269,7 @@ module subroutine io_write_frame_cb(self, iu, config, t, dt) write(iu) self%rot(2) write(iu) self%rot(3) end if - if (config%ltides) then + if (param%ltides) then write(iu) self%k2 write(iu) self%Q end if @@ -1277,7 +1277,7 @@ module subroutine io_write_frame_cb(self, iu, config, t, dt) return end subroutine io_write_frame_cb - module subroutine io_write_frame_system(self, iu, config, t, dt) + module subroutine io_write_frame_system(self, iu, param, t, dt) !! author: The Purdue Swiftest Team - David A. Minton, Carlisle A. Wishard, Jennifer L.L. Pouplin, and Jacob R. Elliott !! !! Write a frame (header plus records for each massive body and active test particle) to output binary file @@ -1289,7 +1289,7 @@ module subroutine io_write_frame_system(self, iu, config, t, dt) ! Arguments class(swiftest_nbody_system), intent(in) :: self !! Swiftest system object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Step size ! Internals @@ -1306,56 +1306,56 @@ module subroutine io_write_frame_system(self, iu, config, t, dt) iu = BINUNIT if (lfirst) then - select case(config%out_stat) + select case(param%out_stat) case('APPEND') - open(unit = iu, file = config%outfile, status = 'OLD', position = 'APPEND', form = 'UNFORMATTED', iostat = ierr) + open(unit = iu, file = param%outfile, status = 'OLD', position = 'APPEND', form = 'UNFORMATTED', iostat = ierr) case('NEW') - open(unit = iu, file = config%outfile, status = 'NEW', form = 'UNFORMATTED', iostat = ierr) + open(unit = iu, file = param%outfile, status = 'NEW', form = 'UNFORMATTED', iostat = ierr) case ('REPLACE') - open(unit = iu, file = config%outfile, status = 'REPLACE', form = 'UNFORMATTED', iostat = ierr) + open(unit = iu, file = param%outfile, status = 'REPLACE', form = 'UNFORMATTED', iostat = ierr) case default - write(*,*) 'Invalid status code',trim(adjustl(config%out_stat)) + write(*,*) 'Invalid status code',trim(adjustl(param%out_stat)) call util_exit(FAILURE) end select if (ierr /= 0) then write(*, *) "Swiftest error: io_write_frame_system - first", ierr - write(*, *) " Binary output file " // trim(adjustl(config%outfile)) // " already exists or cannot be accessed" - write(*, *) " out_stat: " // trim(adjustl(config%out_stat)) + write(*, *) " Binary output file " // trim(adjustl(param%outfile)) // " already exists or cannot be accessed" + write(*, *) " out_stat: " // trim(adjustl(param%out_stat)) call util_exit(FAILURE) end if lfirst = .false. else - open(unit = iu, file = config%outfile, status = 'OLD', position = 'APPEND', form = 'UNFORMATTED', iostat = ierr) + open(unit = iu, file = param%outfile, status = 'OLD', position = 'APPEND', form = 'UNFORMATTED', iostat = ierr) if (ierr /= 0) then write(*, *) "Swiftest error: io_write_frame_system" write(*, *) " Unable to open binary output file for APPEND" call util_exit(FAILURE) end if end if - call io_write_hdr(iu, t, pl%nbody, tp%nbody, config%out_form, config%out_type) + call io_write_hdr(iu, t, pl%nbody, tp%nbody, param%out_form, param%out_type) - if (config%lgr) then + if (param%lgr) then associate(vh => pl%vh, vht => tp%vh) select type(pl) class is (whm_pl) - call pl%gr_pv2vh(config) + call pl%gr_pv2vh(param) end select select type(tp) class is (whm_tp) - call tp%gr_pv2vh(config) + call tp%gr_pv2vh(param) end select end associate end if - if (config%out_form == EL) then ! Do an orbital element conversion prior to writing out the frame, as we have access to the central body here + if (param%out_form == EL) then ! Do an orbital element conversion prior to writing out the frame, as we have access to the central body here call pl%xv2el(cb) call tp%xv2el(cb) end if ! Write out each data type frame - call cb%write_frame(iu, config, t, dt) - call pl%write_frame(iu, config, t, dt) - call tp%write_frame(iu, config, t, dt) + call cb%write_frame(iu, param, t, dt) + call pl%write_frame(iu, param, t, dt) + call tp%write_frame(iu, param, t, dt) deallocate(cb, pl, tp) diff --git a/src/main/swiftest_driver.f90 b/src/main/swiftest_driver.f90 index c4a57c79f..166dbe409 100644 --- a/src/main/swiftest_driver.f90 +++ b/src/main/swiftest_driver.f90 @@ -10,9 +10,9 @@ program swiftest_driver implicit none class(swiftest_nbody_system), allocatable :: nbody_system !! Polymorphic object containing the nbody system to be integrated - type(swiftest_configuration) :: config + type(swiftest_parameters) :: param integer(I4B) :: integrator !! Integrator type code (see swiftest_globals for symbolic names) - character(len=:),allocatable :: config_file_name !! Name of the file containing user-defined configuration parameters + character(len=:),allocatable :: param_file_name !! Name of the file containing user-defined parameters parameters integer(I4B) :: ierr !! I/O error code logical :: lfirst !! Flag indicating that this is the first time through the main loop integer(I8B) :: iloop !! Loop counter @@ -26,29 +26,29 @@ program swiftest_driver character(*),parameter :: statusfmt = '("Time = ", ES12.5, "; fraction done = ", F6.3, "; ' // & 'Number of active pl, tp = ", I5, ", ", I5)' - ierr = io_get_args(integrator, config_file_name) + ierr = io_get_args(integrator, param_file_name) if (ierr /= 0) then write(*,*) 'Error reading in arguments from the command line' call util_exit(FAILURE) end if !$ start_wall_time = omp_get_wtime() - !> Read in the user-defined configuration file and the initial conditions of the system - config%integrator = integrator - call setup_construct_system(nbody_system, config) - call config%read_from_file(config_file_name) - associate(t => config%t, & - t0 => config%t0, & - dt => config%dt, & - tstop => config%tstop, & - istep_out => config%istep_out, & - istep_dump => config%istep_dump) - call nbody_system%initialize(config) + !> Read in the user-defined parameters file and the initial conditions of the system + param%integrator = integrator + call setup_construct_system(nbody_system, param) + call param%read_from_file(param_file_name) + associate(t => param%t, & + t0 => param%t0, & + dt => param%dt, & + tstop => param%tstop, & + istep_out => param%istep_out, & + istep_dump => param%istep_dump) + call nbody_system%initialize(param) lfirst = .true. t = t0 iloop = 0 iout = istep_out idump = istep_dump - if (istep_out > 0) call nbody_system%write_frame(iu, config, t, dt) + if (istep_out > 0) call nbody_system%write_frame(iu, param, t, dt) !> Define the maximum number of threads nthreads = 1 ! In the *serial* case !$ nthreads = omp_get_max_threads() ! In the *parallel* case @@ -60,19 +60,19 @@ program swiftest_driver ntp = nbody_system%tp%nbody npl = nbody_system%pl%nbody !> Step the system forward in time - call nbody_system%step(config) + call nbody_system%step(param) t = t0 + iloop * dt if (t > tstop) exit !> Evaluate any discards or mergers - call nbody_system%discard(config) + call nbody_system%discard(param) !> If the loop counter is at the output cadence value, append the data file with a single frame if (istep_out > 0) then iout = iout - 1 if (iout == 0) then - call nbody_system%write_frame(iu, config, t, dt) + call nbody_system%write_frame(iu, param, t, dt) iout = istep_out end if end if @@ -81,14 +81,14 @@ program swiftest_driver if (istep_dump > 0) then idump = idump - 1 if (idump == 0) then - call nbody_system%dump(config, t, dt, statusfmt) + call nbody_system%dump(param, t, dt, statusfmt) idump = istep_dump end if end if end do !> Dump the final state of the system to file - !call nbody_system%dump(config, t, dt, statusfmt) + !call nbody_system%dump(param, t, dt, statusfmt) !$ finish_wall_time = omp_get_wtime() !$ write(*,*) 'Time: ', finish_wall_time - start_wall_time end associate diff --git a/src/modules/helio_classes.f90 b/src/modules/helio_classes.f90 index ee8359efc..d7b2d2d8d 100644 --- a/src/modules/helio_classes.f90 +++ b/src/modules/helio_classes.f90 @@ -92,21 +92,21 @@ module subroutine helio_coord_vh2vb_tp(self, vbcb) real(DP), dimension(:), intent(in) :: vbcb !! Barycentric velocity of the central body end subroutine helio_coord_vh2vb_tp - module subroutine helio_drift_pl(self, cb, config, dt) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine helio_drift_pl(self, cb, param, dt) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(helio_pl), intent(inout) :: self !! Helio massive body object class(swiftest_cb), intent(inout) :: cb !! Helio central body object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: dt !! Stepsize end subroutine helio_drift_pl - module subroutine helio_drift_tp(self, cb, config, dt) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine helio_drift_tp(self, cb, param, dt) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(helio_tp), intent(inout) :: self !! Helio test particle object class(swiftest_cb), intent(inout) :: cb !! Helio central body object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: dt !! Stepsize end subroutine helio_drift_tp @@ -126,23 +126,23 @@ module subroutine helio_drift_linear_tp(self, dt, pt) real(DP), dimension(:), intent(in) :: pt !! negative barycentric velocity of the Sun end subroutine helio_drift_linear_tp - module subroutine helio_getacch_pl(self, cb, config, t) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine helio_getacch_pl(self, cb, param, t) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(helio_pl), intent(inout) :: self !! Helio massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current time end subroutine helio_getacch_pl - module subroutine helio_getacch_tp(self, cb, pl, config, t, xh) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine helio_getacch_tp(self, cb, pl, param, t, xh) + use swiftest_classes, only : swiftest_cb, swiftest_parameters use whm_classes, only : whm_pl implicit none class(helio_tp), intent(inout) :: self !! Helio test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree class(whm_pl), intent(inout) :: pl !! Swiftest massive body particle data structure. - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current time real(DP), dimension(:,:), intent(in) :: xh !! Heliocentric positions of planets end subroutine helio_getacch_tp @@ -174,31 +174,31 @@ module subroutine helio_setup_tp(self,n) integer, intent(in) :: n !! Number of test particles to allocate end subroutine helio_setup_tp - module subroutine helio_step_system(self, config) - use swiftest_classes, only : swiftest_configuration + module subroutine helio_step_system(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(helio_nbody_system), intent(inout) :: self !! Helio nbody system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters end subroutine helio_step_system - module subroutine helio_step_pl(self, cb, config, t, dt) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine helio_step_pl(self, cb, param, t, dt) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(helio_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), intent(in) :: dt !! Stepsize end subroutine helio_step_pl - module subroutine helio_step_tp(self, cb, pl, config, t, dt) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine helio_step_tp(self, cb, pl, param, t, dt) + use swiftest_classes, only : swiftest_cb, swiftest_parameters use whm_classes, only : whm_pl implicit none class(helio_tp), intent(inout) :: self !! Helio test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure class(whm_pl), intent(inout) :: pl !! WHM massive body data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), intent(in) :: dt !! Stepsize end subroutine helio_step_tp diff --git a/src/modules/rmvs_classes.f90 b/src/modules/rmvs_classes.f90 index b5445c156..881185af1 100644 --- a/src/modules/rmvs_classes.f90 +++ b/src/modules/rmvs_classes.f90 @@ -109,7 +109,7 @@ module rmvs_classes interface module subroutine rmvs_discard_pl_tp(self, pl, t, dt) - use swiftest_classes, only : swiftest_cb, swiftest_pl, swiftest_configuration + use swiftest_classes, only : swiftest_cb, swiftest_pl, swiftest_parameters implicit none class(rmvs_tp), intent(inout) :: self class(swiftest_pl), intent(inout) :: pl !! WHM massive body particle data structure. @@ -117,23 +117,23 @@ module subroutine rmvs_discard_pl_tp(self, pl, t, dt) real(DP), intent(in) :: dt !! Stepsize end subroutine rmvs_discard_pl_tp - module subroutine rmvs_getacch_tp(self, cb, pl, config, t, xh) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine rmvs_getacch_tp(self, cb, pl, param, t, xh) + use swiftest_classes, only : swiftest_cb, swiftest_parameters use whm_classes, only : whm_pl implicit none class(rmvs_tp), intent(inout) :: self !! RMVS test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree class(whm_pl), intent(inout) :: pl !! WHM massive body particle data structure. - class(swiftest_configuration), intent(in) :: config !! Input collection of parameter + class(swiftest_parameters), intent(in) :: param !! Input collection of parameter real(DP), intent(in) :: t !! Current time real(DP), dimension(:,:), intent(in) :: xh !! Heliocentric positions of planets end subroutine rmvs_getacch_tp - module subroutine rmvs_setup_system(self, config) - use swiftest_classes, only : swiftest_configuration + module subroutine rmvs_setup_system(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(rmvs_nbody_system), intent(inout) :: self !! RMVS system object - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters end subroutine rmvs_setup_system module subroutine rmvs_setup_pl(self,n) @@ -148,11 +148,11 @@ module subroutine rmvs_setup_set_beg_end(self, xbeg, xend, vbeg) real(DP), dimension(:,:), intent(in), optional :: xbeg, xend, vbeg end subroutine rmvs_setup_set_beg_end - module subroutine rmvs_step_system(self, config) - use swiftest_classes, only : swiftest_configuration + module subroutine rmvs_step_system(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(rmvs_nbody_system), intent(inout) :: self !! RMVS nbody system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters end subroutine rmvs_step_system module subroutine rmvs_setup_tp(self,n) diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index 3a8ae9bfd..85cf84530 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -8,12 +8,12 @@ module swiftest_classes public !******************************************************************************************************************************** - ! swiftest_configuration class definitions + ! swiftest_parameters class definitions !******************************************************************************************************************************** - !> User defined configuration parameters that are read in from the configuration input file. + !> User defined parameters parameters that are read in from the parameters input file. !> Each paramter is initialized to a default values. - type, public :: swiftest_configuration + type, public :: swiftest_parameters integer(I4B) :: integrator = UNKNOWN_INTEGRATOR !! Symbolic name of the nbody integrator used integer(I4B) :: nplmax = -1 !! Maximum allowed number of massive bodies integer(I4B) :: ntpmax = -1 !! Maximum allowed number of test particles @@ -62,14 +62,14 @@ module swiftest_classes logical :: lyarkovsky = .false. !! Turn on Yarkovsky effect logical :: lyorp = .false. !! Turn on YORP effect contains - procedure :: reader => io_config_reader - procedure :: writer => io_config_writer - procedure :: dump => io_dump_config - procedure :: read_from_file => io_read_config_in + procedure :: reader => io_param_reader + procedure :: writer => io_param_writer + procedure :: dump => io_dump_param + procedure :: read_from_file => io_read_param_in !TODO: Figure out if user-defined derived-type io can be made to work properly - !generic :: read(FORMATTED) => config_reader - !generic :: write(FORMATTED) => config_writer - end type swiftest_configuration + !generic :: read(FORMATTED) => param_reader + !generic :: write(FORMATTED) => param_writer + end type swiftest_parameters !******************************************************************************************************************************** ! swiftest_base class definitions and methods @@ -268,24 +268,24 @@ subroutine abstract_copy(self, src, mask) logical, dimension(:), intent(in) :: mask end subroutine abstract_copy - subroutine abstract_gr_getacch(self, cb, config) - import swiftest_body, swiftest_cb, swiftest_configuration + subroutine abstract_gr_getacch(self, cb, param) + import swiftest_body, swiftest_cb, swiftest_parameters class(swiftest_body), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of parameter + class(swiftest_parameters), intent(in) :: param !! Input collection of parameter end subroutine abstract_gr_getacch - subroutine abstract_initialize(self, config) - import swiftest_base, swiftest_configuration + subroutine abstract_initialize(self, param) + import swiftest_base, swiftest_parameters class(swiftest_base), intent(inout) :: self !! Swiftest base object - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters end subroutine abstract_initialize - subroutine abstract_read_frame(self, iu, config, form, t, ierr) - import DP, I4B, swiftest_base, swiftest_configuration + subroutine abstract_read_frame(self, iu, param, form, t, ierr) + import DP, I4B, swiftest_base, swiftest_parameters class(swiftest_base), intent(inout) :: self !! Swiftest base object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters character(*), intent(in) :: form !! Input format code ("XV" or "EL") real(DP), intent(out) :: t !! Simulation time integer(I4B), intent(out) :: ierr !! Error code @@ -297,30 +297,30 @@ subroutine abstract_set_mu(self, cb) class(swiftest_cb), intent(inout) :: cb !! Swiftest central body objectt end subroutine abstract_set_mu - subroutine abstract_step_system(self, config) - import swiftest_nbody_system, swiftest_configuration + subroutine abstract_step_system(self, param) + import swiftest_nbody_system, swiftest_parameters implicit none class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters end subroutine abstract_step_system - subroutine abstract_write_frame(self, iu, config, t, dt) - import DP, I4B, swiftest_base, swiftest_configuration + subroutine abstract_write_frame(self, iu, param, t, dt) + import DP, I4B, swiftest_base, swiftest_parameters class(swiftest_base), intent(in) :: self !! Swiftest base object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Step size end subroutine abstract_write_frame end interface interface - module subroutine discard_peri_tp(self, cb, pl, config, t, msys) + module subroutine discard_peri_tp(self, cb, pl, param, t, msys) implicit none class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object class(swiftest_pl), intent(inout) :: pl !! Swiftest massive body object - class(swiftest_configuration), intent(in) :: config !! configuration parameters + class(swiftest_parameters), intent(in) :: param !! parameters parameters real(DP), intent(in) :: t !! Current simulation tim real(DP), intent(in) :: msys !! Total system mass end subroutine discard_peri_tp @@ -341,19 +341,19 @@ module subroutine discard_pl_tp(self, pl, t, dt) real(DP), intent(in) :: dt !! Stepsize end subroutine discard_pl_tp - module subroutine discard_sun_tp(self, cb, config, t, msys) + module subroutine discard_sun_tp(self, cb, param, t, msys) implicit none class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object - class(swiftest_configuration), intent(in) :: config !! configuration parameters + class(swiftest_parameters), intent(in) :: param !! parameters parameters real(DP), intent(in) :: t !! Current simulation tim real(DP), intent(in) :: msys !! Total system mass end subroutine discard_sun_tp - module subroutine discard_system(self, config) + module subroutine discard_system(self, param) implicit none class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters end subroutine discard_system module pure elemental subroutine drift_one(mu, px, py, pz, vx, vy, vz, dt, iflag) @@ -380,11 +380,11 @@ module subroutine eucl_irij3_plpl(self) class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object end subroutine eucl_irij3_plpl - module subroutine gr_getaccb_ns_body(self, cb, config, agr, agr0) + module subroutine gr_getaccb_ns_body(self, cb, param, agr, agr0) implicit none class(swiftest_body), intent(inout) :: self class(swiftest_cb), intent(inout) :: cb - class(swiftest_configuration), intent(in) :: config + class(swiftest_parameters), intent(in) :: param real(DP), dimension(:, :), intent(inout) :: agr real(DP), dimension(NDIM), intent(out) :: agr0 end subroutine gr_getaccb_ns_body @@ -401,55 +401,55 @@ module subroutine kick_vh_body(self, dt) real(DP), intent(in) :: dt !! Stepsize end subroutine kick_vh_body - module subroutine io_config_reader(self, unit, iotype, v_list, iostat, iomsg) - class(swiftest_configuration), intent(inout) :: self !! Collection of configuration parameters + module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg) + class(swiftest_parameters), intent(inout) :: self !! Collection of parameters parameters integer, intent(in) :: unit !! File unit number character(len=*), intent(in) :: iotype !! Dummy argument passed to the input/output procedure contains the text from the char-literal-constant, prefixed with DT. !! If you do not include a char-literal-constant, the iotype argument contains only DT. integer, intent(in) :: v_list(:) !! The first element passes the integrator code to the reader integer, intent(out) :: iostat !! IO status code character(len=*), intent(inout) :: iomsg !! Message to pass if iostat /= 0 - end subroutine io_config_reader + end subroutine io_param_reader - module subroutine io_config_writer(self, unit, iotype, v_list, iostat, iomsg) - class(swiftest_configuration),intent(in) :: self !! Collection of configuration parameters + module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg) + class(swiftest_parameters),intent(in) :: self !! Collection of parameters parameters integer, intent(in) :: unit !! File unit number character(len=*), intent(in) :: iotype !! Dummy argument passed to the input/output procedure contains the text from the char-literal-constant, prefixed with DT. !! If you do not include a char-literal-constant, the iotype argument contains only DT. integer, intent(in) :: v_list(:) !! Not used in this procedure integer, intent(out) :: iostat !! IO status code character(len=*), intent(inout) :: iomsg !! Message to pass if iostat /= 0 - end subroutine io_config_writer + end subroutine io_param_writer - module subroutine io_dump_config(self, config_file_name, t, dt) - class(swiftest_configuration),intent(in) :: self !! Output collection of parameters - character(len=*), intent(in) :: config_file_name !! Parameter input file name (i.e. param.in) + module subroutine io_dump_param(self, param_file_name, t, dt) + class(swiftest_parameters),intent(in) :: self !! Output collection of parameters + character(len=*), intent(in) :: param_file_name !! Parameter input file name (i.e. param.in) real(DP),intent(in) :: t !! Current simulation time real(DP),intent(in) :: dt !! Step size - end subroutine io_dump_config + end subroutine io_dump_param - module subroutine io_dump_swiftest(self, config, t, dt, msg) + module subroutine io_dump_swiftest(self, param, t, dt, msg) implicit none class(swiftest_base), intent(inout) :: self !! Swiftest base object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Stepsize character(*), optional, intent(in) :: msg !! Message to display with dump operation end subroutine io_dump_swiftest - module subroutine io_dump_system(self, config, t, dt, msg) + module subroutine io_dump_system(self, param, t, dt, msg) implicit none class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Stepsize character(*), optional, intent(in) :: msg !! Message to display with dump operation end subroutine io_dump_system - module function io_get_args(integrator, config_file_name) result(ierr) + module function io_get_args(integrator, param_file_name) result(ierr) implicit none integer(I4B) :: integrator !! Symbolic code of the requested integrator - character(len=:), allocatable :: config_file_name !! Name of the input configuration file + character(len=:), allocatable :: param_file_name !! Name of the input parameters file integer(I4B) :: ierr !! I/O error code end function io_get_args @@ -461,22 +461,22 @@ module function io_get_token(buffer, ifirst, ilast, ierr) result(token) character(len=:),allocatable :: token !! Returned token string end function io_get_token - module subroutine io_read_body_in(self, config) + module subroutine io_read_body_in(self, param) implicit none class(swiftest_body), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters end subroutine io_read_body_in - module subroutine io_read_cb_in(self, config) + module subroutine io_read_cb_in(self, param) implicit none class(swiftest_cb), intent(inout) :: self - class(swiftest_configuration), intent(inout) :: config + class(swiftest_parameters), intent(inout) :: param end subroutine io_read_cb_in - module subroutine io_read_config_in(self, config_file_name) - class(swiftest_configuration),intent(out) :: self !! Input collection of configuration parameters - character(len=*), intent(in) :: config_file_name !! Parameter input file name (i.e. param.in) - end subroutine io_read_config_in + module subroutine io_read_param_in(self, param_file_name) + class(swiftest_parameters),intent(out) :: self !! Input collection of parameters parameters + character(len=*), intent(in) :: param_file_name !! Parameter input file name (i.e. param.in) + end subroutine io_read_param_in module function io_read_encounter(t, name1, name2, mass1, mass2, radius1, radius2, & xh1, xh2, vh1, vh2, encounter_file, out_type) result(ierr) @@ -488,31 +488,31 @@ module function io_read_encounter(t, name1, name2, mass1, mass2, radius1, radius character(*), intent(in) :: encounter_file,out_type end function io_read_encounter - module subroutine io_read_frame_body(self, iu, config, form, t, ierr) + module subroutine io_read_frame_body(self, iu, param, form, t, ierr) implicit none class(swiftest_body), intent(inout) :: self !! Swiftest particle object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters character(*), intent(in) :: form !! Input format code ("XV" or "EL") real(DP), intent(out) :: t !! Simulation time integer(I4B), intent(out) :: ierr !! Error code end subroutine io_read_frame_body - module subroutine io_read_frame_cb(self, iu, config, form, t, ierr) + module subroutine io_read_frame_cb(self, iu, param, form, t, ierr) implicit none class(swiftest_cb), intent(inout) :: self !! Swiftest central body object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters character(*), intent(in) :: form !! Input format code ("XV" or "EL") real(DP), intent(out) :: t !! Simulation time integer(I4B), intent(out) :: ierr !! Error code end subroutine io_read_frame_cb - module subroutine io_read_frame_system(self, iu, config, form, t, ierr) + module subroutine io_read_frame_system(self, iu, param, form, t, ierr) implicit none class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters character(*), intent(in) :: form !! Input format code ("XV" or "EL") real(DP), intent(out) :: t !! Current simulation time integer(I4B), intent(out) :: ierr !! Error code @@ -528,16 +528,16 @@ module function io_read_hdr(iu, t, npl, ntp, out_form, out_type) result(ierr) character(*), intent(in) :: out_type end function io_read_hdr - module subroutine io_read_initialize_system(self, config) + module subroutine io_read_initialize_system(self, param) implicit none class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters end subroutine io_read_initialize_system - module subroutine io_write_discard(self, config, discards) + module subroutine io_write_discard(self, param, discards) implicit none class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters class(swiftest_body), intent(inout) :: discards !! Swiftest discard object end subroutine io_write_discard @@ -550,29 +550,29 @@ module subroutine io_write_encounter(t, name1, name2, mass1, mass2, radius1, rad character(*), intent(in) :: encounter_file, out_type end subroutine io_write_encounter - module subroutine io_write_frame_body(self, iu, config, t, dt) + module subroutine io_write_frame_body(self, iu, param, t, dt) implicit none class(swiftest_body), intent(in) :: self !! Swiftest particle object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Step size end subroutine io_write_frame_body - module subroutine io_write_frame_cb(self, iu, config, t, dt) + module subroutine io_write_frame_cb(self, iu, param, t, dt) implicit none class(swiftest_cb), intent(in) :: self !! Swiftest central body object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Step size end subroutine io_write_frame_cb - module subroutine io_write_frame_system(self, iu, config, t, dt) + module subroutine io_write_frame_system(self, iu, param, t, dt) implicit none class(swiftest_nbody_system), intent(in) :: self !! Swiftest system object integer(I4B), intent(inout) :: iu !! Unit number for the output file to write frame to - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: t !! Current simulation time real(DP), intent(in) :: dt !! Step size end subroutine io_write_frame_system @@ -631,10 +631,10 @@ module subroutine setup_body(self,n) integer, intent(in) :: n !! Number of particles to allocate space for end subroutine setup_body - module subroutine setup_construct_system(system, config) + module subroutine setup_construct_system(system, param) implicit none class(swiftest_nbody_system), allocatable, intent(inout) :: system !! Swiftest system object - type(swiftest_configuration), intent(in) :: config !! Swiftest configuration parameters + type(swiftest_parameters), intent(in) :: param !! Swiftest parameters parameters end subroutine setup_construct_system module subroutine setup_pl(self,n) @@ -677,11 +677,11 @@ module subroutine setup_tp(self, n) integer, intent(in) :: n !! Number of bodies to allocate space for end subroutine setup_tp - module subroutine user_getacch_body(self, cb, config, t) + module subroutine user_getacch_body(self, cb, param, t) implicit none class(swiftest_body), intent(inout) :: self !! Swiftest massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time end subroutine user_getacch_body diff --git a/src/modules/swiftest_globals.f90 b/src/modules/swiftest_globals.f90 index b3fe78494..846817673 100644 --- a/src/modules/swiftest_globals.f90 +++ b/src/modules/swiftest_globals.f90 @@ -64,7 +64,7 @@ module swiftest_globals character(*), parameter :: SUCCESS_MSG = '(/, "Normal termination of Swiftest (version ", f3.1, ")")' character(*), parameter :: FAIL_MSG = '(/, "Terminating Swiftest (version ", f3.1, ") due to error!!")' - character(*), parameter :: USAGE_MSG = '("Usage: swiftest [bs|helio|ra15|rmvs|symba|tu4|whm] ")' + character(*), parameter :: USAGE_MSG = '("Usage: swiftest [bs|helio|ra15|rmvs|symba|tu4|whm] ")' character(*), parameter :: HELP_MSG = USAGE_MSG integer(I4B), parameter :: ELLIPSE = -1 !! Symbolic names for orbit types - ellipse @@ -103,9 +103,9 @@ module swiftest_globals character(*), dimension(2), parameter :: DUMP_CB_FILE = (/ 'dump_cb1.bin', 'dump_cb2.bin' /) character(*), dimension(2), parameter :: DUMP_PL_FILE = (/ 'dump_pl1.bin', 'dump_pl2.bin' /) character(*), dimension(2), parameter :: DUMP_TP_FILE = (/ 'dump_tp1.bin', 'dump_tp2.bin' /) - character(*), dimension(2), parameter :: DUMP_CONFIG_FILE = (/ 'dump_config1.dat', 'dump_config2.dat' /) + character(*), dimension(2), parameter :: DUMP_param_FILE = (/ 'dump_param1.dat', 'dump_param2.dat' /) - !> Default file names that can be changed by the user in the configuration file + !> Default file names that can be changed by the user in the parameters file character(*), parameter :: ENC_OUTFILE = 'encounter.out' character(*), parameter :: DISCARD_FILE = 'discard.out' character(*), parameter :: ENERGY_FILE = 'energy.out' diff --git a/src/modules/symba.f90 b/src/modules/symba.f90 index ef8f2d27b..bb0361d5c 100644 --- a/src/modules/symba.f90 +++ b/src/modules/symba.f90 @@ -118,7 +118,7 @@ module subroutine io_discard_write_symba(t, mtiny, npl, ntp, nsppl, nsptp, nmerg end subroutine io_discard_write_symba module subroutine symba_casedisruption (t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, eoffset, vbs, & - symba_plA, nplplenc, plplenc_list, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2, config) + symba_plA, nplplenc, plplenc_list, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2, param) implicit none integer(I4B), intent(in) :: index_enc integer(I4B), intent(inout) :: nmergeadd, nmergesub, nplplenc, fragmax @@ -130,12 +130,12 @@ module subroutine symba_casedisruption (t, dt, index_enc, nmergeadd, nmergesub, type(symba_plplenc), intent(inout) :: plplenc_list type(symba_merger), intent(inout) :: mergeadd_list, mergesub_list type(symba_pl), intent(inout) :: symba_plA - type(swiftest_configuration) :: config + type(swiftest_parameters) :: param end subroutine symba_casedisruption module subroutine symba_casehitandrun (t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, eoffset, vbs, & - symba_plA, nplplenc, plplenc_list, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2, config) + symba_plA, nplplenc, plplenc_list, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2, param) implicit none integer(I4B), intent(in) :: index_enc integer(I4B), intent(inout) :: nmergeadd, nmergesub, nplplenc, fragmax @@ -167,10 +167,10 @@ end subroutine symba_casemerge module subroutine symba_caseresolve (t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, & eoffset, vbs, & - npl, symba_plA, nplplenc, plplenc_list, regime, config%nplmax, config%ntpmax, fragmax, mres, rres, array_index1_child, & + npl, symba_plA, nplplenc, plplenc_list, regime, param%nplmax, param%ntpmax, fragmax, mres, rres, array_index1_child, & array_index2_child, m1, m2, rad1, rad2, x1, x2, v1, v2) implicit none - integer(I4B), intent(in) :: index_enc, config%nplmax, config%ntpmax + integer(I4B), intent(in) :: index_enc, param%nplmax, param%ntpmax integer(I4B), intent(inout) :: npl, nmergeadd, nmergesub, nplplenc, fragmax real(DP), intent(in) :: t, dt real(DP), intent(inout) :: eoffset, m1, m2, rad1, rad2 @@ -186,9 +186,9 @@ end subroutine symba_caseresolve module subroutine symba_casesupercatastrophic (t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, & eoffset, vbs, & - symba_plA, nplplenc, plplenc_list, config%nplmax, config%ntpmax, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2) + symba_plA, nplplenc, plplenc_list, param%nplmax, param%ntpmax, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2) implicit none - integer(I4B), intent(in) :: index_enc, config%nplmax, config%ntpmax + integer(I4B), intent(in) :: index_enc, param%nplmax, param%ntpmax integer(I4B), intent(inout) :: nmergeadd, nmergesub, nplplenc, fragmax real(DP), intent(in) :: t, dt real(DP), intent(inout) :: eoffset, m1, m2, rad1, rad2 @@ -247,41 +247,41 @@ module subroutine symba_discard_peri_pl(t, npl, symba_plA, msys, qmin, qmin_alo, type(symba_pl), intent(inout) :: symba_plA end subroutine symba_discard_peri_pl - module subroutine symba_discard_pl(t, npl, config%nplmax, nsp, symba_plA, rmin, rmax, config%rmaxu, qmin, qmin_coord, & - qmin_alo, qmin_ahi, config%j2rp2, config%j4rp4, eoffset) + module subroutine symba_discard_pl(t, npl, param%nplmax, nsp, symba_plA, rmin, rmax, param%rmaxu, qmin, qmin_coord, & + qmin_alo, qmin_ahi, param%j2rp2, param%j4rp4, eoffset) implicit none - integer(I4B), intent(in) :: config%nplmax + integer(I4B), intent(in) :: param%nplmax integer(I4B), intent(inout) :: npl, nsp - real(DP), intent(in) :: t, rmin, rmax, config%rmaxu, qmin, qmin_alo, qmin_ahi, config%j2rp2, config%j4rp4 + real(DP), intent(in) :: t, rmin, rmax, param%rmaxu, qmin, qmin_alo, qmin_ahi, param%j2rp2, param%j4rp4 real(DP), intent(inout) :: eoffset character(*), intent(in) :: qmin_coord type(symba_pl), intent(inout) :: symba_plA end subroutine symba_discard_pl - module subroutine symba_discard_sun_pl(t, npl, msys, swiftest_plA, rmin, rmax, config%rmaxu, ldiscards) + module subroutine symba_discard_sun_pl(t, npl, msys, swiftest_plA, rmin, rmax, param%rmaxu, ldiscards) implicit none logical , intent(inout) :: ldiscards integer(I4B), intent(in) :: npl - real(DP), intent(in) :: t, msys, rmin, rmax, config%rmaxu + real(DP), intent(in) :: t, msys, rmin, rmax, param%rmaxu type(swiftest_pl), intent(inout) :: swiftest_plA end subroutine symba_discard_sun_pl module subroutine symba_discard_tp(t, npl, ntp, nsp, symba_plA, symba_tpA, dt, & - rmin, rmax, config%rmaxu, qmin, qmin_coord, qmin_alo, qmin_ahi, lclose, lrhill_present) + rmin, rmax, param%rmaxu, qmin, qmin_coord, qmin_alo, qmin_ahi, lclose, lrhill_present) implicit none logical , intent(in) :: lclose, lrhill_present integer(I4B), intent(in) :: npl integer(I4B), intent(inout) :: ntp, nsp - real(DP), intent(in) :: t, dt, rmin, rmax, config%rmaxu, qmin, qmin_alo, qmin_ahi + real(DP), intent(in) :: t, dt, rmin, rmax, param%rmaxu, qmin, qmin_alo, qmin_ahi character(*), intent(in) :: qmin_coord type(symba_pl), intent(inout) :: symba_plA type(symba_tp), intent(inout) :: symba_tpA end subroutine symba_discard_tp - module subroutine symba_energy(npl, config%nplmax, swiftest_plA, config%j2rp2, config%j4rp4, ke, pe, te, htot) + module subroutine symba_energy(npl, param%nplmax, swiftest_plA, param%j2rp2, param%j4rp4, ke, pe, te, htot) implicit none - integer(I4B), intent(in) :: npl, config%nplmax - real(DP), intent(in) :: config%j2rp2, config%j4rp4 + integer(I4B), intent(in) :: npl, param%nplmax + real(DP), intent(in) :: param%j2rp2, param%j4rp4 real(DP), intent(out) :: ke, pe, te real(DP), dimension(NDIM), intent(out) :: htot type(swiftest_pl), intent(inout) :: swiftest_plA @@ -290,9 +290,9 @@ end subroutine symba_energy module subroutine symba_fragmentation(t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, & mergesub_list, eoffset, vbs, encounter_file, out_type, npl, ntp, & symba_plA, symba_tpA, nplplenc, npltpenc, pltpenc_list, plplenc_list, & - config%nplmax, config%ntpmax, fragmax) + param%nplmax, param%ntpmax, fragmax) implicit none - integer(I4B), intent(in) :: index_enc, config%nplmax, config%ntpmax + integer(I4B), intent(in) :: index_enc, param%nplmax, param%ntpmax integer(I4B), intent(inout) :: nmergeadd, nmergesub, nplplenc, npltpenc, fragmax integer(I4B), intent(inout) :: npl, ntp real(DP), intent(in) :: t, dt @@ -306,46 +306,46 @@ module subroutine symba_fragmentation(t, dt, index_enc, nmergeadd, nmergesub, me type(symba_tp), intent(inout) :: symba_tpA end subroutine symba_fragmentation - module subroutine symba_getacch(lextra_force, t, npl, nplm, config%nplmax, symba_plA, config%j2rp2, config%j4rp4, nplplenc, & + module subroutine symba_getacch(lextra_force, t, npl, nplm, param%nplmax, symba_plA, param%j2rp2, param%j4rp4, nplplenc, & plplenc_list) implicit none logical , intent(in) :: lextra_force - integer(I4B), intent(in) :: npl, nplm, config%nplmax, nplplenc - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4 + integer(I4B), intent(in) :: npl, nplm, param%nplmax, nplplenc + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4 type(symba_pl), intent(inout) :: symba_plA type(symba_plplenc), intent(in) :: plplenc_list end subroutine symba_getacch - module subroutine symba_getacch_tp(lextra_force, t, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, & - xh, config%j2rp2, config%j4rp4, & + module subroutine symba_getacch_tp(lextra_force, t, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, & + xh, param%j2rp2, param%j4rp4, & npltpenc, pltpenc_list) implicit none logical , intent(in) :: lextra_force - integer(I4B), intent(in) :: npl, nplm, config%nplmax, ntp, config%ntpmax, npltpenc - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4 + integer(I4B), intent(in) :: npl, nplm, param%nplmax, ntp, param%ntpmax, npltpenc + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4 real(DP), dimension(npl, NDIM), intent(in) :: xh type(symba_pl), intent(inout) :: symba_plA type(symba_tp), intent(inout) :: symba_tpA type(symba_pltpenc), intent(in) :: pltpenc_list end subroutine symba_getacch_tp - module subroutine symba_getacch_eucl(lextra_force, t, npl, nplm, config%nplmax, symba_plA, config%j2rp2, config%j4rp4, nplplenc, & + module subroutine symba_getacch_eucl(lextra_force, t, npl, nplm, param%nplmax, symba_plA, param%j2rp2, param%j4rp4, nplplenc, & plplenc_list, num_plpl_comparisons, k_plpl) implicit none logical , intent(in) :: lextra_force - integer(I4B), intent(in) :: npl, nplm, config%nplmax, nplplenc, num_plpl_comparisons - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4 + integer(I4B), intent(in) :: npl, nplm, param%nplmax, nplplenc, num_plpl_comparisons + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4 type(symba_pl), intent(inout) :: symba_plA type(symba_plplenc), intent(in) :: plplenc_list integer(I4B), dimension(num_plpl_comparisons,2),intent(in) :: k_plpl end subroutine symba_getacch_eucl - module subroutine symba_getacch_tp_eucl(lextra_force, t, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, & - xh, config%j2rp2, config%j4rp4, npltpenc, pltpenc_list, num_pltp_comparisons, k_pltp) + module subroutine symba_getacch_tp_eucl(lextra_force, t, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, & + xh, param%j2rp2, param%j4rp4, npltpenc, pltpenc_list, num_pltp_comparisons, k_pltp) implicit none logical , intent(in) :: lextra_force - integer(I4B), intent(in) :: npl, nplm, config%nplmax, ntp, config%ntpmax, npltpenc, num_pltp_comparisons - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4 + integer(I4B), intent(in) :: npl, nplm, param%nplmax, ntp, param%ntpmax, npltpenc, num_pltp_comparisons + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4 real(DP), dimension(npl, NDIM), intent(in) :: xh type(symba_pl), intent(inout) :: symba_plA type(symba_tp), intent(inout) :: symba_tpA @@ -367,11 +367,11 @@ module subroutine symba_helio_drift_tp(irec, ntp, symba_tpA, mu, dt) type(symba_tp), intent(inout) :: symba_tpA end subroutine symba_helio_drift_tp - module subroutine symba_helio_getacch(lflag, lextra_force, t, npl, nplm, config%nplmax, helio_plA, config%j2rp2, config%j4rp4) + module subroutine symba_helio_getacch(lflag, lextra_force, t, npl, nplm, param%nplmax, helio_plA, param%j2rp2, param%j4rp4) implicit none logical , intent(in) :: lflag, lextra_force - integer(I4B), intent(in) :: npl, nplm, config%nplmax - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4 + integer(I4B), intent(in) :: npl, nplm, param%nplmax + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4 type(helio_pl), intent(inout) :: helio_plA end subroutine symba_helio_getacch @@ -429,10 +429,10 @@ module subroutine symba_peri(lfirst, npl, symba_plA, msys, qmin_coord) end subroutine symba_peri module subroutine symba_rearray(t, npl, ntp, nsppl, nsptp, symba_plA, symba_tpA, nmergeadd, & - mergeadd_list, discard_plA, discard_tpA, config%nplmax, config%j2rp2, config%j4rp4) + mergeadd_list, discard_plA, discard_tpA, param%nplmax, param%j2rp2, param%j4rp4) implicit none - integer(I4B), intent(inout) :: npl, ntp, nsppl, nsptp, nmergeadd, config%nplmax !change to fragadd - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4 + integer(I4B), intent(inout) :: npl, ntp, nsppl, nsptp, nmergeadd, param%nplmax !change to fragadd + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4 type(symba_pl), intent(inout) :: symba_plA type(symba_tp), intent(inout) :: symba_tpA type(swiftest_tp), intent(inout) :: discard_tpA @@ -453,11 +453,11 @@ module subroutine symba_reorder_pl(npl, symba_plA) end subroutine symba_reorder_pl !> Initializes the SyMBA aprticles - module subroutine symba_set_initial_conditions(symba_plA, symba_tpA, config) + module subroutine symba_set_initial_conditions(symba_plA, symba_tpA, param) implicit none type(symba_pl), intent(inout) :: symba_plA !! SyMBA massive body structure type(symba_tp), intent(inout) :: symba_tpA !! SyMBA test particle structure - type(swiftest_configuration) :: config !! Input collection of on parameters + type(swiftest_parameters) :: param !! Input collection of on parameters end subroutine symba_set_initial_conditions !> Method to remove the inactive symba test particles and spill them to a discard object @@ -474,15 +474,15 @@ module subroutine symba_spill_pl(self,discard) class(symba_pl), intent(inout) :: discard !! Discarded body list end subroutine symba_spill_pl - module subroutine symba_step_eucl(lfirst, lextra_force, lclose, t, npl, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, config%j2rp2, config%j4rp4,& + module subroutine symba_step_eucl(lfirst, lextra_force, lclose, t, npl, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, param%j2rp2, param%j4rp4,& dt,nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list, mergesub_list, eoffset,& mtiny,encounter_file, out_type, num_plpl_comparisons, k_plpl, num_pltp_comparisons, k_pltp) implicit none logical , intent(in) :: lextra_force, lclose logical , intent(inout) :: lfirst - integer(I4B), intent(in) :: npl, config%nplmax, ntp, config%ntpmax + integer(I4B), intent(in) :: npl, param%nplmax, ntp, param%ntpmax integer(I4B), intent(inout) :: nplplenc, npltpenc, nmergeadd, nmergesub - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4, dt, mtiny + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4, dt, mtiny real(DP), intent(inout) :: eoffset character(*), intent(in) :: encounter_file, out_type type(symba_pl), intent(inout) :: symba_plA @@ -495,16 +495,16 @@ module subroutine symba_step_eucl(lfirst, lextra_force, lclose, t, npl, config%n integer(I4B), dimension(2,num_pltp_comparisons),intent(in) :: k_pltp end subroutine symba_step_eucl - module subroutine symba_step(lfirst, lextra_force, lclose, t, npl, config%nplmax, ntp, config%ntpmax, symba_plA, & - symba_tpA, config%j2rp2, config%j4rp4, dt, nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, & + module subroutine symba_step(lfirst, lextra_force, lclose, t, npl, param%nplmax, ntp, param%ntpmax, symba_plA, & + symba_tpA, param%j2rp2, param%j4rp4, dt, nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, & nmergesub, mergeadd_list, mergesub_list, eoffset, mtiny, encounter_file, out_type, & fragmax) implicit none logical , intent(in) :: lextra_force, lclose logical , intent(inout) :: lfirst - integer(I4B), intent(in) :: npl, config%nplmax, ntp, config%ntpmax + integer(I4B), intent(in) :: npl, param%nplmax, ntp, param%ntpmax integer(I4B), intent(inout) :: nplplenc, npltpenc, nmergeadd, nmergesub, fragmax - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4, dt, mtiny + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4, dt, mtiny real(DP), intent(inout) :: eoffset character(*), intent(in) :: encounter_file, out_type type(symba_pl), intent(inout) :: symba_plA @@ -515,37 +515,37 @@ module subroutine symba_step(lfirst, lextra_force, lclose, t, npl, config%nplmax end subroutine symba_step ! for testing purposes only _ use with symba_step_test - module subroutine symba_step_helio(lfirst, lextra_force, t, npl, nplm, config%nplmax, ntp, config%ntpmax, helio_plA, helio_tpA, config%j2rp2, & - config%j4rp4, dt) + module subroutine symba_step_helio(lfirst, lextra_force, t, npl, nplm, param%nplmax, ntp, param%ntpmax, helio_plA, helio_tpA, param%j2rp2, & + param%j4rp4, dt) implicit none logical , intent(in) :: lextra_force logical , intent(inout) :: lfirst - integer(I4B), intent(in) :: npl, nplm, config%nplmax, ntp, config%ntpmax - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4, dt + integer(I4B), intent(in) :: npl, nplm, param%nplmax, ntp, param%ntpmax + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4, dt type(helio_pl), intent(inout) :: helio_plA type(helio_tp), intent(inout) :: helio_tpA end subroutine symba_step_helio - module subroutine symba_step_helio_pl(lfirst, lextra_force, t, npl, nplm, config%nplmax, helio_plA, config%j2rp2, config%j4rp4, dt, xbeg, xend, & + module subroutine symba_step_helio_pl(lfirst, lextra_force, t, npl, nplm, param%nplmax, helio_plA, param%j2rp2, param%j4rp4, dt, xbeg, xend, & ptb, pte) implicit none logical , intent(in) :: lextra_force logical , intent(inout) :: lfirst - integer(I4B), intent(in) :: npl, nplm, config%nplmax - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4, dt + integer(I4B), intent(in) :: npl, nplm, param%nplmax + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4, dt real(DP), dimension(npl, NDIMm), intent(out) :: xbeg, xend real(DP), dimension(NDIM), intent(out) :: ptb, pte type(helio_pl), intent(inout) :: helio_plA end subroutine symba_step_helio_pl - module subroutine symba_step_interp_eucl(lextra_force, lclose, t, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, config%j2rp2,& - config%j4rp4, dt, eoffset, mtiny, nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list,& + module subroutine symba_step_interp_eucl(lextra_force, lclose, t, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, param%j2rp2,& + param%j4rp4, dt, eoffset, mtiny, nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list,& mergesub_list, encounter_file, out_type, num_plpl_comparisons, k_plpl, num_pltp_comparisons, k_pltp) implicit none logical , intent(in) :: lextra_force, lclose - integer(I4B), intent(in) :: npl, nplm, config%nplmax, ntp, config%ntpmax, nplplenc, npltpenc, num_pltp_comparisons + integer(I4B), intent(in) :: npl, nplm, param%nplmax, ntp, param%ntpmax, nplplenc, npltpenc, num_pltp_comparisons integer(I4B), intent(inout) :: nmergeadd, nmergesub - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4, dt, mtiny + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4, dt, mtiny real(DP), intent(inout) :: eoffset character(*), intent(in) :: encounter_file, out_type type(symba_pl), intent(inout) :: symba_plA @@ -558,14 +558,14 @@ module subroutine symba_step_interp_eucl(lextra_force, lclose, t, npl, nplm, con integer(I4B), dimension(2,num_pltp_comparisons),intent(in) :: k_pltp end subroutine symba_step_interp_eucl - module subroutine symba_step_interp(lextra_force, lclose, t, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, config%j2rp2, & - config%j4rp4, dt, eoffset, mtiny, nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list, & + module subroutine symba_step_interp(lextra_force, lclose, t, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, param%j2rp2, & + param%j4rp4, dt, eoffset, mtiny, nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list, & mergesub_list, encounter_file, out_type, fragmax) implicit none logical , intent(in) :: lextra_force, lclose - integer(I4B), intent(in) :: npl, nplm, config%nplmax, ntp, config%ntpmax, nplplenc, npltpenc + integer(I4B), intent(in) :: npl, nplm, param%nplmax, ntp, param%ntpmax, nplplenc, npltpenc integer(I4B), intent(inout) :: nmergeadd, nmergesub, fragmax - real(DP), intent(in) :: t, config%j2rp2, config%j4rp4, dt, mtiny + real(DP), intent(in) :: t, param%j2rp2, param%j4rp4, dt, mtiny real(DP), intent(inout) :: eoffset character(*), intent(in) :: encounter_file, out_type type(symba_pl), intent(inout) :: symba_plA @@ -577,10 +577,10 @@ end subroutine symba_step_interp recursive module subroutine symba_step_recur(lclose, t, ireci, npl, nplm, ntp, symba_plA, symba_tpA, dt0, eoffset, nplplenc, & npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list, mergesub_list, encounter_file, & - out_type, config%nplmax, config%ntpmax, fragmax) + out_type, param%nplmax, param%ntpmax, fragmax) implicit none logical , intent(in) :: lclose - integer(I4B), intent(in) :: ireci, npl, nplm, ntp, nplplenc, npltpenc, config%nplmax, config%ntpmax, fragmax + integer(I4B), intent(in) :: ireci, npl, nplm, ntp, nplplenc, npltpenc, param%nplmax, param%ntpmax, fragmax integer(I4B), intent(inout) :: nmergeadd, nmergesub real(DP), intent(in) :: t, dt0 real(DP), intent(inout) :: eoffset @@ -741,11 +741,11 @@ subroutine symba_deallocate_encounter(self) return end subroutine symba_deallocate_encounter - subroutine symba_encounter_dummy_input(self,config) + subroutine symba_encounter_dummy_input(self,param) !! This method is needed in order to extend the abstract type swiftest_body. It does nothing implicit none class(symba_encounter), intent(inout) :: self !! SyMBA encounter data structure - type(swiftest_configuration),intent(in) :: config !! Input collection of on parameters + type(swiftest_parameters),intent(in) :: param !! Input collection of on parameters return end subroutine symba_encounter_dummy_input diff --git a/src/modules/whm_classes.f90 b/src/modules/whm_classes.f90 index 24d764722..02e4c0806 100644 --- a/src/modules/whm_classes.f90 +++ b/src/modules/whm_classes.f90 @@ -107,32 +107,32 @@ module subroutine whm_setup_set_ir3j(self) class(whm_pl), intent(inout) :: self !! WHM massive body object end subroutine whm_setup_set_ir3j - module subroutine whm_step_pl(self, cb, config, t, dt) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine whm_step_pl(self, cb, param, t, dt) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! WHM massive body object class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), intent(in) :: dt !! Stepsize end subroutine whm_step_pl !> Get heliocentric accelration of massive bodies - module subroutine whm_getacch_pl(self, cb, config, t) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine whm_getacch_pl(self, cb, param, t) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time end subroutine whm_getacch_pl - module subroutine whm_drift_pl(self, cb, config, dt) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine whm_drift_pl(self, cb, param, dt) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structur - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: dt !! Stepsize end subroutine whm_drift_pl @@ -164,34 +164,34 @@ module subroutine whm_coord_vh2vj_pl(self, cb) class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree end subroutine whm_coord_vh2vj_pl - module subroutine whm_gr_getacch_pl(self, cb, config) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine whm_gr_getacch_pl(self, cb, param) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of end subroutine whm_gr_getacch_pl - module pure subroutine whm_gr_p4_pl(self, config, dt) - use swiftest_classes, only : swiftest_configuration + module pure subroutine whm_gr_p4_pl(self, param, dt) + use swiftest_classes, only : swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters real(DP), intent(in) :: dt !! Step size end subroutine whm_gr_p4_pl - module pure subroutine whm_gr_vh2pv_pl(self, config) - use swiftest_classes, only : swiftest_configuration + module pure subroutine whm_gr_vh2pv_pl(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters end subroutine whm_gr_vh2pv_pl - module pure subroutine whm_gr_pv2vh_pl(self, config) - use swiftest_classes, only : swiftest_configuration + module pure subroutine whm_gr_pv2vh_pl(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters end subroutine whm_gr_pv2vh_pl !> WHM test particle constructor @@ -201,34 +201,34 @@ module subroutine whm_setup_tp(self,n) integer, intent(in) :: n !! Number of test particles to allocate end subroutine whm_setup_tp - module subroutine whm_drift_tp(self, cb, config, dt) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine whm_drift_tp(self, cb, param, dt) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! WHM test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: dt !! Stepsize end subroutine whm_drift_tp !> Get heliocentric accelration of the test particle - module subroutine whm_getacch_tp(self, cb, pl, config, t, xh) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine whm_getacch_tp(self, cb, pl, param, t, xh) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! WHM test particle data structure class(swiftest_cb), intent(inout) :: cb !! Generic Swiftest central body particle data structuree class(whm_pl), intent(inout) :: pl !! WHM massive body particle data structure. - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), dimension(:,:), intent(in) :: xh !! Heliocentric positions of planets end subroutine whm_getacch_tp - module subroutine whm_step_tp(self, cb, pl, config, t, dt) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine whm_step_tp(self, cb, pl, param, t, dt) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! WHM test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure class(whm_pl), intent(inout) :: pl !! WHM massive body data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), intent(in) :: dt !! Stepsize end subroutine whm_step_tp @@ -240,41 +240,41 @@ module subroutine whm_setup_set_beg_end(self, xbeg, xend, vbeg) real(DP), dimension(:,:), intent(in), optional :: vbeg ! vbeg is an unused variable to keep this method forward compatible with RMVS end subroutine whm_setup_set_beg_end - module subroutine whm_gr_getacch_tp(self, cb, config) - use swiftest_classes, only : swiftest_cb, swiftest_configuration + module subroutine whm_gr_getacch_tp(self, cb, param) + use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of end subroutine whm_gr_getacch_tp - module pure subroutine whm_gr_p4_tp(self, config, dt) - use swiftest_classes, only : swiftest_configuration + module pure subroutine whm_gr_p4_tp(self, param, dt) + use swiftest_classes, only : swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters real(DP), intent(in) :: dt !! Step size end subroutine whm_gr_p4_tp - module pure subroutine whm_gr_vh2pv_tp(self, config) - use swiftest_classes, only : swiftest_configuration + module pure subroutine whm_gr_vh2pv_tp(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters end subroutine whm_gr_vh2pv_tp - module pure subroutine whm_gr_pv2vh_tp(self, config) - use swiftest_classes, only : swiftest_configuration + module pure subroutine whm_gr_pv2vh_tp(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters end subroutine whm_gr_pv2vh_tp - module subroutine whm_setup_system(self, config) - use swiftest_classes, only : swiftest_configuration + module subroutine whm_setup_system(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(whm_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(inout) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of on parameters end subroutine whm_setup_system module subroutine whm_spill_pl(self, discards, lspill_list) @@ -294,11 +294,11 @@ module subroutine whm_fill_pl(self, inserts, lfill_list) end subroutine whm_fill_pl !> Steps the Swiftest nbody system forward in time one stepsize - module subroutine whm_step_system(self, config) - use swiftest_classes, only : swiftest_configuration + module subroutine whm_step_system(self, param) + use swiftest_classes, only : swiftest_parameters implicit none class(whm_nbody_system), intent(inout) :: self !! WHM system object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters end subroutine whm_step_system end interface diff --git a/src/rmvs/rmvs_getacch.f90 b/src/rmvs/rmvs_getacch.f90 index 550046131..6201c42da 100644 --- a/src/rmvs/rmvs_getacch.f90 +++ b/src/rmvs/rmvs_getacch.f90 @@ -1,7 +1,7 @@ submodule(rmvs_classes) s_rmvs_getacch use swiftest contains - module subroutine rmvs_getacch_tp(self, cb, pl, config, t, xh) + module subroutine rmvs_getacch_tp(self, cb, pl, param, t, xh) !! author: David A. Minton !! !! Compute the oblateness acceleration in the inner encounter region with planets @@ -13,11 +13,11 @@ module subroutine rmvs_getacch_tp(self, cb, pl, config, t, xh) class(rmvs_tp), intent(inout) :: self !! RMVS test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree class(whm_pl), intent(inout) :: pl !! WHM massive body particle data structure. - class(swiftest_configuration), intent(in) :: config !! Input collection of parameter + class(swiftest_parameters), intent(in) :: param !! Input collection of parameter real(DP), intent(in) :: t !! Current time real(DP), dimension(:,:), intent(in) :: xh !! Heliocentric positions of planets ! Internals - type(swiftest_configuration) :: config_planetocen + type(swiftest_parameters) :: param_planetocen real(DP), dimension(:, :), allocatable :: xh_original integer(I4B) :: i @@ -33,13 +33,13 @@ module subroutine rmvs_getacch_tp(self, cb, pl, config, t, xh) class is (rmvs_cb) associate(xpc => pl%xh, xpct => self%xh) allocate(xh_original, source=tp%xh) - config_planetocen = config + param_planetocen = param ! Temporarily turn off the heliocentric-dependent acceleration terms during an inner encounter - config_planetocen%loblatecb = .false. - config_planetocen%lextra_force = .false. - config_planetocen%lgr = .false. + param_planetocen%loblatecb = .false. + param_planetocen%lextra_force = .false. + param_planetocen%lgr = .false. ! Now compute the planetocentric values of acceleration - call whm_getacch_tp(tp, cb, pl, config_planetocen, t, xh) + call whm_getacch_tp(tp, cb, pl, param_planetocen, t, xh) ! Now compute any heliocentric values of acceleration if (tp%lfirst) then @@ -53,7 +53,7 @@ module subroutine rmvs_getacch_tp(self, cb, pl, config, t, xh) end if ! Swap the planetocentric and heliocentric position vectors tp%xh(:,:) = tp%xheliocentric(:,:) - if (config%loblatecb) then + if (param%loblatecb) then ! Put in the current encountering planet's oblateness acceleration as the central body's if (tp%lfirst) then cb_heliocentric%aobl(:) = cb%inner(inner_index - 1)%aobl(:,1) @@ -63,15 +63,15 @@ module subroutine rmvs_getacch_tp(self, cb, pl, config, t, xh) call tp%obl_acc(cb_heliocentric) end if - if (config%lextra_force) call tp%user_getacch(cb_heliocentric, config, t) - if (config%lgr) call tp%gr_getacch(cb_heliocentric, config) + if (param%lextra_force) call tp%user_getacch(cb_heliocentric, param, t) + if (param%lgr) call tp%gr_getacch(cb_heliocentric, param) tp%xh(:,:) = xh_original(:,:) end associate end select end select else ! Not a close encounter, so just proceded with the standard WHM method - call whm_getacch_tp(tp, cb, pl, config, t, xh) + call whm_getacch_tp(tp, cb, pl, param, t, xh) end if end associate diff --git a/src/rmvs/rmvs_setup.f90 b/src/rmvs/rmvs_setup.f90 index e213b79fd..95634e0a1 100644 --- a/src/rmvs/rmvs_setup.f90 +++ b/src/rmvs/rmvs_setup.f90 @@ -13,7 +13,7 @@ module subroutine rmvs_setup_pl(self,n) integer(I4B), intent(in) :: n !! Number of test particles to allocate ! Internals integer(I4B) :: i,j - !type(swiftest_configuration) :: encounter_config + !type(swiftest_parameters) :: encounter_param !> Call allocation method for parent class associate(pl => self) @@ -73,7 +73,7 @@ module subroutine rmvs_setup_tp(self,n) return end subroutine rmvs_setup_tp - module subroutine rmvs_setup_system(self, config) + module subroutine rmvs_setup_system(self, param) !! author: David A. Minton !! !! Wrapper method to initialize a basic Swiftest nbody system from files. @@ -86,12 +86,12 @@ module subroutine rmvs_setup_system(self, config) implicit none ! Arguments class(rmvs_nbody_system), intent(inout) :: self !! RMVS system object - class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Input collection of parameters parameters ! Internals integer(I4B) :: i, j ! Call parent method - call whm_setup_system(self, config) + call whm_setup_system(self, param) ! Set up the pl-tp planetocentric encounter structures for pl and cb. The planetocentric tp structures are ! generated as necessary during close encounter steps. diff --git a/src/rmvs/rmvs_step.f90 b/src/rmvs/rmvs_step.f90 index bc6eea6ec..4d864e807 100644 --- a/src/rmvs/rmvs_step.f90 +++ b/src/rmvs/rmvs_step.f90 @@ -1,7 +1,7 @@ submodule(rmvs_classes) s_rmvs_step use swiftest contains - module subroutine rmvs_step_system(self, config) + module subroutine rmvs_step_system(self, param) !! author: David A. Minton !! !! Step massive bodies and and active test particles ahead in heliocentric coordinates @@ -11,7 +11,7 @@ module subroutine rmvs_step_system(self, config) implicit none ! Arguments class(rmvs_nbody_system), intent(inout) :: self !! RMVS nbody system object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters ! Internals logical :: lencounter, lfirstpl, lfirsttp real(DP) :: rts @@ -24,7 +24,7 @@ module subroutine rmvs_step_system(self, config) class is (rmvs_pl) select type(tp => self%tp) class is (rmvs_tp) - associate(ntp => tp%nbody, npl => pl%nbody, t => config%t, dt => config%dt, & + associate(ntp => tp%nbody, npl => pl%nbody, t => param%t, dt => param%dt, & xhpl => pl%xh, vhpl => pl%vh, xjpl => pl%xj, vjpl => pl%vj, & xhtp => tp%xh, vhtp => tp%vh) allocate(xbeg, source=pl%xh) @@ -39,21 +39,21 @@ module subroutine rmvs_step_system(self, config) lfirsttp = tp%lfirst pl%outer(0)%x(:,:) = xbeg(:,:) pl%outer(0)%v(:,:) = vbeg(:,:) - call pl%step(cb, config, t, dt) + call pl%step(cb, param, t, dt) pl%outer(NTENC)%x(:,:) = pl%xh(:,:) pl%outer(NTENC)%v(:,:) = pl%vh(:,:) call tp%set_beg_end(xend = pl%xh) - call rmvs_interp_out(pl,cb, dt, config) - call rmvs_step_out(pl, cb, tp, dt, config) + call rmvs_interp_out(pl,cb, dt, param) + call rmvs_step_out(pl, cb, tp, dt, param) call tp%reverse_status() call tp%set_beg_end(xbeg = xbeg, xend = xend) tp%lfirst = .true. - call tp%step(cb, pl, config, t, dt) + call tp%step(cb, pl, param, t, dt) where (tp%status(:) == INACTIVE) tp%status(:) = ACTIVE pl%lfirst = lfirstpl tp%lfirst = lfirsttp else - call whm_step_system(self, config) + call whm_step_system(self, param) end if end associate end select @@ -63,7 +63,7 @@ module subroutine rmvs_step_system(self, config) end subroutine rmvs_step_system - subroutine rmvs_step_out(pl, cb, tp, dt, config) + subroutine rmvs_step_out(pl, cb, tp, dt, param) !! author: David A. Minton !! !! Step ACTIVE test particles ahead in the outer encounter region, setting up and calling the inner region @@ -77,13 +77,13 @@ subroutine rmvs_step_out(pl, cb, tp, dt, config) class(rmvs_cb), intent(inout) :: cb !! RMVS central body object class(rmvs_tp), intent(inout) :: tp !! RMVS test particle object real(DP), intent(in) :: dt !! Step size - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters ! Internals integer(I4B) :: outer_index, j, k real(DP) :: dto, outer_time, rts logical :: lencounter, lfirsttp - associate(npl => pl%nbody, ntp => tp%nbody, t => config%t) + associate(npl => pl%nbody, ntp => tp%nbody, t => param%t) dto = dt / NTENC where(tp%plencP(:) == 0) tp%status(:) = INACTIVE @@ -99,15 +99,15 @@ subroutine rmvs_step_out(pl, cb, tp, dt, config) lencounter = tp%encounter_check(cb, pl, dt, rts) if (lencounter) then ! Interpolate planets in inner encounter region - call rmvs_interp_in(pl, cb, dto, outer_index, config) + call rmvs_interp_in(pl, cb, dto, outer_index, param) ! Step through the inner region - call rmvs_step_in(pl, cb, tp, config, outer_time, dto) + call rmvs_step_in(pl, cb, tp, param, outer_time, dto) lfirsttp = tp%lfirst tp%lfirst = .true. - call tp%step(cb, pl, config, outer_time, dto) + call tp%step(cb, pl, param, outer_time, dto) tp%lfirst = lfirsttp else - call tp%step(cb, pl, config, outer_time, dto) + call tp%step(cb, pl, param, outer_time, dto) end if do j = 1, npl if (pl%nenc(j) == 0) cycle @@ -119,7 +119,7 @@ subroutine rmvs_step_out(pl, cb, tp, dt, config) end subroutine rmvs_step_out - subroutine rmvs_step_in(pl, cb, tp, config, outer_time, dto) + subroutine rmvs_step_in(pl, cb, tp, param, outer_time, dto) !! author: David A. Minton !! !! Step active test particles ahead in the inner encounter region @@ -131,7 +131,7 @@ subroutine rmvs_step_in(pl, cb, tp, config, outer_time, dto) class(rmvs_pl), intent(inout) :: pl !! RMVS massive body object class(rmvs_cb), intent(inout) :: cb !! RMVS central body object class(rmvs_tp), intent(inout) :: tp !! RMVS test particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: outer_time !! Current time real(DP), intent(in) :: dto !! Step size ! Internals @@ -145,8 +145,8 @@ subroutine rmvs_step_in(pl, cb, tp, config, outer_time, dto) allocate(xbeg, mold=pl%xh) allocate(xend, mold=pl%xh) allocate(vbeg, mold=pl%vh) - if (config%loblatecb) call pl%obl_acc(cb) - call rmvs_make_planetocentric(pl, cb, tp, config) + if (param%loblatecb) call pl%obl_acc(cb) + call rmvs_make_planetocentric(pl, cb, tp, param) do i = 1, npl if (nenc(i) == 0) cycle associate(cbenci => pl%planetocentric(i)%cb, plenci => pl%planetocentric(i)%pl, & @@ -155,19 +155,19 @@ subroutine rmvs_step_in(pl, cb, tp, config, outer_time, dto) ! There are inner encounters with this planet...switch to planetocentric coordinates to proceed tpenci%lfirst = .true. inner_time = outer_time - call rmvs_peri_tp(tpenci, pl, inner_time, dti, .true., 0, i, config) + call rmvs_peri_tp(tpenci, pl, inner_time, dti, .true., 0, i, param) ! now step the encountering test particles fully through the inner encounter lfirsttp = .true. do inner_index = 1, NTPHENC ! Integrate over the encounter region, using the "substitute" planetocentric systems at each level plenci%xh(:,:) = plenci%inner(inner_index - 1)%x(:,:) call tpenci%set_beg_end(xbeg = plenci%inner(inner_index - 1)%x, & xend = plenci%inner(inner_index)%x) - call tpenci%step(cbenci, plenci, config, inner_time, dti) + call tpenci%step(cbenci, plenci, param, inner_time, dti) do j = 1, nenc(i) tpenci%xheliocentric(:, j) = tpenci%xh(:, j) + pl%inner(inner_index)%x(:,i) end do inner_time = outer_time + j * dti - call rmvs_peri_tp(tpenci, pl, inner_time, dti, .false., inner_index, i, config) + call rmvs_peri_tp(tpenci, pl, inner_time, dti, .false., inner_index, i, param) end do where(tpenci%status(:) == ACTIVE) tpenci%status(:) = INACTIVE end associate @@ -178,7 +178,7 @@ subroutine rmvs_step_in(pl, cb, tp, config, outer_time, dto) return end subroutine rmvs_step_in - subroutine rmvs_interp_in(pl, cb, dt, outer_index, config) + subroutine rmvs_interp_in(pl, cb, dt, outer_index, param) !! author: David A. Minton !! !! Interpolate planet positions between two Keplerian orbits in inner encounter regio @@ -192,7 +192,7 @@ subroutine rmvs_interp_in(pl, cb, dt, outer_index, config) class(rmvs_cb), intent(inout) :: cb !! RMVS central body particle type real(DP), intent(in) :: dt !! Step size integer(I4B), intent(in) :: outer_index !! Outer substep number within current se - class(swiftest_configuration), intent(in) :: config !! Swiftest configuration file + class(swiftest_parameters), intent(in) :: param !! Swiftest parameters file ! Internals integer(I4B) :: i, inner_index real(DP) :: frac, dntphenc @@ -218,7 +218,7 @@ subroutine rmvs_interp_in(pl, cb, dt, outer_index, config) msun(:) = cb%Gmass xtmp(:, :) = pl%inner(0)%x(:, :) vtmp(:, :) = pl%inner(0)%v(:, :) - if (config%loblatecb) then + if (param%loblatecb) then allocate(xh_original,source=pl%xh) pl%xh(:, :) = xtmp(:, :) ! Temporarily replace heliocentric position with inner substep values to calculate the oblateness terms call pl%obl_acc(cb) @@ -269,13 +269,13 @@ subroutine rmvs_interp_in(pl, cb, dt, outer_index, config) pl%inner(inner_index)%x(:, :) = pl%inner(inner_index)%x(:, :) + frac * xtmp(:, :) pl%inner(inner_index)%v(:, :) = pl%inner(inner_index)%v(:, :) + frac * vtmp(:, :) - if (config%loblatecb) then + if (param%loblatecb) then pl%xh(:,:) = pl%inner(inner_index)%x(:, :) call pl%obl_acc(cb) pl%inner(inner_index)%aobl(:, :) = pl%aobl(:, :) end if end do - if (config%loblatecb) then + if (param%loblatecb) then ! Calculate the final value of oblateness accelerations at the final inner substep pl%xh(:,:) = pl%inner(NTPHENC)%x(:, :) call pl%obl_acc(cb) @@ -288,7 +288,7 @@ subroutine rmvs_interp_in(pl, cb, dt, outer_index, config) end subroutine rmvs_interp_in - subroutine rmvs_interp_out(pl, cb, dt, config) + subroutine rmvs_interp_out(pl, cb, dt, param) !! author: David A. Minton !! !! Interpolate planet positions between two Keplerian orbits in outer encounter region @@ -301,7 +301,7 @@ subroutine rmvs_interp_out(pl, cb, dt, config) class(rmvs_pl), intent(inout) :: pl !! RMVS test particle object class(rmvs_cb), intent(inout) :: cb !! RMVS central body particle type real(DP), intent(in) :: dt !! Step size - class(swiftest_configuration), intent(in) :: config !! Swiftest configuration file + class(swiftest_parameters), intent(in) :: param !! Swiftest parameters file ! Internals integer(I4B) :: i, outer_index real(DP) :: frac, dntenc @@ -370,7 +370,7 @@ subroutine rmvs_interp_out(pl, cb, dt, config) end subroutine rmvs_interp_out - subroutine rmvs_peri_tp(tp, pl, t, dt, lfirst, inner_index, ipleP, config) + subroutine rmvs_peri_tp(tp, pl, t, dt, lfirst, inner_index, ipleP, param) !! author: David A. Minton !! !! Determine planetocentric pericenter passages for test particles in close encounters with a planet @@ -386,7 +386,7 @@ subroutine rmvs_peri_tp(tp, pl, t, dt, lfirst, inner_index, ipleP, config) logical, intent(in) :: lfirst !! Logical flag indicating whether current invocation is the first integer(I4B), intent(in) :: inner_index !! Outer substep number within current set integer(I4B), intent(in) :: ipleP !! index of RMVS planet being closely encountered - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters ! Internals integer(I4B) :: i, id1, id2 real(DP) :: r2, mu, rhill2, vdotr, a, peri, capm, tperi, rpl @@ -416,7 +416,7 @@ subroutine rmvs_peri_tp(tp, pl, t, dt, lfirst, inner_index, ipleP, config) call orbel_xv2aqt(mu, xpc(:, i), vpc(:, i), a, peri, capm, tperi) r2 = dot_product(xpc(:, i), xpc(:, i)) if ((abs(tperi) > FACQDT * dt) .or. (r2 > rhill2)) peri = sqrt(r2) - if (config%encounter_file /= "") then + if (param%encounter_file /= "") then id1 = pl%name(ipleP) rpl = pl%radius(ipleP) xh1(:) = pl%inner(inner_index)%x(:, ipleP) @@ -425,7 +425,7 @@ subroutine rmvs_peri_tp(tp, pl, t, dt, lfirst, inner_index, ipleP, config) xh2(:) = xpc(:, i) + xh1(:) vh2(:) = xpc(:, i) + vh1(:) call io_write_encounter(t, id1, id2, mu, 0.0_DP, rpl, 0.0_DP, xh1(:), xh2(:), vh1(:), vh2(:), & - config%encounter_file, config%out_type) + param%encounter_file, param%out_type) end if if (tp%lperi(i)) then if (peri < tp%peri(i)) then @@ -453,7 +453,7 @@ subroutine rmvs_peri_tp(tp, pl, t, dt, lfirst, inner_index, ipleP, config) end subroutine rmvs_peri_tp - subroutine rmvs_make_planetocentric(pl, cb, tp, config) + subroutine rmvs_make_planetocentric(pl, cb, tp, param) !! author: David A. Minton !! !! When encounters are detected, this method will call the interpolation methods for the planets and @@ -465,7 +465,7 @@ subroutine rmvs_make_planetocentric(pl, cb, tp, config) class(rmvs_pl), intent(inout) :: pl !! RMVS test particle object class(rmvs_cb), intent(inout) :: cb !! RMVS central body particle type class(rmvs_tp), intent(inout) :: tp !! RMVS test particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters ! Internals integer(I4B) :: i, j, inner_index, ipc2hc logical, dimension(:), allocatable :: encmask diff --git a/src/setup/setup.f90 b/src/setup/setup.f90 index f7f3ba9fd..753c3e90c 100644 --- a/src/setup/setup.f90 +++ b/src/setup/setup.f90 @@ -1,7 +1,7 @@ submodule (swiftest_classes) s_setup use swiftest contains - module subroutine setup_construct_system(system, config) + module subroutine setup_construct_system(system, param) !! author: David A. Minton !! !! Constructor for a Swiftest nbody system. Creates the nbody system object based on the user-input integrator @@ -9,9 +9,9 @@ module subroutine setup_construct_system(system, config) implicit none ! Arguments class(swiftest_nbody_system), allocatable, intent(inout) :: system !! Swiftest system object - type(swiftest_configuration), intent(in) :: config !! Swiftest configuration parameters + type(swiftest_parameters), intent(in) :: param !! Swiftest parameters parameters - select case(config%integrator) + select case(param%integrator) case (BS) write(*,*) 'Bulirsch-Stoer integrator not yet enabled' case (HELIO) @@ -51,7 +51,7 @@ module subroutine setup_construct_system(system, config) case (RINGMOONS) write(*,*) 'RINGMOONS-SyMBA integrator not yet enabled' case default - write(*,*) 'Unkown integrator',config%integrator + write(*,*) 'Unkown integrator',param%integrator call util_exit(FAILURE) end select diff --git a/src/symba/symba_casedisruption.f90 b/src/symba/symba_casedisruption.f90 index 463d2db2a..bd8f03330 100644 --- a/src/symba/symba_casedisruption.f90 +++ b/src/symba/symba_casedisruption.f90 @@ -127,7 +127,7 @@ end function cross_product_disruption nmergeadd = nmergeadd + 1 mergeadd_list%status(nmergeadd) = DISRUPTION mergeadd_list%ncomp(nmergeadd) = 2 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i mergeadd_list%mass(nmergeadd) = mres(1) mergeadd_list%radius(nmergeadd) = rres(1) mtot = mtot + mergeadd_list%mass(nmergeadd) @@ -142,7 +142,7 @@ end function cross_product_disruption nmergeadd = nmergeadd + 1 mergeadd_list%status(nmergeadd) = DISRUPTION mergeadd_list%ncomp(nmergeadd) = 2 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i mergeadd_list%mass(nmergeadd) = mres(2) mergeadd_list%radius(nmergeadd) = rres(2) mtot = mtot + mergeadd_list%mass(nmergeadd) @@ -152,7 +152,7 @@ end function cross_product_disruption nmergeadd = nmergeadd + 1 mergeadd_list%status(nmergeadd) = DISRUPTION mergeadd_list%ncomp(nmergeadd) = 2 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i m_rem = (m1 + m2) - (mres(1) + mres(2)) mergeadd_list%mass(nmergeadd) = m_rem / (nfrag - 1) mergeadd_list%radius(nmergeadd) = ((3.0_DP * mergeadd_list%mass(nmergeadd)) / (4.0_DP * pi * avg_d)) & @@ -168,7 +168,7 @@ end function cross_product_disruption m_rem = (m1 + m2) - mres(1) frags_added = frags_added + 1 nmergeadd = nmergeadd + 1 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i mergeadd_list%status(nmergeadd) = DISRUPTION mergeadd_list%ncomp(nmergeadd) = 2 mergeadd_list%mass(nmergeadd) = m_rem / (nfrag - 1) @@ -187,7 +187,7 @@ end function cross_product_disruption !nmergeadd = nmergeadd + 1 !mergeadd_list%status(nmergeadd) = DISRUPTION !mergeadd_list%ncomp(nmergeadd) = 2 - !mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + !mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i !m_rem = (m1 + m2) - (mres(1) + mres(2)) !mergeadd_list%mass(nmergeadd) = m_rem / (nfrag - 1) !mergeadd_list%radius(nmergeadd) = ((3.0_DP * mergeadd_list%mass(nmergeadd)) / (4.0_DP * pi * avg_d)) & diff --git a/src/symba/symba_casehitandrun.f90 b/src/symba/symba_casehitandrun.f90 index 64dd4f326..201195181 100644 --- a/src/symba/symba_casehitandrun.f90 +++ b/src/symba/symba_casehitandrun.f90 @@ -169,7 +169,7 @@ end function cross_product_hitandrun nmergeadd = nmergeadd + 1 mergeadd_list%status(nmergeadd) = HIT_AND_RUN mergeadd_list%ncomp(nmergeadd) = 2 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i - 1 + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i - 1 mergeadd_list%mass(nmergeadd) = mass_rm mergeadd_list%radius(nmergeadd) = rad_rm mergeadd_list%xh(:,nmergeadd) = xh_rm(:) @@ -192,7 +192,7 @@ end function cross_product_hitandrun nmergeadd = nmergeadd + 1 mergeadd_list%status(nmergeadd) = HIT_AND_RUN mergeadd_list%ncomp(nmergeadd) = 2 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i - 1 + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i - 1 mergeadd_list%mass(nmergeadd) = m_rem / (nfrag - 1) mergeadd_list%radius(nmergeadd) = ((3.0_DP * mergeadd_list%mass(nmergeadd)) / (4.0_DP * pi * d_rm)) & ** (1.0_DP / 3.0_DP) diff --git a/src/symba/symba_caseresolve.f90 b/src/symba/symba_caseresolve.f90 index a0ec4cb15..cbee34081 100644 --- a/src/symba/symba_caseresolve.f90 +++ b/src/symba/symba_caseresolve.f90 @@ -13,12 +13,12 @@ case (COLLRESOLVE_REGIME_DISRUPTION) call symba_casedisruption (t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, eoffset, vbs, & - symba_plA, nplplenc, plplenc_list, config%nplmax, config%ntpmax, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2) + symba_plA, nplplenc, plplenc_list, param%nplmax, param%ntpmax, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2) case (COLLRESOLVE_REGIME_SUPERCATASTROPHIC) call symba_casesupercatastrophic (t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, & eoffset, vbs, symba_plA, nplplenc, & - plplenc_list, config%nplmax, config%ntpmax, fragmax, mres, rres, m1, m2, rad1, & + plplenc_list, param%nplmax, param%ntpmax, fragmax, mres, rres, m1, m2, rad1, & rad2, x1, x2, v1, v2) case (COLLRESOLVE_REGIME_GRAZE_AND_MERGE) @@ -29,7 +29,7 @@ case (COLLRESOLVE_REGIME_HIT_AND_RUN) call symba_casehitandrun (t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, eoffset, vbs, & symba_plA, nplplenc, plplenc_list, & - config%nplmax, config%ntpmax, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2) + param%nplmax, param%ntpmax, fragmax, mres, rres, m1, m2, rad1, rad2, x1, x2, v1, v2) case (COLLRESOLVE_REGIME_MERGE) call symba_casemerge (t, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, eoffset, vbs, & diff --git a/src/symba/symba_casesupercatastrophic.f90 b/src/symba/symba_casesupercatastrophic.f90 index 4ecbd12d5..04aa1bfa7 100644 --- a/src/symba/symba_casesupercatastrophic.f90 +++ b/src/symba/symba_casesupercatastrophic.f90 @@ -128,7 +128,7 @@ end function cross_product_supercatastrophic do i = 1, nfrag frags_added = frags_added + 1 nmergeadd = nmergeadd + 1 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i mergeadd_list%status(nmergeadd) = SUPERCATASTROPHIC mergeadd_list%ncomp(nmergeadd) = 2 mergeadd_list%mass(nmergeadd) = m1m2_10 @@ -143,7 +143,7 @@ end function cross_product_supercatastrophic if ((mres(1) > m1m2_10)) then frags_added = frags_added + 1 nmergeadd = nmergeadd + 1 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i mergeadd_list%status(nmergeadd) = SUPERCATASTROPHIC mergeadd_list%ncomp(nmergeadd) = 2 mergeadd_list%mass(nmergeadd) = mres(1) @@ -152,7 +152,7 @@ end function cross_product_supercatastrophic do i = 2, nfrag frags_added = frags_added + 1 nmergeadd = nmergeadd + 1 - mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i mergeadd_list%status(nmergeadd) = SUPERCATASTROPHIC mergeadd_list%ncomp(nmergeadd) = 2 mergeadd_list%mass(nmergeadd) = (m1 + m2 - mres(1)) / (nfrag - 1.0_DP) @@ -175,7 +175,7 @@ end function cross_product_supercatastrophic ! if yes, add a fragment using durda et al 2007 figure 2 supercatastrophic: n = (1.5e5)e(-1.3*d) for the mass ! frags_added = frags_added + 1 ! nmergeadd = nmergeadd + 1 - ! mergeadd_list%name(nmergeadd) = config%nplmax + config%ntpmax + fragmax + i + ! mergeadd_list%name(nmergeadd) = param%nplmax + param%ntpmax + fragmax + i ! mergeadd_list%status(nmergeadd) = SUPERCATASTROPHIC ! mergeadd_list%ncomp(nmergeadd) = 2 ! mergeadd_list%mass(nmergeadd) = m_rem / (nfrag - 1) diff --git a/src/symba/symba_discard_pl.f90 b/src/symba/symba_discard_pl.f90 index c9b5d656e..e5a7803a7 100644 --- a/src/symba/symba_discard_pl.f90 +++ b/src/symba/symba_discard_pl.f90 @@ -16,10 +16,10 @@ ! executable code ldiscards = .false. - if ((rmin >= 0.0_DP) .or. (rmax >= 0.0_DP) .or. (config%rmaxu >= 0.0_DP) .or. ((qmin >= 0.0_DP) .and. (qmin_coord == "bary"))) & + if ((rmin >= 0.0_DP) .or. (rmax >= 0.0_DP) .or. (param%rmaxu >= 0.0_DP) .or. ((qmin >= 0.0_DP) .and. (qmin_coord == "bary"))) & call coord_h2b(npl, symba_plA, msys) - if ((rmin >= 0.0_DP) .or. (rmax >= 0.0_DP) .or. (config%rmaxu >= 0.0_DP)) & - call symba_discard_sun_pl(t, npl, msys, symba_plA, rmin, rmax, config%rmaxu, ldiscards) + if ((rmin >= 0.0_DP) .or. (rmax >= 0.0_DP) .or. (param%rmaxu >= 0.0_DP)) & + call symba_discard_sun_pl(t, npl, msys, symba_plA, rmin, rmax, param%rmaxu, ldiscards) if (qmin >= 0.0_DP) call symba_discard_peri_pl(t, npl, symba_plA, msys, qmin, qmin_alo, qmin_ahi, qmin_coord, ldiscards) return diff --git a/src/symba/symba_discard_sun_pl.f90 b/src/symba/symba_discard_sun_pl.f90 index f10818ba7..a66b2f316 100644 --- a/src/symba/symba_discard_sun_pl.f90 +++ b/src/symba/symba_discard_sun_pl.f90 @@ -10,13 +10,13 @@ use swiftest implicit none integer(I4B) :: i - real(DP) :: energy, vb2, rb2, rh2, rmin2, rmax2, config%rmaxu2 + real(DP) :: energy, vb2, rb2, rh2, rmin2, rmax2, param%rmaxu2 ! executable code rmin2 = rmin*rmin rmax2 = rmax*rmax - config%rmaxu2 = config%rmaxu*config%rmaxu + param%rmaxu2 = param%rmaxu*param%rmaxu do i = 2, npl if (swiftest_plA%status(i) == ACTIVE) then rh2 = dot_product(swiftest_plA%xh(:,i), swiftest_plA%xh(:,i)) @@ -30,13 +30,13 @@ ldiscards = .true. swiftest_plA%status(i) = DISCARDED_RMIN write(*, *) "particle ", swiftest_plA%name(i), " too close to sun at t = ", t - else if (config%rmaxu >= 0.0_DP) then + else if (param%rmaxu >= 0.0_DP) then rb2 = dot_product(swiftest_plA%xb(:,i), swiftest_plA%xb(:,i)) vb2 = dot_product(swiftest_plA%vb(:,i), swiftest_plA%vb(:,i)) energy = 0.5_DP*vb2 - msys/sqrt(rb2) - if ((energy > 0.0_DP) .and. (rb2 > config%rmaxu2)) then + if ((energy > 0.0_DP) .and. (rb2 > param%rmaxu2)) then ldiscards = .true. - swiftest_plA%status(i) = discarded_config%rmaxu + swiftest_plA%status(i) = discarded_param%rmaxu write(*, *) "particle ", swiftest_plA%name(i), " is unbound and too far from barycenter at t = ", t end if end if diff --git a/src/symba/symba_discard_tp.f90 b/src/symba/symba_discard_tp.f90 index 78bcf6e03..660283b87 100644 --- a/src/symba/symba_discard_tp.f90 +++ b/src/symba/symba_discard_tp.f90 @@ -12,7 +12,7 @@ integer(I4B) :: i ! executable code - call discard_tpt, dt, npl, ntp, symba_plA, symba_tpA, rmin, rmax, config%rmaxu, qmin, & + call discard_tpt, dt, npl, ntp, symba_plA, symba_tpA, rmin, rmax, param%rmaxu, qmin, & qmin_alo, qmin_ahi, qmin_coord, lclosel, & lrhill_present) return diff --git a/src/symba/symba_fragmentation.f90 b/src/symba/symba_fragmentation.f90 index b62a5727c..cc351f180 100644 --- a/src/symba/symba_fragmentation.f90 +++ b/src/symba/symba_fragmentation.f90 @@ -212,7 +212,7 @@ call symba_caseresolve(t, dt, index_enc, nmergeadd, nmergesub, mergeadd_list, mergesub_list, eoffset, vbs, & npl, symba_plA, nplplenc, plplenc_list, regime, fragmax, mres, rres, array_index1_child, & - array_index2_child, m1, m2, rad1, rad2, x1, x2, v1, v2, config) + array_index2_child, m1, m2, rad1, rad2, x1, x2, v1, v2, param) end if return diff --git a/src/symba/symba_getacch.f90 b/src/symba/symba_getacch.f90 index a8b986396..4056a6216 100644 --- a/src/symba/symba_getacch.f90 +++ b/src/symba/symba_getacch.f90 @@ -69,7 +69,7 @@ symba_plA%ah(:,index_j) = symba_plA%ah(:,index_j) + faci*dx(:) end if end do - if (config%loblatecb) then + if (param%loblatecb) then !if (lmalloc) then !allocate(xh(npl, NDIM),aobl(npl, NDIM), irh(npl)) !lmalloc = .false. @@ -78,7 +78,7 @@ r2 = dot_product(symba_plA%xh(:,i), symba_plA%xh(:,i)) irh(i) = 1.0_DP/sqrt(r2) end do - call obl_acc(symba_plA, config%j2rp2, config%j4rp4, symba_plA%xh(:,:), irh, aobl) + call obl_acc(symba_plA, param%j2rp2, param%j4rp4, symba_plA%xh(:,:), irh, aobl) do i = 2, npl symba_plA%ah(:,i) = symba_plA%ah(:,i) + aobl(:, i) - aobl(:, 1) end do diff --git a/src/symba/symba_getacch_eucl.f90 b/src/symba/symba_getacch_eucl.f90 index 372366507..fdb8e699a 100644 --- a/src/symba/symba_getacch_eucl.f90 +++ b/src/symba/symba_getacch_eucl.f90 @@ -72,7 +72,7 @@ end if end do - if (config%loblatecb) then + if (param%loblatecb) then if (lmalloc) then allocate(xh(npl, NDIM), aobl(npl, NDIM), irh(npl)) lmalloc = .false. @@ -82,7 +82,7 @@ r2 = dot_product(symba_plA%xh(:,i), symba_plA%xh(:,i)) irh(i) = 1.0_DP/sqrt(r2) end do - call obl_acc(symba_plA, config%j2rp2, config%j4rp4, symba_plA%xh(:,:), irh, aobl) + call obl_acc(symba_plA, param%j2rp2, param%j4rp4, symba_plA%xh(:,:), irh, aobl) do i = 2, npl symba_plA%ah(:,i) = symba_plA%ah(:,i) + aobl(:, i) - aobl(:, 1) end do diff --git a/src/symba/symba_getacch_tp.f90 b/src/symba/symba_getacch_tp.f90 index fd6f03f0d..97f52eef1 100644 --- a/src/symba/symba_getacch_tp.f90 +++ b/src/symba/symba_getacch_tp.f90 @@ -53,23 +53,23 @@ symba_tpA%ah(:,index_tp) = symba_tpA%ah(:,index_tp) + fac*dx(:) end if end do - if (config%loblatecb) then + if (param%loblatecb) then if (lmalloc) then - allocate(aobl(NDIM, config%nplmax), irh(config%nplmax), xht(NDIM, config%ntpmax), aoblt(NDIM, config%ntpmax), irht(config%ntpmax)) + allocate(aobl(NDIM, param%nplmax), irh(param%nplmax), xht(NDIM, param%ntpmax), aoblt(NDIM, param%ntpmax), irht(param%ntpmax)) lmalloc = .false. end if do i = 2, npl r2 = dot_product(xh(:, i), xh(:, i)) irh(i) = 1.0_DP/sqrt(r2) end do - call obl_acc(symba_plA, config%j2rp2, config%j4rp4, symba_plA%xh(:,:), irh, aobl) + call obl_acc(symba_plA, param%j2rp2, param%j4rp4, symba_plA%xh(:,:), irh, aobl) mu = symba_plA%mass(1) do i = 1, ntp xht(:, i) = symba_tpA%xh(:,i) !optimize r2 = dot_product(xht(:, i), xht(:, i)) irht(i) = 1.0_DP/sqrt(r2) end do - call obl_acc_tp(ntp, xht, config%j2rp2, config%j4rp4, irht, aoblt, mu) + call obl_acc_tp(ntp, xht, param%j2rp2, param%j4rp4, irht, aoblt, mu) do i = 1, ntp if (symba_tpA%status(i) == ACTIVE) & symba_tpA%ah(:,i) = symba_tpA%ah(:,i) + aoblt(:, i) - aobl(:, 1) diff --git a/src/symba/symba_getacch_tp_eucl.f90 b/src/symba/symba_getacch_tp_eucl.f90 index 54c59f8c6..0cd4c16cd 100644 --- a/src/symba/symba_getacch_tp_eucl.f90 +++ b/src/symba/symba_getacch_tp_eucl.f90 @@ -55,23 +55,23 @@ end if end do ! $omp end parallel do - if (config%loblatecb) then + if (param%loblatecb) then if (lmalloc) then - allocate(aobl(NDIM, config%nplmax), irh(config%nplmax), xht(NDIM, config%ntpmax), aoblt(NDIM, config%ntpmax), irht(config%ntpmax)) + allocate(aobl(NDIM, param%nplmax), irh(param%nplmax), xht(NDIM, param%ntpmax), aoblt(NDIM, param%ntpmax), irht(param%ntpmax)) lmalloc = .false. end if do i = 2, npl r2 = dot_product(xh(:, i), xh(:, i)) irh(i) = 1.0_DP/sqrt(r2) end do - call obl_acc(symba_plA, config%j2rp2, config%j4rp4, symba_plA%xh(:,:), irh, aobl) + call obl_acc(symba_plA, param%j2rp2, param%j4rp4, symba_plA%xh(:,:), irh, aobl) mu = symba_plA%mass(1) do i = 1, ntp xht(:, i) = symba_tpA%xh(:,i) !optimize r2 = dot_product(xht(:, i), xht(:, i)) irht(i) = 1.0_DP/sqrt(r2) end do - call obl_acc_tp(ntp, xht, config%j2rp2, config%j4rp4, irht, aoblt, mu) + call obl_acc_tp(ntp, xht, param%j2rp2, param%j4rp4, irht, aoblt, mu) do i = 1, ntp if (symba_tpA%status(i) == ACTIVE) & symba_tpA%ah(:,i) = symba_tpA%ah(:,i) + aoblt(:, i) - aobl(:, 1) diff --git a/src/symba/symba_helio_getacch.f90 b/src/symba/symba_helio_getacch.f90 index 243b943ea..65d2171f8 100644 --- a/src/symba/symba_helio_getacch.f90 +++ b/src/symba/symba_helio_getacch.f90 @@ -23,9 +23,9 @@ end do call symba_helio_getacch_int(npl, nplm, helio_plA) end if - if (config%loblatecb) then + if (param%loblatecb) then if (lmalloc) then - allocate(xh(NDIM, config%nplmax), aobl(NDIM, config%nplmax), irh(config%nplmax)) + allocate(xh(NDIM, param%nplmax), aobl(NDIM, param%nplmax), irh(param%nplmax)) lmalloc = .false. end if do i = 2, npl @@ -33,7 +33,7 @@ r2 = dot_product(xh(:, i), xh(:, i)) irh(i) = 1.0_DP/sqrt(r2) end do - call obl_acc(helio_plA, config%j2rp2, config%j4rp4, xh, irh, aobl) + call obl_acc(helio_plA, param%j2rp2, param%j4rp4, xh, irh, aobl) do i = 2, npl helio_plA%ah(:,i) = helio_plA%ahi(:,i) + aobl(:, i) - aobl(:, 1) end do diff --git a/src/symba/symba_rearray.f90 b/src/symba/symba_rearray.f90 index 22e7a1c05..46a81b28d 100644 --- a/src/symba/symba_rearray.f90 +++ b/src/symba/symba_rearray.f90 @@ -20,7 +20,7 @@ nsppl = count(discard_l_pl) nkpl = npl - nsppl frag_l_add = [(.false.,i=1,npl)] - if (config%lfragmentation) then + if (param%lfragmentation) then do i = 1, npl if (mergeadd_list%status(i) == DISRUPTION) then frag_l_add(i) = .true. @@ -54,7 +54,7 @@ discard_plA%vb(1:nsppl, 1) = pack(symba_plA%vb(1:npl, 1), discard_l_pl) discard_plA%vb(1:nsppl, 2) = pack(symba_plA%vb(1:npl, 2), discard_l_pl) discard_plA%vb(1:nsppl, 3) = pack(symba_plA%vb(1:npl, 3), discard_l_pl) - if (config%lfragmentation .and. (nkpl + nfrag > npl)) then + if (param%lfragmentation .and. (nkpl + nfrag > npl)) then symba_plA%name(1:nkpl) = pack(symba_plA%name(1:npl), .not. discard_l_pl) symba_plA%status(1:nkpl) = pack(symba_plA%status(1:npl), .not. discard_l_pl) symba_plA%mass(1:nkpl) = pack(symba_plA%mass(1:npl), .not. discard_l_pl) diff --git a/src/symba/symba_set_initial_conditions.f90 b/src/symba/symba_set_initial_conditions.f90 index dce540003..49a58aad5 100644 --- a/src/symba/symba_set_initial_conditions.f90 +++ b/src/symba/symba_set_initial_conditions.f90 @@ -9,12 +9,12 @@ implicit none ! read in the total number of bodies from the input files - call symba_plA%read_from_file(config) - call symba_tpA%read_from_file(config) + call symba_plA%read_from_file(param) + call symba_tpA%read_from_file(param) ! Save central body mass in vector form so that elemental functions can be evaluated with it - call symba_tpA%set_vec(symba_plA%mass(1),config%dt) - call symba_plA%set_vec(symba_plA%mass(1),config%dt) + call symba_tpA%set_vec(symba_plA%mass(1),param%dt) + call symba_plA%set_vec(symba_plA%mass(1),param%dt) ! Save system mass to both objects call symba_plA%set_msys(symba_plA) diff --git a/src/symba/symba_step.f90 b/src/symba/symba_step.f90 index 14c945d9f..cb1361833 100644 --- a/src/symba/symba_step.f90 +++ b/src/symba/symba_step.f90 @@ -36,7 +36,7 @@ nplplenc = 0 npltpenc = 0 - if (symba_plA%mass(1) < config%mtiny) then + if (symba_plA%mass(1) < param%mtiny) then nplm = 0 else nplm = 1 @@ -46,7 +46,7 @@ ! all this needs to be changed to the tree search function for encounters do i = 2, npl - if (symba_plA%mass(i) < config%mtiny) exit + if (symba_plA%mass(i) < param%mtiny) exit nplm = nplm + 1 do j = i + 1, npl xr(:) = symba_plA%xh(:,j) - symba_plA%xh(:,i) @@ -109,16 +109,16 @@ lencounter = ((nplplenc > 0) .or. (npltpenc > 0)) if (lencounter) then - call symba_step_interp(config%lextra_force, config%lclose, t, npl, nplm, config%nplmax, & - ntp, config%ntpmax, symba_plA, symba_tpA, config%j2rp2, config%j4rp4, & + call symba_step_interp(param%lextra_force, param%lclose, t, npl, nplm, param%nplmax, & + ntp, param%ntpmax, symba_plA, symba_tpA, param%j2rp2, param%j4rp4, & dt, eoffset, nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, & - nmergesub, mergeadd_list, mergesub_list, config%encounter_file, config%out_type, & + nmergesub, mergeadd_list, mergesub_list, param%encounter_file, param%out_type, & fragmax, param) lfirst = .true. else - call symba_step_helio(lfirst, config%lextra_force, t, npl, nplm, config%nplmax, ntp,& - config%ntpmax, symba_plA, symba_tpA, & - config%j2rp2, config%j4rp4, dt) + call symba_step_helio(lfirst, param%lextra_force, t, npl, nplm, param%nplmax, ntp,& + param%ntpmax, symba_plA, symba_tpA, & + param%j2rp2, param%j4rp4, dt) end if return diff --git a/src/symba/symba_step_eucl.f90 b/src/symba/symba_step_eucl.f90 index b6ab1ef58..a5075a415 100644 --- a/src/symba/symba_step_eucl.f90 +++ b/src/symba/symba_step_eucl.f90 @@ -141,13 +141,13 @@ lencounter = ((nplplenc > 0) .or. (npltpenc > 0)) if (lencounter) then ! if there was an encounter, we need to enter symba_step_interp to see if we need recursion - call symba_step_interp_eucl(lextra_force, lclose, t, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, config%j2rp2, config%j4rp4,& + call symba_step_interp_eucl(lextra_force, lclose, t, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, param%j2rp2, param%j4rp4,& dt, eoffset, mtiny, nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list,& mergesub_list, encounter_file, out_type, num_plpl_comparisons, k_plpl, num_pltp_comparisons, k_pltp) lfirst = .true. else ! otherwise we can just advance the particles - call symba_step_helio(lfirst, lextra_force, t, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, & - config%j2rp2, config%j4rp4, dt) + call symba_step_helio(lfirst, lextra_force, t, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, & + param%j2rp2, param%j4rp4, dt) end if return diff --git a/src/symba/symba_step_helio.f90 b/src/symba/symba_step_helio.f90 index 0241f4f9b..54803c97e 100644 --- a/src/symba/symba_step_helio.f90 +++ b/src/symba/symba_step_helio.f90 @@ -14,8 +14,8 @@ ! executable code lfirsttp = lfirst - call symba_step_helio_pl(lfirst, lextra_force, t, npl, nplm, config%nplmax, helio_plA, config%j2rp2, config%j4rp4, dt, xbeg, xend, ptb, pte) - if (ntp > 0) call helio_step_tp(lfirsttp, lextra_force, t, nplm, config%nplmax, ntp, config%ntpmax, helio_plA, helio_tpA, config%j2rp2, config%j4rp4, & + call symba_step_helio_pl(lfirst, lextra_force, t, npl, nplm, param%nplmax, helio_plA, param%j2rp2, param%j4rp4, dt, xbeg, xend, ptb, pte) + if (ntp > 0) call helio_step_tp(lfirsttp, lextra_force, t, nplm, param%nplmax, ntp, param%ntpmax, helio_plA, helio_tpA, param%j2rp2, param%j4rp4, & dt, xbeg, xend, ptb, pte) return diff --git a/src/symba/symba_step_helio_pl.f90 b/src/symba/symba_step_helio_pl.f90 index 9b5c71f67..bf6dd412f 100644 --- a/src/symba/symba_step_helio_pl.f90 +++ b/src/symba/symba_step_helio_pl.f90 @@ -25,7 +25,7 @@ call helio_lindrift(npl, helio_plA%swiftest, dth, ptb) - call symba_helio_getacch(lflag, lextra_force, t, npl, nplm, config%nplmax, helio_plA, config%j2rp2, config%j4rp4) + call symba_helio_getacch(lflag, lextra_force, t, npl, nplm, param%nplmax, helio_plA, param%j2rp2, param%j4rp4) lflag = .true. call helio_kickvb(npl, helio_plA, dth) @@ -38,7 +38,7 @@ do i = 2, nplm xend(:, i) = helio_plA%swiftest%xh(:,i) end do - call symba_helio_getacch(lflag, lextra_force, t+dt, npl, nplm, config%nplmax, helio_plA, config%j2rp2, config%j4rp4) + call symba_helio_getacch(lflag, lextra_force, t+dt, npl, nplm, param%nplmax, helio_plA, param%j2rp2, param%j4rp4) call helio_kickvb(npl, helio_plA, dth) diff --git a/src/symba/symba_step_interp.f90 b/src/symba/symba_step_interp.f90 index 8181ecc8c..b9832ab53 100644 --- a/src/symba/symba_step_interp.f90 +++ b/src/symba/symba_step_interp.f90 @@ -19,7 +19,7 @@ ! executable code if (lmalloc) then - allocate(xbeg(NDIM, config%nplmax), xend(NDIM, config%nplmax)) + allocate(xbeg(NDIM, param%nplmax), xend(NDIM, param%nplmax)) lmalloc = .false. end if dth = 0.5_DP*dt @@ -35,9 +35,9 @@ end do end if - call symba_getacch(lextra_force, t, npl, nplm, symba_plA, config%j2rp2, config%j4rp4, nplplenc, plplenc_list) - if (ntp > 0) call symba_getacch_tp(lextra_force, t, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, xbeg, config%j2rp2, & - config%j4rp4, npltpenc, pltpenc_list) + call symba_getacch(lextra_force, t, npl, nplm, symba_plA, param%j2rp2, param%j4rp4, nplplenc, plplenc_list) + if (ntp > 0) call symba_getacch_tp(lextra_force, t, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, xbeg, param%j2rp2, & + param%j4rp4, npltpenc, pltpenc_list) call helio_kickvb(npl, symba_plA, dth) if (ntp > 0) call helio_kickvb_tp(ntp, symba_tpA, dth) @@ -49,15 +49,15 @@ call symba_step_recur(lclose, t, irec, npl, nplm, ntp, symba_plA, symba_tpA, dt, eoffset, nplplenc, npltpenc, & plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list, mergesub_list, encounter_file, out_type, & - config%nplmax, config%ntpmax, fragmax, param) + param%nplmax, param%ntpmax, fragmax, param) if (ntp > 0) then do i = 2, npl xend(:, i) = symba_plA%xh(:,i) end do end if - call symba_getacch(lextra_force, t+dt, npl, nplm, symba_plA, config%j2rp2, config%j4rp4, nplplenc, plplenc_list) - if (ntp > 0) call symba_getacch_tp(lextra_force, t+dt, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, xend, config%j2rp2, & - config%j4rp4, npltpenc, pltpenc_list) + call symba_getacch(lextra_force, t+dt, npl, nplm, symba_plA, param%j2rp2, param%j4rp4, nplplenc, plplenc_list) + if (ntp > 0) call symba_getacch_tp(lextra_force, t+dt, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, xend, param%j2rp2, & + param%j4rp4, npltpenc, pltpenc_list) call helio_kickvb(npl, symba_plA, dth) if (ntp > 0) call helio_kickvb_tp(ntp, symba_tpA, dth) call coord_vb2vh(npl, symba_plA) diff --git a/src/symba/symba_step_interp_eucl.f90 b/src/symba/symba_step_interp_eucl.f90 index 3a9c84689..9250e87f2 100644 --- a/src/symba/symba_step_interp_eucl.f90 +++ b/src/symba/symba_step_interp_eucl.f90 @@ -18,7 +18,7 @@ ! executable code if (lmalloc) then - allocate(xbeg(NDIM, config%nplmax), xend(NDIM, config%nplmax)) + allocate(xbeg(NDIM, param%nplmax), xend(NDIM, param%nplmax)) lmalloc = .false. end if dth = 0.5_DP*dt @@ -34,10 +34,10 @@ end do end if - call symba_getacch_eucl(lextra_force, t, npl, nplm, config%nplmax, symba_plA, config%j2rp2, config%j4rp4, nplplenc, plplenc_list, & + call symba_getacch_eucl(lextra_force, t, npl, nplm, param%nplmax, symba_plA, param%j2rp2, param%j4rp4, nplplenc, plplenc_list, & num_plpl_comparisons, k_plpl) - if (ntp > 0) call symba_getacch_tp_eucl(lextra_force, t, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, xbeg, config%j2rp2,& - config%j4rp4, npltpenc, pltpenc_list, num_pltp_comparisons, k_pltp) + if (ntp > 0) call symba_getacch_tp_eucl(lextra_force, t, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, xbeg, param%j2rp2,& + param%j4rp4, npltpenc, pltpenc_list, num_pltp_comparisons, k_pltp) call helio_kickvb(npl, symba_plA, dth) if (ntp > 0) call helio_kickvb_tp(ntp, symba_tpA, dth) @@ -54,10 +54,10 @@ xend(:, i) = symba_plA%xh(:,i) end do end if - call symba_getacch_eucl(lextra_force, t+dt, npl, nplm, config%nplmax, symba_plA, config%j2rp2, config%j4rp4, nplplenc, plplenc_list, & + call symba_getacch_eucl(lextra_force, t+dt, npl, nplm, param%nplmax, symba_plA, param%j2rp2, param%j4rp4, nplplenc, plplenc_list, & num_plpl_comparisons, k_plpl) - if (ntp > 0) call symba_getacch_tp_eucl(lextra_force, t+dt, npl, nplm, config%nplmax, ntp, config%ntpmax, symba_plA, symba_tpA, xend, & - config%j2rp2,config%j4rp4, npltpenc, pltpenc_list, num_pltp_comparisons, k_pltp) + if (ntp > 0) call symba_getacch_tp_eucl(lextra_force, t+dt, npl, nplm, param%nplmax, ntp, param%ntpmax, symba_plA, symba_tpA, xend, & + param%j2rp2,param%j4rp4, npltpenc, pltpenc_list, num_pltp_comparisons, k_pltp) call helio_kickvb(npl, symba_plA, dth) if (ntp > 0) call helio_kickvb_tp(ntp, symba_tpA, dth) call coord_vb2vh(npl, symba_plA) diff --git a/src/symba/symba_step_recur.f90 b/src/symba/symba_step_recur.f90 index 52d644287..b380a75c8 100644 --- a/src/symba/symba_step_recur.f90 +++ b/src/symba/symba_step_recur.f90 @@ -73,7 +73,7 @@ if (ntp > 0) call symba_helio_drift_tp(ireci, ntp, symba_tpA, symba_plA%mass(1), dtl) if (lencounter) call symba_step_recur(lclose, t, irecp, npl, nplm, ntp, symba_plA, symba_tpA, dt0, eoffset, nplplenc, & npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list, mergesub_list, encounter_file, out_type, & - config%nplmax, config%ntpmax, fragmax, param) + param%nplmax, param%ntpmax, fragmax, param) sgn = 1.0_DP call symba_kick(irecp, nplplenc, npltpenc, plplenc_list, pltpenc_list, dth, sgn,symba_plA, symba_tpA) if (lclose) then @@ -88,10 +88,10 @@ ! determines collisional regime if lfrag=.true. for close encounter massive bodies ! call symba_frag_pl(...) ! determines if close encounter leads to merger if lfrag=.false. - if (config%lfragmentation) then + if (param%lfragmentation) then call symba_fragmentation (t, dtl, i, nmergeadd, nmergesub, mergeadd_list, mergesub_list, & - eoffset, vbs, encounter_file, out_type, npl, symba_plA, nplplenc, plplenc_list, config%nplmax, & - config%ntpmax, fragmax) + eoffset, vbs, encounter_file, out_type, npl, symba_plA, nplplenc, plplenc_list, param%nplmax, & + param%ntpmax, fragmax) else call symba_merge_pl(t, dtl, i, nplplenc, plplenc_list, nmergeadd, nmergesub, mergeadd_list, & mergesub_list, eoffset, vbs, encounter_file, out_type, npl, symba_plA) @@ -171,7 +171,7 @@ if (ntp > 0) call symba_helio_drift_tp(ireci, ntp, symba_tpA, symba_plA%mass(1), dtl) if (lencounter) call symba_step_recur(lclose, t, irecp, npl, nplm, ntp, symba_plA, symba_tpA, dt0, eoffset, & nplplenc, npltpenc, plplenc_list, pltpenc_list, nmergeadd, nmergesub, mergeadd_list, mergesub_list, & - encounter_file, out_type, config%nplmax, config%ntpmax, fragmax, param) + encounter_file, out_type, param%nplmax, param%ntpmax, fragmax, param) sgn = 1.0_DP call symba_kick(irecp, nplplenc, npltpenc, plplenc_list, pltpenc_list, dth, sgn,symba_plA, symba_tpA) sgn = -1.0_DP @@ -184,10 +184,10 @@ if ((plplenc_list%status(i) == ACTIVE) .and. & (symba_plA%levelg(index_i) >= ireci) .and. & (symba_plA%levelg(index_j) >= ireci)) then - if (config%lfragmentation) then + if (param%lfragmentation) then call symba_fragmentation (t, dtl, i, nmergeadd, nmergesub, mergeadd_list, mergesub_list, & - eoffset, vbs, encounter_file, out_type, npl, symba_plA, nplplenc, plplenc_list, config%nplmax, & - config%ntpmax, fragmax) + eoffset, vbs, encounter_file, out_type, npl, symba_plA, nplplenc, plplenc_list, param%nplmax, & + param%ntpmax, fragmax) else call symba_merge_pl(t, dtl, i, nplplenc, plplenc_list, nmergeadd, nmergesub, mergeadd_list, & mergesub_list, eoffset, vbs, encounter_file, out_type, npl, symba_plA) diff --git a/src/user/user_getacch.f90 b/src/user/user_getacch.f90 index d77f107b6..59b922f15 100644 --- a/src/user/user_getacch.f90 +++ b/src/user/user_getacch.f90 @@ -1,7 +1,7 @@ submodule(swiftest_classes) s_user_getacch use swiftest contains - module subroutine user_getacch_body(self, cb, config, t) + module subroutine user_getacch_body(self, cb, param, t) !! author: David A. Minton !! !! Add user-supplied heliocentric accelerations to planets @@ -11,7 +11,7 @@ module subroutine user_getacch_body(self, cb, config, t) ! Arguments class(swiftest_body), intent(inout) :: self !! Swiftest massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of user configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of user parameters parameters real(DP), intent(in) :: t !! Current time return diff --git a/src/whm/whm_drift.f90 b/src/whm/whm_drift.f90 index dd8cbe403..64ba44441 100644 --- a/src/whm/whm_drift.f90 +++ b/src/whm/whm_drift.f90 @@ -1,7 +1,7 @@ submodule(whm_classes) whm_drift use swiftest contains - module subroutine whm_drift_pl(self, cb, config, dt) + module subroutine whm_drift_pl(self, cb, param, dt) !! author: David A. Minton !! !! Loop through planets and call Danby drift routine @@ -12,7 +12,7 @@ module subroutine whm_drift_pl(self, cb, config, dt) ! Arguments class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structur - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: dt !! Stepsize ! Internals integer(I4B) :: i @@ -32,12 +32,12 @@ module subroutine whm_drift_pl(self, cb, config, dt) iflag(:) = 0 allocate(dtp(npl)) - if (config%lgr) then + if (param%lgr) then do i = 1,npl rmag = norm2(xj(:, i)) vmag2 = dot_product(vj(:, i), vj(:, i)) energy = 0.5_DP * vmag2 - mu(i) / rmag - dtp(i) = dt * (1.0_DP + 3 * config%inv_c2 * energy) + dtp(i) = dt * (1.0_DP + 3 * param%inv_c2 * energy) end do else dtp(:) = dt @@ -64,7 +64,7 @@ module subroutine whm_drift_pl(self, cb, config, dt) end subroutine whm_drift_pl - module subroutine whm_drift_tp(self, cb, config, dt) + module subroutine whm_drift_tp(self, cb, param, dt) !! author: David A. Minton !! !! Loop through test particles and call Danby drift routine @@ -76,7 +76,7 @@ module subroutine whm_drift_tp(self, cb, config, dt) ! Arguments class(whm_tp), intent(inout) :: self !! WHM test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: dt !! Stepsize ! Internals integer(I4B) :: i @@ -95,12 +95,12 @@ module subroutine whm_drift_tp(self, cb, config, dt) allocate(iflag(ntp)) iflag(:) = 0 allocate(dtp(ntp)) - if (config%lgr) then + if (param%lgr) then do i = 1,ntp rmag = norm2(xh(:, i)) vmag2 = dot_product(vh(:, i), vh(:, i)) energy = 0.5_DP * vmag2 - cb%Gmass / rmag - dtp(i) = dt * (1.0_DP + 3 * config%inv_c2 * energy) + dtp(i) = dt * (1.0_DP + 3 * param%inv_c2 * energy) end do else dtp(:) = dt diff --git a/src/whm/whm_getacch.f90 b/src/whm/whm_getacch.f90 index 14f7bfabf..d7201adcc 100644 --- a/src/whm/whm_getacch.f90 +++ b/src/whm/whm_getacch.f90 @@ -1,7 +1,7 @@ submodule(whm_classes) s_whm_getacch use swiftest contains - module subroutine whm_getacch_pl(self, cb, config, t) + module subroutine whm_getacch_pl(self, cb, param, t) !! author: David A. Minton !! !! Compute heliocentric accelerations of planets @@ -12,7 +12,7 @@ module subroutine whm_getacch_pl(self, cb, config, t) ! Arguments class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time ! Internals integer(I4B) :: i @@ -31,15 +31,15 @@ module subroutine whm_getacch_pl(self, cb, config, t) call whm_getacch_ah2(cb, pl) call whm_getacch_ah3(pl) - if (config%loblatecb) call pl%obl_acc(cb) - if (config%lextra_force) call pl%user_getacch(cb, config, t) - if (config%lgr) call pl%gr_getacch(cb, config) + if (param%loblatecb) call pl%obl_acc(cb) + if (param%lextra_force) call pl%user_getacch(cb, param, t) + if (param%lgr) call pl%gr_getacch(cb, param) end associate return end subroutine whm_getacch_pl - module subroutine whm_getacch_tp(self, cb, pl, config, t, xh) + module subroutine whm_getacch_tp(self, cb, pl, param, t, xh) !! author: David A. Minton !! !! Compute heliocentric accelerations of test particles @@ -51,7 +51,7 @@ module subroutine whm_getacch_tp(self, cb, pl, config, t, xh) class(whm_tp), intent(inout) :: self !! WHM test particle data structure class(swiftest_cb), intent(inout) :: cb !! Generic Swiftest central body particle data structuree class(whm_pl), intent(inout) :: pl !! Generic Swiftest massive body particle data structure. - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), dimension(:,:), intent(in) :: xh !! Heliocentric positions of planets ! Internals @@ -67,9 +67,9 @@ module subroutine whm_getacch_tp(self, cb, pl, config, t, xh) tp%ah(:, i) = ah0(:) end do call whm_getacch_ah3_tp(cb, pl, tp, xh) - if (config%loblatecb) call tp%obl_acc(cb) - if (config%lextra_force) call tp%user_getacch(cb, config, t) - if (config%lgr) call tp%gr_getacch(cb, config) + if (param%loblatecb) call tp%obl_acc(cb) + if (param%lextra_force) call tp%user_getacch(cb, param, t) + if (param%lgr) call tp%gr_getacch(cb, param) end associate return end subroutine whm_getacch_tp diff --git a/src/whm/whm_gr.f90 b/src/whm/whm_gr.f90 index edd6ee26d..e938b0b9b 100644 --- a/src/whm/whm_gr.f90 +++ b/src/whm/whm_gr.f90 @@ -1,7 +1,7 @@ submodule(whm_classes) s_whm_gr use swiftest contains - module subroutine whm_gr_getacch_pl(self, cb, config) + module subroutine whm_gr_getacch_pl(self, cb, param) !! author: David A. Minton !! !! Compute relativisitic accelerations of massive bodies @@ -12,14 +12,14 @@ module subroutine whm_gr_getacch_pl(self, cb, config) ! Arguments class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of ! Internals integer(I4B) :: i real(DP), dimension(NDIM) :: suma real(DP), dimension(:, :), allocatable :: aj real(DP) :: beta, rjmag4 - associate(n => self%nbody, msun => cb%Gmass, mu => self%muj, c2 => config%inv_c2, & + associate(n => self%nbody, msun => cb%Gmass, mu => self%muj, c2 => param%inv_c2, & ah => self%ah, xj => self%xj, GMpl => self%Gmass, eta => self%eta) if (n == 0) return allocate(aj, mold = ah) @@ -39,7 +39,7 @@ module subroutine whm_gr_getacch_pl(self, cb, config) return end subroutine whm_gr_getacch_pl - module subroutine whm_gr_getacch_tp(self, cb, config) + module subroutine whm_gr_getacch_tp(self, cb, param) !! author: David A. Minton !! !! Compute relativisitic accelerations of test particles @@ -50,13 +50,13 @@ module subroutine whm_gr_getacch_tp(self, cb, config) ! Arguments class(whm_tp), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structuree - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of ! Internals integer(I4B) :: i real(DP) :: rjmag4, beta associate(n => self%nbody, msun => cb%Gmass, mu => self%mu,& - c2 => config%inv_c2, ah => self%ah, xh => self%xh, status => self%status) + c2 => param%inv_c2, ah => self%ah, xh => self%xh, status => self%status) if (n == 0) return !do concurrent (i = 1:n, status(i) == active) do i = 1, n @@ -68,7 +68,7 @@ module subroutine whm_gr_getacch_tp(self, cb, config) return end subroutine whm_gr_getacch_tp - module pure subroutine whm_gr_p4_pl(self, config, dt) + module pure subroutine whm_gr_p4_pl(self, param, dt) !! author: David A. Minton !! !! Position kick to massive bodies due to p**4 term in the post-Newtonian correction @@ -78,12 +78,12 @@ module pure subroutine whm_gr_p4_pl(self, config, dt) implicit none ! Arguments class(whm_pl), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters real(DP), intent(in) :: dt !! Step size ! Internals integer(I4B) :: i - associate(n => self%nbody, xj => self%xj, vj => self%vj, status => self%status, c2 => config%inv_c2) + associate(n => self%nbody, xj => self%xj, vj => self%vj, status => self%status, c2 => param%inv_c2) if (n == 0) return !do concurrent (i = 1:n, status(i) == ACTIVE) do i = 1,n @@ -94,7 +94,7 @@ module pure subroutine whm_gr_p4_pl(self, config, dt) return end subroutine whm_gr_p4_pl - module pure subroutine whm_gr_p4_tp(self, config, dt) + module pure subroutine whm_gr_p4_tp(self, param, dt) !! author: David A. Minton !! !! Position kick to test particles due to p**4 term in the post-Newtonian correction @@ -104,12 +104,12 @@ module pure subroutine whm_gr_p4_tp(self, config, dt) implicit none ! Arguments class(whm_tp), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters real(DP), intent(in) :: dt !! Step size ! Internals integer(I4B) :: i - associate(n => self%nbody, xh => self%xh, vh => self%vh, status => self%status, c2 => config%inv_c2) + associate(n => self%nbody, xh => self%xh, vh => self%vh, status => self%status, c2 => param%inv_c2) if (n == 0) return !do concurrent (i = 1:n, status(i) == ACTIVE) do i = 1, n @@ -120,7 +120,7 @@ module pure subroutine whm_gr_p4_tp(self, config, dt) return end subroutine whm_gr_p4_tp - module pure subroutine whm_gr_pv2vh_pl(self, config) + module pure subroutine whm_gr_pv2vh_pl(self, param) !! author: David A. Minton !! !! Wrapper function that converts from pseudovelocity to heliocentric velocity for massive bodies @@ -128,7 +128,7 @@ module pure subroutine whm_gr_pv2vh_pl(self, config) implicit none ! Arguments class(whm_pl), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters ! Internals integer(I4B) :: i real(DP), dimension(:,:), allocatable :: vh !! Temporary holder of pseudovelocity for in-place conversion @@ -138,7 +138,7 @@ module pure subroutine whm_gr_pv2vh_pl(self, config) allocate(vh, mold = pv) !do concurrent(i = 1:n, status(i) == ACTIVE) do i = 1, n - call gr_pseudovel2vel(config, mu(i), xh(:, i), pv(:, i), vh(:, i)) + call gr_pseudovel2vel(param, mu(i), xh(:, i), pv(:, i), vh(:, i)) pv(:, i) = vh(:, i) end do deallocate(vh) @@ -146,7 +146,7 @@ module pure subroutine whm_gr_pv2vh_pl(self, config) return end subroutine whm_gr_pv2vh_pl - module pure subroutine whm_gr_pv2vh_tp(self, config) + module pure subroutine whm_gr_pv2vh_tp(self, param) !! author: David A. Minton !! !! Wrapper function that converts from pseudovelocity to heliocentric velocity for test particles bodies @@ -154,7 +154,7 @@ module pure subroutine whm_gr_pv2vh_tp(self, config) implicit none ! Arguments class(whm_tp), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters ! Internals integer(I4B) :: i real(DP), dimension(:,:), allocatable :: vh !! Temporary holder of pseudovelocity for in-place conversion @@ -164,7 +164,7 @@ module pure subroutine whm_gr_pv2vh_tp(self, config) allocate(vh, mold = pv) !do concurrent(i = 1:n, status(i) == ACTIVE) do i = 1, n - call gr_pseudovel2vel(config, mu(i), xh(:, i), pv(:, i), vh(:, i)) + call gr_pseudovel2vel(param, mu(i), xh(:, i), pv(:, i), vh(:, i)) pv(:, i) = vh(:, i) end do deallocate(vh) @@ -172,7 +172,7 @@ module pure subroutine whm_gr_pv2vh_tp(self, config) return end subroutine whm_gr_pv2vh_tp - module pure subroutine whm_gr_vh2pv_pl(self, config) + module pure subroutine whm_gr_vh2pv_pl(self, param) !! author: David A. Minton !! !! Wrapper function that converts from heliocentric velocity to pseudovelocity for massive bodies @@ -180,7 +180,7 @@ module pure subroutine whm_gr_vh2pv_pl(self, config) implicit none ! Arguments class(whm_pl), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters ! Internals integer(I4B) :: i real(DP), dimension(:,:), allocatable :: pv !! Temporary holder of pseudovelocity for in-place conversion @@ -190,7 +190,7 @@ module pure subroutine whm_gr_vh2pv_pl(self, config) allocate(pv, mold = vh) !do concurrent(i = 1:n, status(i) == ACTIVE) do i = 1, n - call gr_vel2pseudovel(config, mu(i), xh(:, i), vh(:, i), pv(:, i)) + call gr_vel2pseudovel(param, mu(i), xh(:, i), vh(:, i), pv(:, i)) vh(:, i) = pv(:, i) end do deallocate(pv) @@ -198,7 +198,7 @@ module pure subroutine whm_gr_vh2pv_pl(self, config) return end subroutine whm_gr_vh2pv_pl - module pure subroutine whm_gr_vh2pv_tp(self, config) + module pure subroutine whm_gr_vh2pv_tp(self, param) !! author: David A. Minton !! !! Wrapper function that converts from heliocentric velocity to pseudovelocity for teset particles @@ -206,7 +206,7 @@ module pure subroutine whm_gr_vh2pv_tp(self, config) implicit none ! Arguments class(whm_tp), intent(inout) :: self !! Swiftest particle object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters ! Internals integer(I4B) :: i real(DP), dimension(:,:), allocatable :: pv !! Temporary holder of pseudovelocity for in-place conversion @@ -216,7 +216,7 @@ module pure subroutine whm_gr_vh2pv_tp(self, config) allocate(pv, mold = vh) !do concurrent(i = 1:n, status(i) == ACTIVE) do i = 1, n - call gr_vel2pseudovel(config, mu(i), xh(:, i), vh(:, i), pv(:, i)) + call gr_vel2pseudovel(param, mu(i), xh(:, i), vh(:, i), pv(:, i)) vh(:, i) = pv(:, i) end do deallocate(pv) @@ -224,7 +224,7 @@ module pure subroutine whm_gr_vh2pv_tp(self, config) return end subroutine whm_gr_vh2pv_tp - pure subroutine gr_vel2pseudovel(config, mu, xh, vh, pv) + pure subroutine gr_vel2pseudovel(param, mu, xh, vh, pv) !! author: David A. Minton !! !! Converts the heliocentric velocity into a pseudovelocity with relativistic corrections. @@ -234,7 +234,7 @@ pure subroutine gr_vel2pseudovel(config, mu, xh, vh, pv) !! Adapted from David A. Minton's Swifter routine gr_vel2pseudovel.f90 implicit none - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: mu !! G * (Mcb + m), G = gravitational constant, Mcb = mass of central body, m = mass of body real(DP), dimension(:), intent(in) :: xh !! Heliocentric position vector real(DP), dimension(:), intent(in) :: vh !! Heliocentric velocity vector @@ -247,7 +247,7 @@ pure subroutine gr_vel2pseudovel(config, mu, xh, vh, pv) integer(I4B), parameter :: MAXITER = 50 real(DP),parameter :: TOL = 1.0e-12_DP - associate (c2 => config%inv_c2) + associate (c2 => param%inv_c2) pv(1:NDIM) = vh(1:NDIM) ! Initial guess rterm = 3 * mu / norm2(xh(:)) v2 = dot_product(vh(:), vh(:)) @@ -298,7 +298,7 @@ pure subroutine gr_vel2pseudovel(config, mu, xh, vh, pv) return end subroutine gr_vel2pseudovel - pure subroutine gr_pseudovel2vel(config, mu, xh, pv, vh) + pure subroutine gr_pseudovel2vel(param, mu, xh, pv, vh) !! author: David A. Minton !! !! Converts the relativistic pseudovelocity back into a veliocentric velocity @@ -306,7 +306,7 @@ pure subroutine gr_pseudovel2vel(config, mu, xh, pv, vh) !! !! Adapted from David A. Minton's Swifter routine gr_pseudovel2vel.f90 implicit none - class(swiftest_configuration), intent(in) :: config !! Input collection of configuration parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of parameters parameters real(DP), intent(in) :: mu !! G * (Mcb + m), G = gravitational constant, Mcb = mass of central body, m = mass of body real(DP), dimension(:), intent(in) :: xh !! Heliocentric position vector real(DP), dimension(:), intent(in) :: pv !! Pseudovelocity velocity vector - see Saha & Tremain (1994), eq. (32) @@ -314,7 +314,7 @@ pure subroutine gr_pseudovel2vel(config, mu, xh, pv, vh) real(DP) :: vmag2, rmag, grterm - associate(c2 => config%inv_c2) + associate(c2 => param%inv_c2) vmag2 = dot_product(pv(:), pv(:)) rmag = norm2(xh(:)) grterm = 1.0_DP - c2 * (0.5_DP * vmag2 + 3 * mu / rmag) diff --git a/src/whm/whm_setup.f90 b/src/whm/whm_setup.f90 index 822108527..af3f4c774 100644 --- a/src/whm/whm_setup.f90 +++ b/src/whm/whm_setup.f90 @@ -72,7 +72,7 @@ module subroutine whm_setup_set_mu_eta_pl(self, cb) end subroutine whm_setup_set_mu_eta_pl - module subroutine whm_setup_system(self, config) + module subroutine whm_setup_system(self, param) !! author: David A. Minton !! !! Wrapper method to initialize a basic Swiftest nbody system from files @@ -80,8 +80,8 @@ module subroutine whm_setup_system(self, config) implicit none ! Arguments class(whm_nbody_system), intent(inout) :: self !! Swiftest system object - class(swiftest_configuration), intent(inout) :: config !! Input collection of on parameters - call io_read_initialize_system(self, config) + class(swiftest_parameters), intent(inout) :: param !! Input collection of on parameters + call io_read_initialize_system(self, param) ! Make sure that the discard list gets allocated initially call self%tp_discards%setup(self%tp%nbody) @@ -89,7 +89,7 @@ module subroutine whm_setup_system(self, config) select type(pl => self%pl) class is (whm_pl) call pl%set_mu(self%cb) - if (config%lgr) call pl%gr_vh2pv(config) + if (param%lgr) call pl%gr_vh2pv(param) !call pl%eucl_index() end select end if @@ -98,7 +98,7 @@ module subroutine whm_setup_system(self, config) select type(tp => self%tp) class is (whm_tp) call tp%set_mu(self%cb) - if (config%lgr) call tp%gr_vh2pv(config) + if (param%lgr) call tp%gr_vh2pv(param) end select end if diff --git a/src/whm/whm_step.f90 b/src/whm/whm_step.f90 index d7c620786..da504963b 100644 --- a/src/whm/whm_step.f90 +++ b/src/whm/whm_step.f90 @@ -3,7 +3,7 @@ contains - module subroutine whm_step_system(self, config) + module subroutine whm_step_system(self, param) !! author: David A. Minton !! !! Step massive bodies and and active test particles ahead in heliocentric coordinates @@ -13,7 +13,7 @@ module subroutine whm_step_system(self, config) implicit none ! Arguments class(whm_nbody_system), intent(inout) :: self !! WHM nbody system object - class(swiftest_configuration), intent(in) :: config !! Input collection of on parameters + class(swiftest_parameters), intent(in) :: param !! Input collection of on parameters select type(cb => self%cb) class is (whm_cb) @@ -21,13 +21,13 @@ module subroutine whm_step_system(self, config) class is (whm_pl) select type(tp => self%tp) class is (whm_tp) - associate(ntp => tp%nbody, npl => pl%nbody, t => config%t, dt => config%dt) + associate(ntp => tp%nbody, npl => pl%nbody, t => param%t, dt => param%dt) call pl%set_rhill(cb) call tp%set_beg_end(xbeg = pl%xh) - call pl%step(cb, config, t, dt) + call pl%step(cb, param, t, dt) if (ntp > 0) then call tp%set_beg_end(xend = pl%xh) - call tp%step(cb, pl, config, t, dt) + call tp%step(cb, pl, param, t, dt) end if end associate end select @@ -36,7 +36,7 @@ module subroutine whm_step_system(self, config) return end subroutine whm_step_system - module subroutine whm_step_pl(self, cb, config, t, dt) + module subroutine whm_step_pl(self, cb, param, t, dt) !! author: David A. Minton !! !! Step planets ahead using kick-drift-kick algorithm @@ -48,7 +48,7 @@ module subroutine whm_step_pl(self, cb, config, t, dt) ! Arguments class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), intent(in) :: dt !! Stepsize ! Internals @@ -59,24 +59,24 @@ module subroutine whm_step_pl(self, cb, config, t, dt) dth = 0.5_DP * dt if (pl%lfirst) then call pl%h2j(cb) - call pl%getacch(cb, config, t) + call pl%getacch(cb, param, t) pl%lfirst = .false. end if call pl%kickvh(dth) call pl%vh2vj(cb) !If GR enabled, calculate the p4 term before and after each drift - if (config%lgr) call pl%gr_p4(config, dth) - call pl%drift(cb, config, dt) - if (config%lgr) call pl%gr_p4(config, dth) + if (param%lgr) call pl%gr_p4(param, dth) + call pl%drift(cb, param, dt) + if (param%lgr) call pl%gr_p4(param, dth) call pl%j2h(cb) - call pl%getacch(cb, config, t + dt) + call pl%getacch(cb, param, t + dt) call pl%kickvh(dth) end associate return end subroutine whm_step_pl - module subroutine whm_step_tp(self, cb, pl, config, t, dt) + module subroutine whm_step_tp(self, cb, pl, param, t, dt) !! author: David A. Minton !! !! Step active test particles ahead using kick-drift-kick algorithm @@ -88,7 +88,7 @@ module subroutine whm_step_tp(self, cb, pl, config, t, dt) class(whm_tp), intent(inout) :: self !! WHM test particle data structure class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure class(whm_pl), intent(inout) :: pl !! WHM massive body data structure - class(swiftest_configuration), intent(in) :: config !! Input collection of + class(swiftest_parameters), intent(in) :: param !! Input collection of real(DP), intent(in) :: t !! Current time real(DP), intent(in) :: dt !! Stepsize ! Internals @@ -98,15 +98,15 @@ module subroutine whm_step_tp(self, cb, pl, config, t, dt) xbeg => self%xbeg, xend => self%xend) dth = 0.5_DP * dt if (tp%lfirst) then - call tp%getacch(cb, pl, config, t, xbeg) + call tp%getacch(cb, pl, param, t, xbeg) tp%lfirst = .false. end if call tp%kickvh(dth) !If GR enabled, calculate the p4 term before and after each drift - if (config%lgr) call tp%gr_p4(config, dth) - call tp%drift(cb, config, dt) - if (config%lgr) call tp%gr_p4(config, dth) - call tp%getacch(cb, pl, config, t + dt, xend) + if (param%lgr) call tp%gr_p4(param, dth) + call tp%drift(cb, param, dt) + if (param%lgr) call tp%gr_p4(param, dth) + call tp%getacch(cb, pl, param, t + dt, xend) call tp%kickvh(dth) end associate return