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

Commit

Permalink
Switched to gfortran, as ifort keeps segfaulting without providing tr…
Browse files Browse the repository at this point in the history
…aceback. Fixed up some parallelized code and started adding more metadata to the particle info type.
  • Loading branch information
daminton committed Aug 29, 2021
1 parent fdbf1a9 commit 1802274
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Makefile.Defines
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporari
GPRODUCTION = -O3 -ffree-line-length-none $(GPAR)

#FFLAGS = $(IDEBUG) $(HEAPARR) $(SIMDVEC) $(PAR)
FFLAGS = $(IPRODUCTION) $(OPTREPORT)
FORTRAN = ifort
#FFLAGS = $(IPRODUCTION) -g -traceback $(OPTREPORT)
#FORTRAN = ifort
#AR = xiar

#FORTRAN = gfortran
FORTRAN = gfortran
#FFLAGS = $(GDEBUG) $(GMEM) $(GPAR)
#FFLAGS = $(GPRODUCTION)
FFLAGS = $(GPRODUCTION)
AR = ar

# DO NOT include in CFLAGS the "-c" option to compile object only
Expand Down
27 changes: 12 additions & 15 deletions examples/symba_mars_disk/testnetcdf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand All @@ -11,7 +11,7 @@
"'/home/daminton/git/swiftest/examples/symba_mars_disk'"
]
},
"execution_count": 1,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -26,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -48,7 +48,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -405,28 +405,25 @@
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;origin_type&#x27; (id: 1533)&gt;\n",
"array([&#x27;Initial conditions&#x27;, &#x27;Initial conditions&#x27;, &#x27;Initial conditions&#x27;,\n",
" ..., &#x27;Disruption&#x27;, &#x27;Disruption&#x27;, &#x27;Disruption&#x27;], dtype=&#x27;&lt;U18&#x27;)\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;npl&#x27; (time: 2)&gt;\n",
"array([1500, 1518], dtype=int32)\n",
"Coordinates:\n",
" * id (id) int32 0 1 2 3 4 5 6 7 ... 1526 1527 1528 1529 1530 1531 1532</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'origin_type'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>id</span>: 1533</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-48180d32-9f26-4604-b808-9383695ce00c' class='xr-array-in' type='checkbox' checked><label for='section-48180d32-9f26-4604-b808-9383695ce00c' 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>&#x27;Initial conditions&#x27; &#x27;Initial conditions&#x27; ... &#x27;Disruption&#x27;</span></div><div class='xr-array-data'><pre>array([&#x27;Initial conditions&#x27;, &#x27;Initial conditions&#x27;, &#x27;Initial conditions&#x27;,\n",
" ..., &#x27;Disruption&#x27;, &#x27;Disruption&#x27;, &#x27;Disruption&#x27;], dtype=&#x27;&lt;U18&#x27;)</pre></div></div></li><li class='xr-section-item'><input id='section-e7667ab1-5255-4351-bf10-fae40f8a2dba' class='xr-section-summary-in' type='checkbox' checked><label for='section-e7667ab1-5255-4351-bf10-fae40f8a2dba' class='xr-section-summary' >Coordinates: <span>(1)</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 class='xr-has-index'>id</span></div><div class='xr-var-dims'>(id)</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 ... 1529 1530 1531 1532</div><input id='attrs-f9e8025e-a6e3-477f-b385-fae0041382ff' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-f9e8025e-a6e3-477f-b385-fae0041382ff' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-fe8d67bf-38ac-4ccf-a428-94aa8ea433f8' class='xr-var-data-in' type='checkbox'><label for='data-fe8d67bf-38ac-4ccf-a428-94aa8ea433f8' 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, 1, 2, ..., 1530, 1531, 1532], dtype=int32)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-43321af9-77b4-43cb-a671-5de466147bf1' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-43321af9-77b4-43cb-a671-5de466147bf1' 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>"
" * time (time) float64 0.0 6e+03</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'npl'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>time</span>: 2</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-f9c3a65f-c74c-426c-9895-b8897fcea149' class='xr-array-in' type='checkbox' checked><label for='section-f9c3a65f-c74c-426c-9895-b8897fcea149' 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>1500 1518</span></div><div class='xr-array-data'><pre>array([1500, 1518], dtype=int32)</pre></div></div></li><li class='xr-section-item'><input id='section-784c99fe-5ed7-4bf3-a2a7-f9405dbfdb9b' class='xr-section-summary-in' type='checkbox' checked><label for='section-784c99fe-5ed7-4bf3-a2a7-f9405dbfdb9b' class='xr-section-summary' >Coordinates: <span>(1)</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 class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0 6e+03</div><input id='attrs-0497a2e4-c00e-41be-bf0f-d13db0631c56' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-0497a2e4-c00e-41be-bf0f-d13db0631c56' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7c87ab97-ffbe-4e4d-a011-48a2772c0a77' class='xr-var-data-in' type='checkbox'><label for='data-7c87ab97-ffbe-4e4d-a011-48a2772c0a77' 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., 6000.])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-899045cd-a32d-4ccf-8665-19282cc3436e' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-899045cd-a32d-4ccf-8665-19282cc3436e' 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 'origin_type' (id: 1533)>\n",
"array(['Initial conditions', 'Initial conditions', 'Initial conditions',\n",
" ..., 'Disruption', 'Disruption', 'Disruption'], dtype='<U18')\n",
"<xarray.DataArray 'npl' (time: 2)>\n",
"array([1500, 1518], dtype=int32)\n",
"Coordinates:\n",
" * id (id) int32 0 1 2 3 4 5 6 7 ... 1526 1527 1528 1529 1530 1531 1532"
" * time (time) float64 0.0 6e+03"
]
},
"execution_count": 3,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sim.ds['origin_type']"
"sim.ds['npl']"
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/kick/kick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ module subroutine kick_getacch_int_all_pl(npl, nplpl, k_plpl, x, Gmass, radius,
if (rji2 > rlim2) call kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmass(i), Gmass(j), ahi(1,i), ahi(2,i), ahi(3,i), ahj(1,j), ahj(2,j), ahj(3,j))
end do
!$omp end parallel do
!$omp parallel workshare
acc(:,1:npl) = acc(:,1:npl) + ahi(:,1:npl) + ahj(:,1:npl)
!$omp end parallel workshare
return
end subroutine kick_getacch_int_all_pl

