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

Commit

Permalink
Fixed array deallocation and some type mismatch warnings gfortran gave
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jan 13, 2023
1 parent e760cb4 commit 0498af1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
39 changes: 23 additions & 16 deletions src/collision/collision_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -351,22 +351,29 @@ module subroutine collision_util_dealloc_fragments(self)
class(collision_fragments), intent(inout) :: self

if (allocated(self%info)) deallocate(self%info)
self%mtot = 0.0_DP
self%status = 0
self%rh(:,:) = 0.0_DP
self%vh(:,:) = 0.0_DP
self%rb(:,:) = 0.0_DP
self%vb(:,:) = 0.0_DP
self%rot(:,:) = 0.0_DP
self%Ip(:,:) = 0.0_DP
self%mass(:) = 0.0_DP
self%radius(:) = 0.0_DP
self%density(:) = 0.0_DP
self%rc(:,:) = 0.0_DP
self%vc(:,:) = 0.0_DP
self%r_unit(:,:) = 0.0_DP
self%t_unit(:,:) = 0.0_DP
self%n_unit(:,:) = 0.0_DP
if (allocated(self%status)) deallocate(self%status)
if (allocated(self%rh)) deallocate(self%rh)
if (allocated(self%vh)) deallocate(self%vh)
if (allocated(self%rb)) deallocate(self%rb)
if (allocated(self%vb)) deallocate(self%vb)
if (allocated(self%rc)) deallocate(self%rc)
if (allocated(self%vc)) deallocate(self%vc)
if (allocated(self%r_unit)) deallocate(self%r_unit)
if (allocated(self%t_unit)) deallocate(self%t_unit)
if (allocated(self%n_unit)) deallocate(self%n_unit)
if (allocated(self%rot)) deallocate(self%rot)
if (allocated(self%Ip)) deallocate(self%Ip)
if (allocated(self%mass)) deallocate(self%mass)
if (allocated(self%radius)) deallocate(self%radius)
if (allocated(self%density)) deallocate(self%density)
if (allocated(self%rmag)) deallocate(self%rmag)
if (allocated(self%vmag)) deallocate(self%vmag)
if (allocated(self%rotmag)) deallocate(self%rotmag)
if (allocated(self%origin_body)) deallocate(self%origin_body)
if (allocated(self%L_orbit)) deallocate(self%L_orbit)
if (allocated(self%L_spin)) deallocate(self%L_spin)
if (allocated(self%ke_orbit)) deallocate(self%ke_orbit)
if (allocated(self%ke_spin)) deallocate(self%ke_spin)

return
end subroutine collision_util_dealloc_fragments
Expand Down
3 changes: 2 additions & 1 deletion src/swiftest/swiftest_driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ program swiftest_driver
!!
!! Adapted from Swifter by David E. Kaufmann's Swifter driver programs swifter_[bs,helio,ra15,rmvs,symba,tu4,whm].f90
!! Adapted from Hal Levison and Martin Duncan's Swift driver programs
use netcdf
use swiftest
implicit none

Expand Down Expand Up @@ -54,7 +55,7 @@ program swiftest_driver
idump = 0

! Set up nbody_system storage for intermittent file dumps
if (dump_cadence == 0) dump_cadence = ceiling(nloops / (1.0_DP * istep_out), kind=I8B)
if (dump_cadence == 0) dump_cadence = int(ceiling(nloops / (1.0_DP * istep_out), kind=I8B), kind=I4B)

! Construct the main n-body nbody_system using the user-input integrator to choose the type of nbody_system
call swiftest_util_setup_construct_system(nbody_system, param)
Expand Down

0 comments on commit 0498af1

Please sign in to comment.