64 integer :: ai, ni, zi, snfile, fstat
65 character :: nl, buf(30)
67 character*10,
dimension(track_nuclei_nr) :: tmp_nucleinames
68 character*1500 :: head_toplist
69 character*5 :: help_char
70 info_entry(
"analysis_init")
87 '# 1:iteration 2:time[s], 3:T[GK], 4:rho[g/cm3], 5:Ye '//nl &
88 ,
'# 6:R[km], 7:Y_n, 8:Y_p, 9:Y_alpha, 10:Y_lights '//nl &
89 ,
'# 11:Y_heavies 12:<Z> 13:<A> 14:entropy [kB/baryon] (15:Sn [MeV])'
96 allocate(
sn(net_size))
100 read(snfile, *, iostat=fstat) zi, ni, ai, val
113 write(
tsfile,
'((A1,(A22,3x),*(A23,3x)))') &
114 "#",
"time[s]",
"Temperature [GK]",
"tau_ga [s]",
"tau_ag [s]",
"tau_ng [s]",
"tau_gn [s]", &
115 "tau_pg [s]",
"tau_gp [s]",
"tau_np [s]",
"tau_pn [s]", &
116 "tau_an [s]",
"tau_na [s]",
"tau_ap [s]",
"tau_pa [s]",
"tau_beta [s]",
"tau_alpha [s]", &
117 "tau_nfiss [s]",
"tau_sfiss [s]",
"tau_bfiss [s]"
128 write(
track_unit,
'((A,20X,*(A,18X)))')
"# time[s]",tmp_nucleinames(:)
136 write (
toplist_unit,
"('#',31X,A,434X,A,413X,'|',5X,A,185X,A)")
"Top nuclear energy producers for each reaction given in erg/g/s", &
137 "Top nuclear energy consumers for each reaction given in erg/g/s", &
138 "Top nuclear energy producers for each isotope given in erg/g/s", &
139 "Top nuclear energy consumers for each isotope given in erg/g/s"
142 head_toplist =
"# Time[s] Etot[erg/g/s] Reaction_1"
144 head_toplist = trim(adjustl(head_toplist))//
" Reaction_"//trim(adjustl(
int_to_str(i)))
146 head_toplist = trim(adjustl(head_toplist))//
" Ereac_1"
148 head_toplist = trim(adjustl(head_toplist))//
" Ereac_"//trim(adjustl(
int_to_str(i)))
150 head_toplist = trim(adjustl(head_toplist))//
" Reaction_1"
152 head_toplist = trim(adjustl(head_toplist))//
" Reaction_"//trim(adjustl(
int_to_str(i)))
154 head_toplist = trim(adjustl(head_toplist))//
" Ereac_1"
156 head_toplist = trim(adjustl(head_toplist))//
" Ereac_"//trim(adjustl(
int_to_str(i)))
158 head_toplist = trim(adjustl(head_toplist))//
" | Iso1"
160 help_char =
"Iso"//trim(adjustl(
int_to_str(i)))
161 head_toplist = trim(adjustl(head_toplist))//
" "//adjustr(help_char)
163 head_toplist = trim(adjustl(head_toplist))//
" Eiso_1"
165 head_toplist = trim(adjustl(head_toplist))//
" Eiso_"//trim(adjustl(
int_to_str(i)))
167 head_toplist = trim(adjustl(head_toplist))//
" Iso1"
169 help_char =
"Iso"//trim(adjustl(
int_to_str(i)))
170 head_toplist = trim(adjustl(head_toplist))//
" "//adjustr(help_char)
172 head_toplist = trim(adjustl(head_toplist))//
" Eiso_1"
174 head_toplist = trim(adjustl(head_toplist))//
" Eiso_"//trim(adjustl(
int_to_str(i)))
184 '# Newton-Raphson diagnostic output'//nl &
185 ,
'# 1 : global iteration count (cnt)'//nl &
186 ,
'# 2 : global time [s]'//nl &
187 ,
'# 3 : temperature T9 [GK]'//nl &
188 ,
'# 4 : adapt stepsize loop counter (k)'//nl &
189 ,
'# 5 : NR loop counter (nr_count)'//nl &
190 ,
'# 6 : global timestep [s]'//nl &
191 ,
'# 7 : mass conservation error'//nl &
192 ,
'# 8 : maximal abundance change (eps)'//nl &
193 ,
'# 9 : most rapidly evolving isotope (epsl)'//nl &
194 ,
'# 10: abundance of the isotope epsl, y(epsl)'
201 write(
nuc_heat_file,
'((A,5X))')
"# Generated Energy for each nuclear reaction type given in erg/g/s"
203 "# time[s]",
"Engen(Total)",
"S_src",
"Engen(weak)",
"Engen(n,g)",&
204 "Engen(p,g)",
"Engen(a,g)",
"Engen(n,p)",
"Engen(n,a)", &
205 "Engen(p,a)",
"Engen(fiss)"
212 write(
nu_loss_gain_unit,
'(A)')
"# File containing the neutrino loss/gain for the nuclear heating."
213 write(
nu_loss_gain_unit,
'(A)')
"# Negative values mean that energy is added to the system."
216 "#",
"time[s]",
"T[GK]",
"rho[g/cm3]",
"R[km]",
"nu_total",
"nu_beta",&
217 "nu_nuheat",
"nu_thermal"
221 info_exit(
"analysis_init")
234 real(
r_kind),
intent(in) :: ctime
235 real(
r_kind),
intent(in) :: t9
236 real(
r_kind),
intent(in) :: rho_b
237 real(
r_kind),
intent(in) :: entropy
238 real(
r_kind),
intent(in) :: rkm
239 real(
r_kind),
dimension(net_size),
intent(in) :: y
240 real(
r_kind),
dimension(0:net_size),
intent(inout) :: pf
242 info_entry(
'output_initial_step')
244 info_exit(
'output_initial_step')
265 integer,
intent(in) :: cnt
266 real(
r_kind),
intent(in) :: ctime
267 real(
r_kind),
intent(in) :: t9
268 real(
r_kind),
intent(in) :: rho_b
269 real(
r_kind),
intent(in) :: entropy
270 real(
r_kind),
intent(in) :: rkm
271 real(
r_kind),
dimension(net_size),
intent(in) :: y
272 real(
r_kind),
dimension(0:net_size),
intent(inout) :: pf
274 info_entry(
'output_final_step')
295 print
'("---------------")'
297 print
'("============================")'
300 print
'(A)',
"End of trajectory file reached."
302 print
'(A)',
"Final time reached."
304 print
'(A)',
"Final temperature reached."
306 print
'(A)',
"Final density reached."
308 print
'(A)',
"Freeze-out reached."
311 info_exit(
'output_final_step')
344 integer,
intent(in) :: cnt
345 real(
r_kind),
intent(in) :: ctime
346 real(
r_kind),
intent(in) :: t9
347 real(
r_kind),
intent(in) :: rho_b
348 real(
r_kind),
intent(in) :: entropy
349 real(
r_kind),
intent(in) :: rkm
350 real(
r_kind),
dimension(net_size),
intent(in) :: y
351 real(
r_kind),
dimension(0:net_size),
intent(inout) :: pf
353 real(
r_kind) :: ysum,yasum,abar,ye
355 info_entry(
"output_iteration")
361 print
'(A)',
"#-- 1:it 2:time[s] 3:T9[GK] 4:rho[g/cm3] &
362 5:entropy[kB/baryon]"
365 print
'(I8,X,ES14.7,X,F10.7,X,ES14.7,X,F12.7)', &
366 cnt,ctime,t9,rho_b,entropy
370 if (verbose_level.ge.2)
then
442 ysum= sum(y(1:net_size))
443 yasum= sum(y(1:net_size)*
isotope(1:net_size)%mass)
444 ye = sum(
isotope(1:net_size)%p_nr*y(1:net_size))
484 ysum= sum(y(1:net_size))
485 yasum= sum(y(1:net_size)*
isotope(1:net_size)%mass)
486 ye = sum(
isotope(1:net_size)%p_nr*y(1:net_size))
511 if (timescales_every .gt. 0)
then
512 if ((mod(cnt,timescales_every).eq.0) .and. (
evolution_mode .ne. em_nse))
then
542 info_exit(
"output_iteration")
566 real(
r_kind),
intent(in) :: ctime
567 real(
r_kind),
dimension(net_size),
intent(in) :: y
568 real(
r_kind),
dimension(track_nuclei_nr) :: tmp_y
571 info_entry(
"output_track_nuclei")
575 if (tmp_y(i) .lt. 1d-99) tmp_y(i) = 0.
578 write(
track_unit,
'(*(es23.16,5x))') ctime,tmp_y(:)
579 info_exit(
"output_track_nuclei")
608 real(
r_kind),
intent(in) :: ctime
609 real(
r_kind),
intent(in) :: temp
610 real(
r_kind),
intent(in) :: rho
611 real(
r_kind),
intent(in) :: rkm
646 integer,
intent(in) :: cnt
647 real(
r_kind),
intent(in) :: ctime
648 real(
r_kind),
intent(in) :: t9
649 real(
r_kind),
intent(in) :: rho_b
650 real(
r_kind),
intent(in) :: entropy
651 real(
r_kind),
intent(in) :: rkm
652 real(
r_kind),
dimension(net_size),
intent(in) :: y
654 real(
r_kind) :: ye,yneu,ypro,yhe4,ylight,yheavies,ysum,yasum,yzsum,abar,zbar
662 ye = sum(
isotope(1:net_size)%p_nr*y(1:net_size))
663 ylight= max(1.0d-99,sum(y(ipro+1:ihe4-1)))
665 if (ihe4.ge.1) yheavies= max(1.0d-99,sum(y(ihe4+1:net_size)))
667 ysum = sum(y(1:net_size))
668 yasum = sum(y(1:net_size)*
isotope(1:net_size)%mass)
669 yzsum = sum(y(1:net_size)*
isotope(1:net_size)%p_nr)
675 if (ineu.ge.1) yneu= max(1.0d-99,y(ineu))
678 if (ipro.ge.1) ypro= max(1.0d-99,y(ipro))
681 if (ihe4.ge.1) yhe4= max(1.0d-99,y(ihe4))
684 write (
mainout_unit,
'(i8,X,100(es23.16,2X))') cnt,ctime,t9,rho_b,ye,rkm, &
685 yneu,ypro,yhe4,ylight,yheavies,zbar,abar,entropy,
sn_ave
687 write (
mainout_unit,
'(i8,X,100(es23.16,2X))') cnt,ctime,t9,rho_b,ye,rkm, &
688 yneu,ypro,yhe4,ylight,yheavies,zbar,abar,entropy
714 real(
r_kind),
intent(in) :: ctime
715 real(
r_kind),
intent(in) :: t9
716 real(
r_kind),
intent(in) :: rho_b
717 real(
r_kind),
dimension(net_size),
intent(in):: y
735 real(r_kind),
intent(in) :: ctime
736 real(r_kind),
intent(in) :: T9
737 real(r_kind),
intent(in) :: rho_b
738 real(r_kind),
dimension(net_size),
intent(in):: Y
773 integer,
intent(in) :: cnt
774 integer,
intent(in) :: k
775 integer,
intent(in) :: nr_c
776 real(
r_kind),
intent(in) :: ctime
777 real(
r_kind),
intent(in) :: t9
778 real(
r_kind),
intent(in) :: stepsize
779 real(
r_kind),
intent(in) :: mtot
780 real(
r_kind),
dimension(net_size) :: y_p,y
786 info_entry(
"output_nr_diagnostic")
799 if(y_p(i).lt.1.d-10) cycle
800 if(dabs(y_p(i)-y(i)).eq.0.d0) cycle
801 epst = dabs(y(i)/y_p(i)-1.d0)
802 if (epst.gt.eps)
then
810 '(i7,2(1x,es19.11),2(1x,i4),3(1x,es19.11),a5,x,es19.11)') &
811 cnt,ctime,t9,k,nr_c,stepsize,dabs(mtot-1d0),eps,
isotope(epsl)%name, &
815 info_exit(
"output_nr_diagnostic")
837 integer,
intent(in) :: cnt
838 real(
r_kind),
intent(in) :: ctime
842 info_entry(
'output_final_stats')
852 print
'(A,ES19.12)',
'Final time: ', ctime
853 print
'(A,I10)',
'Total number of iterations: ', cnt
854 print
'(A,ES12.5)',
'Elapsed time [s]: ', simtime
856 info_exit(
'output_final_stats')
878 real(
r_kind),
intent(in) :: t,t9,rho_b
879 real(
r_kind),
dimension(net_size),
intent(in) :: y
880 character (len=21) :: snapfile
881 integer :: snapunit, z
884 info_entry(
"printsnap")
886 write(snapfile,
'("snaps/snapsh_",i4.4,".dat")')
snapcnt
889 write(snapunit,
'(3a8)')
'time',
'temp',
'dens'
890 write(snapunit,
'(3es23.14)')t,t9,rho_b
891 write(snapunit,
'(4(a8))')
'nin',
'zin',
'y',
'x'
894 write(snapunit,
'(2(i3,2x),2(es23.14))') &
903 info_exit(
"printsnap")
918 real(
r_kind),
dimension(net_size),
intent(in) :: y
920 real(
r_kind) :: ysum,yasum,yzsum,abar_ions,zbar_ions
923 info_entry(
"calc_nseparation_energy")
927 do i=max(1,ihe4),net_size
928 abar_ions = abar_ions +
isotope(i)%mass * y(i)
929 zbar_ions = zbar_ions +
isotope(i)%p_nr * y(i)
932 ysum = sum(y(max(1,ihe4):net_size))
933 abar_ions = abar_ions / ysum
934 zbar_ions = zbar_ions / ysum
937 do i=max(1,ihe4),net_size
950 info_exit(
"calc_nseparation_energy")
985 logical,
intent(in) :: hdf5_mode
987 logical,
intent(in) :: write_toplist
993 integer :: help_parts
996 real(
r_kind) :: engen_q_value
997 real(
r_kind) :: engen_q_weak
998 real(
r_kind) :: engen_q_ng,engen_q_gn
999 real(
r_kind) :: engen_q_pg,engen_q_gp
1000 real(
r_kind) :: engen_q_ga,engen_q_ag
1001 real(
r_kind) :: engen_q_pa,engen_q_ap
1002 real(
r_kind) :: engen_q_pn,engen_q_np
1003 real(
r_kind) :: engen_q_na,engen_q_an
1004 real(
r_kind) :: engen_fiss
1005 real(
r_kind) :: engen_tot_ncap, engen_tot_pcap, engen_tot_acap, &
1006 engen_tot_npcap,engen_tot_nacap, engen_tot_pacap
1007 real(
r_kind) :: engen_tot_exc
1008 real(
r_kind) :: entropy_src_term
1009 real(
r_kind) :: mic2,gi,twopi_h2c2,mui
1011 real(
r_kind),
dimension(0:net_size)::pf
1012 real(
r_kind) :: etaele,etapos
1015 real(
r_kind) :: tmp_energy
1016 real(
r_kind),
dimension(net_size) ::det_bet_engen
1017 real(
r_kind),
dimension(net_size) ::det_ag_engen
1018 real(
r_kind),
dimension(net_size) ::det_pg_engen
1019 real(
r_kind),
dimension(net_size) ::det_ng_engen
1020 real(
r_kind),
dimension(net_size) ::det_pn_engen
1021 real(
r_kind),
dimension(net_size) ::det_ap_engen
1022 real(
r_kind),
dimension(net_size) ::det_an_engen
1023 real(
r_kind),
dimension(net_size) ::det_other_engen
1024 real(
r_kind),
dimension(net_size) ::det_fiss_engen
1025 real(
r_kind),
dimension(net_size) ::det_tot_engen
1027 integer,
dimension(nreac) ::toplist_idx
1028 real(
r_kind),
dimension(nreac) ::toplist_energy
1029 logical,
dimension(nreac) ::toplist_mask
1030 character*30 ::reac_dummy
1031 character*30,
dimension(toplist_amount)::tplist_str
1032 real(
r_kind),
dimension(toplist_amount)::tplist
1033 character*30,
dimension(toplist_amount)::btlist_str
1034 real(
r_kind),
dimension(toplist_amount)::btlist
1035 real(
r_kind),
dimension(net_size) ::toplist_energy_iso
1036 integer,
dimension(net_size) ::toplist_idx_iso
1037 character*5,
dimension(toplist_amount) ::tplist_str_iso
1038 real(
r_kind),
dimension(toplist_amount)::tplist_iso
1039 character*5,
dimension(toplist_amount) ::btlist_str_iso
1040 real(
r_kind),
dimension(toplist_amount)::btlist_iso
1042 info_entry(
"calc_nuclear_heating")
1063 det_bet_engen(:) = 0.0
1064 det_ag_engen(:) = 0.0
1065 det_pg_engen(:) = 0.0
1066 det_ng_engen(:) = 0.0
1067 det_pn_engen(:) = 0.0
1068 det_ap_engen(:) = 0.0
1069 det_an_engen(:) = 0.0
1070 det_other_engen(:) = 0.0
1071 det_fiss_engen(:) = 0.0
1072 det_tot_engen(:) = 0.0
1077 if (write_toplist)
then
1078 toplist_energy(:) = 0d0
1079 toplist_energy_iso(:) = 0d0
1080 toplist_mask(:) = .false.
1091 if ((
evolution_mode .eq. em_nse) .and. (.not. rr_tmp%is_weak)) cycle
1094 if (rat .eq. 0) cycle
1097 select case (rr_tmp%group)
1100 tmp_energy = rat*
y(rr_tmp%parts(1)) * rr_tmp%q_value
1102 engen_q_value = engen_q_value + tmp_energy
1106 if (rr_tmp%is_weak)
then
1107 engen_q_weak = engen_q_weak + tmp_energy
1109 det_bet_engen(rr_tmp%parts(1)) = det_bet_engen(rr_tmp%parts(1))+tmp_energy
1113 if(rr_tmp%reac_type.eq.
rrt_gn)
then
1114 engen_q_gn = engen_q_gn + tmp_energy
1117 if (rr_tmp%parts(2) .eq.
ineu)
then
1118 help_parts = rr_tmp%parts(3)
1120 help_parts = rr_tmp%parts(2)
1122 det_ng_engen(help_parts) = det_ng_engen(help_parts)+tmp_energy
1127 if(rr_tmp%reac_type.eq.
rrt_gp)
then
1128 engen_q_gp = engen_q_gp + tmp_energy
1131 if (rr_tmp%parts(2) .eq.
ipro)
then
1132 help_parts = rr_tmp%parts(3)
1134 help_parts = rr_tmp%parts(2)
1136 det_pg_engen(help_parts) = det_pg_engen(help_parts)+tmp_energy
1140 if(rr_tmp%reac_type.eq.
rrt_ga)
then
1141 engen_q_ga = engen_q_ga + tmp_energy
1144 if (rr_tmp%parts(2) .eq.
ihe4)
then
1145 help_parts = rr_tmp%parts(3)
1147 help_parts = rr_tmp%parts(2)
1149 det_ag_engen(help_parts) = det_ag_engen(help_parts)+tmp_energy
1154 if(rr_tmp%reac_type.eq.
rrt_o)
then
1156 det_other_engen(rr_tmp%parts(1)) = det_other_engen(rr_tmp%parts(1))+tmp_energy
1162 tmp_energy = rat*
y(rr_tmp%parts(1)) *
y(rr_tmp%parts(2)) &
1165 engen_q_value = engen_q_value + tmp_energy
1169 if(rr_tmp%reac_type.eq.
rrt_ng)
then
1170 engen_q_ng = engen_q_ng + tmp_energy
1173 if (rr_tmp%parts(2) .eq.
ineu)
then
1174 help_parts = rr_tmp%parts(1)
1176 help_parts = rr_tmp%parts(2)
1178 det_ng_engen(help_parts) = det_ng_engen(help_parts)+tmp_energy
1182 if(rr_tmp%reac_type.eq.
rrt_pg)
then
1183 engen_q_pg = engen_q_pg + tmp_energy
1186 if (rr_tmp%parts(2) .eq.
ipro)
then
1187 help_parts = rr_tmp%parts(1)
1189 help_parts = rr_tmp%parts(2)
1191 det_pg_engen(help_parts) = det_pg_engen(help_parts)+tmp_energy
1195 if(rr_tmp%reac_type.eq.
rrt_ag)
then
1196 engen_q_ag = engen_q_ag + tmp_energy
1199 if (rr_tmp%parts(2) .eq.
ihe4)
then
1200 help_parts = rr_tmp%parts(1)
1202 help_parts = rr_tmp%parts(2)
1204 det_ag_engen(help_parts) = det_ag_engen(help_parts)+tmp_energy
1208 if(rr_tmp%reac_type.eq.
rrt_pa)
then
1209 engen_q_pa = engen_q_pa + tmp_energy
1212 if (rr_tmp%parts(3) .eq.
ihe4)
then
1213 help_parts = rr_tmp%parts(4)
1215 help_parts = rr_tmp%parts(3)
1217 det_ap_engen(help_parts) = det_ap_engen(help_parts)+tmp_energy
1221 if(rr_tmp%reac_type.eq.
rrt_ap)
then
1222 engen_q_ap = engen_q_ap + tmp_energy
1225 if (rr_tmp%parts(2) .eq.
ihe4)
then
1226 help_parts = rr_tmp%parts(1)
1228 help_parts = rr_tmp%parts(2)
1230 det_ap_engen(help_parts) = det_ap_engen(help_parts)+tmp_energy
1234 if(rr_tmp%reac_type.eq.
rrt_np)
then
1235 engen_q_np = engen_q_np + tmp_energy
1238 if (rr_tmp%parts(3) .eq.
ipro)
then
1239 help_parts = rr_tmp%parts(4)
1241 help_parts = rr_tmp%parts(3)
1243 det_pn_engen(help_parts) = det_pn_engen(help_parts)+tmp_energy
1247 if(rr_tmp%reac_type.eq.
rrt_pn)
then
1248 engen_q_pn = engen_q_pn + tmp_energy
1251 if (rr_tmp%parts(1) .eq.
ipro)
then
1252 help_parts = rr_tmp%parts(2)
1254 help_parts = rr_tmp%parts(1)
1256 det_pn_engen(help_parts) = det_pn_engen(help_parts)+tmp_energy
1260 if(rr_tmp%reac_type.eq.
rrt_an)
then
1261 engen_q_an = engen_q_an + tmp_energy
1264 if (rr_tmp%parts(1) .eq.
ihe4)
then
1265 help_parts = rr_tmp%parts(2)
1267 help_parts = rr_tmp%parts(1)
1269 det_an_engen(help_parts) = det_an_engen(help_parts)+tmp_energy
1273 if(rr_tmp%reac_type.eq.
rrt_na)
then
1274 engen_q_na = engen_q_na + tmp_energy
1277 if (rr_tmp%parts(3) .eq.
ihe4)
then
1278 help_parts = rr_tmp%parts(4)
1280 help_parts = rr_tmp%parts(3)
1282 det_an_engen(help_parts) = det_an_engen(help_parts)+tmp_energy
1286 if(rr_tmp%reac_type.eq.
rrt_o)
then
1288 det_other_engen(rr_tmp%parts(1)) = det_other_engen(rr_tmp%parts(1))+tmp_energy
1294 tmp_energy = rat*
y(rr_tmp%parts(1)) *
y(rr_tmp%parts(2)) &
1295 *
y(rr_tmp%parts(3)) * rr_tmp%q_value
1298 engen_q_value = engen_q_value + tmp_energy
1300 if(rr_tmp%reac_type.eq.
rrt_o)
then
1302 det_other_engen(rr_tmp%parts(1)) = det_other_engen(rr_tmp%parts(1))+tmp_energy
1308 tmp_energy = rat*
y(rr_tmp%parts(1)) *
y(rr_tmp%parts(2)) &
1309 *
y(rr_tmp%parts(3)) *
y(rr_tmp%parts(4))* rr_tmp%q_value
1311 engen_q_value = engen_q_value + tmp_energy
1313 if(rr_tmp%reac_type.eq.
rrt_o)
then
1315 det_other_engen(rr_tmp%parts(1)) = det_other_engen(rr_tmp%parts(1))+tmp_energy
1324 if (write_toplist)
then
1327 if (tmp_energy .ne. 0d0)
then
1328 toplist_energy(i) = tmp_energy
1329 toplist_mask(i) = .true.
1337 fission:
do i=1,
nfiss
1340 if (rat .eq. 0) cycle
1341 if ((fr_tmp%mode.eq.2).or.(fr_tmp%mode.eq.3))
then
1342 engen_q_value = engen_q_value + rat*
y(
fissrate(i)%fissparts(1)) *
fissrate(i)%averageQ
1343 engen_fiss = engen_fiss + rat*
y(
fissrate(i)%fissparts(1)) *
fissrate(i)%averageQ
1345 else if (fr_tmp%mode.eq.1)
then
1352 det_fiss_engen(
fissrate(i)%fissparts(1)) = det_fiss_engen(
fissrate(i)%fissparts(1))+tmp_energy
1362 if (
y(i).gt.1d-25)
then
1363 tmp_energy = -(isotope(i)%mass_exc)*(
y(i)-
y_p(i))
1364 engen_tot_exc = engen_tot_exc + tmp_energy
1366 if (write_toplist)
then
1367 toplist_energy_iso(i) = tmp_energy
1371 det_tot_engen(i) = -(isotope(i)%mass_exc)*(
y(i)-
y_p(i))
1377 entropy_src_term = 0.d0
1381 if (
rhob .gt. 1d-10)
then
1384 mue = etaele *
unit%k_mev *
t9*1d9
1388 mue = mue +
unit%mass_e
1390 kbt =
t9*1d9 *
unit%k_mev
1392 if (
y(i).gt.1d-25)
then
1393 mic2 = isotope(i)%mass*
unit%mass_u - isotope(i)%p_nr *
unit%mass_e + isotope(i)%mass_exc
1394 gi = 2d0*isotope(i)%spin + 1d0
1396 mui = -kbt*log( gi*pf(i) / (
rhob*
y(i)*
unit%n_a) * &
1397 (twopi_h2c2 * mic2 * kbt)**1.5d0 )
1399 entropy_src_term = entropy_src_term -(mic2 + mui + isotope(i)%p_nr*mue)*(
y(i)-
y_p(i))
1405 engen_q_value = engen_q_value /
unit%hix
1406 engen_q_weak = engen_q_weak /
unit%hix
1407 engen_q_ng = engen_q_ng /
unit%hix
1408 engen_q_gn = engen_q_gn /
unit%hix
1409 engen_q_pg = engen_q_pg /
unit%hix
1410 engen_q_gp = engen_q_gp /
unit%hix
1411 engen_q_ga = engen_q_ga /
unit%hix
1412 engen_q_ag = engen_q_ag /
unit%hix
1413 engen_q_np = engen_q_np /
unit%hix
1414 engen_q_pn = engen_q_pn /
unit%hix
1415 engen_q_na = engen_q_na /
unit%hix
1416 engen_q_an = engen_q_an /
unit%hix
1417 engen_q_pa = engen_q_pa /
unit%hix
1418 engen_q_ap = engen_q_ap /
unit%hix
1419 engen_fiss = engen_fiss /
unit%hix
1423 det_bet_engen = det_bet_engen /
unit%hix
1424 det_ag_engen = det_ag_engen /
unit%hix
1425 det_pg_engen = det_pg_engen /
unit%hix
1426 det_ng_engen = det_ng_engen /
unit%hix
1427 det_pn_engen = det_pn_engen /
unit%hix
1428 det_ap_engen = det_ap_engen /
unit%hix
1429 det_an_engen = det_an_engen /
unit%hix
1430 det_other_engen = det_other_engen /
unit%hix
1431 det_fiss_engen = det_fiss_engen /
unit%hix
1435 engen_tot_ncap = engen_q_ng + engen_q_gn
1436 engen_tot_pcap = engen_q_pg + engen_q_gp
1437 engen_tot_acap = engen_q_ag + engen_q_ga
1438 engen_tot_npcap= engen_q_np + engen_q_pn
1439 engen_tot_nacap= engen_q_na + engen_q_an
1440 engen_tot_pacap= engen_q_pa + engen_q_ap
1442 if (write_toplist)
then
1445 toplist_energy(:) = toplist_energy(:) /
unit%hix
1446 toplist_energy_iso(:) = toplist_energy_iso(:) /
stepsize/
unit%hix
1451 if (toplist_energy(1) .lt. toplist_energy(2))
then
1452 call raise_exception(
"There was a bug in the toplist. Energy is not sorted.", &
1453 "calc_nuclear_heating")
1458 tplist_str(:) =
"---------"
1462 if (j .gt.
nreac)
exit
1464 if (toplist_mask(toplist_idx(j)))
then
1467 tplist(i+1) = toplist_energy(j)
1476 if (tplist(1) .lt. tplist(2))
then
1477 call raise_exception(
"There was a bug in the toplist. Energy is not sorted.", &
1478 "calc_nuclear_heating")
1483 btlist_str(:) =
"---------"
1487 if (j .gt.
nreac)
exit
1489 if (toplist_mask(toplist_idx(
nreac+1-j)))
then
1492 btlist(i+1) = toplist_energy(
nreac+1-j)
1503 call quicksort(0,net_size,toplist_energy_iso,toplist_idx_iso)
1507 tplist_str_iso(:) =
"-----"
1511 if (j .gt. net_size)
exit
1513 if (toplist_energy_iso(j) .ne. 0d0)
then
1514 tplist_str_iso(i+1) =
net_names(toplist_idx_iso(j))
1515 tplist_iso(i+1) = toplist_energy_iso(j)
1526 btlist_str_iso(:) =
"-----"
1530 if (j .gt. net_size)
exit
1532 if (toplist_energy_iso(net_size+1-j) .ne. 0d0)
then
1533 btlist_str_iso(i+1) =
net_names(toplist_idx_iso(net_size+1-j))
1534 btlist_iso(i+1) = toplist_energy_iso(net_size+1-j)
1547 "(A,3X), 2X,"//int_to_str(
toplist_amount)//
"(es12.4,3X),' | ',"//&
1551 time,engen_tot_exc, tplist_str, tplist, btlist_str,btlist, tplist_str_iso, tplist_iso, &
1552 btlist_str_iso, btlist_iso
1583 engen_tot_pcap, engen_tot_acap,engen_tot_npcap, &
1584 engen_tot_nacap, engen_tot_pacap, engen_q_weak, &
1586 det_bet_engen, det_ag_engen, det_pg_engen, &
1587 det_ng_engen, det_pn_engen, det_ap_engen, &
1588 det_an_engen, det_other_engen, det_fiss_engen, &
1595 info_exit(
"calc_nuclear_heating")
1629 real(
r_kind),
intent(in) :: ctime
1630 real(
r_kind),
intent(in) :: t9
1631 logical,
optional,
intent(in) :: hdf5
1632 real(
r_kind),
dimension(net_size),
intent(in) :: y
1650 real(
r_kind) :: tau_alpha
1651 real(
r_kind) :: tau_nfiss
1652 real(
r_kind) :: tau_sfiss
1653 real(
r_kind) :: tau_bfiss
1656 real(
r_kind) :: ng_sum,gn_sum,pg_sum,gp_sum,beta_sum
1657 real(
r_kind) :: np_sum,pn_sum,an_sum,na_sum,ag_sum,ga_sum
1658 real(
r_kind) :: ap_sum,pa_sum
1659 real(
r_kind) :: alpha_sum, nfiss_sum, sfiss_sum, bfiss_sum
1665 real(
r_kind) :: q_sm = 1.e-20
1667 info_entry(
"calc_av_timescales")
1690 ysum = sum(y(max(1,
ihe4):net_size))
1698 if ((rr_tmp%group.eq.1).or.(rr_tmp%group.eq.2).or.(rr_tmp%group.eq.3) .or.(rr_tmp%group.eq.11))
then
1699 if ((rr_tmp%reac_type .eq.
rrt_betm).or.(rr_tmp%reac_type .eq.
rrt_betp).and.(rr_tmp%source.ne.
'ms99'))
then
1701 nuc = rr_tmp%parts(1)
1702 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1703 beta_sum = beta_sum + rat*y(nuc)
1709 if ((rr_tmp%reac_type.eq.
rrt_alpd))
then
1710 nuc = rr_tmp%parts(1)
1711 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1712 alpha_sum = alpha_sum + rat*y(nuc)
1717 if(rr_tmp%reac_type.eq.
rrt_ap)
then
1718 nuc = rr_tmp%parts(2)
1719 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1720 ap_sum = ap_sum + rat*y(nuc)*y(
ihe4)
1725 if(rr_tmp%reac_type.eq.
rrt_pa)
then
1726 nuc = rr_tmp%parts(2)
1727 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1728 pa_sum = pa_sum + rat*y(nuc)*y(
ipro)
1733 if(rr_tmp%reac_type.eq.
rrt_ng)
then
1734 nuc = rr_tmp%parts(2)
1735 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1736 ng_sum = ng_sum + rat*y(nuc)*y(
ineu)
1741 if(rr_tmp%reac_type.eq.
rrt_gn)
then
1742 nuc = rr_tmp%parts(1)
1743 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1744 gn_sum = gn_sum + rat*y(nuc)
1749 if(rr_tmp%reac_type.eq.
rrt_pg)
then
1750 nuc = rr_tmp%parts(2)
1751 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1752 pg_sum = pg_sum + rat*y(nuc)*y(
ipro)
1757 if(rr_tmp%reac_type.eq.
rrt_gp)
then
1758 nuc = rr_tmp%parts(1)
1759 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1760 gp_sum = gp_sum + rat*y(nuc)
1765 if(rr_tmp%reac_type.eq.
rrt_ag)
then
1766 nuc = rr_tmp%parts(2)
1767 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1768 ag_sum = ag_sum + rat*y(nuc)*y(
ihe4)
1773 if(rr_tmp%reac_type.eq.
rrt_ga)
then
1774 nuc = rr_tmp%parts(1)
1775 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1776 ga_sum = ga_sum + rat*y(nuc)
1781 if(rr_tmp%reac_type.eq.
rrt_np)
then
1782 nuc = rr_tmp%parts(2)
1783 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1784 np_sum = np_sum + rat*y(nuc)*y(
ineu)
1789 if(rr_tmp%reac_type.eq.
rrt_pn)
then
1790 nuc = rr_tmp%parts(2)
1791 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1792 pn_sum = pn_sum + rat*y(nuc)*y(
ipro)
1797 if(rr_tmp%reac_type.eq.
rrt_an)
then
1798 nuc = rr_tmp%parts(2)
1799 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1800 an_sum = an_sum + rat*y(nuc)*y(
ihe4)
1805 if(rr_tmp%reac_type.eq.
rrt_na)
then
1806 nuc = rr_tmp%parts(2)
1807 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1808 na_sum = na_sum + rat*y(nuc)*y(
ineu)
1814 fission:
do i=1,
nfiss
1818 if(fr_tmp%reac_type.eq.
rrt_nf)
then
1819 nuc = fr_tmp%fissparts(2)
1820 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1821 nfiss_sum = nfiss_sum + rat*y(nuc)*y(
ineu)
1826 if(fr_tmp%reac_type.eq.
rrt_sf)
then
1827 nuc = fr_tmp%fissparts(1)
1828 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1829 sfiss_sum = sfiss_sum + rat*y(nuc)
1834 if(fr_tmp%reac_type.eq.
rrt_bf)
then
1835 nuc = fr_tmp%fissparts(1)
1836 if(rat.gt.1.d-20 .and. y(nuc).gt.1.d-20)
then
1837 bfiss_sum = bfiss_sum + rat*y(nuc)
1843 tau_ng = ysum / ng_sum
1844 tau_gn = ysum / gn_sum
1845 tau_pg = ysum / pg_sum
1846 tau_gp = ysum / gp_sum
1847 tau_ag = ysum / ag_sum
1848 tau_ga = ysum / ga_sum
1849 tau_np = ysum / np_sum
1850 tau_pn = ysum / pn_sum
1851 tau_an = ysum / an_sum
1852 tau_na = ysum / na_sum
1853 tau_pa = ysum / pa_sum
1854 tau_ap = ysum / ap_sum
1855 tau_beta = ysum / beta_sum
1856 tau_alpha = ysum / alpha_sum
1857 tau_nfiss = ysum / nfiss_sum
1858 tau_sfiss = ysum / sfiss_sum
1859 tau_bfiss = ysum / bfiss_sum
1861 if (.not.
present(hdf5))
then
1863 write(
tsfile,
'(*(es23.16,3x))') &
1864 ctime, t9, tau_ga,tau_ag, tau_ng, tau_gn, tau_pg, tau_gp, tau_np, &
1865 tau_pn, tau_an, tau_na,tau_pa,tau_ap, tau_beta, tau_alpha, &
1866 tau_nfiss, tau_sfiss, tau_bfiss
1871 tau_gp, tau_np, tau_pn, tau_an, tau_na, &
1872 tau_ap, tau_pa, tau_beta, tau_alpha, &
1873 tau_nfiss, tau_sfiss, tau_bfiss)
1880 info_exit(
'calc_av_timescales')
1898 real(
r_kind),
dimension(net_size),
intent(in) :: y
1899 integer,
dimension(net_size) :: list
1900 real(
r_kind),
dimension(:),
allocatable :: xa,yz
1901 integer :: finfile,finsfile,finzfile
1902 integer :: mval,zmval
1904 integer :: mass,protonnum
1909 write(finfile,
'(A)')
"# 1:A 2:Z 3:N 4:Yi 5:Xi"
1915 if (y(i).le.1.d-20) cycle
1916 write(finfile,
'(3(i5,2x),2es23.14)')
isotope(i)%mass, &
1933 if(y(i).gt.1.d-20)
then
1934 xa(mass) = xa(mass) + y(i)*mass
1935 if (protonnum.gt.0) yz(protonnum) = yz(protonnum) + y(i)
1940 write(finsfile,
'(A)')
"# 1:A 2:Y(A) 3:X(A)"
1943 write(finsfile,
'(i5,2x,es23.14,2x,es23.14)')i, xa(i)/i ,xa(i)
1946 write(finzfile,
'(A)')
"# 1:Z 2:Y(Z)"
1948 write(finzfile,
'(i5,2x,es23.14)')i, yz(i)
1954 end subroutine finab
1972 integer,
intent(in) :: nsize
1973 integer,
dimension(nsize),
intent(out) :: list
1974 type(sorttype),
dimension(nsize) :: tmp
1976 integer :: amin,zmin
1979 info_entry(
'finab_sort')
1987 tmp(i)%chk = .false.
1992 if(tmp(j)%chk) cycle
1993 select case (tmp(j)%a-amin)
1999 if (tmp(j)%z.lt.zmin)
then
2009 tmp(nxt)%chk = .true.
2014 info_exit(
'finab_sort')
2035 info_entry(
'analysis_finalize')
2057 info_exit(
'analysis_finalize')