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

Commit

Permalink
Added placeholder system spin stepper method. Verified that the WHM, …
Browse files Browse the repository at this point in the history
…RMVS, and Helio examples still work correctly.
  • Loading branch information
daminton committed Jul 13, 2021
1 parent 91afecd commit 90d4183
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@
" 1.17040422e-11])\n",
"Coordinates:\n",
" id int64 2\n",
" * time (d) (time (d)) float64 0.0 11.0 22.0 ... 3.63e+03 3.641e+03 3.652e+03</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'rmag'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>time (d)</span>: 333</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-44e959ac-3d3f-485f-9a2d-bcb19d18f5b2' class='xr-array-in' type='checkbox' checked><label for='section-44e959ac-3d3f-485f-9a2d-bcb19d18f5b2' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>0.0 0.0 0.0 0.0 0.0 ... 2.959e-11 2.323e-11 1.702e-11 1.17e-11</span></div><div class='xr-array-data'><pre>array([0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" * time (d) (time (d)) float64 0.0 11.0 22.0 ... 3.63e+03 3.641e+03 3.652e+03</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'rmag'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>time (d)</span>: 333</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-8749a769-0901-41f5-9ba4-019a50cd278c' class='xr-array-in' type='checkbox' checked><label for='section-8749a769-0901-41f5-9ba4-019a50cd278c' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>0.0 0.0 0.0 0.0 0.0 ... 2.959e-11 2.323e-11 1.702e-11 1.17e-11</span></div><div class='xr-array-data'><pre>array([0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
Expand Down Expand Up @@ -662,7 +662,7 @@
" 2.44264806e-11, 3.07065663e-11, 3.63320360e-11, 4.07478190e-11,\n",
" 4.35128453e-11, 4.43475549e-11, 4.31649567e-11, 4.00801554e-11,\n",
" 3.53984592e-11, 2.95862328e-11, 2.32329074e-11, 1.70175537e-11,\n",
" 1.17040422e-11])</pre></div></div></li><li class='xr-section-item'><input id='section-daa6107b-3ec4-4c1e-bcee-7a03e5b8ffca' class='xr-section-summary-in' type='checkbox' checked><label for='section-daa6107b-3ec4-4c1e-bcee-7a03e5b8ffca' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>id</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>2</div><input id='attrs-1cd85f81-5468-4aaa-a17f-3259770f3693' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-1cd85f81-5468-4aaa-a17f-3259770f3693' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b6e7cb0c-901c-47d8-a851-f06cc4c50304' class='xr-var-data-in' type='checkbox'><label for='data-b6e7cb0c-901c-47d8-a851-f06cc4c50304' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(2)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time (d)</span></div><div class='xr-var-dims'>(time (d))</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0 11.0 ... 3.641e+03 3.652e+03</div><input id='attrs-5bed48e7-0d38-48b5-b517-c4a7562075be' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-5bed48e7-0d38-48b5-b517-c4a7562075be' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a437951f-5629-473c-aba0-3d65bae4ec8e' class='xr-var-data-in' type='checkbox'><label for='data-a437951f-5629-473c-aba0-3d65bae4ec8e' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ 0., 11., 22., ..., 3630., 3641., 3652.])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-f8bbbecd-f0fa-4669-8001-285373eaea46' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-f8bbbecd-f0fa-4669-8001-285373eaea46' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
" 1.17040422e-11])</pre></div></div></li><li class='xr-section-item'><input id='section-1bceb514-f629-4b6a-871d-fc24a1a135d7' class='xr-section-summary-in' type='checkbox' checked><label for='section-1bceb514-f629-4b6a-871d-fc24a1a135d7' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>id</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>2</div><input id='attrs-dc752801-1fdf-44a8-aeb0-eee157ccdc9d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-dc752801-1fdf-44a8-aeb0-eee157ccdc9d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-0038f928-da2d-4b40-95d1-abdab17c6512' class='xr-var-data-in' type='checkbox'><label for='data-0038f928-da2d-4b40-95d1-abdab17c6512' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(2)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time (d)</span></div><div class='xr-var-dims'>(time (d))</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0 11.0 ... 3.641e+03 3.652e+03</div><input id='attrs-0e4a8e9d-e44e-4dd5-a44c-e3bb7f765c03' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-0e4a8e9d-e44e-4dd5-a44c-e3bb7f765c03' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5062c5ac-955c-45fe-9574-995273df53d6' class='xr-var-data-in' type='checkbox'><label for='data-5062c5ac-955c-45fe-9574-995273df53d6' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ 0., 11., 22., ..., 3630., 3641., 3652.])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-1720088d-f5e3-4e21-95eb-a213002b5b0a' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-1720088d-f5e3-4e21-95eb-a213002b5b0a' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'rmag' (time (d): 333)>\n",
Expand Down
1 change: 1 addition & 0 deletions examples/whm_swifter_comparison/cb.swiftest.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
0
39.476926408897626
0.004650467260962157
4.7535806948127355e-12
Expand Down
48 changes: 24 additions & 24 deletions examples/whm_swifter_comparison/pl.swifter.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@
0 39.476926408897625196
0.0 0.0 0.0
0.0 0.0 0.0
1 6.5537098095653139645e-06 0.0014751253039664285066
1 6.5537098095653139645e-06 0.0014751243077781048702
1.6306381826061645943e-05
0.36019833403308620934 -0.07157757063116521046 -0.038889932331457412185
0.012062683987023428416 10.539199589223686515 0.86012493216791845955
2 9.663313399581537916e-05 0.006759112363391176217
0.33206272695596028566 0.07436707001147663254 -0.02438290851908785084
-4.2340114788918336805 10.486553514018327622 1.2453138107251555947
2 9.663313399581537916e-05 0.006759104275397271956
4.0453784346544178454e-05
-0.71276554591539231787 0.0894943770131735733 0.042358444034962597358
-0.96047232050779632014 -7.363179644470093107 -0.045627977257453471387
3 0.000120026935827952453094 0.010044757472678654026
-0.7188115337296047125 -0.0118554711069603201795 0.041316403191083782287
0.07826338813583945357 -7.419533988988633545 -0.10634201014368884618
3 0.000120026935827952453094 0.010044787321379672528
4.25875607065040958e-05
0.27645830888837641393 -0.97837771886398083865 4.5542715832163949185e-05
5.9448497026859876977 1.6852493323830119935 -9.895818943662129852e-05
4 1.2739802010675941456e-05 0.007246754169100752911
0.35677088372527121507 -0.95189300879814897627 4.4027442504036787155e-05
5.7819217550992820422 2.18192814489641851 -0.00012230072278352209966
4 1.2739802010675941456e-05 0.007246743835971885302
2.265740805092889601e-05
-1.4965217056830220077 0.729867855162097956 0.052005223740499352536
-2.049353987860530548 -4.1577626275819368415 -0.03686191825212072444
5 0.037692251088985676735 0.3552713962079929143
-1.5233712071242269115 0.6723825347339112968 0.051459143378398922164
-1.8728417739956807141 -4.239719661832373223 -0.042909557750301418264
5 0.037692251088985676735 0.35527126534549128905
0.00046732617030490929307
4.027841704615886087 -3.0231618001306270749 -0.077559557972985263
1.6231826570873460391 2.3366237981055781438 -0.046019759896080974796
6 0.011285899820091272997 0.43765160695836118215
4.049944927347420176 -2.9910878677758190314 -0.078187280837353656526
1.6060801375519682711 2.349356876761497338 -0.045690062807172619064
6 0.011285899820091272997 0.4376527512949726007
0.00038925687730393611812
6.2788354074558432316 -7.724005035333701308 -0.11559390097316769863
1.4696075442034620881 1.282966226939726742 -0.08077393754283409384
7 0.0017236589478267730203 0.4695227539643713788
6.298929503477405767 -7.706413024510769816 -0.11669919842191249504
1.4661378456572359413 1.2872251175075805794 -0.08070991686100478242
7 0.0017236589478267730203 0.4695362423191493196
0.00016953449859497231466
14.869154031353570389 12.9936724365634095335 -0.1443982771709022006
-0.95437109658589562686 1.0170745961532793757 0.016089151184688745742
8 0.0020336100526728302319 0.78127049251990261927
14.856082147529010129 13.007589275314199284 -0.14417795763685259391
-0.9554310497290159123 1.0161753499437922057 0.016099529164307530124
8 0.0020336100526728302319 0.7812870996943599397
0.000164587904124493665
29.55509611047864027 -4.6450138458072487424 -0.585533781429422695
0.17223467348300621534 1.1421766618084267115 -0.027457548207218328868
29.55744967800954015 -4.629377558152945049 -0.58590957207831262377
0.17162147939801157335 1.1422848961108499101 -0.027445465472921385952
32 changes: 16 additions & 16 deletions examples/whm_swifter_comparison/pl.swiftest.in
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
8
1 6.5537098095653139645e-06
1.6306381826061645943e-05
0.36019833403308620934 -0.07157757063116521046 -0.038889932331457412185
0.012062683987023428416 10.539199589223686515 0.86012493216791845955
0.33206272695596028566 0.07436707001147663254 -0.02438290851908785084
-4.2340114788918336805 10.486553514018327622 1.2453138107251555947
2 9.663313399581537916e-05
4.0453784346544178454e-05
-0.71276554591539231787 0.0894943770131735733 0.042358444034962597358
-0.96047232050779632014 -7.363179644470093107 -0.045627977257453471387
-0.7188115337296047125 -0.0118554711069603201795 0.041316403191083782287
0.07826338813583945357 -7.419533988988633545 -0.10634201014368884618
3 0.000120026935827952453094
4.25875607065040958e-05
0.27645830888837641393 -0.97837771886398083865 4.5542715832163949185e-05
5.9448497026859876977 1.6852493323830119935 -9.895818943662129852e-05
0.35677088372527121507 -0.95189300879814897627 4.4027442504036787155e-05
5.7819217550992820422 2.18192814489641851 -0.00012230072278352209966
4 1.2739802010675941456e-05
2.265740805092889601e-05
-1.4965217056830220077 0.729867855162097956 0.052005223740499352536
-2.049353987860530548 -4.1577626275819368415 -0.03686191825212072444
-1.5233712071242269115 0.6723825347339112968 0.051459143378398922164
-1.8728417739956807141 -4.239719661832373223 -0.042909557750301418264
5 0.037692251088985676735
0.00046732617030490929307
4.027841704615886087 -3.0231618001306270749 -0.077559557972985263
1.6231826570873460391 2.3366237981055781438 -0.046019759896080974796
4.049944927347420176 -2.9910878677758190314 -0.078187280837353656526
1.6060801375519682711 2.349356876761497338 -0.045690062807172619064
6 0.011285899820091272997
0.00038925687730393611812
6.2788354074558432316 -7.724005035333701308 -0.11559390097316769863
1.4696075442034620881 1.282966226939726742 -0.08077393754283409384
6.298929503477405767 -7.706413024510769816 -0.11669919842191249504
1.4661378456572359413 1.2872251175075805794 -0.08070991686100478242
7 0.0017236589478267730203
0.00016953449859497231466
14.869154031353570389 12.9936724365634095335 -0.1443982771709022006
-0.95437109658589562686 1.0170745961532793757 0.016089151184688745742
14.856082147529010129 13.007589275314199284 -0.14417795763685259391
-0.9554310497290159123 1.0161753499437922057 0.016099529164307530124
8 0.0020336100526728302319
0.000164587904124493665
29.55509611047864027 -4.6450138458072487424 -0.585533781429422695
0.17223467348300621534 1.1421766618084267115 -0.027457548207218328868
29.55744967800954015 -4.629377558152945049 -0.58590957207831262377
0.17162147939801157335 1.1422848961108499101 -0.027445465472921385952
16 changes: 8 additions & 8 deletions examples/whm_swifter_comparison/tp.swifter.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
4
101
2.3071617894844269614 1.6438449758645010679 -0.37312906258436789875
-2.256588666826445461 2.8302735208962828827 0.50519430783805206563
2.2759060918449769417 1.6823262546111898974 -0.3661544509052930274
-2.3097811686367798667 2.7916683305060454227 0.51377483806222698173
102
3.011471099377928784 -1.1061264985150089935 0.5067865823770466571
0.69505215270382913404 2.5183263418638507098 -1.8031340524448678953
3.0206599411327550442 -1.0715345879373190385 0.4820489106686373093
0.64736314289225124926 2.5354787229381968757 -1.8109825958052419904
103
-0.51350730399144917104 -3.139963346661017951 0.7339670445581878422
3.0598116277417892524 -0.1107568728194456082 -0.09922455469700767241
-0.47156753362343428737 -3.1411451968218520037 0.73253063903937232215
3.067486522793096946 -0.061867034122113133084 -0.11064022385054755856
104
-2.070517783632789044 -0.7764919020604850175 0.27514297675486260042
1.7817875607764876778 -3.94088558602991294 -0.09896621676031464546
-2.0454358521790818592 -0.83017357434175576003 0.27369621627497042748
1.8825682786003801814 -3.9015333153827542793 -0.112405737336568095776
16 changes: 8 additions & 8 deletions examples/whm_swifter_comparison/tp.swiftest.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
4
101
2.3071617894844269614 1.6438449758645010679 -0.37312906258436789875
-2.256588666826445461 2.8302735208962828827 0.50519430783805206563
2.2759060918449769417 1.6823262546111898974 -0.3661544509052930274
-2.3097811686367798667 2.7916683305060454227 0.51377483806222698173
102
3.011471099377928784 -1.1061264985150089935 0.5067865823770466571
0.69505215270382913404 2.5183263418638507098 -1.8031340524448678953
3.0206599411327550442 -1.0715345879373190385 0.4820489106686373093
0.64736314289225124926 2.5354787229381968757 -1.8109825958052419904
103
-0.51350730399144917104 -3.139963346661017951 0.7339670445581878422
3.0598116277417892524 -0.1107568728194456082 -0.09922455469700767241
-0.47156753362343428737 -3.1411451968218520037 0.73253063903937232215
3.067486522793096946 -0.061867034122113133084 -0.11064022385054755856
104
-2.070517783632789044 -0.7764919020604850175 0.27514297675486260042
1.7817875607764876778 -3.94088558602991294 -0.09896621676031464546
-2.0454358521790818592 -0.83017357434175576003 0.27369621627497042748
1.8825682786003801814 -3.9015333153827542793 -0.112405737336568095776
14 changes: 6 additions & 8 deletions src/helio/helio_step.f90
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
submodule(helio_classes) s_helio_step
use swiftest
contains

