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

Commit

Permalink
Embarked on a major restructuring of the encounter, collision, and fr…
Browse files Browse the repository at this point in the history
…agment system. Created a new top-level module specializing in collisions. Wrote it so other collision models besides Fraggle can easily be implemented.
  • Loading branch information
daminton committed Dec 16, 2022
1 parent 149189f commit 96bd172
Show file tree
Hide file tree
Showing 24 changed files with 1,371 additions and 1,296 deletions.
18 changes: 11 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@

# Add the source files
SET(FAST_MATH_FILES
${SRC}/modules/swiftest_globals.f90
${SRC}/modules/lambda_function.f90
${SRC}/modules/swiftest_operators.f90
${SRC}/modules/walltime_classes.f90
${SRC}/modules/swiftest_classes.f90
${SRC}/modules/encounter_classes.f90
${SRC}/modules/collision_classes.f90
${SRC}/modules/fraggle_classes.f90
${SRC}/modules/helio_classes.f90
${SRC}/modules/lambda_function.f90
${SRC}/modules/rmvs_classes.f90
${SRC}/modules/swiftest_classes.f90
${SRC}/modules/swiftest_globals.f90
${SRC}/modules/swiftest_operators.f90
${SRC}/modules/swiftest.f90
${SRC}/modules/symba_classes.f90
${SRC}/modules/walltime_classes.f90
${SRC}/modules/whm_classes.f90
${SRC}/modules/swiftest.f90
${SRC}/fraggle/collision_io.f90
${SRC}/fraggle/collision_placeholder.f90
${SRC}/fraggle/collision_setup.f90
${SRC}/fraggle/collision_util.f90
${SRC}/discard/discard.f90
${SRC}/drift/drift.f90
${SRC}/encounter/encounter_check.f90
Expand All @@ -33,7 +38,6 @@ SET(FAST_MATH_FILES
${SRC}/encounter/encounter_io.f90
${SRC}/fraggle/fraggle_generate.f90
${SRC}/fraggle/fraggle_io.f90
${SRC}/fraggle/fraggle_placeholder.f90
${SRC}/fraggle/fraggle_regime.f90
${SRC}/fraggle/fraggle_set.f90
${SRC}/fraggle/fraggle_setup.f90
Expand Down
227 changes: 227 additions & 0 deletions src/collision/collision_io.f90

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,47 @@
!! You should have received a copy of the GNU General Public License along with Swiftest.
!! If not, see: https://www.gnu.org/licenses.

submodule(fraggle_classes) s_fraggle_placeholder
submodule(collision_classes) s_collision_placeholder
use swiftest

contains

!> The following interfaces are placeholders intended to satisfy the required abstract methods given by the parent class
module subroutine fraggle_placeholder_accel(self, system, param, t, lbeg)
module subroutine collision_placeholder_accel(self, system, param, t, lbeg)
implicit none
class(fraggle_fragments), intent(inout) :: self !! Fraggle fragment system object
class(collision_fragments), intent(inout) :: self !! Fraggle fragment system object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Current simulation time
logical, intent(in) :: lbeg !! Optional argument that determines whether or not this is the beginning or end of the step
write(*,*) "The type-bound procedure 'accel' is not defined for type fraggle_fragments"
write(*,*) "The type-bound procedure 'accel' is not defined for the collision_fragments class"
return
end subroutine fraggle_placeholder_accel
end subroutine collision_placeholder_accel

module subroutine fraggle_placeholder_kick(self, system, param, t, dt, lbeg)
module subroutine collision_placeholder_kick(self, system, param, t, dt, lbeg)
implicit none
class(fraggle_fragments), intent(inout) :: self !! Fraggle fragment system object
class(collision_fragments), intent(inout) :: self !! Fraggle fragment system object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system objec
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Current time
real(DP), intent(in) :: dt !! Stepsize
logical, intent(in) :: lbeg !! Logical flag indicating whether this is the beginning of the half step or not.

write(*,*) "The type-bound procedure 'kick' is not defined for type fraggle_fragments"
write(*,*) "The type-bound procedure 'kick' is not defined for the collision_fragments class"
return
end subroutine fraggle_placeholder_kick
end subroutine collision_placeholder_kick

module subroutine fraggle_placeholder_step(self, system, param, t, dt)
module subroutine collision_placeholder_step(self, system, param, t, dt)
implicit none
class(fraggle_fragments), intent(inout) :: self !! Swiftest body object
class(collision_fragments), intent(inout) :: self !! Swiftest body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest 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

write(*,*) "The type-bound procedure 'step' is not defined for type fraggle_fragments"
write(*,*) "The type-bound procedure 'step' is not defined for the collision_fragments class"
return
end subroutine fraggle_placeholder_step
end subroutine collision_placeholder_step


end submodule s_fraggle_placeholder
end submodule s_collision_placeholder
73 changes: 73 additions & 0 deletions src/collision/collision_setup.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
!! Copyright 2022 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh
!! This file is part of Swiftest.
!! Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
!! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
!! Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
!! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
!! You should have received a copy of the GNU General Public License along with Swiftest.
!! If not, see: https://www.gnu.org/licenses.

submodule (collision_classes) s_collision_setup
use swiftest
contains

module subroutine collision_setup_system(self, system, param)
!! author: David A. Minton
!!
!! Initializer for the encounter collision system. Allocates the collider and fragments classes and the before/after snapshots
implicit none
! Arguments
class(collision_system), intent(inout) :: self !! Encounter collision system object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
! Internals


return
end subroutine collision_setup_system

module subroutine collision_setup_fragments(self, n, param)
!! author: David A. Minton
!!
!! Allocates arrays for n fragments in a collision system. Passing n = 0 deallocates all arrays.
implicit none
! Arguments
class(collision_fragments), intent(inout) :: self
integer(I4B), intent(in) :: n
class(swiftest_parameters), intent(in) :: param


call self%swiftest_pl%setup(n, param)
if (n < 0) return

call self%dealloc()

if (n == 0) return

! allocate(self%rotmag(n))
! allocate(self%v_r_mag(n))
! allocate(self%v_t_mag(n))
! allocate(self%v_n_mag(n))

call self%reset()

return
end subroutine collision_setup_fragments


module subroutine collision_setup_impactors(self, system, param)
!! author: David A. Minton
!!
!! Initializes a collider object
implicit none
! Arguments
class(collision_impactors), intent(inout) :: self !! Fragment system object
class(swiftest_nbody_system), intent(in) :: system
class(swiftest_parameters), intent(in) :: param !! Current swiftest run configuration parameters

return
end subroutine collision_setup_impactors

end submodule s_collision_setup


Loading

0 comments on commit 96bd172

Please sign in to comment.