Skip to content

Commit baebe41

Browse files
authored
Fix eps_nuc output (#512)
eps_nuc as reported by net/ already contains the eps_nuc_neu (nuclear neutrino) losses. Thus we should not subtract them again. Fixes #493
1 parent 86acc1f commit baebe41

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

star/private/history.f90

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,11 @@ real(dp) function interpolate_burn_bdy_r(k) result(val)
832832
end if
833833
val = s% r(k) / s%r(1)
834834
if (k == 1) return
835-
eps1 = s% eps_nuc(k) - s% eps_nuc_neu_total(k) - s% non_nuc_neu(k)
835+
! Do not subtract s% eps_nuc_neu_total(k) eps_nuc already contains it
836+
eps1 = s% eps_nuc(k) - s% non_nuc_neu(k)
836837
bv1 = sign(1d0, eps1) * log10(max(1d0, abs(eps1)))
837-
eps0 = s% eps_nuc(k - 1) - s% eps_nuc_neu_total(k - 1) - s% non_nuc_neu(k - 1)
838+
! Do not subtract s% eps_nuc_neu_total(k) eps_nuc already contains it
839+
eps0 = s% eps_nuc(k - 1) - s% non_nuc_neu(k - 1)
838840
bv0 = sign(1d0, eps0) * log10(max(1d0, abs(eps0)))
839841
bv = max(bv0, bv1)
840842
eps = pow(10d0, bv)

star/private/profile_getval.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,11 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val)
467467
val = s% eps_grav_ad(k)% val
468468
val = sign(1d0,val)*log10(max(1d0,abs(val)))
469469
case (p_net_nuclear_energy)
470-
val = s% eps_nuc(k) - s% eps_nuc_neu_total(k) - s% non_nuc_neu(k)
470+
! Do not subtract s% eps_nuc_neu_total(k) eps_nuc already contains it
471+
val = s% eps_nuc(k) - s% non_nuc_neu(k)
471472
val = sign(1d0,val)*log10(max(1d0,abs(val)))
472473
case (p_eps_nuc_plus_nuc_neu)
474+
! eps_nuc subtracts eps_nuc_neu so this is just the total eenrgy from nuclear burning without neutrinos
473475
val = s% eps_nuc(k) + s% eps_nuc_neu_total(k)
474476
case (p_eps_nuc_minus_non_nuc_neu)
475477
val = s% eps_nuc(k) - s% non_nuc_neu(k)

star_data/public/star_data_step_work.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@
221221
real(dp), pointer :: eps_nuc(:) ! sum of reaction_eps_nuc for all reactions in net
222222
! thermal ergs per gram per second from nuclear reactions
223223
! (including losses to neutrinos produced in the reactions)
224+
! Thus you should not subtract eps_nuc_neu_total from this
224225
real(dp), pointer :: eps_nuc_categories(:,:) ! (num_categories, nz)
225226
real(dp), pointer :: d_epsnuc_dlnd(:) ! partial wrt density
226227
real(dp), pointer :: d_epsnuc_dlnT(:) ! partial wrt temperature

0 commit comments

Comments
 (0)