module subroutine helio_step_system(self, param, t, dt)
!! author: David A. Minton
!!
!! Step massive bodies and and active test particles ahead in heliocentric coordinates
!! Step massive bodies and and active test particles ahead in heliocentric coordinates.
!!
!! Currently there's no difference between this and the WHM system stepper, so this is just
!! a wrapper function to keep the method calls consistent for inherited types.
!!
!! Adapted from Hal Levison's Swift routine step_kdk.f
!! Adapted from David E. Kaufmann's Swifter routine helio_step.f90
Expand All @@ -14,13 +18,7 @@ module subroutine helio_step_system(self, param, t, dt)
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Simulation time
real(DP), intent(in) :: dt !! Current stepsize

associate(system => self, cb => self%cb, pl => self%pl, tp => self%tp)
tp%lfirst = pl%lfirst
call pl%set_rhill(cb)
call pl%step(system, param, t, dt)
call tp%step(system, param, t, dt)
end associate
call whm_step_system(self, param, t, dt)
return
end subroutine helio_step_system

Expand Down
19 changes: 10 additions & 9 deletions src/modules/helio_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module helio_classes
!********************************************************************************************************************************
type, public, extends(whm_nbody_system) :: helio_nbody_system
contains
procedure, public :: step => helio_step_system !! Advance the Helio nbody system forward in time by one step
end type helio_nbody_system

