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

Commit

Permalink
Fixed uninitizalized L_orb_mag in set_fragment_tangenttial_velocities
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jun 4, 2021
1 parent 9215863 commit 8169b5e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/symba/symba_frag_pos.f90
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ subroutine set_fragment_tangential_velocities(lerr)
! Convert a fraction of the pre-impact angular momentum into fragment spin angular momentum
L_frag_spin(:) = f_spin * L_frag_tot(:)
L_frag_orb(:) = L_frag_tot(:) - L_frag_spin(:)

L_orb_mag = norm2(L_frag_orb(:))
! Divide up the pre-impact spin angular momentum equally amongst the fragments and calculate the spin kinetic energy
do i = 1, nfrag
rot_frag(:,i) = L_frag_spin(:) / (nfrag * m_frag(i) * Ip_frag(3, i) * rad_frag(i)**2)
Expand Down Expand Up @@ -588,8 +588,7 @@ function tangential_objective_function(v_t_mag_input, lerr) result(fval)
integer(I4B) :: i
real(DP), dimension(:,:), allocatable :: v_shift
real(DP), dimension(NDIM) :: L_frag, L
real(DP) :: dLmag
!real(DP), dimension(:), allocatable :: v_t_mag_output
real(DP) :: dL

lerr = .false.

Expand All @@ -605,10 +604,10 @@ function tangential_objective_function(v_t_mag_input, lerr) result(fval)
call util_crossproduct(x_frag(:, i), v_shift(:, i), L(:))
L_frag(:) = L_frag(:) + L(:) * m_frag(i)
end do
dLmag = norm2(L_frag(:) - L_frag_orb(:)) / norm2(L_frag_orb(:))
dL = norm2(L_frag(:) - L_frag_orb(:)) / norm2(L_frag_orb(:))
ke_frag = 0.5_DP * ke_frag
ke_frag_spin = 0.5_DP * ke_frag_spin
fval = (ke_frag + ke_frag_spin) / ke_frag_budget * dLmag
fval = (ke_frag + ke_frag_spin) / ke_frag_budget * dL
lerr = .false.
return
end function tangential_objective_function
Expand Down

0 comments on commit 8169b5e

Please sign in to comment.