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

Fix phantom analysis CE recombination energy vs time not working #617

Merged
merged 2 commits into from
Feb 12, 2025
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
3 changes: 1 addition & 2 deletions src/main/ionization.f90
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ subroutine get_erec_components(logd,T,X,Y,erec)
e(4) = eion(4)*Y*0.25

call get_xion(logd,T,X,Y,xi)

erec = sum(erec(1:4)*xi(1:4))
erec = e*xi

end subroutine get_erec_components

Expand Down
13 changes: 8 additions & 5 deletions src/utils/analysis_common_envelope.f90
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ subroutine do_analysis(dumpfile,num,xyzh,vxyzu,particlemass,npart,time,iunit)
case(27) ! Analyse disk around companion
call analyse_disk(num,npart,particlemass,xyzh,vxyzu)
case(28) ! Recombination energy vs. time
call erec_vs_t(time,npart,particlemass,xyzh)
call erec_vs_t(time,npart,particlemass,xyzh,vxyzu)
case(29) ! Binding energy profile
call create_bindingEnergy_profile(time,num,npart,particlemass,xyzh,vxyzu)
case(30) ! Planet coordinates and mass
Expand Down Expand Up @@ -3682,23 +3682,26 @@ end subroutine analyse_disk
! Recombination energy vs. time
!+
!----------------------------------------------------------------
subroutine erec_vs_t(time,npart,particlemass,xyzh)
use ionization_mod, only:get_erec_components
subroutine erec_vs_t(time,npart,particlemass,xyzh,vxyzu)
use ionization_mod, only:ionization_setup,get_erec_components
integer, intent(in) :: npart
real, intent(in) :: time,particlemass
real, intent(inout) :: xyzh(:,:)
real, intent(inout) :: xyzh(:,:),vxyzu(:,:)
character(len=17) :: filename,columns(4)
integer :: i
real :: ereci(4),erec(4),tempi,rhoi
real :: ereci(4),erec(4),tempi,rhoi,spsoundi,ponrhoi

columns = (/' H2', &
' HI', &
' HeI', &
' HeII'/)

call ionization_setup

erec = 0.
do i = 1,npart
rhoi = rhoh(xyzh(4,i), particlemass)
call equationofstate(ieos,ponrhoi,spsoundi,rhoi,xyzh(1,i),xyzh(2,i),xyzh(3,i),tempi,vxyzu(4,i))
call get_erec_components( log10(rhoi*unit_density), tempi, X_in, 1.-X_in-Z_in, ereci)
erec = erec + ereci
enddo
Expand Down
Loading