detailed_balance.f90
Go to the documentation of this file.
1 !> @file detailed_balance.f90
2 !!
3 !! The error file code for this file is ***W26***.
4 !!
5 !! Contains the module \ref detailed_balance
6 
7 
8 !> @brief Module that deals with inverse reaction rates.
9 !!
10 !! This module is only used when \ref parameter_class::use_detailed_balance is
11 !! enabled. The detailed balance is calculated as follows:
12 !!
13 !! \f[
14 !! \sigma_\mathrm{inv} = N_A^{-n}
15 !! \delta
16 !! \left(\frac{\prod_i A_i}{\prod_j A_j}\right)^{1.5}
17 !! \left(\frac{\prod_i g_i}{\prod_j g_j}\right)
18 !! \left( \frac{m_u k_B T}{2\pi \hbar^2}\right)^{1.5 \cdot n}
19 !! e^{-Q/(k_B T)}
20 !! \sigma_\mathrm{forw},
21 !! \f]
22 !! where \f$n\f$ is the number of reactants minus the number of products,
23 !! \f$ N_A \f$ is Avogadros number, \f$A_i\f$ is the mass number of reactants of the forward reaction,
24 !! \f$A_j\f$ the number of products of the forward reaction, \f$g_i\f$ the spin factor \f$ 2J_i +1\f$
25 !! of reactants (j, for products), Q the q-value of the forward reaction, T the temperature
26 !! and \f$ \sigma_\mathrm{forw} \f$ the forward reaction.
27 !!
28 !! The necessity of calculating detailed balance within the network is given by the
29 !! tabulated rates that may not easily obey the detailed balance principle otherwise.
30 !! Furthermore, there exist inconsistencies between the reaclib Q-value and the
31 !! Q-value calculated by the winvn (version downloaded 24.07.22).
32 !! The Q-value given in the reaclib are mostly used for calculating the inverse rates.
33 !! However there seem to exist also some other inconsistencies.
34 !! An example of an inconsistent q-value in reaclib is given by the reaction:
35 !! n + k55 -> k56
36 !! other inconsistencies are included in, e.g.,
37 !! n + ge89 -> ge90
38 !! or p + co52 -> ni53 which deviates by a (almost) constant factor of 4 indicating
39 !! a different spin that was used in reaclib to calculate the inverse reaction.
40 !! @image html k56.png "Reaction calculated with detailed balance and taken from reaclib (25.07.22)" height=280
41 !! @image html ni53.png "Reaction calculated with detailed balance and taken from reaclib (25.07.22)" height=280
42 !! This problem was also topic of
43 !! [Lippuner & Roberts 2017](https://ui.adsabs.harvard.edu/abs/2017ApJS..233...18L/abstract).
44 !!
45 !! The essence of a discussion with H. Schatz is that reaclib reactions can be based on other mass models/data
46 !! than the winvn table. Every reaclib reaction can have its own set of mass tables. It might be better to
47 !! calculate inverse reaction yourself in the network as you will be more consistent, especially close to
48 !! equilibrium values such as NSE. However, this goes to the cost of an inconsistency between the inverse
49 !! and forward rate as the forward rate involves other mass models for the calculation. For (n,gamma) reactions
50 !! that are based on Hauser-Feshbach, Hendrik suggested that one could use a scaling relation of the forward rate
51 !! based on the Q-value differences.
52 !!
53 !!
54 !! @author M. Reichert
55 !! @date 22.07.22
56 #include "macros.h"
61  implicit none
62 
63  integer,private :: ninv !< Number of inverse rates
64  integer,private :: ninv_old !< Number of old inverse rates
65 
66  ! Helper variables for ignoring specific sources
67  character(len=4),allocatable,dimension(:),private :: src_ignore
68  integer,private :: src_ignore_length
69  character(len=4),allocatable,dimension(:),private :: src_q_reacl
70  integer,private :: src_q_reacl_length
71  character(len=4),allocatable,dimension(:),private :: src_q_winvn
72  integer,private :: src_q_winvn_length
73 
74  !
75  ! Public and private fields and methods of the module
76  !
77  public:: &
79  private:: &
81 
82 
83  contains
84 
85 
86 
87  !> Initialize everything for the inverse rates
88  !!
89  !! This subroutine analyzes the parameters to determine which rates have to
90  !! be replaced and which Q-value has to be used.
91  !!
92  !! @author M. Reichert
93  !! @date 04.08.22
94  subroutine init_inverse_rates()
98  implicit none
99 
100  ! Dont do anything if not enabled
101  if ((.not. use_detailed_balance) .or. use_prepared_network) return
102 
103  info_entry("init_inverse_rates")
104 
105  ! Get the ignore source string as array
107  ! Source strings for which the Q-value of reaclib should be used
109  ! Source strings for which the Q-value of winvn should be used
111 
112  ! Give some verbose output
113  if (verbose_level .ge. 2) then
114  write(*,*) "Detailed balance: ignoring source : ",src_ignore
115  write(*,*) "Detailed balance: use Q-value reaclib: ",src_q_reacl
116  write(*,*) "Detailed balance: use Q-value winvn : ",src_q_winvn
117  end if
118 
119  info_exit("init_inverse_rates")
120 
121  end subroutine init_inverse_rates
122 
123 
124 
125  !> Delete and create new inverse rates
126  !!
127  !! This routine first identifies included reverse rates and deletes them.
128  !! Afterwards, new reverse rates are created and attached to the rate array at the end.
129  !! The position of the rates at the end of the array is important as they will use the
130  !! previously calculated forward rates. Weak reactions, fission, and chapter 7
131  !! reactions do not have any inverse reaction. This routine also stores
132  !! the index of the forward reaction in %param(1).
133  !!
134  !! @author M. Reichert
135  !! @date 22.07.22
136  subroutine merge_inverse_rates(rrate_array,rrate_length)
137  use benam_class, only: getcoefficients
139  implicit none
140  ! Declare the pass
141  type(reactionrate_type),dimension(:),allocatable,intent(inout) :: rrate_array !< Large rate array, containing all reactions
142  integer,intent(inout) :: rrate_length !< length of rrate_array
143  ! Internal varialbes
144  integer :: i !< Loop variable
145  type(reactionrate_type) :: rr_tmp !< Temporary reaction rate
146  integer :: newlength !< New rate array length
147  integer :: count !< Helper variable
148  type(reactionrate_type),dimension(:),allocatable :: new_rrate_array !< New rate array
149  integer :: rstat !< Allocation status
150  integer,dimension(11) :: ignore_inv !< Ignore these chapters for inverse rates
151 
152  ! Only do something when parameter is enabled
153  if ((.not. use_detailed_balance) .or. use_prepared_network) return
154 
155  info_entry("merge_inverse_rates")
156 
157  ! For testing:
158  ! Chapters that appear in the following array as number
159  ! will use the reverse rates of the reaclib. E.g.,
160  ! the following will ignore chapter 2 and 4:
161  ! ignore_inv = (/-1,2,-1,4,-1,-1,-1,-1,-1,-1,-1/)
162  ! With only "-1" included, nothing will be ignored
163  ! and all reaclib reverse rates will be replaced
164  ! by detailed balance ones.
165  ignore_inv = (/-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1/)
166 
167  ! Count the inverse rates
168  ninv = 0
169  ninv_old = 0
170  ! Go through the rates and check if one has to add an inverse one
171  do i=1,rrate_length
172  ! For shorter writing
173  rr_tmp = rrate_array(i)
174 
175  if (verbose_level .gt. 2) then
176  ! This happens in the current reaclib...
177  if (rr_tmp%is_weak .and. rr_tmp%is_reverse) then
178  write(*,*) "Detected rate that is weak and reverse!"
179  end if
180  end if
181 
182  ! Skip weak rates, neutrino rates, fission
183  if (rr_tmp%is_weak) cycle
184  if (rr_tmp%reac_src .eq. rrs_nu) cycle
185  if (rr_tmp%reac_src .eq. rrs_fiss) cycle
186  ! Ignore rates that have to be specified in the ignore list
187  if (any(src_ignore .eq. adjustr(rr_tmp%source))) cycle
188 
189  ! In case chapters should get ignored
190  if (any(ignore_inv==rr_tmp%group)) cycle
191 
192  ! Count old inverse rates
193  if (rr_tmp%is_reverse) then
194  ninv_old = ninv_old +1
195  cycle
196  end if
197 
198  ! Every other rate should have an inverse
199  ninv = ninv+1
200  end do
201 
202  ! Allocate the new array
203  newlength = rrate_length-ninv_old+ninv
204  allocate(new_rrate_array(newlength), stat = rstat)
205  if (rstat /= 0) call raise_exception('Allocation of "new_rrate_array" failed.',&
206  "merge_inverse_rates", 260001)
207 
208  ! Write all non reverse rates in new array
209  count = 1
210  do i=1,rrate_length
211  ! For shorter writing
212  rr_tmp = rrate_array(i)
213 
214  ! Skip reverse rates (however, not the weak ones)
215  ! Ignore some chapters if you want..
216  ! Ignore the list of ignore sources..
217  if (rr_tmp%is_reverse .and. (.not. rr_tmp%is_weak) .and. &
218  (.not. (any(ignore_inv==rr_tmp%group))) .and. &
219  (.not. (any(src_ignore == adjustr(rr_tmp%source))))) then
220  cycle
221  end if
222 
223  ! Add all non reverse rates here
224  new_rrate_array(count) = rr_tmp
225 
226  ! next rate
227  count = count+1
228  end do
229 
230  ! Now create the reverse rates
231  do i=1,newlength
232 
233  ! For shorter writing
234  rr_tmp = new_rrate_array(i)
235 
236  ! ignore some chapters in case that it is enabled
237  if (any(ignore_inv==rr_tmp%group) .or. &
238  any(src_ignore == adjustr(rr_tmp%source))) then
239  cycle
240  end if
241 
242  ! Skip reverse rates
243  if (rr_tmp%is_reverse) then
244  cycle
245  end if
246 
247  ! Skip weak rates, neutrino rates, fission
248  if (rr_tmp%is_weak) cycle
249  if (rr_tmp%reac_src .eq. rrs_nu) cycle
250  if (rr_tmp%reac_src .eq. rrs_fiss) cycle
251 
252  ! Add reverse rate
253  call create_inverse_rate(rr_tmp,new_rrate_array(count))
254  ! index of the forward rate
255  new_rrate_array(count)%param(1)=i
256 
257  ! Set the Q-value of forward and inverse reactions based on the
258  ! parameter "use_detailed_balance_q_reac". If this is true,
259  ! the Q-value from the reaclib will be used, otherwise
260  ! it will be calculated from the winvn
261  if ((use_detailed_balance_q_reac) .or. (any(src_q_reacl== rr_tmp%source)) .and. &
262  (.not. any(src_q_winvn== rr_tmp%source)) ) then
263  ! Set the q_value consistent to the reaclib!
264  new_rrate_array(count)%q_value = -new_rrate_array(i)%q_value
265  elseif ((.not. use_detailed_balance_q_reac) .or. (any(src_q_winvn== rr_tmp%source)) .and. &
266  (.not. any(src_q_reacl== rr_tmp%source))) then
267  ! Set the q_value consistent to the winvn as they differ for some reactions!
268  new_rrate_array(i)%q_value = -new_rrate_array(count)%q_value
269  end if
270 
271  ! next rate
272  count = count+1
273  end do
274 
275  ! Get coefficients like one_over_nfrac for inverse rates
276  if (ninv .ne. 0) then
277  call getcoefficients(new_rrate_array(newlength-ninv+1:newlength),ninv)
278  end if
279 
280  ! Give verbose output
281  if (verbose_level .ge. 2) then
282  call write_reac_rate(new_rrate_array,newlength,rrate_array,rrate_length)
283  end if
284 
285  ! Write into the correct array and resize the old one
286  deallocate(rrate_array, stat = rstat)
287  if (rstat /= 0) call raise_exception('Deallocation of "rrate_array" failed.',&
288  "merge_inverse_rates", 260002)
289  allocate(rrate_array(newlength), stat = rstat)
290  if (rstat /= 0) call raise_exception('Allocation of "rrate_array" failed.',&
291  "merge_inverse_rates", 260001)
292 
293  rrate_array(:) = new_rrate_array(:)
294  deallocate(new_rrate_array, stat = rstat)
295  if (rstat /= 0) call raise_exception('Deallocation of "new_rrate_array" failed.',&
296  "merge_inverse_rates", 260002)
297  ! set the new length
298  rrate_length = newlength
299 
300  ! Say how it worked out
302 
303  info_exit("merge_inverse_rates")
304 
305  end subroutine merge_inverse_rates
306 
307 
308  !> Routine to create an inverse rate, based on the forward rate.
309  !!
310  !! Writes the correct nuclei in the parts array of each reaction.
311  !! Furthermore, as the %param() array of the rates is not used, it is redefined to contain:
312  !! - 1: Index to forward rate in rate array
313  !! - 2: #Products - #Reactants.
314  !! - 3: \f$ 1.5 \cdot \log(A_{r1} \cdot ...) / (A_{p1} \cdot ...) \f$, with A_r being
315  !! the mass number of the reactants and A_p of the products.
316  !! - 4: \f$ 1.5 \cdot \log(M_u/(2.0\cdot \pi \cdot \hbar^2)) \f$.
317  !! - 5: \f$ - \log((2J_{r1}+1) \cdot ...) / ((2J_{p1}+1) \cdot ...) \f$, with J_r being
318  !! the spin of the reactants and J_p of the products.
319  !! . Additionally, the Q-value is calculated from the mass excess.
320  !!
321  !! @author M. Reichert
322  !! @date 22.07.22
323  subroutine create_inverse_rate(forward_rate,inverse_rate)
325  use global_class, only: isotope
326  use parameter_class, only: unit
328  implicit none
329  type(reactionrate_type),intent(in) :: forward_rate !< Temporary reaction rate
330  type(reactionrate_type),intent(out) :: inverse_rate !< Temporary reaction rate
331  ! Internal variables
332  integer :: nr_prod,nr_react !< Number of products/reactants
333  integer :: inv_chapter !< Inverse reaclib chapter
334  integer :: i,j !< Loop variable
335 
336  ! Initialize the rate
337  inverse_rate%param(:) = 0 ! will only be used for the index of forward rate
338  inverse_rate%source = "detb" ! detailed balance
339  inverse_rate%reac_src = rrs_detb ! detailed balance
340  inverse_rate%is_weak = .false. ! not allowed to be a weak rate
341  inverse_rate%is_resonant = forward_rate%is_resonant
342  inverse_rate%reac_type = rrt_o ! The type is set at the end of this subroutine
343  inverse_rate%nu_frac = 0 ! No weak reaction is given a inverse one, so no neutrino should be here
344 
345  ! The %parts are used to store basic things in order not to
346  ! recalculate everything all over again
347  ! -%param(1) : Index of forward reaction in reaction rate array
348  ! -%param(2) : Difference of amount of reactions - products
349  ! -%param(3) : Prod(A_reac)/Prod(A_prod)
350  ! -%param(4) : Constant for calculation of inverse rate
351  ! -%param(5) : Spin factor
352 
353  ! Flag the reverse
354  inverse_rate%is_reverse = .true.
355  ! Get the correct chapter and put the nuclei on correct place
356 
357  ! Get number of products/educts of forward rate (#educt -> #product)
358  nr_prod = get_nr_products(forward_rate%group)
359  nr_react = get_nr_reactants(forward_rate%group)
360 
361  ! Chapter 8 might be different, check manually once again for it
362  if (forward_rate%group .eq. 8) then
363  nr_prod = count(forward_rate%parts/=0)-nr_react
364  end if
365 
366  ! Get the inverse reaclib chapter
367  inv_chapter = get_chapter(nr_prod,nr_react)
368  inverse_rate%group=inv_chapter
369 
370  ! Swap the parts
371  inverse_rate%parts(:) = 0
372  do i=1,nr_prod
373  inverse_rate%parts(i) = forward_rate%parts(i+nr_react)
374  end do
375  do j=1,nr_react
376  inverse_rate%parts(j+nr_prod) = forward_rate%parts(j)
377  end do
378 
379  ! Calculate the Q-Value
380  inverse_rate%q_value = 0
381  do i=1,nr_prod
382  inverse_rate%q_value = inverse_rate%q_value - &
383  isotope(inverse_rate%parts(i))%mass_exc
384  end do
385  do j=1,nr_react
386  inverse_rate%q_value = inverse_rate%q_value + &
387  isotope(inverse_rate%parts(j+nr_prod))%mass_exc
388  end do
389 
390  ! Save the difference between #prods and #educts
391  inverse_rate%param(2) = dble(nr_prod-nr_react)
392 
393  ! Factor of masses
394  ! Prod(A_reac)/Prod(A_prod)
395  inverse_rate%param(3) = 1
396  do i=1,nr_prod
397  inverse_rate%param(3) = inverse_rate%param(3) * &
398  dble(isotope(inverse_rate%parts(i))%mass)
399  end do
400  do j=1,nr_react
401  inverse_rate%param(3) = inverse_rate%param(3) / &
402  dble(isotope(inverse_rate%parts(j+nr_prod))%mass)
403  end do
404 
405  ! Spin factor
406  inverse_rate%param(5) = 1
407  do i=1,nr_prod
408  inverse_rate%param(5) = inverse_rate%param(5) * &
409  (2.0*isotope(inverse_rate%parts(i))%spin+1.0)
410  end do
411  do j=1,nr_react
412  inverse_rate%param(5) = inverse_rate%param(5) / &
413  (2.0*isotope(inverse_rate%parts(j+nr_prod))%spin+1.0)
414  end do
415 
416  ! Convert to the correct format that is necessary later
417  inverse_rate%q_value = -inverse_rate%q_value
418  inverse_rate%param(2) = -inverse_rate%param(2)
419  inverse_rate%param(3) = -dlog(inverse_rate%param(3)**(3.0/2.0))
420  inverse_rate%param(4) = (3./2.)*dlog((unit%mass_u/((2.0*unit%pi*(unit%hbc*1d-13)**2.))))
421  inverse_rate%param(5) = -dlog(inverse_rate%param(5))
422 
423  ! Set the reaction type
424  call set_reaction_type(inverse_rate)
425 
426  end subroutine create_inverse_rate
427 
428 
429 
430  !> Calculate the inverse rate from the forward one via detailed balance.
431  !!
432  !! This subroutine calculates the inverse rate via detailed balance. Detailed balance
433  !! gives a direct relation between forward and inverse reaction.
434  !!
435  !! @note This subroutine also sets a threshold for inverse rates in case the Q-value
436  !! for a photodissociation is positive. In this case the rates can diverge towards
437  !! lower temperatures. This can mess up convergence of the system due to precision errors.
438  !! For the default FRDM winvn/reaclib q-values this is not a problem, however, when
439  !! using other mass models or when varying the masses it can become a problem.
440  !!
441  !! @see [Fowler, Caughlan, and Zimmerman (1967)](https://www.annualreviews.org/doi/10.1146/annurev.aa.05.090167.002521)
442  !! @author M. Reichert
443  !! @date 22.07.22
444  !!
445  !! \b Edited:
446  !! - 18.11.22; M.R: implemented more restrictive cutoff for the rates in case of
447  !! positive q-values
448  !! .
449  subroutine calculate_detailed_balance(temp,rrate_array,inverse_rate,rate)
450  use parameter_class, only: unit
451  use global_class, only: nreac
452  implicit none
453  ! Declare the pass
454  type(reactionrate_type),dimension(nreac),intent(in) :: rrate_array !< Large rate array, containing all reactions
455  type(reactionrate_type),intent(in) :: inverse_rate !< inverse reaction rate to evaluate
456  real(r_kind),intent(in) :: temp !< Temperature [GK]
457  real(r_kind),intent(out) :: rate !< Value for the reaction rate
458  ! Internal variables
459  type(reactionrate_type) :: forward_rate !< forward reaction rate
460  real(r_kind) :: kbt !< kB*T
461  real(r_kind) :: delta !< Variables with one_over_n_fac
462  real(r_kind) :: rat !< Storage for log(forward rate)
463  real(r_kind),parameter :: cutoff_cr_h=90 !< Cutoff for the crosssection for low temperatures
464  real(r_kind),parameter :: cutoff_cr_m=70 !< Cutoff for the crosssection for low temperatures
465  real(r_kind),parameter :: cutoff_cr_l=60 !< Cutoff for the crosssection for low temperatures
466  real(r_kind),parameter :: cutoff_t9_h=1d0 !< Temperature below which the rate will be cut
467  real(r_kind),parameter :: cutoff_t9_m=8d-1!< Temperature below which the rate will be cut
468  real(r_kind),parameter :: cutoff_t9_l=5d-1!< Minimum temperature for the cut
469  real(r_kind) :: maxrat !< helper variable to set a maximum rate
470 
471  ! Check that the code really should calculate detailed balance
472  if (.not. use_detailed_balance) then
473  call raise_exception("Parameter for enabling detailed balance calculation was "//&
474  "turned off, but trying to calculate it."//new_line("A"),&
475  "calculate_detailed_balance",260005)
476  end if
477 
478  kbt = (unit%k_mev*1.0d9*temp) ! MeV/GK
479 
480  ! Save the forward rate
481  forward_rate = rrate_array(int(inverse_rate%param(1)))
482 
483  ! Get the forward rate, as the inverse rates are at the end of the array,
484  ! there is no need to recalculate
485  rat = dlog(forward_rate%cached_p)
486 
487  ! Double counting factors
488  delta = dlog(forward_rate%one_over_n_fac/inverse_rate%one_over_n_fac)
489 
490  ! Calculation of the rate
491  rate = inverse_rate%param(3) +\
492  inverse_rate%param(2) * inverse_rate%param(4) +\
493  inverse_rate%param(5) +\
494  delta +\
495  inverse_rate%param(2)*dlog(kbt**(3./2.))+\
496  inverse_rate%q_value/(kbt)-\
497  inverse_rate%param(2)*dlog(unit%n_a) +\
498  rat
499 
500  ! I'm restricting the rate here since some rates close to the dripline are
501  ! diverging. An example of such an diverging rate is given by
502  ! the inverse rate of:
503  ! k55 + n -> k56
504  ! The problem with this rate is that the q-value according to the winvn is:
505  ! mexc(k55) + mexc(n) - mexc(k56) = Q
506  ! (-0.270) + (8.071) - (8.747) = -0.946 MeV
507  ! The Q-value in reaclib is: 1.676 MeV. The reaclib value
508  ! is the value that is used for the inverse rate in reaclib.
509  ! When using a negative q-value, we get however a rate that is
510  ! ~exp(q/kbT) [so positive], so it is diverging towards lower temperatures.
511  ! This also makes sense as the system should be unstable when getting energy
512  ! from breaking up the nucleus.
513  ! As most of the rates are close to zero for low temperatures, a diverging
514  ! rate can mess up the DGL system completely leading to a crash by
515  ! precision errors.
516  if ((temp .lt. cutoff_t9_h ) .and. (inverse_rate%q_value .gt. 0)) then
517 
518  ! Limit the rate in a smooth way and in two steps
519  if ((temp .gt. cutoff_t9_l) .and. (temp .le. cutoff_t9_m)) then
520  ! Linear interpolation
521  maxrat = (cutoff_cr_l*(cutoff_t9_m-temp) + cutoff_cr_m*(temp-cutoff_t9_l))/&
522  (cutoff_t9_m-cutoff_t9_l)
523  elseif ((temp .gt. cutoff_t9_m) .and. (temp .le. cutoff_t9_h)) then
524  ! Linear interpolation
525  maxrat = (cutoff_cr_m*(cutoff_t9_h-temp) + cutoff_cr_h*(temp-cutoff_t9_m))/&
526  (cutoff_t9_h-cutoff_t9_m)
527  else
528  maxrat = cutoff_cr_l
529  end if
530 
531  ! Limit it
532  if ((rate .gt. maxrat)) rate = maxrat
533 
534  end if
535 
536  ! General cutoff
537  if ((rate .gt. cutoff_cr_h)) rate = cutoff_cr_h
538 
539  rate = dexp(rate)
540  end subroutine calculate_detailed_balance
541 
542 
543 
544  !> Verbose routine to output one inverse reaction of chapter 4-9
545  !!
546  !! This subroutine outputs one forward, one calculated inverse, and
547  !! the same inverse as given by the reaclib for chapter 4-9.
548  !! All other chapters do not have forward rates so far.
549  !! The calculated inverse and reaclib inverse should to large extends
550  !! agree. There might be a small deviation due to different q-values
551  !! used in the reaclib and in the winvn. This routine is only
552  !! called when verbose_level is greater or equal two.
553  !!
554  !! @note For all chapter 7 reactions, the double counting factor seems
555  !! to be missing in the inverse rate of Reaclib (31.7.2022).
556  !!
557  !! @author M. Reichert
558  !! @date 30.07.22
559  subroutine write_reac_rate(rate_array,nrea,rate_array_old,nrea_old)
560  use global_class, only: ihe4, ineu, ipro
561  use benam_class, only: benam
562  use nucstuff_class, only: calc_t9_pow
565  implicit none
566  ! Declare the pass
567  integer,intent(in) :: nrea,nrea_old !< Length of rate arrays
568  type(reactionrate_type),dimension(nrea),intent(inout) :: rate_array !< Reaction rates with db
569  type(reactionrate_type),dimension(nrea),intent(inout) :: rate_array_old !< Reaction rates from reacl.
570  integer :: i,j !< Loop variables
571  integer :: idx_ne20,idx_mg24 !< Index of ne20, mg24
572  integer :: idx_na20,idx_c12 !< Index of na20, c12
573  integer :: idx_d,idx_li7,idx_he3 !< Index of d, li7, he3
574  real(r_kind),dimension(301) :: temp_grid !< Temperature grid for output
575  real(r_kind),dimension(11,301) :: rat_forward !< Storage for forward rate
576  real(r_kind),dimension(11,301) :: rat_inverse !< Storage for inverse rate (db)
577  real(r_kind),dimension(11,301) :: rat_inverse_reacl !< Storage for inverse rate (reacl.)
578  real(r_kind) :: rat_tmp !< Temporary rate value
579  integer :: file_id !< ID of the output file
580 
581  ! Logarithmic temperature grid
582  temp_grid(1)=-2d0
583  do i=2,301
584  temp_grid(i) = temp_grid(i-1)+0.01d0
585  end do
586  temp_grid = 10d0**temp_grid
587 
588  ! Initialize the rates.
589  rat_forward(:,:)=0d0
590  rat_inverse(:,:)=0d0
591  rat_inverse_reacl(:,:)=0d0
592 
593  ! search for he4 ne20 <-> mg24 as benchmark (chapter 4)
594  idx_ne20 = benam(" ne20")
595  idx_mg24 = benam(" mg24")
596  ! search for n na20 <-> p ne20 as benchmark (chapter 5)
597  idx_na20 = benam(" na20")
598  ! search for d li7 <-> n he4 he4 as benchmark (chapter 6)
599  idx_d = benam(" d")
600  idx_li7 = benam(" li7")
601  ! search for he3 li7 <-> n p he4 he4 as benchmark (chapter 7)
602  idx_he3 = benam(" he3")
603  ! search for a a a <-> c12 as benchmark (chapter 8)
604  idx_c12 = benam(" c12")
605  ! search for n p p <-> p d as benchmark (chapter 9)
606 
607  ! Calculate the rates at all temperature grid points
608  do j=1,301
609  call calc_t9_pow(temp_grid(j))
610  do i=1,nrea
611  ! he4 ne20 -> mg24
612  if ((((rate_array(i)%parts(1) .eq. ihe4) .and. &
613  (rate_array(i)%parts(2) .eq. idx_ne20)) .or. &
614  ((rate_array(i)%parts(1) .eq. idx_ne20) .and. &
615  (rate_array(i)%parts(2) .eq. ihe4))) .and. &
616  (rate_array(i)%parts(3) .eq. idx_mg24) .and. &
617  (rate_array(i)%group .eq. 4)) then
618  call calculate_reacl_rate(rate_array(i),rat_tmp)
619  rat_forward(4,j) = rat_forward(4,j)+rat_tmp
620  rate_array(i)%cached_p = rat_tmp
621  end if
622 
623  ! he4 he4 he4 -> c12
624  if (( (rate_array(i)%parts(1) .eq. ihe4) .and. &
625  (rate_array(i)%parts(2) .eq. ihe4) .and. &
626  (rate_array(i)%parts(3) .eq. ihe4) .and. &
627  (rate_array(i)%parts(4) .eq. idx_c12)) .and. &
628  (rate_array(i)%group .eq. 8)) then
629  call calculate_reacl_rate(rate_array(i),rat_tmp)
630  rat_forward(8,j) = rat_forward(8,j)+rat_tmp
631  rate_array(i)%cached_p = rat_tmp
632  end if
633 
634  ! n na20 -> p ne20
635  if ((((rate_array(i)%parts(1) .eq. ineu) .and. &
636  (rate_array(i)%parts(2) .eq. idx_na20)) .or. &
637  ((rate_array(i)%parts(1) .eq. idx_na20) .and. &
638  (rate_array(i)%parts(2) .eq. ineu))) .and. &
639  (((rate_array(i)%parts(3) .eq. ipro) .and. &
640  (rate_array(i)%parts(4) .eq. idx_ne20)) .or. &
641  ((rate_array(i)%parts(3) .eq. idx_ne20) .and. &
642  (rate_array(i)%parts(4) .eq. ipro))) .and. &
643  (rate_array(i)%group .eq. 5)) then
644  call calculate_reacl_rate(rate_array(i),rat_tmp)
645  rat_forward(5,j) = rat_forward(5,j)+rat_tmp
646  rate_array(i)%cached_p = rat_tmp
647  end if
648 
649  ! d li7 -> n he4 he4
650  if ((((rate_array(i)%parts(1) .eq. idx_d) .and. &
651  (rate_array(i)%parts(2) .eq. idx_li7) .and. &
652  (rate_array(i)%parts(3) .eq. ineu)) .and. &
653  (rate_array(i)%parts(4) .eq. ihe4) .and. &
654  (rate_array(i)%parts(5) .eq. ihe4)) .and. &
655  (rate_array(i)%group .eq. 6)) then
656  call calculate_reacl_rate(rate_array(i),rat_tmp)
657  rat_forward(6,j) = rat_forward(6,j)+rat_tmp
658  rate_array(i)%cached_p = rat_tmp
659  end if
660 
661  ! he3 li7 <-> n p he4 he4
662  if ((((rate_array(i)%parts(1) .eq. idx_he3) .and. &
663  (rate_array(i)%parts(2) .eq. idx_li7) .and. &
664  (rate_array(i)%parts(3) .eq. ineu)) .and. &
665  (rate_array(i)%parts(4) .eq. ipro) .and. &
666  (rate_array(i)%parts(5) .eq. ihe4) .and. &
667  (rate_array(i)%parts(6) .eq. ihe4)) .and. &
668  (rate_array(i)%group .eq. 7)) then
669  call calculate_reacl_rate(rate_array(i),rat_tmp)
670  rat_forward(7,j) = rat_forward(7,j)+rat_tmp
671  rate_array(i)%cached_p = rat_tmp
672  end if
673 
674  ! n p p <-> p d
675  if ((((rate_array(i)%parts(1) .eq. ineu) .and. &
676  (rate_array(i)%parts(2) .eq. ipro) .and. &
677  (rate_array(i)%parts(3) .eq. ipro)) .and. &
678  (rate_array(i)%parts(4) .eq. ipro) .and. &
679  (rate_array(i)%parts(5) .eq. idx_d)) .and. &
680  (rate_array(i)%group .eq. 9)) then
681  call calculate_reacl_rate(rate_array(i),rat_tmp)
682  rat_forward(9,j) = rat_forward(9,j)+rat_tmp
683  rate_array(i)%cached_p = rat_tmp
684  end if
685  end do
686 
687  do i=1,nrea
688  ! he4 ne20 <- mg24
689  if ((((rate_array(i)%parts(3) .eq. ihe4) .and. &
690  (rate_array(i)%parts(2) .eq. idx_ne20)) .or. &
691  ((rate_array(i)%parts(2) .eq. ihe4) .and. &
692  (rate_array(i)%parts(3) .eq. idx_ne20))) .and. &
693  (rate_array(i)%parts(1) .eq. idx_mg24) .and. &
694  (rate_array(i)%group .eq. 2) .and. &
695  (rate_array(i)%source .eq. "detb")) then
696  call calculate_detailed_balance(temp_grid(j),rate_array,rate_array(i),rat_tmp)
697  rat_inverse(4,j) = rat_inverse(4,j)+rat_tmp
698  rate_array(i)%cached_p = rat_tmp
699  end if
700 
701  ! he4 he4 he4 <- c12
702  if (( (rate_array(i)%parts(2) .eq. ihe4) .and. &
703  (rate_array(i)%parts(3) .eq. ihe4) .and. &
704  (rate_array(i)%parts(4) .eq. ihe4) .and. &
705  (rate_array(i)%parts(1) .eq. idx_c12)) .and. &
706  (rate_array(i)%group .eq. 3) .and. &
707  (rate_array(i)%source .eq. "detb")) then
708  call calculate_detailed_balance(temp_grid(j),rate_array,rate_array(i),rat_tmp)
709  rat_inverse(8,j) = rat_inverse(8,j)+rat_tmp
710  rate_array(i)%cached_p = rat_tmp
711  end if
712 
713  ! n na20 <- p ne20
714  if ((((rate_array(i)%parts(3) .eq. ineu) .and. &
715  (rate_array(i)%parts(4) .eq. idx_na20)) .or. &
716  ((rate_array(i)%parts(3) .eq. idx_na20) .and. &
717  (rate_array(i)%parts(4) .eq. ineu))) .and. &
718  (((rate_array(i)%parts(1) .eq. ipro) .and. &
719  (rate_array(i)%parts(2) .eq. idx_ne20)) .or. &
720  ((rate_array(i)%parts(1) .eq. idx_ne20) .and. &
721  (rate_array(i)%parts(2) .eq. ipro))) .and. &
722  (rate_array(i)%group .eq. 5) .and. &
723  (rate_array(i)%source .eq. "detb")) then
724  call calculate_detailed_balance(temp_grid(j),rate_array,rate_array(i),rat_tmp)
725  rat_inverse(5,j) = rat_inverse(5,j)+rat_tmp
726  rate_array(i)%cached_p = rat_tmp
727  end if
728 
729  ! d li7 <- n he4 he4
730  if ((((rate_array(i)%parts(4) .eq. idx_d) .and. &
731  (rate_array(i)%parts(5) .eq. idx_li7)) .or. &
732  ((rate_array(i)%parts(5) .eq. idx_d) .and. &
733  (rate_array(i)%parts(4) .eq. idx_li7)) .and. &
734  ((rate_array(i)%parts(1) .eq. ineu) .and. &
735  (rate_array(i)%parts(2) .eq. ihe4) .and. &
736  (rate_array(i)%parts(3) .eq. ihe4)) .or. &
737  ((rate_array(i)%parts(1) .eq. ihe4) .and. &
738  (rate_array(i)%parts(2) .eq. ineu) .and. &
739  (rate_array(i)%parts(3) .eq. ihe4)) .or. &
740  ((rate_array(i)%parts(1) .eq. ihe4) .and. &
741  (rate_array(i)%parts(2) .eq. ihe4) .and. &
742  (rate_array(i)%parts(3) .eq. ineu))) .and. &
743  (rate_array(i)%group .eq. 9) .and. &
744  (rate_array(i)%source .eq. "detb")) then
745  call calculate_detailed_balance(temp_grid(j),rate_array,rate_array(i),rat_tmp)
746  rat_inverse(6,j) = rat_inverse(6,j)+rat_tmp
747  rate_array(i)%cached_p = rat_tmp
748  end if
749 
750  ! he3 li7 <- n p he4 he4
751  if ((((rate_array(i)%parts(5) .eq. idx_he3) .and. &
752  (rate_array(i)%parts(6) .eq. idx_li7) .and. &
753  (rate_array(i)%parts(1) .eq. ineu)) .and. &
754  (rate_array(i)%parts(2) .eq. ipro) .and. &
755  (rate_array(i)%parts(3) .eq. ihe4) .and. &
756  (rate_array(i)%parts(4) .eq. ihe4)) .and. &
757  (rate_array(i)%group .eq. 10) .and. &
758  (rate_array(i)%source .eq. "detb")) then
759  call calculate_detailed_balance(temp_grid(j),rate_array,rate_array(i),rat_tmp)
760  rat_inverse(7,j) = rat_inverse(7,j)+rat_tmp
761  rate_array(i)%cached_p = rat_tmp
762  end if
763 
764  ! n p p <-> p d
765  if ((((rate_array(i)%parts(3) .eq. ineu) .and. &
766  (rate_array(i)%parts(4) .eq. ipro) .and. &
767  (rate_array(i)%parts(5) .eq. ipro)) .and. &
768  (rate_array(i)%parts(1) .eq. ipro) .and. &
769  (rate_array(i)%parts(2) .eq. idx_d)) .and. &
770  (rate_array(i)%group .eq. 6) .and. &
771  (rate_array(i)%source .eq. "detb")) then
772  call calculate_detailed_balance(temp_grid(j),rate_array,rate_array(i),rat_tmp)
773  rat_inverse(9,j) = rat_inverse(9,j)+rat_tmp
774  rate_array(i)%cached_p = rat_tmp
775  end if
776 
777  end do
778 
779  do i=1,nrea_old
780  if ((((rate_array_old(i)%parts(3) .eq. ihe4) .and. &
781  (rate_array_old(i)%parts(2) .eq. idx_ne20)) .or. &
782  ((rate_array_old(i)%parts(2) .eq. ihe4) .and. &
783  (rate_array_old(i)%parts(3) .eq. idx_ne20))) .and. &
784  (rate_array_old(i)%parts(1) .eq. idx_mg24) .and. &
785  (rate_array_old(i)%group .eq. 2)) then
786  call calculate_reacl_rate(rate_array_old(i),rat_tmp)
787  rat_inverse_reacl(4,j) = rat_inverse_reacl(4,j)+rat_tmp
788  rate_array_old(i)%cached_p = rat_tmp
789  end if
790 
791  ! he4 he4 he4 <- c12
792  if (( (rate_array_old(i)%parts(2) .eq. ihe4) .and. &
793  (rate_array_old(i)%parts(3) .eq. ihe4) .and. &
794  (rate_array_old(i)%parts(4) .eq. ihe4) .and. &
795  (rate_array_old(i)%parts(1) .eq. idx_c12)) .and. &
796  (rate_array_old(i)%group .eq. 3)) then
797  call calculate_reacl_rate(rate_array_old(i),rat_tmp)
798  rat_inverse_reacl(8,j) = rat_inverse_reacl(8,j)+rat_tmp
799  rate_array_old(i)%cached_p = rat_tmp
800  end if
801 
802  if ((((rate_array_old(i)%parts(3) .eq. ineu) .and. &
803  (rate_array_old(i)%parts(4) .eq. idx_na20)) .or. &
804  ((rate_array_old(i)%parts(3) .eq. idx_na20) .and. &
805  (rate_array_old(i)%parts(4) .eq. ineu))) .and. &
806  (((rate_array_old(i)%parts(1) .eq. ipro) .and. &
807  (rate_array_old(i)%parts(2) .eq. idx_ne20)) .or. &
808  ((rate_array_old(i)%parts(1) .eq. idx_ne20) .and. &
809  (rate_array_old(i)%parts(2) .eq. ipro))) .and. &
810  (rate_array_old(i)%group .eq. 5)) then
811  call calculate_reacl_rate(rate_array_old(i),rat_tmp)
812  rat_inverse_reacl(5,j) = rat_inverse_reacl(5,j)+rat_tmp
813  rate_array_old(i)%cached_p = rat_tmp
814  end if
815 
816  ! d li7 <- n he4 he4
817  if ((((rate_array_old(i)%parts(4) .eq. idx_d) .and. &
818  (rate_array_old(i)%parts(5) .eq. idx_li7) .and. &
819  (rate_array_old(i)%parts(1) .eq. ineu)) .and. &
820  (rate_array_old(i)%parts(2) .eq. ihe4) .and. &
821  (rate_array_old(i)%parts(3) .eq. ihe4)) .and. &
822  (rate_array_old(i)%group .eq. 9)) then
823  call calculate_reacl_rate(rate_array_old(i),rat_tmp)
824  rat_inverse_reacl(6,j) = rat_inverse_reacl(6,j)+rat_tmp
825  rate_array_old(i)%cached_p = rat_tmp
826  end if
827 
828  ! he3 li7 <- n p he4 he4
829  if ((((rate_array_old(i)%parts(5) .eq. idx_he3) .and. &
830  (rate_array_old(i)%parts(6) .eq. idx_li7) .and. &
831  (rate_array_old(i)%parts(1) .eq. ineu)) .and. &
832  (rate_array_old(i)%parts(2) .eq. ipro) .and. &
833  (rate_array_old(i)%parts(3) .eq. ihe4) .and. &
834  (rate_array_old(i)%parts(4) .eq. ihe4)) .and. &
835  (rate_array_old(i)%group .eq. 10)) then
836  call calculate_reacl_rate(rate_array_old(i),rat_tmp)
837  rat_inverse_reacl(7,j) = rat_inverse_reacl(7,j)+rat_tmp
838  rate_array_old(i)%cached_p = rat_tmp
839  end if
840 
841  ! n p p <-> p d
842  if ((((rate_array_old(i)%parts(3) .eq. ineu) .and. &
843  (rate_array_old(i)%parts(4) .eq. ipro) .and. &
844  (rate_array_old(i)%parts(5) .eq. ipro)) .and. &
845  (rate_array_old(i)%parts(1) .eq. ipro) .and. &
846  (rate_array_old(i)%parts(2) .eq. idx_d)) .and. &
847  (rate_array_old(i)%group .eq. 6)) then
848  call calculate_reacl_rate(rate_array_old(i),rat_tmp)
849  rat_inverse_reacl(9,j) = rat_inverse_reacl(9,j)+rat_tmp
850  rate_array_old(i)%cached_p = rat_tmp
851  end if
852 
853  end do
854 
855  ! Ensure the format works
856  do i=1,11
857  rat_inverse_reacl(i,j) = max(rat_inverse_reacl(i,j),1d-99)
858  rat_inverse(i,j) = max(rat_inverse(i,j),1d-99)
859  rat_forward(i,j) = max(rat_forward(i,j),1d-99)
860  end do
861  end do
862 
863  file_id = open_outfile("debug_detailed_balance.dat")
864  write(file_id,"(A)")"# File to check inverse rates. The inverse rates calculated (I) and "
865  write(file_id,"(A)")"# from the reaclib (IR) should agree. There might be slight deviations"
866  write(file_id,"(A)")"# due to different Q-values in the Reaclib and winvn file."
867  write(file_id,"(A)")"# Tested are a couple of chapters, e.g.,"
868  write(file_id,"(A)")"# Chapter 4: Ne20 + He4 -> Mg24"
869  write(file_id,"(A)")"# Chapter 5: n + Na20 -> p Ne20"
870  write(file_id,"(A)")"# Chapter 6: d + Li7 -> n + He4 + He4"
871  write(file_id,"(A)")"# Chapter 7: He3 + Li7 -> n + p + He4 + He4"
872  write(file_id,"(A)")"# Chapter 8: He4 + He4 + He4 -> C12"
873  write(file_id,"(A)")"# Chapter 9: n + p + p -> p + d"
874  write(file_id,"(A)")"###############################################"
875  write(file_id,"(A)")"# T [GK], F (4), I (4), IR (4),"//&
876  " F (5), I (5), IR (5),"//&
877  " F (6), I (6), IR (6),"//&
878  " F (7), I (7), IR (7),"//&
879  " F (8), I (8), IR (8),"//&
880  " F (9), I (9), IR (9)"
881  do i=1,301
882  write(file_id,"(*(1pE13.4))")temp_grid(i),rat_forward(4,i),rat_inverse(4,i),rat_inverse_reacl(4,i),&
883  rat_forward(5,i),rat_inverse(5,i),rat_inverse_reacl(5,i),&
884  rat_forward(6,i),rat_inverse(6,i),rat_inverse_reacl(6,i),&
885  rat_forward(7,i),rat_inverse(7,i),rat_inverse_reacl(7,i),&
886  rat_forward(8,i),rat_inverse(8,i),rat_inverse_reacl(8,i),&
887  rat_forward(9,i),rat_inverse(9,i),rat_inverse_reacl(9,i)
888  end do
889 
890  call close_io_file(file_id,"debug_detailed_balance.dat")
891 
892  end subroutine write_reac_rate
893 
894 
895  !> Write the verbose output of the reaction rates
896  !!
897  !! The rates are always counted, for a certain verbose level they
898  !! are also printed to the OUT file
899  !!
900  !! @author M. Reichert
901  !! @date 21.07.22
904  implicit none
905 
906  if (verbose_level .ge. 1) then
907  call write_data_to_std_out("Removing inverse rates",int_to_str(ninv_old))
908  call write_data_to_std_out("Adding inverse rates",int_to_str(ninv))
909  end if
910  end subroutine write_reac_verbose_out
911 
912 
913 end module detailed_balance
parameter_class::use_prepared_network
logical use_prepared_network
Use a prepared folder with all necessary data in binary format.
Definition: parameter_class.f90:94
detailed_balance::ninv_old
integer, private ninv_old
Number of old inverse rates.
Definition: detailed_balance.f90:64
global_class::ipro
integer, public ipro
index of alphas, neutrons and protons
Definition: global_class.f90:94
global_class::reactionrate_type
reaction rate type
Definition: global_class.f90:44
detailed_balance::src_q_winvn_length
integer, private src_q_winvn_length
Definition: detailed_balance.f90:72
detailed_balance::src_ignore
character(len=4), dimension(:), allocatable, private src_ignore
Definition: detailed_balance.f90:67
detailed_balance::write_reac_rate
subroutine, private write_reac_rate(rate_array, nrea, rate_array_old, nrea_old)
Verbose routine to output one inverse reaction of chapter 4-9.
Definition: detailed_balance.f90:560
parameter_class::use_detailed_balance
logical use_detailed_balance
Calculate the inverse reactions via detailed balance rather than using them form file.
Definition: parameter_class.f90:97
reaclib_rate_module
Module that deals with reaclib reaction rates.
Definition: reaclib_rate_module.f90:13
detailed_balance::init_inverse_rates
subroutine, public init_inverse_rates()
Initialize everything for the inverse rates.
Definition: detailed_balance.f90:95
detailed_balance::create_inverse_rate
subroutine, private create_inverse_rate(forward_rate, inverse_rate)
Routine to create an inverse rate, based on the forward rate.
Definition: detailed_balance.f90:324
error_msg_class
Error handling routines.
Definition: error_msg_class.f90:16
global_class::ihe4
integer, public ihe4
Definition: global_class.f90:94
benam_class::benam
integer function, public benam(name)
Returns the index number of isotope 'name'.
Definition: benam_class.f90:251
detailed_balance::src_q_winvn
character(len=4), dimension(:), allocatable, private src_q_winvn
Definition: detailed_balance.f90:71
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
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
global_class::ineu
integer, public ineu
Definition: global_class.f90:94
global_class::isotope
type(isotope_type), dimension(:), allocatable, public isotope
all nuclides used in the network
Definition: global_class.f90:34
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
nucstuff_class
Module with helper functions such as rate tabulation, partition functions, and theoretical weak rates...
Definition: nucstuff_class.f90:11
detailed_balance::write_reac_verbose_out
subroutine, private write_reac_verbose_out()
Write the verbose output of the reaction rates.
Definition: detailed_balance.f90:903
detailed_balance::src_q_reacl_length
integer, private src_q_reacl_length
Definition: detailed_balance.f90:70
detailed_balance::calculate_detailed_balance
subroutine, public calculate_detailed_balance(temp, rrate_array, inverse_rate, rate)
Calculate the inverse rate from the forward one via detailed balance.
Definition: detailed_balance.f90:450
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
parameter_class::detailed_balance_src_ignore
character(max_fname_len) detailed_balance_src_ignore
Source flag(s) to ignore within calculated detailed balance.
Definition: parameter_class.f90:102
parameter_class::detailed_balance_src_q_reac
character(max_fname_len) detailed_balance_src_q_reac
Source flag(s) to use q-value from rate file for inverse reaction.
Definition: parameter_class.f90:103
detailed_balance
Module that deals with inverse reaction rates.
Definition: detailed_balance.f90:57
parameter_class::unit
type(unit_type), public unit
constants and unit conversion factors
Definition: parameter_class.f90:54
rrs_nu
#define rrs_nu
Definition: macros.h:51
file_handling_class
Provide some basic file-handling routines.
Definition: file_handling_class.f90:18
r_kind
#define r_kind
Definition: macros.h:46
detailed_balance::ninv
integer, private ninv
Number of inverse rates.
Definition: detailed_balance.f90:63
nucstuff_class::analyze_src_string
subroutine, public analyze_src_string(input_string, output_array, length_output)
Analyze a string and split it with delimiter ";".
Definition: nucstuff_class.f90:422
parameter_class::detailed_balance_src_q_winvn
character(max_fname_len) detailed_balance_src_q_winvn
Source flag(s) to use q-value from winvn file for inverse reaction.
Definition: parameter_class.f90:104
reaclib_rate_module::set_reaction_type
subroutine, public set_reaction_type(rr_tmp)
Set a flag for the reaction type.
Definition: reaclib_rate_module.f90:569
nucstuff_class::get_nr_reactants
integer function get_nr_reactants(group)
Get number of reactants of the reaction based on the reaclib chapter.
Definition: nucstuff_class.f90:301
rrt_o
#define rrt_o
Definition: macros.h:81
rrs_fiss
#define rrs_fiss
Definition: macros.h:54
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
parameter_class::use_detailed_balance_q_reac
logical use_detailed_balance_q_reac
Use Q-value from reaclib for the calculation of detailed balance.
Definition: parameter_class.f90:98
global_class
Contains types and objects shared between multiple modules.
Definition: global_class.f90:19
detailed_balance::src_ignore_length
integer, private src_ignore_length
Definition: detailed_balance.f90:68
global_class::nreac
integer, public nreac
total number of reactions
Definition: global_class.f90:98
reaclib_rate_module::calculate_reacl_rate
subroutine calculate_reacl_rate(rrate, rat_calc)
Calculate a reaclib rate.
Definition: reaclib_rate_module.f90:229
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
nucstuff_class::get_chapter
integer function get_chapter(nr_react, nr_prod)
Get the reaclib chapter based on nr. of prods. and educts.
Definition: nucstuff_class.f90:245
nucstuff_class::calc_t9_pow
subroutine, public calc_t9_pow(t9)
A helper to compute powers of temperature used in the reaction rates.
Definition: nucstuff_class.f90:190
rrs_detb
#define rrs_detb
Definition: macros.h:53
detailed_balance::src_q_reacl
character(len=4), dimension(:), allocatable, private src_q_reacl
Definition: detailed_balance.f90:69
parameter_class
Contains all runtime parameters as well as phys and math constants.
Definition: parameter_class.f90:24
benam_class::getcoefficients
subroutine, public getcoefficients(rate_array, length_rate_array)
Returns the 1/n! factor where n is the number of equal isotopes entering a reaction....
Definition: benam_class.f90:307
benam_class
Subroutines needed to initialise the network.
Definition: benam_class.f90:11
nucstuff_class::get_nr_products
integer function get_nr_products(group)
Get number of products of the reaction based on the reaclib chapter.
Definition: nucstuff_class.f90:345