!********************************************************************************************************************************
Expand Down Expand Up @@ -151,15 +152,6 @@ module subroutine helio_kickvb_tp(self, dt)
real(DP), intent(in) :: dt !! Stepsize
end subroutine helio_kickvb_tp

module subroutine helio_step_system(self, param, t, dt)
use swiftest_classes, only : swiftest_parameters
implicit none
class(helio_nbody_system), intent(inout) :: self !! Helio nbody system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Simulation time
real(DP), intent(in) :: dt !! Current stepsize
end subroutine helio_step_system

module subroutine helio_step_pl(self, system, param, t, dt)
use swiftest_classes, only : swiftest_nbody_system, swiftest_parameters
implicit none
Expand All @@ -170,6 +162,15 @@ module subroutine helio_step_pl(self, system, param, t, dt)
real(DP), intent(in) :: dt !! Stepsize
end subroutine helio_step_pl

module subroutine helio_step_system(self, param, t, dt)
use swiftest_classes, only : swiftest_parameters
implicit none
class(helio_nbody_system), intent(inout) :: self !! Helio nbody system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Simulation time
real(DP), intent(in) :: dt !! Current stepsize
end subroutine helio_step_system

module subroutine helio_step_tp(self, system, param, t, dt)
use swiftest_classes, only : swiftest_cb, swiftest_parameters, swiftest_nbody_system
implicit none
Expand Down
Loading

0 comments on commit 90d4183

Please sign in to comment.