From 7b784f6aeb71d6714fe0e90f19c4063654d176f9 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 16 Sep 2021 13:53:50 -0400 Subject: [PATCH] Added param to the argument list of the interaction acceleration methods so that the choice of whether to use the flattened matrix or not is availble --- examples/symba_mars_disk/Untitled.ipynb | 6 - examples/symba_mars_disk/param.in | 13 +- examples/symba_mars_disk/param.real8.in | 33 + examples/symba_mars_disk/testnetcdf.ipynb | 5414 +-------------------- src/helio/helio_kick.f90 | 6 +- src/kick/kick.f90 | 16 +- src/modules/swiftest_classes.f90 | 16 +- src/modules/symba_classes.f90 | 5 +- src/symba/symba_kick.f90 | 5 +- src/whm/whm_kick.f90 | 6 +- 10 files changed, 143 insertions(+), 5377 deletions(-) delete mode 100644 examples/symba_mars_disk/Untitled.ipynb create mode 100644 examples/symba_mars_disk/param.real8.in diff --git a/examples/symba_mars_disk/Untitled.ipynb b/examples/symba_mars_disk/Untitled.ipynb deleted file mode 100644 index 7fec51502..000000000 --- a/examples/symba_mars_disk/Untitled.ipynb +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cells": [], - "metadata": {}, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/examples/symba_mars_disk/param.in b/examples/symba_mars_disk/param.in index 1769c6c74..b75341794 100644 --- a/examples/symba_mars_disk/param.in +++ b/examples/symba_mars_disk/param.in @@ -1,17 +1,17 @@ !Parameter file for the SyMBA-RINGMOONS test T0 0.0 -TSTOP 60000.0 +TSTOP 12000.0 DT 600.0 CB_IN cb.in PL_IN mars.in TP_IN tp.in IN_TYPE ASCII -ISTEP_OUT 100 -ISTEP_DUMP 100 -BIN_OUT bin.nc +ISTEP_OUT 1 +ISTEP_DUMP 1 +BIN_OUT bin.nc PARTICLE_OUT particle.dat -OUT_TYPE REAL8 -OUT_FORM XV +OUT_TYPE NETCDF_DOUBLE +OUT_FORM XVEL OUT_STAT REPLACE CHK_CLOSE yes CHK_RMIN 3389500.0 @@ -31,3 +31,4 @@ MU2KG 1.0 DU2M 1.0 TU2S 1.0 SEED 2 3080983 2220830 +FLATTEN_INTERACTIONS yes diff --git a/examples/symba_mars_disk/param.real8.in b/examples/symba_mars_disk/param.real8.in new file mode 100644 index 000000000..6ebc9197a --- /dev/null +++ b/examples/symba_mars_disk/param.real8.in @@ -0,0 +1,33 @@ +!Parameter file for the SyMBA-RINGMOONS test +T0 0.0 +TSTOP 6000.0 +DT 600.0 +CB_IN cb.in +PL_IN mars.in +TP_IN tp.in +IN_TYPE ASCII +ISTEP_OUT 1 +ISTEP_DUMP 1 +BIN_OUT bin.dat +PARTICLE_OUT particle.dat +OUT_TYPE REAL8 +OUT_FORM EL +OUT_STAT REPLACE +CHK_CLOSE yes +CHK_RMIN 3389500.0 +CHK_RMAX 3389500000.0 +CHK_EJECT 3389500000.0 +CHK_QMIN 3389500.0 +CHK_QMIN_COORD HELIO +CHK_QMIN_RANGE 3389500.0 338950000000.0 +EXTRA_FORCE no +RHILL_PRESENT yes +GMTINY 10000.0 +MIN_GMFRAG 1000.0 +ENERGY yes +FRAGMENTATION yes +ROTATION yes +MU2KG 1.0 +DU2M 1.0 +TU2S 1.0 +SEED 2 3080983 2220830 diff --git a/examples/symba_mars_disk/testnetcdf.ipynb b/examples/symba_mars_disk/testnetcdf.ipynb index be4bf6a11..a0dd92fe6 100644 --- a/examples/symba_mars_disk/testnetcdf.ipynb +++ b/examples/symba_mars_disk/testnetcdf.ipynb @@ -2,31 +2,42 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 6, "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The autoreload extension is already loaded. To reload it, use:\n", + " %reload_ext autoreload\n" + ] + }, { "data": { "text/plain": [ - "'/home/daminton/git/swiftest/examples/symba_mars_disk'" + "'/home/daminton/gittmp/swiftest/examples/symba_mars_disk'" ] }, - "execution_count": 1, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ + "%load_ext autoreload\n", + "%autoreload 2\n", "import swiftest\n", "import os\n", "import xarray as xr\n", "import numpy as np\n", + "from netCDF4 import Dataset\n", "os.getcwd()" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -35,20 +46,20 @@ "text": [ "Reading Swiftest file param.in\n", "\n", - "Creating Dataset\n", - "Successfully converted 6 output frames.\n", + "Creating Dataset from NetCDF file\n", + "Successfully converted 11 output frames.\n", "Swiftest simulation data stored as xarray DataSet .ds\n" ] } ], "source": [ "sim = swiftest.Simulation(param_file=\"param.in\")\n", - "sim.bin2xr()\n" + "sim.bin2xr()" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -405,43 +416,35 @@ " stroke: currentColor;\n", " fill: currentColor;\n", "}\n", - "
<xarray.DataArray 'status' (id: 1521)>\n",
-       "array(['ACTIVE', 'ACTIVE', 'ACTIVE', ..., 'ACTIVE', 'ACTIVE', 'ACTIVE'],\n",
-       "      dtype='<U17')\n",
+       "
<xarray.DataArray 'id' (id: 1525)>\n",
+       "array([   0,    1,    2, ..., 1522, 1523, 1524], dtype=int32)\n",
        "Coordinates:\n",
-       "  * id       (id) int32 0 1 2 3 4 5 6 7 ... 1514 1515 1516 1517 1518 1519 1520
" + " * id (id) int32 0 1 2 3 4 5 6 7 ... 1518 1519 1520 1521 1522 1523 1524\n", + "Attributes:\n", + " _FillValue: -2147483647
" ], "text/plain": [ - "\n", - "array(['ACTIVE', 'ACTIVE', 'ACTIVE', ..., 'ACTIVE', 'ACTIVE', 'ACTIVE'],\n", - " dtype='\n", + "array([ 0, 1, 2, ..., 1522, 1523, 1524], dtype=int32)\n", "Coordinates:\n", - " * id (id) int32 0 1 2 3 4 5 6 7 ... 1514 1515 1516 1517 1518 1519 1520" + " * id (id) int32 0 1 2 3 4 5 6 7 ... 1518 1519 1520 1521 1522 1523 1524\n", + "Attributes:\n", + " _FillValue: -2147483647" ] }, - "execution_count": 3, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "sim.ds['status']" + "sim.ds.id" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, - "outputs": [], - "source": [ - "ds = xr.open_dataset('bin.nc')" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, "outputs": [ { "data": { @@ -797,5372 +800,99 @@ " stroke: currentColor;\n", " fill: currentColor;\n", "}\n", - "
<xarray.DataArray 'status' ()>\n",
-       "array('Supercatastrophic', dtype='<U17')\n",
+       "
<xarray.DataArray 'id' (id: 1525)>\n",
+       "array([0.000e+00, 1.000e+00, 2.000e+00, ..., 1.522e+03, 1.523e+03, 1.524e+03])\n",
        "Coordinates:\n",
-       "    id       int32 726
" + " * id (id) float64 0.0 1.0 2.0 3.0 ... 1.522e+03 1.523e+03 1.524e+03
" ], "text/plain": [ - "\n", - "array('Supercatastrophic', dtype='\n", + "array([0.000e+00, 1.000e+00, 2.000e+00, ..., 1.522e+03, 1.523e+03, 1.524e+03])\n", "Coordinates:\n", - " id int32 726" + " * id (id) float64 0.0 1.0 2.0 3.0 ... 1.522e+03 1.523e+03 1.524e+03" ] }, - "execution_count": 5, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "sim.ds['status'].sel(id=726)" + "sim.ds.id" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'discard_time' (id: 1521)>\n",
-       "array([ 0.000000e+000,  6.013470e-154,  6.013470e-154, ..., -1.797693e+308,\n",
-       "       -1.797693e+308, -1.797693e+308])\n",
-       "Coordinates:\n",
-       "  * id       (id) int32 0 1 2 3 4 5 6 7 ... 1514 1515 1516 1517 1518 1519 1520
" - ], - "text/plain": [ - "\n", - "array([ 0.000000e+000, 6.013470e-154, 6.013470e-154, ..., -1.797693e+308,\n", - " -1.797693e+308, -1.797693e+308])\n", - "Coordinates:\n", - " * id (id) int32 0 1 2 3 4 5 6 7 ... 1514 1515 1516 1517 1518 1519 1520" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" + "ename": "NameError", + "evalue": "name 'osd' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mosd\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'id'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'osd' is not defined" + ] } ], "source": [ - "sim.ds['discard_time']" + "osd['id']" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "dslost = sim.ds.where(sim.ds['status'] != \"ACTIVE\", drop=True)" + "ds = xr.open_dataset(sim.param['BIN_OUT'], mask_and_scale=False)\n", + "ds = swiftest.io.clean_string_values(sim.param, ds)" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'discard_time' (id: 2)>\n",
-       "array([2400., 2400.])\n",
-       "Coordinates:\n",
-       "  * id       (id) int32 230 726
" - ], - "text/plain": [ - "\n", - "array([2400., 2400.])\n", - "Coordinates:\n", - " * id (id) int32 230 726" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "dslost['discard_time']" + "ods = xr.open_dataset('bin.nc', mask_and_scale=False)" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "lastloss = dslost.where(dslost['discard_time'] == 98400.0, drop=True)" + "ods['a']" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "dsactive = sim.ds.where(sim.ds['status'] == \"ACTIVE\", drop=True)" + "ods.id" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset>\n",
-       "Dimensions:          (id: 1519, time: 6)\n",
-       "Coordinates:\n",
-       "  * time             (time) float64 0.0 600.0 1.2e+03 1.8e+03 2.4e+03 3e+03\n",
-       "  * id               (id) int32 0 1 2 3 4 5 6 ... 1515 1516 1517 1518 1519 1520\n",
-       "Data variables: (12/57)\n",
-       "    npl              (time, id) float64 1.5e+03 1.5e+03 ... 1.518e+03 1.518e+03\n",
-       "    ntp              (time, id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n",
-       "    name             (id) object 'Mars' 'Body2' ... 'Newbody0001520'\n",
-       "    particle_type    (id) object 'Central Body' ... 'Massive Body'\n",
-       "    xhx              (time, id) float64 0.0 -2.358e+06 ... -3.489e+06 -3.476e+06\n",
-       "    xhy              (time, id) float64 0.0 8.604e+06 ... -8.532e+06 -8.571e+06\n",
-       "    ...               ...\n",
-       "    discard_xhy      (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n",
-       "    discard_xhz      (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n",
-       "    discard_vhx      (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n",
-       "    discard_vhy      (id) float64 0.0 2.122e-314 2.122e-314 ... 0.0 0.0 0.0\n",
-       "    discard_vhz      (id) float64 0.0 3.024e-153 3.024e-153 ... 0.0 0.0 0.0\n",
-       "    discard_body_id  (id) float64 -2.147e+09 -2.147e+09 ... -2.147e+09
" - ], - "text/plain": [ - "\n", - "Dimensions: (id: 1519, time: 6)\n", - "Coordinates:\n", - " * time (time) float64 0.0 600.0 1.2e+03 1.8e+03 2.4e+03 3e+03\n", - " * id (id) int32 0 1 2 3 4 5 6 ... 1515 1516 1517 1518 1519 1520\n", - "Data variables: (12/57)\n", - " npl (time, id) float64 1.5e+03 1.5e+03 ... 1.518e+03 1.518e+03\n", - " ntp (time, id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n", - " name (id) object 'Mars' 'Body2' ... 'Newbody0001520'\n", - " particle_type (id) object 'Central Body' ... 'Massive Body'\n", - " xhx (time, id) float64 0.0 -2.358e+06 ... -3.489e+06 -3.476e+06\n", - " xhy (time, id) float64 0.0 8.604e+06 ... -8.532e+06 -8.571e+06\n", - " ... ...\n", - " discard_xhy (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", - " discard_xhz (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", - " discard_vhx (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", - " discard_vhy (id) float64 0.0 2.122e-314 2.122e-314 ... 0.0 0.0 0.0\n", - " discard_vhz (id) float64 0.0 3.024e-153 3.024e-153 ... 0.0 0.0 0.0\n", - " discard_body_id (id) float64 -2.147e+09 -2.147e+09 ... -2.147e+09" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "dsactive" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [], - "source": [ - "lastadd = sim.ds.where(sim.ds['origin_time'] == 2400.0, drop=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset>\n",
-       "Dimensions:          (id: 20, time: 6)\n",
-       "Coordinates:\n",
-       "  * time             (time) float64 0.0 600.0 1.2e+03 1.8e+03 2.4e+03 3e+03\n",
-       "  * id               (id) int32 1501 1502 1503 1504 1505 ... 1517 1518 1519 1520\n",
-       "Data variables: (12/57)\n",
-       "    npl              (time, id) float64 1.5e+03 1.5e+03 ... 1.518e+03 1.518e+03\n",
-       "    ntp              (time, id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n",
-       "    name             (id) object 'Newbody0001501' ... 'Newbody0001520'\n",
-       "    particle_type    (id) object 'Massive Body' ... 'Massive Body'\n",
-       "    xhx              (time, id) float64 0.0 0.0 0.0 ... -3.489e+06 -3.476e+06\n",
-       "    xhy              (time, id) float64 0.0 0.0 0.0 ... -8.532e+06 -8.571e+06\n",
-       "    ...               ...\n",
-       "    discard_xhy      (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n",
-       "    discard_xhz      (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n",
-       "    discard_vhx      (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n",
-       "    discard_vhy      (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n",
-       "    discard_vhz      (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n",
-       "    discard_body_id  (id) float64 -2.147e+09 -2.147e+09 ... -2.147e+09
" - ], - "text/plain": [ - "\n", - "Dimensions: (id: 20, time: 6)\n", - "Coordinates:\n", - " * time (time) float64 0.0 600.0 1.2e+03 1.8e+03 2.4e+03 3e+03\n", - " * id (id) int32 1501 1502 1503 1504 1505 ... 1517 1518 1519 1520\n", - "Data variables: (12/57)\n", - " npl (time, id) float64 1.5e+03 1.5e+03 ... 1.518e+03 1.518e+03\n", - " ntp (time, id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n", - " name (id) object 'Newbody0001501' ... 'Newbody0001520'\n", - " particle_type (id) object 'Massive Body' ... 'Massive Body'\n", - " xhx (time, id) float64 0.0 0.0 0.0 ... -3.489e+06 -3.476e+06\n", - " xhy (time, id) float64 0.0 0.0 0.0 ... -8.532e+06 -8.571e+06\n", - " ... ...\n", - " discard_xhy (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", - " discard_xhz (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", - " discard_vhx (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", - " discard_vhy (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", - " discard_vhz (id) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", - " discard_body_id (id) float64 -2.147e+09 -2.147e+09 ... -2.147e+09" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "lastadd" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [], - "source": [ - "lastframe = dsactive.isel(time=-1, drop=True)\n", - "firstframe = sim.ds.isel(time=0, drop=True)\n", - "firstframe = firstframe.where(firstframe['a'] < 1e20, drop=True)\n", - "midframe = sim.ds.isel(time=-2, drop=True)\n", - "midframe = midframe.where(midframe['a'] < 1e20, drop=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'id' (id: 1519)>\n",
-       "array([   0,    1,    2, ..., 1518, 1519, 1520], dtype=int32)\n",
-       "Coordinates:\n",
-       "  * id       (id) int32 0 1 2 3 4 5 6 7 ... 1514 1515 1516 1517 1518 1519 1520
" - ], - "text/plain": [ - "\n", - "array([ 0, 1, 2, ..., 1518, 1519, 1520], dtype=int32)\n", - "Coordinates:\n", - " * id (id) int32 0 1 2 3 4 5 6 7 ... 1514 1515 1516 1517 1518 1519 1520" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "lastframe.id" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'id' (id: 0)>\n",
-       "array([], dtype=int32)\n",
-       "Coordinates:\n",
-       "  * id       (id) int32 
" - ], - "text/plain": [ - "\n", - "array([], dtype=int32)\n", - "Coordinates:\n", - " * id (id) int32 " - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "lastloss.id" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'Gmass' ()>\n",
-       "array(4.28396188e+13)
" - ], - "text/plain": [ - "\n", - "array(4.28396188e+13)" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "lastframe['Gmass'].sum()" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'Gmass' ()>\n",
-       "array(4.28396188e+13)
" - ], - "text/plain": [ - "\n", - "array(4.28396188e+13)" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "firstframe['Gmass'].sum()" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'Gmass' ()>\n",
-       "array(4.28396188e+13)
" - ], - "text/plain": [ - "\n", - "array(4.28396188e+13)" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "midframe['Gmass'].sum()" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset>\n",
-       "Dimensions:          ()\n",
-       "Coordinates:\n",
-       "    id               int32 2\n",
-       "Data variables: (12/57)\n",
-       "    npl              float64 1.518e+03\n",
-       "    ntp              float64 0.0\n",
-       "    name             object 'Body3'\n",
-       "    particle_type    object 'Massive Body'\n",
-       "    xhx              float64 -3.025e+06\n",
-       "    xhy              float64 -1.02e+07\n",
-       "    ...               ...\n",
-       "    discard_xhy      float64 0.0\n",
-       "    discard_xhz      float64 0.0\n",
-       "    discard_vhx      float64 0.0\n",
-       "    discard_vhy      float64 2.122e-314\n",
-       "    discard_vhz      float64 3.024e-153\n",
-       "    discard_body_id  float64 -2.147e+09
" - ], - "text/plain": [ - "\n", - "Dimensions: ()\n", - "Coordinates:\n", - " id int32 2\n", - "Data variables: (12/57)\n", - " npl float64 1.518e+03\n", - " ntp float64 0.0\n", - " name object 'Body3'\n", - " particle_type object 'Massive Body'\n", - " xhx float64 -3.025e+06\n", - " xhy float64 -1.02e+07\n", - " ... ...\n", - " discard_xhy float64 0.0\n", - " discard_xhz float64 0.0\n", - " discard_vhx float64 0.0\n", - " discard_vhy float64 2.122e-314\n", - " discard_vhz float64 3.024e-153\n", - " discard_body_id float64 -2.147e+09" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "lastframe.sel(id=2)" + "sim.ds.sel(id=1501)['a']" ] }, { @@ -6170,7 +900,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "cds.sel(id=1501)['a']" + ] } ], "metadata": { diff --git a/src/helio/helio_kick.f90 b/src/helio/helio_kick.f90 index b06abd581..928e7c197 100644 --- a/src/helio/helio_kick.f90 +++ b/src/helio/helio_kick.f90 @@ -20,7 +20,7 @@ module subroutine helio_kick_getacch_pl(self, system, param, t, lbeg) if (self%nbody == 0) return associate(cb => system%cb, pl => self, npl => self%nbody) - call pl%accel_int() + call pl%accel_int(param) if (param%loblatecb) then call pl%accel_obl(system) if (lbeg) then @@ -65,9 +65,9 @@ module subroutine helio_kick_getacch_tp(self, system, param, t, lbeg) associate(tp => self, cb => system%cb, pl => system%pl, npl => system%pl%nbody) system%lbeg = lbeg if (system%lbeg) then - call tp%accel_int(pl%Gmass(1:npl), pl%xbeg(:,1:npl), npl) + call tp%accel_int(param, pl%Gmass(1:npl), pl%xbeg(:,1:npl), npl) else - call tp%accel_int(pl%Gmass(1:npl), pl%xend(:,1:npl), npl) + call tp%accel_int(param, pl%Gmass(1:npl), pl%xend(:,1:npl), npl) end if if (param%loblatecb) call tp%accel_obl(system) if (param%lextra_force) call tp%accel_user(system, param, t, lbeg) diff --git a/src/kick/kick.f90 b/src/kick/kick.f90 index 05603143b..de99a9bb0 100644 --- a/src/kick/kick.f90 +++ b/src/kick/kick.f90 @@ -2,7 +2,7 @@ use swiftest contains - module subroutine kick_getacch_int_pl(self) + module subroutine kick_getacch_int_pl(self, param) !! author: David A. Minton !! !! Compute direct cross (third) term heliocentric accelerations of massive bodies @@ -11,7 +11,8 @@ module subroutine kick_getacch_int_pl(self) !! Adapted from David E. Kaufmann's Swifter routine whm_kick_getacch_ah3.f90 and helio_kick_getacch_int.f90 implicit none ! Arguments - class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object + class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object + class(swiftest_parameters), intent(in) :: param !! Current swiftest run configuration parameters call kick_getacch_int_all_flat_pl(self%nbody, self%nplpl, self%k_plpl, self%xh, self%Gmass, self%radius, self%ah) @@ -19,7 +20,7 @@ module subroutine kick_getacch_int_pl(self) end subroutine kick_getacch_int_pl - module subroutine kick_getacch_int_tp(self, GMpl, xhp, npl) + module subroutine kick_getacch_int_tp(self, param, GMpl, xhp, npl) !! author: David A. Minton !! !! Compute direct cross (third) term heliocentric accelerations of test particles by massive bodies @@ -28,10 +29,11 @@ module subroutine kick_getacch_int_tp(self, GMpl, xhp, npl) !! Adapted from David E. Kaufmann's Swifter routine whm_kick_getacch_ah3.f90 and helio_kick_getacch_int_tp.f90 implicit none ! Arguments - class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object - real(DP), dimension(:), intent(in) :: GMpl !! Massive body masses - real(DP), dimension(:,:), intent(in) :: xhp !! Massive body position vectors - integer(I4B), intent(in) :: npl !! Number of active massive bodies + class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object + class(swiftest_parameters), intent(in) :: param !! Current swiftest run configuration parameters + real(DP), dimension(:), intent(in) :: GMpl !! Massive body masses + real(DP), dimension(:,:), intent(in) :: xhp !! Massive body position vectors + integer(I4B), intent(in) :: npl !! Number of active massive bodies if ((self%nbody == 0) .or. (npl == 0)) return diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index 287654614..a88fb7d7a 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -841,17 +841,19 @@ module subroutine io_write_hdr_system(self, iu, param) class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine io_write_hdr_system - module subroutine kick_getacch_int_pl(self) + module subroutine kick_getacch_int_pl(self, param) implicit none - class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object + class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object + class(swiftest_parameters), intent(in) :: param !! Current swiftest run configuration parameters end subroutine kick_getacch_int_pl - module subroutine kick_getacch_int_tp(self, GMpl, xhp, npl) + module subroutine kick_getacch_int_tp(self, param, GMpl, xhp, npl) implicit none - class(swiftest_tp), intent(inout) :: self !! Swiftest test particle - real(DP), dimension(:), intent(in) :: GMpl !! Massive body masses - real(DP), dimension(:,:), intent(in) :: xhp !! Massive body position vectors - integer(I4B), intent(in) :: npl !! Number of active massive bodies + class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object + class(swiftest_parameters), intent(in) :: param !! Current swiftest run configuration parameters + real(DP), dimension(:), intent(in) :: GMpl !! Massive body masses + real(DP), dimension(:,:), intent(in) :: xhp !! Massive body position vectors + integer(I4B), intent(in) :: npl !! Number of active massive bodies end subroutine kick_getacch_int_tp module subroutine kick_getacch_int_all_flat_pl(npl, nplpl, k_plpl, x, Gmass, radius, acc) diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index 40267e298..f805aa2c4 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -358,9 +358,10 @@ module subroutine symba_io_write_discard(self, param) class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters end subroutine symba_io_write_discard - module subroutine symba_kick_getacch_int_pl(self) + module subroutine symba_kick_getacch_int_pl(self, param) implicit none - class(symba_pl), intent(inout) :: self + class(symba_pl), intent(inout) :: self !! SyMBA massive body object + class(swiftest_parameters), intent(in) :: param !! Current swiftest run configuration parameters end subroutine symba_kick_getacch_int_pl module subroutine symba_kick_getacch_pl(self, system, param, t, lbeg) diff --git a/src/symba/symba_kick.f90 b/src/symba/symba_kick.f90 index 97b52e96e..2011ee0c2 100644 --- a/src/symba/symba_kick.f90 +++ b/src/symba/symba_kick.f90 @@ -2,7 +2,7 @@ use swiftest contains - module subroutine symba_kick_getacch_int_pl(self) + module subroutine symba_kick_getacch_int_pl(self, param) !! author: David A. Minton !! !! Compute direct cross (third) term heliocentric accelerations of massive bodies, with no mutual interactions between bodies below GMTINY @@ -11,7 +11,8 @@ module subroutine symba_kick_getacch_int_pl(self) !! Adapted from David E. Kaufmann's Swifter routine helio_kick_getacch_int.f90 implicit none ! Arguments - class(symba_pl), intent(inout) :: self + class(symba_pl), intent(inout) :: self !! SyMBA massive body object + class(swiftest_parameters), intent(in) :: param !! Current swiftest run configuration parameter call kick_getacch_int_all_flat_pl(self%nbody, self%nplplm, self%k_plpl, self%xh, self%Gmass, self%radius, self%ah) diff --git a/src/whm/whm_kick.f90 b/src/whm/whm_kick.f90 index f831ce15b..c36c1ce23 100644 --- a/src/whm/whm_kick.f90 +++ b/src/whm/whm_kick.f90 @@ -32,7 +32,7 @@ module subroutine whm_kick_getacch_pl(self, system, param, t, lbeg) call whm_kick_getacch_ah1(cb, pl) call whm_kick_getacch_ah2(cb, pl) - call pl%accel_int() + call pl%accel_int(param) if (param%loblatecb) then call pl%accel_obl(system) @@ -84,13 +84,13 @@ module subroutine whm_kick_getacch_tp(self, system, param, t, lbeg) do concurrent(i = 1:ntp, tp%lmask(i)) tp%ah(:, i) = tp%ah(:, i) + ah0(:) end do - call tp%accel_int(pl%Gmass(1:npl), pl%xbeg(:, 1:npl), npl) + call tp%accel_int(param, pl%Gmass(1:npl), pl%xbeg(:, 1:npl), npl) else ah0(:) = whm_kick_getacch_ah0(pl%Gmass(1:npl), pl%xend(:, 1:npl), npl) do concurrent(i = 1:ntp, tp%lmask(i)) tp%ah(:, i) = tp%ah(:, i) + ah0(:) end do - call tp%accel_int(pl%Gmass(1:npl), pl%xend(:, 1:npl), npl) + call tp%accel_int(param, pl%Gmass(1:npl), pl%xend(:, 1:npl), npl) end if if (param%loblatecb) call tp%accel_obl(system)