Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop statements #632

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/cosmic/evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,18 @@ def _evolve_single_system(f):
f["kick_info"],
path_to_tracks,
path_to_he_tracks)
bcm = _evolvebin.binary.bcm[:bcm_index].copy()
bpp = _evolvebin.binary.bpp[:bpp_index].copy()
_evolvebin.binary.bpp[:bpp_index] = np.zeros(bpp.shape)
_evolvebin.binary.bcm[:bcm_index] = np.zeros(bcm.shape)

bpp = np.hstack((bpp, np.ones((bpp.shape[0], 1))*f["bin_num"]))
bcm = np.hstack((bcm, np.ones((bcm.shape[0], 1))*f["bin_num"]))
kick_info = np.hstack((kick_info, np.ones((kick_info.shape[0], 1))*f["bin_num"]))

if bpp_index<0:
raise ValueError("Failed in METISSE_zcnsts")
else:
bcm = _evolvebin.binary.bcm[:bcm_index].copy()
bpp = _evolvebin.binary.bpp[:bpp_index].copy()
_evolvebin.binary.bpp[:bpp_index] = np.zeros(bpp.shape)
_evolvebin.binary.bcm[:bcm_index] = np.zeros(bcm.shape)

bpp = np.hstack((bpp, np.ones((bpp.shape[0], 1))*f["bin_num"]))
bcm = np.hstack((bcm, np.ones((bcm.shape[0], 1))*f["bin_num"]))
kick_info = np.hstack((kick_info, np.ones((kick_info.shape[0], 1))*f["bin_num"]))

return f, bpp, bcm, kick_info, _evolvebin.snvars.natal_kick_array.copy()

Expand Down
17 changes: 15 additions & 2 deletions src/cosmic/src/assign_commons_COSMIC.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ subroutine assign_commons()

real(dp) :: d


if(front_end == COSMIC) then
! use inputs from COSMIC

Expand All @@ -25,11 +24,25 @@ subroutine assign_commons()
end subroutine

subroutine get_bhspin(bhspin,id)
use track_support
use track_support, only: tarr,dp
implicit none
integer, intent(in) :: id
real(dp), intent(out) :: bhspin

bhspin = tarr(id)% pars% bhspin
end subroutine

subroutine check_error(err)
use track_support, only: code_error
integer, intent(out) :: err
err = 0
if(code_error) err = 1
end subroutine


subroutine assign_error()
use track_support, only: code_error
code_error = .true.
end subroutine


19 changes: 17 additions & 2 deletions src/cosmic/src/evolv2.f
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
REAL*8 qc_fixed
LOGICAL switchedCE,disrupt
integer err

Cf2py intent(in) kstar
Cf2py intent(in) mass
Expand Down Expand Up @@ -255,8 +256,6 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
endif

if(using_METISSE) CALL initialize_front_end('cosmic')
if(using_METISSE) call allocate_track(2,mass0)

*
* Save the initial state.
*
Expand Down Expand Up @@ -340,10 +339,20 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
*
* Set the collision matrix.
*
err = 0
if(using_cmc.eq.0)then
* for SSE path_to_tracks and path_to_he_tracks are empty ('')
CALL zcnsts(z,zpars,path_to_tracks,path_to_he_tracks)
if(using_METISSE) then
call check_error(err)
if (err>0) then
bpp_index_out = -1
return
endif
endif
endif
if(using_METISSE) call allocate_track(2,mass0)
kmin = 1
kmax = 2
Expand Down Expand Up @@ -4405,6 +4414,10 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
evolve_type = 10.0
!added by PA for systems that stop evolving halfway
if(iter.ge.loop) evolve_type = 100.0
if (using_METISSE) then
call check_error(err)
if (err>0) evolve_type = 101.0
end if
rrl1 = rad(1)/rol(1)
rrl2 = rad(2)/rol(2)
teff1 = 1000.d0*((1130.d0*lumin(1)/
Expand Down Expand Up @@ -4537,6 +4550,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
* CALL exit(0)
* STOP
endif
bcm(ip+1,1) = -1.0
bpp(jp+1,1) = -1.0
Expand All @@ -4546,6 +4560,7 @@ SUBROUTINE evolv2(kstar,mass,tb,ecc,z,tphysf,
kick_info_out = kick_info
endif
if (using_METISSE) call dealloc_track()
*
END SUBROUTINE evolv2
Expand Down
6 changes: 4 additions & 2 deletions src/cosmic/src/zcnsts.f
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ SUBROUTINE zcnsts(z,zpars,path_to_tracks,path_to_he_tracks)

real*8 z,zpars(20)
CHARACTER*256 path_to_tracks,path_to_he_tracks

integer :: ierr

if (using_METISSE) then
!WRITE(*,*) 'Calling METISSE_zcnsts',using_METISSE
CALL METISSE_zcnsts(z,zpars,path_to_tracks,path_to_he_tracks)
CALL METISSE_zcnsts(z,zpars,path_to_tracks,
& path_to_he_tracks,ierr)
if (ierr/=0) call assign_error()

elseif (using_SSE) then
!WRITE(*,*) 'Calling SSE_zcnsts'
Expand Down
3 changes: 2 additions & 1 deletion src/cosmic/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,8 @@ def convert_kstar_evol_type(bpp):
14: "blue straggler",
15: "supernova of primary",
16: "supernova of secondary",
100: "RLOF interpolation timeout error"
100: "RLOF interpolation timeout error",
101: "METISSE error"
}

evolve_type_string_to_int_dict = {
Expand Down
Loading