Go to the documentation of this file.
58 real(
r_kind),
intent(in) :: t9
59 real(
r_kind),
intent(in) :: rho
60 real(
r_kind),
intent(in) :: ye
61 real(
r_kind),
dimension(net_size),
intent(in) :: y
62 real(
r_kind),
intent(out) :: entropy
64 info_entry(
"nuclear_heating_init")
69 'nuclear_heating_init',310004)
79 if (verbose_level .ge. 2)
then
81 write(
engen_unit,
"(A)")
"# 1:iteration 2:time[s] 3:timestep[s] 4:E_gen(tot) [erg/g] 5:E_gen(t) [erg/(g*s)] 6:E_gen(t) [MeV/(baryon*s)]"
89 if (verbose_level .ge. 2)
then
94 write(
debug_heatfrac,
"(A)")
"# 1:time[s] 2:qdot 3: qdot_ffn 4: qdot_nu 5: qdot_bet 6: qdot_ffn/total 7: qdot_nu/total 8: qdot_bet/total"
98 if (verbose_level .ge. 2)
then
100 write(
debug_temp,
"(A)")
"# 1:Timestep[s] 2:NR_cnt 3:T9_new 4:T9_old 5:T9_taken"
113 info_exit(
"nuclear_heating_init")
120 real(
r_kind),
intent(in) :: t9
121 real(
r_kind),
intent(in) :: rho
122 real(
r_kind),
intent(in) :: ye
123 real(
r_kind),
dimension(net_size),
intent(in) :: y
124 real(
r_kind),
intent(out) :: entropy
127 integer :: eos_status
128 real(
r_kind) :: ysum, yasum
133 state%abar= yasum / ysum
136 if (eos_status .ne. 0 )
then
139 "nuclear_heating_init",310003)
157 real(r_kind),
intent(in) :: time
158 real(r_kind) :: denom
164 if (verbose_level .gt. 2)
then
167 if (qdot .eq. 0)
then
174 write(
debug_heatfrac,
'(es16.5,1x,es16.5,1x,es16.5,1x,es16.5,1x,es16.5,1x,f5.2,1x,f5.2,1x,f5.2)') &
205 real(r_kind),
dimension(net_size),
intent(in) :: Y
206 real(r_kind),
intent(in) :: h
209 real(r_kind) :: qdot_tmp
217 qdot_tmp = rrate%cached * rrate%q_value * rrate%nu_frac * &
218 y(rrate%parts(1)) * h
220 qdot_tmp = rrate%cached * rrate%q_value * rrate%nu_frac * &
221 y(rrate%parts(1))*y(rrate%parts(2)) * h
223 qdot_tmp = rrate%cached * rrate%q_value * rrate%nu_frac * &
224 y(rrate%parts(1))*y(rrate%parts(2))*y(rrate%parts(3)) * h
226 qdot_tmp = rrate%cached * rrate%q_value * rrate%nu_frac * &
227 y(rrate%parts(1))*y(rrate%parts(2))*y(rrate%parts(3))*y(rrate%parts(4)) * h
230 if (verbose_level .ge. 2)
then
232 if (rrate%reac_src .eq.
rrs_twr)
then
234 elseif (rrate%reac_src .eq.
rrs_nu)
then
241 if (rrate%reac_src .eq.
rrs_nu)
then
270 integer,
intent(in) :: length
280 write(file_id,
"(A5,2X,A10,2X,A10,2X,A10,2X,A10)")
"Group",
"Isotope",
"Source",
"Nu_frac",
"Q_value"
285 if (rrate_array(i)%is_weak)
then
286 write(file_id,
"(2X,I3,2X,A10,2X,A10,2X,F10.5,2X,F10.5)") rrate_array(i)%group,&
287 net_names(rrate_array(i)%parts(1)),rrate_array(i)%source,&
288 rrate_array(i)%nu_frac,rrate_array(i)%q_value
319 subroutine nuclear_heating_update(nr_count,rho,Ye,pf,Y_p,Y,entropy_p,entropy,T9_p,T9,T9_tr_p,T9_tr,timestep,T9conv)
327 integer,
intent(in) :: nr_count
328 real(
r_kind),
intent(in) :: rho
329 real(
r_kind),
intent(in) :: ye
330 real(
r_kind),
dimension(0:net_size),
intent(out) :: pf
331 real(
r_kind),
dimension(net_size),
intent(in) :: y_p
332 real(
r_kind),
dimension(net_size),
intent(in) :: y
333 real(
r_kind),
intent(in) :: entropy_p
334 real(
r_kind),
intent(out) :: entropy
335 real(
r_kind),
intent(in) :: t9_tr_p
336 real(
r_kind),
intent(in) :: t9_tr
337 real(
r_kind),
intent(in) :: t9_p
338 real(
r_kind),
intent(inout) :: t9
339 real(
r_kind),
intent(in) :: timestep
340 real(
r_kind),
intent(out) :: t9conv
342 real(
r_kind) :: mic2, mui, kbt
345 real(
r_kind) :: twopi_h2c2
346 real(
r_kind) :: entropy_inc
352 real(
r_kind) :: ysum,yasum, temp_next
355 integer :: eos_status
357 info_entry(
"nuclear_heating_update")
379 call nuclear_heating_energy(rho,ye,pf,y_p,y,entropy_p,entropy,t9_p,t9,t9_tr_p,t9_tr,eos_status)
382 'nuclear_heating_update',310004)
388 if (eos_status .ne. 0)
then
396 new_tdiff = t9-t9_old
398 if (nr_count .ge. 3)
then
399 t9 = t9_old + new_tdiff*max((1d0/(float(nr_count)-1d0)),0.1d0)
411 state%abar= yasum / ysum
421 if (verbose_level .ge. 2)
then
422 write(
debug_temp,
"(es16.5,1x,I5,1x,es16.5,1x,es16.5,1x,es16.5)") &
423 timestep, nr_count, t9_calc, t9_old, t9
426 t9conv = dabs(max(t9_calc,t9_old)/min(t9_calc,t9_old) - 1d0)
428 info_exit(
"nuclear_heating_update")
460 subroutine nuclear_heating_energy(rho,Ye,pf,Y_p,Y,entropy_p,entropy,T9_p,T9,T9_tr_p,T9_tr,eos_status)
468 real(
r_kind),
intent(in) :: rho
469 real(
r_kind),
intent(in) :: ye
470 real(
r_kind),
dimension(0:net_size),
intent(out) :: pf
471 real(
r_kind),
dimension(net_size),
intent(in) :: y_p
472 real(
r_kind),
dimension(net_size),
intent(in) :: y
473 real(
r_kind),
intent(in) :: entropy_p
474 real(
r_kind),
intent(out) :: entropy
475 real(
r_kind),
intent(inout) :: t9
476 real(
r_kind),
intent(in) :: t9_p
477 real(
r_kind),
intent(in) :: t9_tr_p
478 real(
r_kind),
intent(in) :: t9_tr
479 integer,
intent(out) :: eos_status
481 real(
r_kind) :: mic2, mui, kbt
484 real(
r_kind) :: twopi_h2c2
485 real(
r_kind) :: entropy_inc
490 real(
r_kind) :: ysum,yasum, temp_next, cv
497 state%abar= yasum / ysum
501 if (eos_status .ne. 0)
then
508 tdot_i = -(
isotope(i)%mass_exc)*(y(i)-y_p(i)) / (state%cv)
526 if (eos_status .ne. 0)
then
530 add_incr = state%t*1d-9 - t9_p
532 add_incr = (t9_tr-t9_tr_p)
539 if (eos_status .ne. 0)
then
543 add_incr = state%t*1d-9 - t9_p
546 t9 = t9_p + (tdot*1e-9) + add_incr
608 real(
r_kind),
intent(in) :: rho
609 real(
r_kind),
intent(in) :: ye
610 real(
r_kind),
dimension(0:net_size),
intent(out) :: pf
611 real(
r_kind),
dimension(net_size),
intent(in) :: y_p
612 real(
r_kind),
dimension(net_size),
intent(in) :: y
613 real(
r_kind),
intent(in) :: entropy_p
614 real(
r_kind),
intent(out) :: entropy
615 real(
r_kind),
intent(inout) :: t9
616 integer,
intent(out) :: eos_status
618 real(
r_kind) :: mic2, mui, kbt
621 real(
r_kind) :: twopi_h2c2
622 real(
r_kind) :: entropy_inc
624 real(
r_kind) :: etaele,etapos
627 real(
r_kind) :: ysum,yasum, temp_next
630 info_entry(
"nuclear_heating_entropy")
639 call chempot(temp_next,rho,ye,etaele,etapos)
640 mue = etaele *
unit%k_mev * temp_next
641 mue = mue +
unit%mass_e
645 state%abar= yasum / ysum
675 kbt = temp_next *
unit%k_mev
678 if (y(i).gt.1d-25)
then
682 mui = -kbt*log( gi*pf(i) / (rho*y(i)*
unit%n_a) * &
683 (twopi_h2c2 *
isotope(i)%mass*
unit%mass_u * kbt)**1.5d0 )
687 engen_i = -(mic2 + mui +
isotope(i)%p_nr*mue)*(y(i)-y_p(i))
698 entropy= entropy_p + entropy_inc
703 if (entropy .lt. 0)
then
705 if (verbose_level .gt. 1)
then
706 write(*,*)
"Warning! Restricting entropy as it was negative: ", entropy
713 if (eos_status .ne. 0 )
then
731 info_exit(
"nuclear_heating_entropy")
760 integer,
intent(in) :: cnt
761 real(
r_kind),
intent(in) :: ctime
763 real(
r_kind) :: engen_per_s
765 info_entry(
"output_nuclear_heating")
777 info_exit(
"output_nuclear_heating")
integer expand_count
1 for the first timestep 2 for following steps, 0 for no expansion yet
real(r_kind), save, public qdot_bet
Total energy radiated away by.
logical, public heating_switch
Variables related to nuclear heating.
real(r_kind) freeze_rate_temp
Tmperature at which rates get frozen (for reacl. rates this should be 1d-2GK)
character *5, dimension(:), allocatable, public net_names
list of isotopes contained in the network
type(reactionrate_type), dimension(:), allocatable, public rrate
array containing all reaction rates used in the network
Takes care of the temperature and entropy updates due to the nuclear energy release.
subroutine, private nuclear_heating_energy(rho, Ye, pf, Y_p, Y, entropy_p, entropy, T9_p, T9, T9_tr_p, T9_tr, eos_status)
Modifies the temperature to account for nuclear heating.
subroutine, public nuclear_heating_init(T9, rho, Ye, Y, entropy)
Nuclear heating initialization routine.
Subroutines to handle parametric evolution of hydrodynamic quantities after the final timestep of the...
real(r_kind) t9h_p
Temperature [GK] storage for heating mode 2.
character(:) function, allocatable, public int_to_str(num)
Converts a given integer to a string.
subroutine timmes_eos(var, vin, d, Ye, state, status)
subroutine, public thermal_neutrinos(abar, Ye, temp, den, timestep, neutrino_loss)
Calculates the neutrino emissivity.
subroutine, public raise_exception(msg, sub, error_code)
Raise a exception with a given error message.
integer top_engen_every
frequency of energy generators toplist
real(r_kind), save, public qdot_nu
Total energy added to the system by neutrino.
real(r_kind), private engen_nuc
Total energy, generated by nuclear reactions.
real(r_kind), private debug_ffn_qd
debug variable for the qdot caused by ffn rates
type(isotope_type), dimension(:), allocatable, public isotope
all nuclides used in the network
Module with helper functions such as rate tabulation, partition functions, and theoretical weak rates...
real(r_kind), save, public qdot_th
Total energy lost by thermal neutrinos.
real(r_kind), private debug_bet_qd
debug variable for the qdot caused by beta decay rates
subroutine, private start_heating(T9, rho, Ye, Y, entropy)
Initialize the entrop and temperature for the heating.
real(r_kind) heating_density
Density at which nuclear heating will be switched on (-1) to always include heating.
integer, private debug_heatfrac
Debug file for the heating fraction.
real(r_kind), private debug_nu_qd
debug variable for the qdot caused by nu rates
integer, private debug_temp
Debug file for temperature integration.
integer h_nu_loss_every
Output neutrino loss and gain in hdf5 format.
The thermal_neutrino_module serves as interface to the neutrino emission routines from the sneut5....
integer, public net_size
total number of isotopes (network size)
type(unit_type), public unit
constants and unit conversion factors
real(r_kind) heating_frac
use this fraction of nuclear-generated energy for heating
subroutine, public nuclear_heating_update(nr_count, rho, Ye, pf, Y_p, Y, entropy_p, entropy, T9_p, T9, T9_tr_p, T9_tr, timestep, T9conv)
Modifies the temperature and entropy to account for nuclear heating.
subroutine, public output_nuclear_heating(cnt, ctime)
Output data related to nuclear heating.
Provide some basic file-handling routines.
character(:) function, allocatable, public num_to_str(num)
Converts a given real to a string with format "(1pE10.2)".
subroutine reset_qdot(time)
Reset the qdot variable.
integer heating_mode
Mode for heating: 0 - no heating, 1 - heating using an entropy equation, 2 - heating from the energy ...
real(r_kind) stepsize
Stepsize.
integer, private engen_unit
Engen output file.
real(r_kind) engen
total energy generation [MeV/s]
subroutine chempot(temp, den, ye, etaele, etapos)
Given a temperature temp [K], density den [g/cm**3], and a composition characterized by y_e,...
subroutine calculate_qdot(rrate, Y, h)
logical use_thermal_nu_loss
Whether to include thermal neutrino loss or not.
integer nu_loss_every
Output neutrino loss and gain.
subroutine output_debug_nufrac(rrate_array, length)
Output the heating fractions to a debug file.
integer function, public open_outfile(file_name)
Shorthand for opening a new file for writing (output file)
subroutine, public inter_partf(temp, interpol)
Calculates partition function.
Contains types and objects shared between multiple modules.
integer, public nreac
total number of reactions
subroutine, private nuclear_heating_entropy(rho, Ye, pf, Y_p, Y, entropy_p, entropy, T9, eos_status)
Modifies the temperature and ent_p to account for nuclear heating.
Simulation variables for a single zone model.
Contains all runtime parameters as well as phys and math constants.