network_init_module.f90
Go to the documentation of this file.
1 !> @file network_init_module.f90
2 !!
3 !! The error file code for this file is ***W30***.
4 !!
5 !! @brief \ref network_init_module contains \ref network_init and
6 !! supplementary functions to set up and initialize the network
7 !! @author Christian Winteler
8 !!
9 !! \b Created: 23.02.09
10 !! \b Edited:
11 !! - 15.06.17
12 !! - MR 11.01.20 - introduced error_msg_class
13 !! - MR 24.01.21 - splitted things to new rate modules
14 !! .
15 
16 
17 !> Module to prepare the reaction network
18 !!
19 !! This module contains subroutines that call other modules initialization.
20 !! In addition it reads reaction rates and many other things.
21 #include "macros.h"
25  implicit none
26 
27  !
28  ! Public and private fields and methods of the module
29  !
30  public:: &
32  private:: &
34 
35 contains
36 
37 
38 !>
39 !! Main initialising subroutine. calls reading subroutines and fills the
40 !! reactionrate array.
41 !!
42 !! Reads included nuclei, Reaclib, theoretical weak rates,
43 !! neutrino rates, tabulated rates, fission rates (and more)
44 !! and prepares in this way the reaction rates
45 !! \ref global_class::rrate.
46 !!
47 !! @returns \ref global_class::rrate
48 !!
49 !! \b Edited:
50 !! - 14.04.15
51 !! - OK 15.06.17, made into a module
52 !! .
53 subroutine network_init()
54 
61  use parameter_class, only: net_source
67  use format_class, only: load_format
68  use nucstuff_class, only: init_nucstuff
70 
71  !
72  integer :: alloc_stat !< Allocation state
73  integer :: fisscount !< Number of fission reactions
74 !===========================procedure division==================================
75  info_entry("network_init")
76 
77  !-- loads custom formats my_format(:)
78  call load_format()
79  !-- returns nuclide data in isotope(:)
81  !-- returns Amin and Amax for each isotopic chain in minmax
82  call get_minmax()
83  !-- Initialize nucstuff
84  call init_nucstuff()
85 
86  !-- Count the total amount of rates
87  nreac = 0
88 
89  !-- Count and read reaclib rates
90  call init_reaclib_rates()
91  !-- Count and read alpha decay rates
93  !-- Count and read tabulated rates
95  !-- Count and read neutrino rates
96  call init_nuflux()
97  !-- Count and read external beta decays
98  call init_ext_beta_rates()
99  !-- Count and read fission rates
100  call init_fission_rates()
101  !-- Count and read theoretical weak rates
103  !-- Initialize inverse reactions
104  call init_inverse_rates()
105 
106 
107  ! MR: Note that the following order is important.
108  ! For example, TWR have to be merged before neutrino rates!
109  ! Otherwise the results change. (Tested with Example_CCSN_wind_bliss)
110  ! Furthermore, inverse rates have to be merged at the very end as
111  ! they rely on already computed forward rates in the calculation
112  ! of the Jacobian.
113  !
114  !-- Merge reaclib rates into rrate
116  !-- Merge alpha decays
118  !-- Merge external beta decays
120  !-- Merge tabulated rates into rrate
122  !-- Merge theoretical weak rates into rrate
124  !-- Merge neutrino reactions into rrate
126  !-- Merge fission rates into rrate
127  call merge_fission_rates(rrate,nreac,fisscount)
128  !-- Merge inverse rates (detailed balance) into rrate
130 
131  ! Tell how many rates there are
132  if (verbose_level.ge.1) then
133  call write_data_to_std_out("Total reactions after merge",int_to_str(nreac+fisscount))
134  endif
135 
136  ! Initialize screening
137  call init_screening(nreac)
138 
139  if (verbose_level.gt.2) then
140  !----- print list of reactions - debug_all-reactions.txt and debug_weak-reactions.txt
141  call print_reactions()
142  !----- print reactions for debugging - debug-react.dat
143  call print_debug()
144  end if
145 
146 
147  info_exit("network_init")
148 
149 end subroutine network_init
150 
151 
152 !>
153 !! All the necessary initializations and settings before the main loop
154 !!
155 !! To initialize it calls the init subroutines from other modules,
156 !! e.g., \ref readini::readini_init, \ref analysis::analysis_init.
157 !! It also prepares the first time depending on \ref parameter_class::initemp
158 !! and it fills the abundance array \ref single_zone_vars::y and
159 !! \ref single_zone_vars::y_p.
160 !!
161 !! \b Edited:
162 !! - OK 15.06.2017
163 !! - OK 27.08.2017
164 !! .
172 use global_class, only: net_size, ineu, ipro
173 use flow_module, only: flow_init
178 use analysis
181 use nucstuff_class
182 use pardiso_class
185 use nuclear_heating
187 use readini
188 use parser_module
189 use gear_module, only: init_gear_solver
190 implicit none
191 integer :: i
192 real(r_kind) :: t_i
193 real(r_kind) :: t9_i
194 real(r_kind) :: rho_i
195 real(r_kind) :: rkm_i
196 real(r_kind) :: ye_i
197 integer :: alloc_stat
198 real(r_kind) :: dummy_hot, dummy_cold,dummy_temp !< Helper variables
199  !< to get temperature starting point
200 integer :: dummy_index_cold,dummy_index_hot !< Helper variables
201  !< to get temperature starting point
202 ! Variables used for the Expansion/EOS----
203 type(timmes_eos_state) :: inistate
204 integer :: eos_status
205 logical :: init,converged
206 
207  ! define units
208  call unit_define()
209 
210  ! initializations
211  evolution_mode= em_init
212  net_size= 0
214  ! initialise Clenshaw-Curtis integration method
215  !call init_cc(ncc)
216 
217  ! initialise mergesort module
218  call mergesort_init()
219 
220  ! initialise network, returns net_size (and network data in modules)
221  call network_init()
222 
223  ! initialise readini module (for opening debug files)
224  call readini_init()
225 
226  ! initialise analysis module
227  call analysis_init()
228 
229 
230  ! sparse prepares the usage of Compressed Sparse Column Format
231  call sparse()
232 
233  ! initialise flow subroutine, has to get called after sparse!
234  if (flow_every.gt.0) then
235  call flow_init()
236 #ifdef USE_HDF5
237  elseif (h_flow_every .gt. 0) then
238  call flow_init()
239 #endif
240  end if
241 
242  ! allocate arrays
243  allocate(y_p(net_size),stat=alloc_stat)
244  if ( alloc_stat /= 0) call raise_exception('Allocating "Y_p" failed.',&
245  "prepare_simulation",300001)
246  allocate(y(net_size),stat=alloc_stat)
247  if ( alloc_stat /= 0) call raise_exception('Allocating "Y" failed.',&
248  "prepare_simulation",300001)
249  allocate(dydt(net_size),stat=alloc_stat)
250  if ( alloc_stat /= 0) call raise_exception('Allocating "dYdt" failed.',&
251  "prepare_simulation",300001)
252  allocate(f(net_size),stat=alloc_stat)
253  if ( alloc_stat /= 0) call raise_exception('Allocating "f" failed.',&
254  "prepare_simulation",300001)
255 
256  ! read nuclear data needed for nse subroutine
257  call nse_init()
258 
259 
260  if (trim(trajectory_mode).EQ.'from_file') then
261  !-- 'initemp_hot' parameter controls the starting point of the trajectory:
262  ! 0: start from the beginning;
263  ! >0: start from the last T peak, at which the T exceeded initemp
264 
265  !-- 'initemp_cold' controls the minimum allowed temperature in case the
266  ! trajectory is too cold. If this is the case, the trajectory will start at the
267  ! peak temperature that obeys T>initemp_cold and T<initemp_hot.
268  init_index= 1
269  dummy_index_cold= 1
270  dummy_index_hot= 1
271  dummy_temp= -99
272  if (initemp_hot.gt.0d0) then
273  dummy_hot = log(initemp_hot)
274  dummy_cold= log(initemp_cold)
275 
276  do i=1,zsteps
277  ! Find peak temperature
278  if ((ztemp(i) .gt. dummy_temp) .and. (ztemp(i) .gt. dummy_cold)) then
279  dummy_temp= ztemp(i)
280  dummy_index_cold= i
281  end if
282 
283  if (ztemp(i).gt.dummy_hot) dummy_index_hot= i
284  end do
285 
286  ! If there is a high temperature (initemp_hot) included, use the init index
287  ! at this point in temperature, otherwise use maximum of trajectory
288  if ((dummy_index_hot .eq. 1) .and. (ztemp(1) .lt. dummy_hot)) then
289  init_index = dummy_index_cold
290  else
291  init_index = dummy_index_hot
292  end if
293 
294 
295  if(init_index.eq.zsteps) then
296  call raise_exception('Temperature of the trajectory is too high (>initemp_hot).'//new_line("A")//&
297  'The last temperature of the trajectory is '&
298  //trim(adjustl(num_to_str(dexp(ztemp(zsteps)))))//" GK."//&
299  new_line("A")//"Initemp is "&
300  //trim(adjustl(num_to_str(initemp_hot)))//" GK. "//&
301  "Check the trajectory and units.",&
302  "prepare_simulation",300003)
303  endif
304  endif
305  t_i= ztime(init_index)
306  t9_i= dexp(ztemp(init_index))
307  rho_i= dexp(zdens(init_index))
308  rkm_i= dexp(zrad(init_index))
309  ye_i= zye(init_index)
310 
311  ! Check if the temperature is very far from what is expected
312  ! and if initemp_hot is the temperature to start with.
313  if (t9_i .gt. initemp_hot) then
314  ! Is the temperature of the grid point of the trajectory
315  ! within 0.0001 of the desired temperature?
316  if (abs(t9_i-initemp_hot) .gt. 1d-9) then
317  ! Get the correct time
318  ! Better use Brent's method (reverse_type=2) as it respects boundaries
319  call inverse_interp1d(zsteps,ztemp,initemp_hot*(1+1d-9),ztime,t_i,reverse_type=2)
320  ! Get the correct temperature, density, radius, ye
321  call interp1d (zsteps,ztime,t_i,ztemp,t9_i)
322  call interp1d (zsteps,ztime,t_i,zdens,rho_i)
323  call interp1d (zsteps,ztime,t_i,zrad,rkm_i,itype=itype_linear)
324  call interp1d (zsteps,ztime,t_i,zye,ye_i,.true.,itype=itype_linear)
325  end if
326  end if
327 
328  if (verbose_level.ge.1) then
329  call write_data_to_std_out("Thermodynamic trajectory","from file")
330  call write_data_to_std_out("Starting index",int_to_str(init_index))
331  end if
332  else if (trim(trajectory_mode).EQ.'analytic') then
333 
334  ! Find the time of T=T_init
336 
337  ! For, e.g., constant temperature the above NR won't work
338  if (converged) then
339  ! take the later value in case it is too hot at the initial one
340  t_i = max(t_i,t_analytic)
341  else
342  ! if the convergence failed, just start at the initial time
343  t_i= t_analytic
344  end if
345 
346  ! get the density, temperature and radius at the initial time
347  t9_i = parse_string(t9_analytic,t_i)
348  rho_i= parse_string(rho_analytic,t_i)
349  rkm_i= parse_string(rkm_analytic,t_i)
350  ye_i = parse_string(ye_analytic,t_i)
351 
352  if (verbose_level.ge.1) then
353  call write_data_to_std_out("Thermodynamic trajectory","analytic")
354  end if
355  else
356  call raise_exception("Unknown trajectory_mode '"//trim(adjustl(trajectory_mode))//"'.",&
357  "prepare_simulation",300004)
358  end if
359 
360  ! initialise expansion module (for opening debug files)
361  call expansion_init()
362 
363  ! start timing
364  call system_clock(cl_start,cl_rate,cl_cmax)
365 
366  time= t_i
367  time_p= t_i
368  t9= t9_i
369  t9_p= t9_i
370  rhob= rho_i
371  rhob_p= rho_i
372  rkm= rkm_i
373  rkm_p= rkm_i
374  ye= ye_i
375  ye_p= ye_i
376 
377  ! check whether we start in NSE conditions; if not read seeds from progenitor
378  if (read_initial_composition) then
379  if (verbose_level.ge.1) call write_data_to_std_out("Initial abundance source","File")
380  call read_seed(y)
381  ! Recalculate the Ye
382  ye = sum(isotope(1:net_size)%p_nr*y(1:net_size))
383  ye_p= ye
384  evolution_mode= em_nethot
385  if (t9.gt.nsetemp_cold) evolution_mode= em_nse
386  else
387 
388  y(1:net_size)= 0.d0
389  y(ineu)= 1.d0-ye ! abundance of neutrons
390  y(ipro)= ye ! abundance of protons
391  if (t9.gt.nsetemp_cold) then
392  evolution_mode= em_nse
393  if (verbose_level.ge.1) then
394  call write_data_to_std_out("Evolution mode","NSE")
395  endif
396  if (verbose_level.ge.1) call write_data_to_std_out("Initial abundance source","NSE")
397  call winnse_guess(t9, rhob, ye, y(ineu), y(ipro), y)
398  do i=1,net_size
399  if(y(i).lt.1.d-25) y(i)=0.d0
400  enddo
401  else
402  if (verbose_level.ge.1) then
403  call write_data_to_std_out("Evolution mode","Network")
404  endif
405  if (verbose_level.ge.1) call write_data_to_std_out("Initial abundance source","Nucleons")
406  endif
407  endif
408  y_p(1:net_size)= y(1:net_size)
409 
410  ! initialize evolution mode
411  init= .true.
412  call switch_evolution_mode (init)
413 
414  ! get initial entropy -> needed for expansion with timmes_eos
415  inistate%abar = sum(y(1:net_size)*isotope(1:net_size)%mass) &
416  / sum(y(1:net_size))
417  call timmes_eos(ink,t9*1.d9,rhob,ye,inistate,eos_status)
418  if(eos_status.ne.0) call raise_exception("Error when calling the EOS. Called with:"//&
419  new_line("A")//&
420  "T : "//num_to_str(t9)//" GK"//new_line("A")//&
421  "Rho : "//num_to_str(rhob)//" g/ccm"//new_line("A")//&
422  "Ye : "//num_to_str(ye)//new_line("A")//&
423  "Abar: "//num_to_str(inistate%abar),&
424  "prepare_simulation",300005)
425 
426  ent = inistate%s
427  ent_p= ent
428  if (verbose_level.ge.1)call write_data_to_std_out("Initial entropy",num_to_str(ent),"[kB/nuc]")
429  ! initialize nuclear heating module
430  if (heating_mode .ne. 0) then
431  call nuclear_heating_init (t9, rhob, ye, y, ent)
432  ! Initialize thermal neutrinos as well
433  call thermal_neutrino_init()
434  endif
435 
436  ! initialise Gear's method if used
437  if(solver==1) call init_gear_solver(y,t_i,initial_stepsize)
438 
439 
440 end subroutine prepare_simulation
441 
442 
443 !>
444 !! Create a folder with binary files that contain all necessary reaction data
445 !!
446 !! This routine creates binary files in the exact format that WinNet needs to
447 !! initialize the rate arrays. The reading of these files can be done much faster
448 !! then reading the original files. The files are stored in the folder specified
449 !! by the path argument. The folder is created if it does not exist.
450 !! Using these files is specifically useful when running many trajectories.
451 !!
452 !! @author M. Reichert
453 !! @date 21.07.23
454 subroutine create_rate_folder(path)
455  use global_class, only: net_size
465  implicit none
466  character(len=*), intent(in) :: path
467  character(max_fname_len) :: path_dir
468 
469  ! define units
470  call unit_define()
471 
472  net_size= 0
473 
474  ! initialise mergesort module
475  call mergesort_init()
476  ! initialise network, returns net_size (and network data in modules)
477  call network_init()
478  ! Make sure the path ends with a slash
479  path_dir = trim(path)//"/"
480  ! Create folder
481  call system('mkdir -p '//trim(adjustl(path_dir)))
482 
483  ! Output weak rates
484  call output_binary_parameter_data(trim(adjustl(path_dir)))
485  call output_binary_network_data(trim(adjustl(path_dir)))
486  call output_binary_weak_reaction_data(trim(adjustl(path_dir)))
487  call output_binary_reaclib_reaction_data(trim(adjustl(path_dir)))
488  call output_binary_fission_reaction_data(trim(adjustl(path_dir)))
489  call output_binary_neutrino_reaction_data(trim(adjustl(path_dir)))
490  call output_binary_tabulated_reaction_data(trim(adjustl(path_dir)))
491 
492  ! Give information
493  call output_param_prepared_network(trim(adjustl(path_dir)))
494 
495 end subroutine create_rate_folder
496 
497 
498 
499 !>
500 !! Switches between NSE and network modes (EM_NSE / EM_NETHOT / EM_NETCOLD)
501 !!
502 !! The following conditions are included to switch the evolution mode:
503 !!
504 !! <table>
505 !! <caption id="multi_row">Evolution mode switches</caption>
506 !! <tr><th> Evolution mode <th> Condition
507 !! <tr><td> EM_NSE <td> \f$T_9\f$ > parameter_class::nsetemp_hot
508 !! <tr><td> EM_NETHOT <td> parameter_class::temp_reload_exp_weak_rates < \f$T_9\f$ < parameter_class::nsetemp_cold
509 !! <tr><td> EM_NETCOLD <td> \f$T_9\f$ < parameter_class::temp_reload_exp_weak_rates
510 !! <tr><td> EM_TERMINATE <td> Depends on termination criterion, see parameter_class::termination_criterion
511 !! </table>
512 !!
513 !! The following figure illustrates the different regions for an example trajectory:
514 !! @image html temperature_regimes.png width=400px
515 !!
516 !! @note This subroutine also changes the timestep at the transition from NSE
517 !! to the network. For the gear solver, gear_module::set_timestep
518 !! has to be called.
519 !!
520 !! @todo At this point it could be useful to check here the difference
521 !! between the saved value of dYdt from the network and the dYdt
522 !! calculated by the nse abchange function, right after the network->nse
523 !! switch
524 !!
525 !! @see single_zone_vars::evolution_mode
526 !!
527 !! \b Edited:
528 !! - 17.12.16
529 !! .
530 subroutine switch_evolution_mode (init)
538 use gear_module, only: init_gear_solver
541 implicit none
542 logical, intent(inout):: init !< Flag that indicates a necessary initialization
543 
544  if (evolution_mode.eq.em_init) then
545  ! initalize at the very beginning
546  if (t9.gt.nsetemp_hot) then
547  evolution_mode= em_nse
549  y(ineu), y(ipro), y)
550  call write_data_to_std_out("Starting evolution mode","NSE")
551  ! print *, "Evolution: starting in NSE mode"
552  else
553  evolution_mode= em_nethot
554  call write_data_to_std_out("Starting evolution mode","Network")
555  ! print *, "Evolution: starting in network mode"
556  endif
557  elseif (t9.gt.nsetemp_hot .and. evolution_mode.ne.em_nse) then
558  ! network --> NSE
559  evolution_mode= em_nse
560  print *, "Evolution mode: switching to nse"
562  y(ineu), y(ipro), y)
563  init = .true. ! reset to correctly compute the timestep below
565  elseif (t9.lt.nsetemp_cold .and. evolution_mode.eq.em_nse) then
566  ! NSE --> network
567  evolution_mode= em_nethot
569  y(ineu), y(ipro), y)
570  ! winnse_descend modifies abundances Y;
571  ! need to copy abundances to previous timelevel, because otherwise
572  ! they will be overwritten in the beginning of adapt_stepsize in
573  ! advance_next_step() subroutine;
574  y_p(1:net_size)= y(1:net_size)
575  ! initialise Gear's method if used
576  init = .true. ! reset to correctly compute the timestep below
578  print *,"Evolution mode: switching to network"
579  end if
580 
581  ! Check if heating has to be enabled
582  if ((.not. heating_switch) .and. (rhob .le. heating_density) .and. &
583  (heating_mode .ne. 0)) then
584  heating_switch = .true.
585  ! Pretty output
586  if (.not. init) then
587  print *,"Evolution mode: switching on heating"
588  end if
589  end if
590 
591  !-- Problem: beta decay reaction rates are not reliable at T9 < 1.d-2
592  if (weak.and.(evolution_mode.eq.em_nethot).and. &
593  (t9.le.temp_reload_exp_weak_rates)) then
594  ! try 1: replace theoretical weak rates with experimental ones
595  call reload_exp_weak_rates() !TODO: fix and expand this subroutine
596  iwformat = 0
597  weak = .false.
598  evolution_mode = em_netcold
599  print *,"Evolution mode: switching to cold network (only experimental rates)"
600  end if
601 
602  !-- Determine if simulation should terminate
603  select case (termination_criterion)
604  case(0) ! when trajectory ends
605  if (time.ge.ztime(zsteps)) evolution_mode= em_terminate
606  case(1) ! after a given final time
607  if (time.ge.final_time) evolution_mode= em_terminate
608  case(2) ! when a lower temperature is hit
609  if (t9.le.final_temp) evolution_mode= em_terminate
610  case(3) ! below a certain density threshold
611  if (rhob.le.final_dens) evolution_mode= em_terminate
612  case(4) ! after freeze-out
613  if (y_p(ineu)/sum(y_p(ihe4+1:net_size)).le.1.0d0) then
614  evolution_mode= em_terminate
615  endif
616  case default
617  call raise_exception('Invalid termination_criterion ('//trim(adjustl(int_to_str(termination_criterion)))//&
618  ').',"prepare_simulation", 300006)
619  end select
620 
621 end subroutine switch_evolution_mode
622 
623 
624 
625 
626 
627 
628 
629 
630 !>
631 !! Print an overview of the reactions involved in the calculation.
632 !!
633 !! An example file (_debug_all-reactions.txt_ ) looks like:
634 !! \file{...
635 !! O N E P A R T I C L E R E A C T I O N S
636 !! 1 n ---> p Q= 0.782 MEV ffn
637 !! Reaction type: weak
638 !! 2 n ---> p Q= 0.000 MEV nen
639 !! Reaction type: neutrino
640 !! 3 p ---> n Q= -0.782 MEV ffn
641 !! Reaction type: weak
642 !! ...}
643 !!
644 !! Furthermore, a file ( _debug_weak-reactions.txt_ ) containing all
645 !! weak reactions is created that looks like:
646 !! \file{
647 !! OVERVIEW OF ALL WEAK-REACTIONS IN THE NETWORK
648 !! 1 n ---> p Q= 0.782 MEV ffn
649 !! 2 n ---> p Q= 0.000 MEV nen
650 !! 3 p ---> n Q= -0.782 MEV ffn
651 !! 4 p ---> n Q= 0.000 MEV nebp }
652 !!
653 !! @note Fission reactions do not obey the default reaclib format and are not
654 !! visualized correct.
655 !!
656 !! \b Edited:
657 !! - MR: 21.01.21 - included interface (get_net_name) to net_names instead of accessing it directly
658 subroutine print_reactions()
659 
660  use global_class, only: nreac, rrate, net_names
661  use benam_class, only: get_net_name
663  implicit none
664 
665  integer :: reactions,weak_unit
666  integer :: i,i1,i2,i3,cnt,wcnt
667  !character(31) :: rateSortKey
668 
669  reactions= open_outfile('debug_all-reactions.txt')
670  weak_unit= open_outfile('debug_weak-reactions.txt')
671  ! write(reactions,'(i1,4/)')1
672  write(reactions,'(t11,a41)') &
673  'OVERVIEW OF ALL REACTIONS IN THE NETWORK'
674  ! write(weak_unit,'(i1,4/)')1
675  write(weak_unit,'(t11,a46)') &
676  'OVERVIEW OF ALL WEAK-REACTIONS IN THE NETWORK'
677  i1=1
678  i2=1
679  i3=1
680  cnt=1
681  wcnt=1
682  do i=1,nreac
683 
684  select case(rrate(i)%group)
685  case(1)
686  if(i1.eq.1) then
687  write(reactions,'(5/,t11,a)')&
688  'O N E P A R T I C L E R E A C T I O N S'
689  i1=0
690  cnt=1
691  wcnt=1
692  end if
693  write(reactions,100)cnt,net_names(rrate(i)%parts(1)), &
694  get_net_name(rrate(i)%parts(2)), &
695  rrate(i)%q_value,rrate(i)%source
696  cnt = cnt+1
697  if(rrate(i)%is_weak) then
698  write(weak_unit,100)wcnt,net_names(rrate(i)%parts(1)), &
699  get_net_name(rrate(i)%parts(2)), &
700  rrate(i)%q_value,rrate(i)%source
701  wcnt = wcnt+1
702  end if
703  case(2)
704  write(reactions,200)cnt,net_names(rrate(i)%parts(1)), &
705  get_net_name(rrate(i)%parts(2)), &
706  get_net_name(rrate(i)%parts(3)), &
707  rrate(i)%q_value,rrate(i)%source
708  cnt = cnt+1
709  if(rrate(i)%is_weak) then
710  write(weak_unit,200)wcnt,get_net_name(rrate(i)%parts(1)), &
711  get_net_name(rrate(i)%parts(2)), &
712  get_net_name(rrate(i)%parts(3)), &
713  rrate(i)%q_value,rrate(i)%source
714  wcnt = wcnt+1
715  end if
716  case(3)
717  if (rrate(i)%parts(5).eq.0) then
718  write(reactions,300)cnt,get_net_name(rrate(i)%parts(1)), &
719  get_net_name(rrate(i)%parts(2)), &
720  get_net_name(rrate(i)%parts(3)), &
721  get_net_name(rrate(i)%parts(4)), &
722  rrate(i)%q_value,rrate(i)%source
723  else
724  write(reactions,310)cnt,get_net_name(rrate(i)%parts(1)), &
725  get_net_name(rrate(i)%parts(2)), &
726  get_net_name(rrate(i)%parts(3)), &
727  get_net_name(rrate(i)%parts(4)), &
728  get_net_name(rrate(i)%parts(5)), &
729  rrate(i)%q_value,rrate(i)%source
730  end if
731  cnt = cnt+1
732  if(rrate(i)%is_weak) then
733  if (rrate(i)%parts(5).eq.0) then
734  write(weak_unit,300)wcnt,get_net_name(rrate(i)%parts(1)), &
735  get_net_name(rrate(i)%parts(2)), &
736  get_net_name(rrate(i)%parts(3)), &
737  get_net_name(rrate(i)%parts(4)), &
738  rrate(i)%q_value,rrate(i)%source
739  else
740  write(weak_unit,310)cnt,get_net_name(rrate(i)%parts(1)), &
741  get_net_name(rrate(i)%parts(2)), &
742  get_net_name(rrate(i)%parts(3)), &
743  get_net_name(rrate(i)%parts(4)), &
744  get_net_name(rrate(i)%parts(5)), &
745  rrate(i)%q_value,rrate(i)%source
746  end if
747  wcnt = wcnt+1
748  end if
749  case(4)
750  if(i2.eq.1) then
751  write(reactions,'(5/,t11,a)') &
752  'T W O P A R T I C L E R E A C T I O N S'
753  i2=0
754  cnt=1
755  end if
756  write(reactions,400)cnt,get_net_name(rrate(i)%parts(1)), &
757  get_net_name(rrate(i)%parts(2)), &
758  get_net_name(rrate(i)%parts(3)), &
759  rrate(i)%q_value,rrate(i)%source
760  !write(reactions,*) rateSortKey(rrate(i)%group,rrate(i)%parts)
761  cnt = cnt+1
762  case(5)
763  write(reactions,500)cnt,get_net_name(rrate(i)%parts(1)), &
764  get_net_name(rrate(i)%parts(2)), &
765  get_net_name(rrate(i)%parts(3)), &
766  get_net_name(rrate(i)%parts(4)), &
767  rrate(i)%q_value,rrate(i)%source
768  cnt = cnt+1
769  case(6)
770  write(reactions,600)cnt,get_net_name(rrate(i)%parts(1)), &
771  get_net_name(rrate(i)%parts(2)), &
772  get_net_name(rrate(i)%parts(3)), &
773  get_net_name(rrate(i)%parts(4)), &
774  get_net_name(rrate(i)%parts(5)), &
775  rrate(i)%q_value,rrate(i)%source
776  cnt = cnt+1
777  case(7)
778  write(reactions,700)cnt,get_net_name(rrate(i)%parts(1)), &
779  get_net_name(rrate(i)%parts(2)), &
780  get_net_name(rrate(i)%parts(3)), &
781  get_net_name(rrate(i)%parts(4)), &
782  get_net_name(rrate(i)%parts(5)), &
783  get_net_name(rrate(i)%parts(6)), &
784  rrate(i)%q_value,rrate(i)%source
785  cnt = cnt+1
786  case(8)
787  if(i3.eq.1) then
788  write(reactions,'(5/,t11,a)') &
789  'T H R E E P A R T I C L E R E A C T I O N S'
790  i3=0
791  cnt=1
792  end if
793  if (rrate(i)%parts(6).ne.0) then
794  write(reactions,830)cnt,get_net_name(rrate(i)%parts(1)), &
795  get_net_name(rrate(i)%parts(2)), &
796  get_net_name(rrate(i)%parts(3)), &
797  get_net_name(rrate(i)%parts(4)), &
798  get_net_name(rrate(i)%parts(5)), &
799  get_net_name(rrate(i)%parts(6)), &
800  rrate(i)%q_value,rrate(i)%source
801  else if(rrate(i)%parts(5).ne.0) then
802  write(reactions,820)cnt,get_net_name(rrate(i)%parts(1)), &
803  get_net_name(rrate(i)%parts(2)), &
804  get_net_name(rrate(i)%parts(3)), &
805  get_net_name(rrate(i)%parts(4)), &
806  get_net_name(rrate(i)%parts(5)), &
807  rrate(i)%q_value,rrate(i)%source
808  else
809  write(reactions,810)cnt,get_net_name(rrate(i)%parts(1)), &
810  get_net_name(rrate(i)%parts(2)), &
811  get_net_name(rrate(i)%parts(3)), &
812  get_net_name(rrate(i)%parts(4)), &
813  rrate(i)%q_value,rrate(i)%source
814  end if
815  cnt = cnt+1
816  end select
817 
818  ! Write the type of reaction to the debug file
819  if ( rrate(i)%reac_type == rrt_sf) then
820  write(reactions,840) "spontaneous fission"
821  else if ( rrate(i)%reac_type == rrt_bf ) then
822  write(reactions,840) "beta-delayed fission"
823  else if ( rrate(i)%reac_type == rrt_nf ) then
824  write(reactions,840) "neutron-induced fission"
825  else if ( rrate(i)%reac_type == rrt_ng ) then
826  write(reactions,840) "n-gamma"
827  else if ( rrate(i)%reac_type == rrt_ag ) then
828  write(reactions,840) "alpha-gamma"
829  else if ( rrate(i)%reac_type == rrt_pg ) then
830  write(reactions,840) "p-gamma"
831  else if ( rrate(i)%reac_type == rrt_gn ) then
832  write(reactions,840) "gamma-n"
833  else if ( rrate(i)%reac_type == rrt_ga ) then
834  write(reactions,840) "gamma-alpha"
835  else if ( rrate(i)%reac_type == rrt_gp ) then
836  write(reactions,840) "gamma-p"
837  else if ( rrate(i)%reac_type == rrt_pn ) then
838  write(reactions,840) "p-n"
839  else if ( rrate(i)%reac_type == rrt_np ) then
840  write(reactions,840) "n-p"
841  else if ( rrate(i)%reac_type == rrt_an ) then
842  write(reactions,840) "alpha-n"
843  else if ( rrate(i)%reac_type == rrt_na ) then
844  write(reactions,840) "n-alpha"
845  else if ( rrate(i)%reac_type == rrt_ap ) then
846  write(reactions,840) "alpha-p"
847  else if ( rrate(i)%reac_type == rrt_pa ) then
848  write(reactions,840) "p-alpha"
849  else if ( rrate(i)%reac_type == rrt_nu ) then
850  write(reactions,840) "neutrino"
851  else if ( rrate(i)%reac_type == rrt_o ) then
852  write(reactions,840) "other"
853  else if ( rrate(i)%reac_type == rrt_betm ) then
854  write(reactions,840) "beta minus"
855  else if ( rrate(i)%reac_type == rrt_betp ) then
856  write(reactions,840) "beta plus"
857  else if ( rrate(i)%reac_type == rrt_alpd ) then
858  write(reactions,840) "alpha decay"
859  else if ( rrate(i)%reac_type == rrt_pemi ) then
860  write(reactions,840) "p emission"
861  else if ( rrate(i)%reac_type == rrt_nemi ) then
862  write(reactions,840) "n emission"
863  else if ( rrate(i)%reac_type == rrt_ec ) then
864  write(reactions,840) "Electron capture"
865  else
866  write(reactions,840) "unknown"
867  end if
868 
869 
870  end do
871  call close_io_file(reactions,'debug_all-reactions.txt')
872  call close_io_file(weak_unit,'debug_weak-reactions.txt')
873  return
874 
875 100 format (i6,t12,a5,t18,'--->',t22,a5,t57,'Q=',t59,f7.3,t67,'MEV',t74,a4)
876 200 format (i6,t12,a5,t18,'--->',t22,a5,t27,'+',t28,a5,t57, &
877  'Q=',t59,f7.3,t67,'MEV',t74,a4)
878 300 format (i6,t12,a5,t18,'--->',t22,a5,t27,'+',t28,a5,t33,'+',t34,a5,t57, &
879  'Q=',t59,f7.3,t67,'MEV',t74,a4)
880 310 format (i6,t12,a5,t18,'--->',t22,a5,t27,'+',t28,a5,t33,'+',t34,a5, &
881  t39,'+',t40,a5,t57,'Q=',t59,f7.3,t67,'MEV',t74,a4)
882 400 format (i6,t12,a5,t17,'+',t18,a5,t24,'--->',t28,a5,t57, &
883  'Q=',t59,f7.3,t67,'MEV',t74,a4)
884 500 format (i6,t12,a5,t17,'+',t18,a5,t24,'--->',t28,a5,t33,'+',t34,a5,t57, &
885  'Q=',t59,f7.3,t67,'MEV',t74,a4)
886 600 format (i6,t12,a5,t17,'+',t18,a5,t24,'--->',t28,a5,t33,'+',t34,a5, &
887  t39,'+',t40,a5,t57,'Q=',t59,f7.3,t67,'MEV',t74,a4)
888 700 format (i6,t12,a5,t17,'+',t18,a5,t24,'--->',t28,a5,t33,'+',t34,a5, &
889  t39,'+',t40,a5,t45,'+',t46,a5,t57,'Q=',t59,f7.3,t67,'MEV',t74,a4)
890 810 format (i6,t12,a5,t17,'+',t18,a5,t23,'+',t24,a5,t30,'--->',t34,a5, &
891  t57,'Q=',t59,f7.3,t67,'MEV',t74,a4)
892 820 format (i6,t12,a5,t17,'+',t18,a5,t23,'+',t24,a5,t30,'--->',t34,a5, &
893  t39,'+',t40,a,t57,'Q=',t59,f7.3,t67,'MEV',t74,a4)
894 830 format (i6,t12,a5,t17,'+',t18,a5,t23,'+',t24,a5,t30,'--->',t34,a5, &
895  t39,'+',t40,a,t45,'+',t46,a,t57,'Q=',t59,f7.3,t67,'MEV',t74,a4)
896 840 format ('Reaction type: ',a)
897 
898 end subroutine print_reactions
899 
900 
901 
902 
903 
904 !> Print a debug file of the reaction
905 !!
906 !! In contrast to \ref print_reactions, this subroutine prints additional flags
907 !! of a reaction. The structure of a file looks like:
908 !!
909 !! <table>
910 !! <caption id="multi_row">File structure</caption>
911 !! <tr><td> Reaclib chapter <td> isotope names <td> Q-Value <td> Source label
912 !! <tr><td> Amount destroyed/synthesized <td> double counting factor
913 !! <tr><td>"is_weak" <td> "is_resonant" <td> "is_reverse"
914 !! </table>
915 !! An example of the file (_debug_reac.dat_) looks like:
916 !! \file{...
917 !! 5 n na32 p ne32 -16.606 rath
918 !! -1 -1 1 1 0 0 1.000
919 !! F F T
920 !! 5 p na32 n mg32 18.317 rath
921 !! -1 -1 1 1 0 0 1.000
922 !! F F F
923 !! ...}
924 !!
925 subroutine print_debug()
926 
927  use global_class, only: nreac, rrate
929  implicit none
930 
931  integer :: ofile
932  integer :: i
933  character*5,dimension(6) :: rnam
934 
935  ofile= open_outfile('debug_reac.dat')
936  do i =1,nreac
937  call getnames(i,rnam)
938  write(ofile,111)rrate(i)%group,rnam(1:6),rrate(i)%q_value,rrate(i)%source
939  write(ofile,222)rrate(i)%ch_amount(1:6),rrate(i)%one_over_n_fac
940  write(ofile,333)rrate(i)%is_weak,rrate(i)%is_resonant,rrate(i)%is_reverse
941  end do
942  call close_io_file(ofile,'debug_reac.dat')
943  return
944 
945 111 format(i1,t3,6a5,t35,f7.3,t44,a4)
946 222 format(6(i2,1x),t22,f7.3)
947 333 format(3l5)
948 
949 end subroutine print_debug
950 
951 
952 !> Get the names of a certain reaction
953 !!
954 !! @returns all nuclei names that participate in a reaction with index ind
955 subroutine getnames(ind,names)
956  use global_class, only: net_names, rrate
957  implicit none
958 
959  integer, intent(in) :: ind !< Index of the reaction
960  character*5,dimension(6),intent(out) :: names !< Names of the participating isotopes
961  integer :: i !< Loop variable
962 
963  do i =1,6
964  if(rrate(ind)%parts(i).lt.1) then
965  names(i) = ' '
966  else
967  names(i) = net_names(rrate(ind)%parts(i))
968  end if
969  end do
970  return
971 
972 end subroutine getnames
973 
974 
975 end module network_init_module
976 !----------------------------------------------------------------------------
single_zone_vars::y
real(r_kind), dimension(:), allocatable y
Definition: single_zone_vars.f90:21
ls_timmes_eos_module::ink
integer, parameter ink
Definition: ls_timmes_eos_module.f:14
parameter_class::iwformat
integer iwformat
defines format of the weak rates (0 = tabulated, 1 = log<ft>)
Definition: parameter_class.f90:81
beta_decay_rate_module::merge_beta_decays
subroutine, public merge_beta_decays(rrate_array, rrate_length)
Merge external beta decays into the larger rate array.
Definition: beta_decay_rate_module.f90:124
winnse_module
Module to calculate NSE.
Definition: winnse_module.f90:34
screening_module
Module to calculate electron screening.
Definition: screening_module.f90:17
nuflux_class::init_nuflux
subroutine, public init_nuflux()
Initialize nuflux module.
Definition: nuflux_class.f90:126
global_class::heating_switch
logical, public heating_switch
Variables related to nuclear heating.
Definition: global_class.f90:41
parameter_class::nse_descend_t9start
real(r_kind) nse_descend_t9start
high initial temperature in GK for winnse_descend subroutine
Definition: parameter_class.f90:125
global_class::net_names
character *5, dimension(:), allocatable, public net_names
list of isotopes contained in the network
Definition: global_class.f90:95
rrt_nf
#define rrt_nf
Definition: macros.h:78
winnse_module::winnse_guess
subroutine, public winnse_guess(t9, rho, ye, yn_guess, yp_guess, ysol)
Calculate NSE composition with an initial guess.
Definition: winnse_module.f90:116
global_class::ipro
integer, public ipro
index of alphas, neutrons and protons
Definition: global_class.f90:94
ls_timmes_eos_module
Definition: ls_timmes_eos_module.f:2
global_class::rrate
type(reactionrate_type), dimension(:), allocatable, public rrate
array containing all reaction rates used in the network
Definition: global_class.f90:65
gear_module::init_gear_solver
subroutine, public init_gear_solver(Y, t_init, h_init)
Initialize iteration variables.
Definition: gear_module.f90:131
analysis::cl_cmax
integer cl_cmax
system clock variables
Definition: analysis.f90:24
inter_module
Module inter_module with interpolation routines.
Definition: inter_module.f90:13
network_init_module::print_debug
subroutine, private print_debug()
Print a debug file of the reaction.
Definition: network_init_module.f90:926
nuflux_class::merge_neutrino_rates
subroutine, public merge_neutrino_rates(rrate_array, rrate_length)
Routine to merge neutrino rates into rrate array.
Definition: nuflux_class.f90:1346
analysis::cl_start
integer cl_start
Definition: analysis.f90:24
nucstuff_class::init_nucstuff
subroutine init_nucstuff()
Initialize nucstuff class.
Definition: nucstuff_class.f90:40
single_zone_vars::rhob
real(r_kind) rhob
Definition: single_zone_vars.f90:17
reaclib_rate_module::merge_reaclib_rates
subroutine, public merge_reaclib_rates(rrate_array, rrate_length)
Merge the reaclib rates into a larger array.
Definition: reaclib_rate_module.f90:270
fission_rate_module::init_fission_rates
subroutine, public init_fission_rates()
Initialize the fission reactions.
Definition: fission_rate_module.f90:99
reaclib_rate_module
Module that deals with reaclib reaction rates.
Definition: reaclib_rate_module.f90:13
mergesort_module::mergesort_init
subroutine, public mergesort_init()
Initialize the mergesort module and open files for debugging.
Definition: mergesort_module.f90:48
detailed_balance::init_inverse_rates
subroutine, public init_inverse_rates()
Initialize everything for the inverse rates.
Definition: detailed_balance.f90:95
parameter_class::flow_every
integer flow_every
flow output frequency
Definition: parameter_class.f90:64
format_class::load_format
subroutine load_format()
Definition: format_class.f90:24
single_zone_vars::t9
real(r_kind) t9
Definition: single_zone_vars.f90:15
rrt_an
#define rrt_an
Definition: macros.h:72
nuclear_heating
Takes care of the temperature and entropy updates due to the nuclear energy release.
Definition: nuclear_heating.f90:11
single_zone_vars::rkm
real(r_kind) rkm
Definition: single_zone_vars.f90:18
expansion_module::expansion_init
subroutine expansion_init()
Initialize the expansion module and open files for debugging.
Definition: expansion_module.f90:60
single_zone_vars::ent
real(r_kind) ent
Definition: single_zone_vars.f90:20
nuclear_heating::nuclear_heating_init
subroutine, public nuclear_heating_init(T9, rho, Ye, Y, entropy)
Nuclear heating initialization routine.
Definition: nuclear_heating.f90:51
parameter_class::h_flow_every
integer h_flow_every
flow output frequency in hdf5 format
Definition: parameter_class.f90:65
error_msg_class
Error handling routines.
Definition: error_msg_class.f90:16
global_class::ihe4
integer, public ihe4
Definition: global_class.f90:94
expansion_module
Subroutines to handle parametric evolution of hydrodynamic quantities after the final timestep of the...
Definition: expansion_module.f90:16
rrt_ec
#define rrt_ec
Definition: macros.h:61
alpha_decay_rate_module::merge_alpha_decays
subroutine, public merge_alpha_decays(rrate_array, rrate_length)
Merge alpha decays into the larger rate array.
Definition: alpha_decay_rate_module.f90:204
parameter_class::termination_criterion
integer termination_criterion
condition to terminate the simulation ([0]=trajectory_file, 1=final_time, 2=final_temp,...
Definition: parameter_class.f90:127
rrt_np
#define rrt_np
Definition: macros.h:73
parameter_class::unit_define
subroutine, public unit_define()
Declares values for the elements in unit_type.
Definition: parameter_class.f90:236
fission_rate_module
Module to deal with fission reactions.
Definition: fission_rate_module.f90:16
rrt_gp
#define rrt_gp
Definition: macros.h:70
beta_decay_rate_module
This module contains subroutines to include external beta decays.
Definition: beta_decay_rate_module.f90:27
error_msg_class::int_to_str
character(:) function, allocatable, public int_to_str(num)
Converts a given integer to a string.
Definition: error_msg_class.f90:224
parameter_class::nsetemp_cold
real(r_kind) nsetemp_cold
T [GK] for the nse->network switch.
Definition: parameter_class.f90:119
single_zone_vars::evolution_mode
integer evolution_mode
NSE, network hot/cold, etc.
Definition: single_zone_vars.f90:23
alpha_decay_rate_module
This module contains subroutines to add alpha decays.
Definition: alpha_decay_rate_module.f90:19
parameter_class::output_param_prepared_network
subroutine output_param_prepared_network(path)
Output relevant parameters to a file in the prepared network path.
Definition: parameter_class.f90:1542
ls_timmes_eos_module::timmes_eos
subroutine timmes_eos(var, vin, d, Ye, state, status)
Definition: ls_timmes_eos_module.f:49
parameter_class::final_dens
real(r_kind) final_dens
termination density [g/cm3]
Definition: parameter_class.f90:131
nuflux_class::output_binary_neutrino_reaction_data
subroutine, public output_binary_neutrino_reaction_data(path)
Write the reactions to a file in binary format.
Definition: nuflux_class.f90:774
error_msg_class::raise_exception
subroutine, public raise_exception(msg, sub, error_code)
Raise a exception with a given error message.
Definition: error_msg_class.f90:245
parameter_class::initial_stepsize
real(r_kind) initial_stepsize
this value is used as a stepsize at initial step
Definition: parameter_class.f90:128
winnse_module::nse_init
subroutine, public nse_init()
Allocates and initialises various arrays needed for the nse calculation.
Definition: winnse_module.f90:75
reaclib_rate_module::init_reaclib_rates
subroutine, public init_reaclib_rates()
Count and read reaclib reactions.
Definition: reaclib_rate_module.f90:45
single_zone_vars::rkm_p
real(r_kind) rkm_p
Radius of the outflow [km].
Definition: single_zone_vars.f90:18
network_init_module::switch_evolution_mode
subroutine, public switch_evolution_mode(init)
Switches between NSE and network modes (EM_NSE / EM_NETHOT / EM_NETCOLD)
Definition: network_init_module.f90:531
readini
Subroutines for initialization and parameter parsing.
Definition: readini.f90:15
network_init_module
Module to prepare the reaction network.
Definition: network_init_module.f90:22
tw_rate_module::reload_exp_weak_rates
subroutine, public reload_exp_weak_rates()
This routine is used to replace theoretical weak rates with experimental ones it's called when T9 < p...
Definition: tw_rate_module.f90:1117
parameter_class::max_fname_len
integer, parameter, public max_fname_len
maximum length of filenames
Definition: parameter_class.f90:58
tabulated_rate_module::output_binary_tabulated_reaction_data
subroutine, public output_binary_tabulated_reaction_data(path)
Save the theoretical tabulated rates to a unformatted binary file.
Definition: tabulated_rate_module.f90:610
global_class::ineu
integer, public ineu
Definition: global_class.f90:94
rrt_pn
#define rrt_pn
Definition: macros.h:74
parameter_class::rho_analytic
character(max_fname_len) rho_analytic
analytic density [g/cm3]
Definition: parameter_class.f90:187
global_class::isotope
type(isotope_type), dimension(:), allocatable, public isotope
all nuclides used in the network
Definition: global_class.f90:34
network_init_module::create_rate_folder
subroutine create_rate_folder(path)
Create a folder with binary files that contain all necessary reaction data.
Definition: network_init_module.f90:455
error_msg_class::write_data_to_std_out
subroutine, public write_data_to_std_out(str_msg, value_str, unit)
Write data to the standard output (usually OUT)
Definition: error_msg_class.f90:122
benam_class::output_binary_network_data
subroutine, public output_binary_network_data(path)
Save the general network information to a binary file.
Definition: benam_class.f90:499
single_zone_vars::time_p
real(r_kind) time_p
Time.
Definition: single_zone_vars.f90:13
hydro_trajectory::ztime
real(r_kind), dimension(:), allocatable, public ztime
time information from trajectory
Definition: hydro_trajectory.f90:19
rrt_ga
#define rrt_ga
Definition: macros.h:68
nucstuff_class
Module with helper functions such as rate tabulation, partition functions, and theoretical weak rates...
Definition: nucstuff_class.f90:11
nuflux_class
Contains variables and parameters related to neutrino fluxes.
Definition: nuflux_class.f90:14
rrt_pemi
#define rrt_pemi
Definition: macros.h:63
rrt_alpd
#define rrt_alpd
Definition: macros.h:62
parameter_class::rkm_analytic
character(max_fname_len) rkm_analytic
analytic radial scale [km]
Definition: parameter_class.f90:188
rrt_betp
#define rrt_betp
Definition: macros.h:60
inter_module::interp1d
subroutine, public interp1d(n, xp, xb, yp, res, flin, itype)
Interface for 1D interpolation routines.
Definition: inter_module.f90:100
parameter_class::heating_density
real(r_kind) heating_density
Density at which nuclear heating will be switched on (-1) to always include heating.
Definition: parameter_class.f90:124
network_init_module::print_reactions
subroutine, private print_reactions()
Print an overview of the reactions involved in the calculation.
Definition: network_init_module.f90:659
rrt_na
#define rrt_na
Definition: macros.h:71
tabulated_rate_module::init_tabulated_rates
subroutine, public init_tabulated_rates()
Initialize tabulated rates.
Definition: tabulated_rate_module.f90:78
rrt_pg
#define rrt_pg
Definition: macros.h:69
tw_rate_module::weak
logical, public weak
switch for weak rates
Definition: tw_rate_module.f90:58
single_zone_vars::ent_p
real(r_kind) ent_p
Entropy [kB/baryon].
Definition: single_zone_vars.f90:20
detailed_balance::merge_inverse_rates
subroutine, public merge_inverse_rates(rrate_array, rrate_length)
Delete and create new inverse rates.
Definition: detailed_balance.f90:137
rrt_ap
#define rrt_ap
Definition: macros.h:76
single_zone_vars::f
real(r_kind), dimension(:), allocatable f
Definition: single_zone_vars.f90:22
parameter_class::output_binary_parameter_data
subroutine output_binary_parameter_data(path)
Output the parameter data to a binary file.
Definition: parameter_class.f90:1673
parser_module
Subroutines for equation parsing in case of an analytic trajectory or luminosity mode.
Definition: parser_module.f90:22
hydro_trajectory::zrad
real(r_kind), dimension(:), allocatable, public zrad
radii from trajectory
Definition: hydro_trajectory.f90:23
parameter_class::read_initial_composition
logical read_initial_composition
specify whether initial distribution of abundances should be read from file
Definition: parameter_class.f90:91
parameter_class::t_analytic
real(r_kind) t_analytic
for parameteric trajectories: initial time
Definition: parameter_class.f90:126
parser_module::find_start_value
subroutine, public find_start_value(input_string, eq_value, initial_guess, converged, result)
Finds a value of the variable for a given y-value.
Definition: parser_module.f90:856
thermal_neutrino_module
The thermal_neutrino_module serves as interface to the neutrino emission routines from the sneut5....
Definition: thermal_neutrino_module.f90:19
screening_module::init_screening
subroutine, public init_screening(nreac)
Initialize the screening module.
Definition: screening_module.f90:43
detailed_balance
Module that deals with inverse reaction rates.
Definition: detailed_balance.f90:57
readini::read_seed
subroutine, public read_seed(iniab)
Reads in seed abundances from file parameter_class::seed_file.
Definition: readini.f90:327
parameter_class::solver
integer solver
solver flag (0 - implicit Euler, 1 - Gear's method, ...), is integer as it is faster than comparing s...
Definition: parameter_class.f90:147
readini::readini_init
subroutine, public readini_init()
Initialize the readini module and open files.
Definition: readini.f90:46
parser_module::parse_string
real(r_kind) function, public parse_string(input_string, var_value)
Takes a string and evaluates the expression.
Definition: parser_module.f90:807
winnse_module::winnse_descend
subroutine, public winnse_descend(t9strt, t9fnl, rho, ye, yni, ypi, ysol)
This routine descends from an initially high temperature, at which the NSE abudances can be accuratel...
Definition: winnse_module.f90:177
global_class::net_size
integer, public net_size
total number of isotopes (network size)
Definition: global_class.f90:93
beta_decay_rate_module::init_ext_beta_rates
subroutine, public init_ext_beta_rates()
Initialize external beta decay rates.
Definition: beta_decay_rate_module.f90:74
analysis::analysis_init
subroutine, public analysis_init()
Open files, write headers, allocate space etc.
Definition: analysis.f90:52
file_handling_class
Provide some basic file-handling routines.
Definition: file_handling_class.f90:18
network_init_module::prepare_simulation
subroutine, public prepare_simulation
All the necessary initializations and settings before the main loop.
Definition: network_init_module.f90:166
error_msg_class::num_to_str
character(:) function, allocatable, public num_to_str(num)
Converts a given real to a string with format "(1pE10.2)".
Definition: error_msg_class.f90:205
parameter_class::heating_mode
integer heating_mode
Mode for heating: 0 - no heating, 1 - heating using an entropy equation, 2 - heating from the energy ...
Definition: parameter_class.f90:148
analysis
Contains various routines for analysis and diagnostic output.
Definition: analysis.f90:9
hydro_trajectory::init_index
integer init_index
Initial index in the trajectory.
Definition: hydro_trajectory.f90:18
single_zone_vars::time
real(r_kind) time
Definition: single_zone_vars.f90:13
network_init_module::network_init
subroutine, private network_init()
Main initialising subroutine. calls reading subroutines and fills the reactionrate array.
Definition: network_init_module.f90:54
pardiso_class
Contains subroutines for sparse matrix assembly and the solver core.
Definition: pardiso_class.f90:24
flow_module::flow_init
subroutine, public flow_init()
Initialise flow subroutine.
Definition: flow_module.f90:50
single_zone_vars::stepsize
real(r_kind) stepsize
Stepsize.
Definition: single_zone_vars.f90:14
fission_rate_module::output_binary_fission_reaction_data
subroutine, public output_binary_fission_reaction_data(path)
Save the fission data to a unformatted binary file.
Definition: fission_rate_module.f90:388
r_kind
#define r_kind
Definition: macros.h:46
rrt_gn
#define rrt_gn
Definition: macros.h:66
parameter_class::nsetemp_hot
real(r_kind) nsetemp_hot
T [GK] for the nse<-network switch.
Definition: parameter_class.f90:120
flow_module
Provides subroutines to calculate reaction flows.
Definition: flow_module.f90:18
hydro_trajectory::zsteps
integer zsteps
number of timesteps in the hydro trajectory
Definition: hydro_trajectory.f90:17
rrt_pa
#define rrt_pa
Definition: macros.h:75
hydro_trajectory
Contains arrays representing thermodynamic conditions from hydro trajectory file.
Definition: hydro_trajectory.f90:14
hydro_trajectory::zdens
real(r_kind), dimension(:), allocatable, public zdens
density information from trajectory
Definition: hydro_trajectory.f90:21
benam_class::get_nuclear_properties
subroutine, public get_nuclear_properties()
Reads nuclear properties (name,a,n,z,spin,mass excess,partition functions) from file 'winvn' and htpf...
Definition: benam_class.f90:642
reaclib_rate_module::output_binary_reaclib_reaction_data
subroutine output_binary_reaclib_reaction_data(path)
Save the complete rrate array to a binary file.
Definition: reaclib_rate_module.f90:194
network_init_module::getnames
subroutine, private getnames(ind, names)
Get the names of a certain reaction.
Definition: network_init_module.f90:956
single_zone_vars::dydt
real(r_kind), dimension(:), allocatable dydt
Time derivative of the abundances.
Definition: single_zone_vars.f90:22
benam_class::get_minmax
subroutine, public get_minmax()
Returns Amin and Amax for each isotopic chain in minmax.
Definition: benam_class.f90:916
rrt_betm
#define rrt_betm
Definition: macros.h:59
single_zone_vars::y_p
real(r_kind), dimension(:), allocatable y_p
Abundances.
Definition: single_zone_vars.f90:21
rrt_o
#define rrt_o
Definition: macros.h:81
parameter_class::final_time
real(r_kind) final_time
termination time in seconds
Definition: parameter_class.f90:129
tw_rate_module::init_theoretical_weak_rates
subroutine, public init_theoretical_weak_rates()
Initialize theoretical weak rates.
Definition: tw_rate_module.f90:91
parameter_class::final_temp
real(r_kind) final_temp
termination temperature [GK]
Definition: parameter_class.f90:130
tabulated_rate_module
This module contains everything for the tabulated rates that can replace reaclib rates.
Definition: tabulated_rate_module.f90:28
tabulated_rate_module::merge_tabulated_rates
subroutine, public merge_tabulated_rates(rrate_array, rrate_length)
Merge tabulated rates into larger rate array.
Definition: tabulated_rate_module.f90:141
file_handling_class::open_outfile
integer function, public open_outfile(file_name)
Shorthand for opening a new file for writing (output file)
Definition: file_handling_class.f90:108
hydro_trajectory::zye
real(r_kind), dimension(:), allocatable, public zye
electron fraction information from trajectory
Definition: hydro_trajectory.f90:22
global_class
Contains types and objects shared between multiple modules.
Definition: global_class.f90:19
rrt_nemi
#define rrt_nemi
Definition: macros.h:64
benam_class::get_net_name
character(:) function, allocatable, public get_net_name(index, trimmed)
Getter of net_names, translating indices to a nucleus name.
Definition: benam_class.f90:280
parameter_class::t9_analytic
character(max_fname_len) t9_analytic
analytic temperature [T9]
Definition: parameter_class.f90:186
single_zone_vars::ye
real(r_kind) ye
Definition: single_zone_vars.f90:19
global_class::nreac
integer, public nreac
total number of reactions
Definition: global_class.f90:98
parameter_class::temp_reload_exp_weak_rates
real(r_kind) temp_reload_exp_weak_rates
temperature below which one should not use theoretical weak rates so they are replaced with exp....
Definition: parameter_class.f90:83
tw_rate_module::merge_theoretical_weak_rates
subroutine merge_theoretical_weak_rates(rrate_array, rrate_length)
Merge theoretical weak rates into larger rate array.
Definition: tw_rate_module.f90:209
fission_rate_module::merge_fission_rates
subroutine, public merge_fission_rates(rrate_array, rrate_length, fiss_count)
Merge fission rates with larger array.
Definition: fission_rate_module.f90:460
rrt_ag
#define rrt_ag
Definition: macros.h:67
parameter_class::net_source
character(max_fname_len) net_source
list of isotopes included in the network (sunet)
Definition: parameter_class.f90:155
file_handling_class::close_io_file
subroutine, public close_io_file(unit_no, file_name)
Close an external file.
Definition: file_handling_class.f90:144
tw_rate_module
This module contains everything for the theoretical weak rates that are added into the rate array.
Definition: tw_rate_module.f90:23
rrt_bf
#define rrt_bf
Definition: macros.h:79
ls_timmes_eos_module::timmes_eos_state
Definition: ls_timmes_eos_module.f:23
rrt_sf
#define rrt_sf
Definition: macros.h:80
format_class
Define custom format statements used to read in major data files.
Definition: format_class.f90:16
tw_rate_module::output_binary_weak_reaction_data
subroutine, public output_binary_weak_reaction_data(path)
Save the theoretical weak rates to a unformatted binary file.
Definition: tw_rate_module.f90:391
alpha_decay_rate_module::init_alpha_decay_rates
subroutine, public init_alpha_decay_rates()
Initialize alpha decay rates.
Definition: alpha_decay_rate_module.f90:54
hydro_trajectory::ztemp
real(r_kind), dimension(:), allocatable, public ztemp
temperature information from trajectory
Definition: hydro_trajectory.f90:20
rrt_ng
#define rrt_ng
Definition: macros.h:65
analysis::cl_rate
integer cl_rate
Definition: analysis.f90:24
mergesort_module
Module mergesort_module for merging arrays of rates.
Definition: mergesort_module.f90:16
single_zone_vars
Simulation variables for a single zone model.
Definition: single_zone_vars.f90:11
parameter_class::ye_analytic
character(max_fname_len) ye_analytic
analytic electron fraction
Definition: parameter_class.f90:189
parameter_class::initemp_cold
real(r_kind) initemp_cold
T [GK] lowest allowed temperature to start the calculation from.
Definition: parameter_class.f90:113
single_zone_vars::rhob_p
real(r_kind) rhob_p
Density [g/cm^3].
Definition: single_zone_vars.f90:17
gear_module
gear_module contains adaptive high-order Gear solver
Definition: gear_module.f90:37
pardiso_class::sparse
subroutine, public sparse
Determines the position of jacobian entries in the cscf value array.
Definition: pardiso_class.f90:79
single_zone_vars::t9_p
real(r_kind) t9_p
Temperature [GK].
Definition: single_zone_vars.f90:15
inter_module::inverse_interp1d
subroutine, public inverse_interp1d(n, xp, xb, yp, res, flin, itype, reverse_type)
The inverse of the 1D interpolation function.
Definition: inter_module.f90:926
thermal_neutrino_module::thermal_neutrino_init
subroutine, public thermal_neutrino_init()
Initializes the thermal_neutrino_module.
Definition: thermal_neutrino_module.f90:48
rrt_nu
#define rrt_nu
Definition: macros.h:77
parameter_class
Contains all runtime parameters as well as phys and math constants.
Definition: parameter_class.f90:24
benam_class
Subroutines needed to initialise the network.
Definition: benam_class.f90:11
single_zone_vars::ye_p
real(r_kind) ye_p
Electron fraction [mol/g].
Definition: single_zone_vars.f90:19
parameter_class::initemp_hot
real(r_kind) initemp_hot
T [GK] for the starting point of the trajectory: =0: from the beginning; >0: from the last T>initemp.
Definition: parameter_class.f90:114