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

Commit

Permalink
Fixed issu that caused solar collisions to not conserve angular momen…
Browse files Browse the repository at this point in the history
…tum when restarted. cb%dL was not being computed on restarted runs.
  • Loading branch information
daminton committed Feb 4, 2023
1 parent bae60de commit 4fd9671
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/fraggle/fraggle_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ end subroutine fraggle_generate_disrupt

module subroutine fraggle_generate_hitandrun(self, nbody_system, param, t)
implicit none
class(collision_fraggle), intent(inout) :: self !! Collision system object
class(collision_fraggle), intent(inout) :: self !! Collision system object
class(base_nbody_system), intent(inout) :: nbody_system !! Swiftest nbody system object
class(base_parameters), intent(inout) :: param !! Current run configuration parameters with SyMBA additions
real(DP), intent(in) :: t !! Time of collision
Expand Down
8 changes: 5 additions & 3 deletions src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ module subroutine swiftest_io_netcdf_get_t0_values_system(self, param)
integer(I4B) :: itmax, idmax, tslot
real(DP), dimension(:), allocatable :: vals
real(DP), dimension(1) :: rtemp
real(DP), dimension(NDIM) :: rot0, Ip0
real(DP), dimension(NDIM) :: rot0, Ip0, L
real(DP) :: mass0

associate (nc => self%system_history%nc, cb => self%cb)
Expand Down Expand Up @@ -628,6 +628,8 @@ module subroutine swiftest_io_netcdf_get_t0_values_system(self, param)
rot0(:) = rot0(:) * DEG2RAD
call netcdf_io_check( nf90_get_var(nc%id, nc%Ip_varid, Ip0, start=[1,1,tslot], count=[NDIM,1,1]), "netcdf_io_get_t0_values_system Ip_varid" )
cb%L0(:) = Ip0(3) * mass0 * cb%R0**2 * rot0(:)
L(:) = cb%Ip(3) * cb%mass * cb%radius**2 * cb%rot(:)
cb%dL(:) = L(:) - cb%L0
end if

! Retrieve the current bookkeeping variables
Expand Down Expand Up @@ -2400,8 +2402,8 @@ module subroutine swiftest_io_param_writer(self, unit, iotype, v_list, iostat, i
end if
call io_param_writer_one("FIRSTKICK",param%lfirstkick, unit)

if (param%GMTINY > 0.0_DP) call io_param_writer_one("GMTINY",param%GMTINY, unit)
if (param%min_GMfrag > 0.0_DP) call io_param_writer_one("MIN_GMFRAG",param%min_GMfrag, unit)
if (param%GMTINY >= 0.0_DP) call io_param_writer_one("GMTINY",param%GMTINY, unit)
if (param%min_GMfrag >= 0.0_DP) call io_param_writer_one("MIN_GMFRAG",param%min_GMfrag, unit)
call io_param_writer_one("COLLISION_MODEL",param%collision_model, unit)
if (param%collision_model == "FRAGGLE" ) then
nseeds = size(param%seed)
Expand Down

0 comments on commit 4fd9671

Please sign in to comment.