From 0e4b818341bea48a273502a84e6f8e0baf593f4e Mon Sep 17 00:00:00 2001 From: Chunliang Mu <86601204+chunliangmu@users.noreply.github.com> Date: Tue, 11 Feb 2025 18:23:54 +1100 Subject: [PATCH 1/2] Fix analysis CE recombination energy vs time not working --- src/main/ionization.f90 | 3 ++- src/utils/analysis_common_envelope.f90 | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/ionization.f90 b/src/main/ionization.f90 index 5e22c1b14..6c38f5b6f 100644 --- a/src/main/ionization.f90 +++ b/src/main/ionization.f90 @@ -329,7 +329,8 @@ subroutine get_erec_components(logd,T,X,Y,erec) call get_xion(logd,T,X,Y,xi) - erec = sum(erec(1:4)*xi(1:4)) + ! [clmu] attempted fix + erec = e*xi end subroutine get_erec_components diff --git a/src/utils/analysis_common_envelope.f90 b/src/utils/analysis_common_envelope.f90 index 349d78b79..96dab28d2 100644 --- a/src/utils/analysis_common_envelope.f90 +++ b/src/utils/analysis_common_envelope.f90 @@ -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 @@ -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 From ca43776bf404e72c0efdefeee4638313816c0a0f Mon Sep 17 00:00:00 2001 From: Mike Lau Date: Wed, 12 Feb 2025 09:52:00 +0100 Subject: [PATCH 2/2] Update ionization.f90 --- src/main/ionization.f90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/ionization.f90 b/src/main/ionization.f90 index 6c38f5b6f..24e924fbe 100644 --- a/src/main/ionization.f90 +++ b/src/main/ionization.f90 @@ -328,8 +328,6 @@ subroutine get_erec_components(logd,T,X,Y,erec) e(4) = eion(4)*Y*0.25 call get_xion(logd,T,X,Y,xi) - - ! [clmu] attempted fix erec = e*xi end subroutine get_erec_components