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

Commit

Permalink
Added templates for the encounter io netcdf methods
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Dec 2, 2022
1 parent c2c781f commit 61321de
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 14 deletions.
25 changes: 25 additions & 0 deletions src/encounter/encounter_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,29 @@ module subroutine encounter_io_dump_storage_list(self, param)
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine encounter_io_dump_storage_list

module subroutine encounter_io_initialize_output(self, param)
!! author: David A. Minton
!!
!! Initialize a NetCDF encounter file system and defines all variables.
implicit none
! Arguments
class(encounter_io_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters

return
end subroutine encounter_io_initialize_output

module subroutine encounter_io_open_file(self, param, readonly)
!! author: David A. Minton
!!
!! Opens a NetCDF encounter file and does the variable inquiries to activate variable ids
implicit none
! Arguments
class(encounter_io_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
logical, optional, intent(in) :: readonly !! Logical flag indicating that this should be open read only

return
end subroutine encounter_io_open_file

end submodule s_encounter_io
21 changes: 20 additions & 1 deletion src/modules/encounter_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ module encounter_classes
contains
procedure :: dump => encounter_io_dump_storage_list
end type encounter_storage


type, extends(netcdf_parameters) :: encounter_io_parameters
contains
procedure :: initialize => encounter_io_initialize_output !! Initialize a set of parameters used to identify a NetCDF output object
procedure :: open => encounter_io_open_file !! Opens a NetCDF file
end type encounter_io_parameters

type encounter_bounding_box_1D
integer(I4B) :: n !! Number of bodies with extents
integer(I4B), dimension(:), allocatable :: ind !! Sorted minimum/maximum extent indices (value > n indicates an ending index)
Expand Down Expand Up @@ -185,6 +191,19 @@ module subroutine encounter_io_dump_storage_list(self, param)
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine encounter_io_dump_storage_list

module subroutine encounter_io_initialize_output(self, param)
implicit none
class(encounter_io_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset
class(swiftest_parameters), intent(in) :: param
end subroutine encounter_io_initialize_output

module subroutine encounter_io_open_file(self, param, readonly)
implicit none
class(encounter_io_parameters), intent(inout) :: self !! Parameters used to identify a particular NetCDF dataset
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
logical, optional, intent(in) :: readonly !! Logical flag indicating that this should be open read only
end subroutine encounter_io_open_file

module subroutine encounter_setup_aabb(self, n, n_last)
implicit none
class(encounter_bounding_box), intent(inout) :: self !! Swiftest encounter structure
Expand Down
27 changes: 14 additions & 13 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ module symba_classes
use swiftest_classes, only : swiftest_parameters, swiftest_base, swiftest_particle_info, netcdf_parameters
use helio_classes, only : helio_cb, helio_pl, helio_tp, helio_nbody_system
use fraggle_classes, only : fraggle_colliders, fraggle_fragments
use encounter_classes, only : encounter_list
use encounter_classes, only : encounter_list, encounter_storage
implicit none
public

integer(I4B), private, parameter :: NENMAX = 32767
integer(I4B), private, parameter :: NTENC = 3
real(DP), private, parameter :: RHSCALE = 6.5_DP
real(DP), private, parameter :: RSHELL = 0.48075_DP
integer(I4B), private, parameter :: NENMAX = 32767
integer(I4B), private, parameter :: NTENC = 3
real(DP), private, parameter :: RHSCALE = 6.5_DP
real(DP), private, parameter :: RSHELL = 0.48075_DP

type, extends(swiftest_parameters) :: symba_parameters
real(DP) :: GMTINY = -1.0_DP !! Smallest G*mass that is fully gravitating
real(DP) :: min_GMfrag = -1.0_DP !! Smallest G*mass that can be produced in a fragmentation event
integer(I4B), dimension(:), allocatable :: seed !! Random seeds
logical :: lfragmentation = .false. !! Do fragmentation modeling instead of simple merger.
real(DP) :: GMTINY = -1.0_DP !! Smallest G*mass that is fully gravitating
real(DP) :: min_GMfrag = -1.0_DP !! Smallest G*mass that can be produced in a fragmentation event
integer(I4B), dimension(:), allocatable :: seed !! Random seeds
logical :: lfragmentation = .false. !! Do fragmentation modeling instead of simple merger.
contains
procedure :: reader => symba_io_param_reader
procedure :: writer => symba_io_param_writer
Expand All @@ -45,16 +45,16 @@ module symba_classes
integer(I4B), dimension(:), allocatable :: child !! Index of children particles
contains
procedure :: dealloc => symba_util_dealloc_kin !! Deallocates all allocatable arrays
final :: symba_util_final_kin !! Finalizes the SyMBA kinship object - deallocates all allocatables
final :: symba_util_final_kin !! Finalizes the SyMBA kinship object - deallocates all allocatables
end type symba_kinship

!********************************************************************************************************************************
! symba_cb class definitions and method interfaces
!*******************************************************************************************************************************
!> SyMBA central body particle class
type, extends(helio_cb) :: symba_cb
real(DP) :: GM0 = 0.0_DP !! Initial G*mass of the central body
real(DP) :: dGM = 0.0_DP !! Change in G*mass of the central body
real(DP) :: GM0 = 0.0_DP !! Initial G*mass of the central body
real(DP) :: dGM = 0.0_DP !! Change in G*mass of the central body
real(DP) :: R0 = 0.0_DP !! Initial radius of the central body
real(DP) :: dR = 0.0_DP !! Change in the radius of the central body
contains
Expand Down Expand Up @@ -184,6 +184,7 @@ module symba_classes
class(symba_plplenc), allocatable :: plplenc_list !! List of massive body-massive body encounters in a single step
class(symba_plplenc), allocatable :: plplcollision_list !! List of massive body-massive body collisions in a single step
integer(I4B) :: irec !! System recursion level
type(encounter_storage(nframes=:)), allocatable :: encounter_history
contains
procedure :: write_discard => symba_io_write_discard !! Write out information about discarded and merged planets and test particles in SyMBA
procedure :: initialize => symba_setup_initialize_system !! Performs SyMBA-specific initilization steps
Expand Down Expand Up @@ -219,7 +220,7 @@ module subroutine symba_collision_encounter_extract_collisions(self, system, par
module subroutine symba_collision_make_colliders_pl(self,idx)
implicit none
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
integer(I4B), dimension(2), intent(in) :: idx !! Array holding the indices of the two bodies involved in the collision
integer(I4B), dimension(2), intent(in) :: idx !! Array holding the indices of the two bodies involved in the collision
end subroutine symba_collision_make_colliders_pl

module subroutine symba_collision_resolve_fragmentations(self, system, param)
Expand Down

0 comments on commit 61321de

Please sign in to comment.