Expand Down
19 changes: 11 additions & 8 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,17 @@ module swiftest_classes
!> Class definition for the particle origin information object. This object is used to track time, location, and collisional regime
!> of fragments produced in collisional events.
type :: swiftest_particle_info
character(len=NAMELEN) :: name !! Non-unique name
character(len=NAMELEN) :: particle_type !! String containing a description of the particle type (e.g. Central Body, Massive Body, Test Particle)
character(len=NAMELEN) :: origin_type !! String containing a description of the origin of the particle (e.g. Initial Conditions, Supercatastrophic, Disruption, etc.)
real(DP) :: origin_time !! The time of the particle's formation
real(DP), dimension(NDIM) :: origin_xh !! The heliocentric distance vector at the time of the particle's formation
real(DP), dimension(NDIM) :: origin_vh !! The heliocentric velocity vector at the time of the particle's formation
character(len=NAMELEN) :: name !! Non-unique name
character(len=NAMELEN) :: particle_type !! String containing a description of the particle type (e.g. Central Body, Massive Body, Test Particle)
character(len=NAMELEN) :: origin_type !! String containing a description of the origin of the particle (e.g. Initial Conditions, Supercatastrophic, Disruption, etc.)
real(DP) :: origin_time !! The time of the particle's formation
real(DP), dimension(NDIM) :: origin_xh !! The heliocentric distance vector at the time of the particle's formation
real(DP), dimension(NDIM) :: origin_vh !! The heliocentric velocity vector at the time of the particle's formation
real(DP) :: discard_time !! The time of the particle's discard
character(len=NAMELEN) :: status !! Particle status description: Active, Merged, Fragmented, etc.
real(DP), dimension(NDIM) :: discard_xh !! The heliocentric distance vector at the time of the particle's discard
real(DP), dimension(NDIM) :: discard_vh !! The heliocentric velocity vector at the time of the particle's discard
integer(I4B) :: discard_body_id !! The id of the other body involved in the discard (0 if no other body involved)
contains
procedure :: dump => io_dump_particle_info !! Dumps contents of particle information to file
procedure :: read_in => io_read_in_particle_info !! Read in a particle information object from an open file
Expand Down Expand Up @@ -844,7 +849,6 @@ module subroutine kick_getacch_int_all_pl(npl, nplpl, k_plpl, x, Gmass, radius,
end subroutine kick_getacch_int_all_pl

module pure subroutine kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmi, Gmj, axi, ayi, azi, axj, ayj, azj)
!$omp declare simd(kick_getacch_int_one_pl)
implicit none
real(DP), intent(in) :: rji2 !! Square of distance between the two bodies
real(DP), intent(in) :: xr, yr, zr !! Distances between the two bodies in x, y, and z directions
Expand All @@ -855,7 +859,6 @@ module pure subroutine kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmi, Gmj, axi,
end subroutine kick_getacch_int_one_pl

module pure subroutine kick_getacch_int_one_tp(rji2, xr, yr, zr, Gmpl, ax, ay, az)
!$omp declare simd(kick_getacch_int_one_tp)
implicit none
real(DP), intent(in) :: rji2 !! Square of distance between the test particle and massive body
real(DP), intent(in) :: xr, yr, zr !! Distances between the two bodies in x, y, and z directions
Expand Down

0 comments on commit 1802274

Please sign in to comment.