Go to the documentation of this file.
75 info_entry(
"network_init")
132 if (verbose_level.ge.1)
then
139 if (verbose_level.gt.2)
then
147 info_exit(
"network_init")
197 integer :: alloc_stat
198 real(
r_kind) :: dummy_hot, dummy_cold,dummy_temp
200 integer :: dummy_index_cold,dummy_index_hot
204 integer :: eos_status
205 logical :: init,converged
244 if ( alloc_stat /= 0)
call raise_exception(
'Allocating "Y_p" failed.',&
245 "prepare_simulation",300001)
248 "prepare_simulation",300001)
250 if ( alloc_stat /= 0)
call raise_exception(
'Allocating "dYdt" failed.',&
251 "prepare_simulation",300001)
254 "prepare_simulation",300001)
260 if (trim(trajectory_mode).EQ.
'from_file')
then
278 if ((
ztemp(i) .gt. dummy_temp) .and. (
ztemp(i) .gt. dummy_cold))
then
283 if (
ztemp(i).gt.dummy_hot) dummy_index_hot= i
288 if ((dummy_index_hot .eq. 1) .and. (
ztemp(1) .lt. dummy_hot))
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 '&
299 new_line(
"A")//
"Initemp is "&
301 "Check the trajectory and units.",&
302 "prepare_simulation",300003)
328 if (verbose_level.ge.1)
then
332 else if (trim(trajectory_mode).EQ.
'analytic')
then
352 if (verbose_level.ge.1)
then
356 call raise_exception(
"Unknown trajectory_mode '"//trim(adjustl(trajectory_mode))//
"'.",&
357 "prepare_simulation",300004)
393 if (verbose_level.ge.1)
then
399 if(
y(i).lt.1.d-25)
y(i)=0.d0
402 if (verbose_level.ge.1)
then
418 if(eos_status.ne.0)
call raise_exception(
"Error when calling the EOS. Called with:"//&
424 "prepare_simulation",300005)
466 character(len=*),
intent(in) :: path
467 character(max_fname_len) :: path_dir
479 path_dir = trim(path)//
"/"
481 call system(
'mkdir -p '//trim(adjustl(path_dir)))
542 logical,
intent(inout):: init
560 print *,
"Evolution mode: switching to nse"
578 print *,
"Evolution mode: switching to network"
587 print *,
"Evolution mode: switching on heating"
599 print *,
"Evolution mode: switching to cold network (only experimental rates)"
618 ').',
"prepare_simulation", 300006)
665 integer :: reactions,weak_unit
666 integer :: i,i1,i2,i3,cnt,wcnt
672 write(reactions,
'(t11,a41)') &
673 'OVERVIEW OF ALL REACTIONS IN THE NETWORK'
675 write(weak_unit,
'(t11,a46)') &
676 'OVERVIEW OF ALL WEAK-REACTIONS IN THE NETWORK'
684 select case(
rrate(i)%group)
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'
697 if(
rrate(i)%is_weak)
then
709 if(
rrate(i)%is_weak)
then
717 if (
rrate(i)%parts(5).eq.0)
then
732 if(
rrate(i)%is_weak)
then
733 if (
rrate(i)%parts(5).eq.0)
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'
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'
793 if (
rrate(i)%parts(6).ne.0)
then
801 else if(
rrate(i)%parts(5).ne.0)
then
820 write(reactions,840)
"spontaneous fission"
822 write(reactions,840)
"beta-delayed fission"
824 write(reactions,840)
"neutron-induced fission"
826 write(reactions,840)
"n-gamma"
828 write(reactions,840)
"alpha-gamma"
830 write(reactions,840)
"p-gamma"
832 write(reactions,840)
"gamma-n"
834 write(reactions,840)
"gamma-alpha"
836 write(reactions,840)
"gamma-p"
838 write(reactions,840)
"p-n"
840 write(reactions,840)
"n-p"
842 write(reactions,840)
"alpha-n"
844 write(reactions,840)
"n-alpha"
846 write(reactions,840)
"alpha-p"
848 write(reactions,840)
"p-alpha"
850 write(reactions,840)
"neutrino"
852 write(reactions,840)
"other"
854 write(reactions,840)
"beta minus"
856 write(reactions,840)
"beta plus"
858 write(reactions,840)
"alpha decay"
860 write(reactions,840)
"p emission"
862 write(reactions,840)
"n emission"
864 write(reactions,840)
"Electron capture"
866 write(reactions,840)
"unknown"
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)
933 character*5,
dimension(6) :: 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
945 111
format(i1,t3,6a5,t35,f7.3,t44,a4)
946 222
format(6(i2,1x),t22,f7.3)
959 integer,
intent(in) :: ind
960 character*5,
dimension(6),
intent(out) :: names
964 if(
rrate(ind)%parts(i).lt.1)
then
real(r_kind), dimension(:), allocatable y
integer iwformat
defines format of the weak rates (0 = tabulated, 1 = log<ft>)
subroutine, public merge_beta_decays(rrate_array, rrate_length)
Merge external beta decays into the larger rate array.
Module to calculate electron screening.
subroutine, public init_nuflux()
Initialize nuflux module.
logical, public heating_switch
Variables related to nuclear heating.
real(r_kind) nse_descend_t9start
high initial temperature in GK for winnse_descend subroutine
character *5, dimension(:), allocatable, public net_names
list of isotopes contained in the network
subroutine, public winnse_guess(t9, rho, ye, yn_guess, yp_guess, ysol)
Calculate NSE composition with an initial guess.
integer, public ipro
index of alphas, neutrons and protons
type(reactionrate_type), dimension(:), allocatable, public rrate
array containing all reaction rates used in the network
subroutine, public init_gear_solver(Y, t_init, h_init)
Initialize iteration variables.
integer cl_cmax
system clock variables
Module inter_module with interpolation routines.
subroutine, private print_debug()
Print a debug file of the reaction.
subroutine, public merge_neutrino_rates(rrate_array, rrate_length)
Routine to merge neutrino rates into rrate array.
subroutine init_nucstuff()
Initialize nucstuff class.
subroutine, public merge_reaclib_rates(rrate_array, rrate_length)
Merge the reaclib rates into a larger array.
subroutine, public init_fission_rates()
Initialize the fission reactions.
Module that deals with reaclib reaction rates.
subroutine, public mergesort_init()
Initialize the mergesort module and open files for debugging.
subroutine, public init_inverse_rates()
Initialize everything for the inverse rates.
integer flow_every
flow output frequency
Takes care of the temperature and entropy updates due to the nuclear energy release.
subroutine expansion_init()
Initialize the expansion module and open files for debugging.
subroutine, public nuclear_heating_init(T9, rho, Ye, Y, entropy)
Nuclear heating initialization routine.
integer h_flow_every
flow output frequency in hdf5 format
Subroutines to handle parametric evolution of hydrodynamic quantities after the final timestep of the...
subroutine, public merge_alpha_decays(rrate_array, rrate_length)
Merge alpha decays into the larger rate array.
integer termination_criterion
condition to terminate the simulation ([0]=trajectory_file, 1=final_time, 2=final_temp,...
subroutine, public unit_define()
Declares values for the elements in unit_type.
Module to deal with fission reactions.
This module contains subroutines to include external beta decays.
character(:) function, allocatable, public int_to_str(num)
Converts a given integer to a string.
real(r_kind) nsetemp_cold
T [GK] for the nse->network switch.
integer evolution_mode
NSE, network hot/cold, etc.
This module contains subroutines to add alpha decays.
subroutine output_param_prepared_network(path)
Output relevant parameters to a file in the prepared network path.
subroutine timmes_eos(var, vin, d, Ye, state, status)
real(r_kind) final_dens
termination density [g/cm3]
subroutine, public output_binary_neutrino_reaction_data(path)
Write the reactions to a file in binary format.
subroutine, public raise_exception(msg, sub, error_code)
Raise a exception with a given error message.
real(r_kind) initial_stepsize
this value is used as a stepsize at initial step
subroutine, public nse_init()
Allocates and initialises various arrays needed for the nse calculation.
subroutine, public init_reaclib_rates()
Count and read reaclib reactions.
real(r_kind) rkm_p
Radius of the outflow [km].
subroutine, public switch_evolution_mode(init)
Switches between NSE and network modes (EM_NSE / EM_NETHOT / EM_NETCOLD)
Subroutines for initialization and parameter parsing.
Module to prepare the reaction network.
subroutine, public reload_exp_weak_rates()
This routine is used to replace theoretical weak rates with experimental ones it's called when T9 < p...
integer, parameter, public max_fname_len
maximum length of filenames
subroutine, public output_binary_tabulated_reaction_data(path)
Save the theoretical tabulated rates to a unformatted binary file.
character(max_fname_len) rho_analytic
analytic density [g/cm3]
type(isotope_type), dimension(:), allocatable, public isotope
all nuclides used in the network
subroutine create_rate_folder(path)
Create a folder with binary files that contain all necessary reaction data.
subroutine, public write_data_to_std_out(str_msg, value_str, unit)
Write data to the standard output (usually OUT)
subroutine, public output_binary_network_data(path)
Save the general network information to a binary file.
real(r_kind), dimension(:), allocatable, public ztime
time information from trajectory
Module with helper functions such as rate tabulation, partition functions, and theoretical weak rates...
Contains variables and parameters related to neutrino fluxes.
character(max_fname_len) rkm_analytic
analytic radial scale [km]
subroutine, public interp1d(n, xp, xb, yp, res, flin, itype)
Interface for 1D interpolation routines.
real(r_kind) heating_density
Density at which nuclear heating will be switched on (-1) to always include heating.
subroutine, private print_reactions()
Print an overview of the reactions involved in the calculation.
subroutine, public init_tabulated_rates()
Initialize tabulated rates.
logical, public weak
switch for weak rates
real(r_kind) ent_p
Entropy [kB/baryon].
subroutine, public merge_inverse_rates(rrate_array, rrate_length)
Delete and create new inverse rates.
real(r_kind), dimension(:), allocatable f
subroutine output_binary_parameter_data(path)
Output the parameter data to a binary file.
Subroutines for equation parsing in case of an analytic trajectory or luminosity mode.
real(r_kind), dimension(:), allocatable, public zrad
radii from trajectory
logical read_initial_composition
specify whether initial distribution of abundances should be read from file
real(r_kind) t_analytic
for parameteric trajectories: initial time
subroutine, public find_start_value(input_string, eq_value, initial_guess, converged, result)
Finds a value of the variable for a given y-value.
The thermal_neutrino_module serves as interface to the neutrino emission routines from the sneut5....
subroutine, public init_screening(nreac)
Initialize the screening module.
Module that deals with inverse reaction rates.
subroutine, public read_seed(iniab)
Reads in seed abundances from file parameter_class::seed_file.
integer solver
solver flag (0 - implicit Euler, 1 - Gear's method, ...), is integer as it is faster than comparing s...
subroutine, public readini_init()
Initialize the readini module and open files.
real(r_kind) function, public parse_string(input_string, var_value)
Takes a string and evaluates the expression.
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...
integer, public net_size
total number of isotopes (network size)
subroutine, public init_ext_beta_rates()
Initialize external beta decay rates.
subroutine, public analysis_init()
Open files, write headers, allocate space etc.
Provide some basic file-handling routines.
subroutine, public prepare_simulation
All the necessary initializations and settings before the main loop.
character(:) function, allocatable, public num_to_str(num)
Converts a given real to a string with format "(1pE10.2)".
integer heating_mode
Mode for heating: 0 - no heating, 1 - heating using an entropy equation, 2 - heating from the energy ...
Contains various routines for analysis and diagnostic output.
integer init_index
Initial index in the trajectory.
subroutine, private network_init()
Main initialising subroutine. calls reading subroutines and fills the reactionrate array.
Contains subroutines for sparse matrix assembly and the solver core.
subroutine, public flow_init()
Initialise flow subroutine.
real(r_kind) stepsize
Stepsize.
subroutine, public output_binary_fission_reaction_data(path)
Save the fission data to a unformatted binary file.
real(r_kind) nsetemp_hot
T [GK] for the nse<-network switch.
Provides subroutines to calculate reaction flows.
integer zsteps
number of timesteps in the hydro trajectory
Contains arrays representing thermodynamic conditions from hydro trajectory file.
real(r_kind), dimension(:), allocatable, public zdens
density information from trajectory
subroutine, public get_nuclear_properties()
Reads nuclear properties (name,a,n,z,spin,mass excess,partition functions) from file 'winvn' and htpf...
subroutine output_binary_reaclib_reaction_data(path)
Save the complete rrate array to a binary file.
subroutine, private getnames(ind, names)
Get the names of a certain reaction.
real(r_kind), dimension(:), allocatable dydt
Time derivative of the abundances.
subroutine, public get_minmax()
Returns Amin and Amax for each isotopic chain in minmax.
real(r_kind), dimension(:), allocatable y_p
Abundances.
real(r_kind) final_time
termination time in seconds
subroutine, public init_theoretical_weak_rates()
Initialize theoretical weak rates.
real(r_kind) final_temp
termination temperature [GK]
This module contains everything for the tabulated rates that can replace reaclib rates.
subroutine, public merge_tabulated_rates(rrate_array, rrate_length)
Merge tabulated rates into larger rate array.
integer function, public open_outfile(file_name)
Shorthand for opening a new file for writing (output file)
real(r_kind), dimension(:), allocatable, public zye
electron fraction information from trajectory
Contains types and objects shared between multiple modules.
character(:) function, allocatable, public get_net_name(index, trimmed)
Getter of net_names, translating indices to a nucleus name.
character(max_fname_len) t9_analytic
analytic temperature [T9]
integer, public nreac
total number of reactions
real(r_kind) temp_reload_exp_weak_rates
temperature below which one should not use theoretical weak rates so they are replaced with exp....
subroutine merge_theoretical_weak_rates(rrate_array, rrate_length)
Merge theoretical weak rates into larger rate array.
subroutine, public merge_fission_rates(rrate_array, rrate_length, fiss_count)
Merge fission rates with larger array.
character(max_fname_len) net_source
list of isotopes included in the network (sunet)
subroutine, public close_io_file(unit_no, file_name)
Close an external file.
This module contains everything for the theoretical weak rates that are added into the rate array.
subroutine, public output_binary_weak_reaction_data(path)
Save the theoretical weak rates to a unformatted binary file.
subroutine, public init_alpha_decay_rates()
Initialize alpha decay rates.
real(r_kind), dimension(:), allocatable, public ztemp
temperature information from trajectory
Module mergesort_module for merging arrays of rates.
Simulation variables for a single zone model.
character(max_fname_len) ye_analytic
analytic electron fraction
real(r_kind) initemp_cold
T [GK] lowest allowed temperature to start the calculation from.
real(r_kind) rhob_p
Density [g/cm^3].
gear_module contains adaptive high-order Gear solver
subroutine, public sparse
Determines the position of jacobian entries in the cscf value array.
real(r_kind) t9_p
Temperature [GK].
subroutine, public inverse_interp1d(n, xp, xb, yp, res, flin, itype, reverse_type)
The inverse of the 1D interpolation function.
subroutine, public thermal_neutrino_init()
Initializes the thermal_neutrino_module.
Contains all runtime parameters as well as phys and math constants.
Subroutines needed to initialise the network.
real(r_kind) ye_p
Electron fraction [mol/g].
real(r_kind) initemp_hot
T [GK] for the starting point of the trajectory: =0: from the beginning; >0: from the last T>initemp.