jacobian_class.f90
Go to the documentation of this file.
1 !> @file jacobian_class.f90
2 !!
3 !! The error file code for this file is ***W28***.
4 !! @brief Module jacobian_class for calculating and solving the linearized equations
5 !!
6 
7 !> Contains subroutines to assemble the system Jacobian and changes in the abundances
8 !!
9 !! \b Edited:
10 !! - 23.01.21, MR - fixed overflows and turned off fission in NSE
11 #include "macros.h"
13 
15  use pardiso_class, only: vals,jind
16  use benam_class
17  use nucstuff_class
18  use effphase_class
19  use nuflux_class
21  use global_class, only: nreac
22  implicit none
23 
24  ! helper variables
25  real(r_kind),parameter,private :: rate_min_cutoff = 1d-50 !< Minimum cutoff for the reaction rates
26  real(r_kind),parameter,private :: rate_max_cutoff = 1d99 !< Maximum cutoff for the reaction rates
27  logical,private :: freeze_rate_indicator = .false. !< Indicator for debug statement
28  logical,private :: nu_shutoff_indicator = .false. !< Indicator for debug statement
29  real(r_kind),private :: old_time=-99, old_temp=-99, old_dens=-99, old_ye=-99, old_rad=-99
30  !
31  ! Public and private fields and methods of the module (all routines are publis)
32  !
33  public:: &
35  private:: &
37 
38 contains
39 
40 
41 
42 !> Subroutine to calculate the reaction rates
43 !!
44 !! The calculation depends on the source flag of the reaction rate.
45 !! While reaclib rates are done by a simple fit formula, tabulated rates
46 !! have to be interpolated, theoretical weak rates have to interpolate
47 !! on a temperature-density grid, etc.
48 !!
49 !! @see reaclib_rate_module::calculate_reacl_rate, tabulated_rate_module::calculate_tab_rate,
50 !! tw_rate_module::calculate_twr_rate
51 !!
52 !! \b Edited:
53 !! - 26.07.22, MR: Created this subroutine from code snippets
54 !! that were flying around in Jacobi_init and abchange.
55 !! .
56 subroutine calculate_reaction_rate(time, temp, rho, Ye, rkm, rrate_array, idx, rat_calc)
65  use screening_module, only: screen, hv, iscreen
67  implicit none
68  ! Declare the pass
69  type(reactionrate_type),dimension(nreac),intent(inout),optional :: rrate_array!< Rate array
70  real(r_kind),intent(in) :: time !< Time [s]
71  real(r_kind),intent(in) :: temp !< Temperature
72  integer,intent(in),optional :: idx !< Index of rate in array
73  real(r_kind),intent(in) :: rho !< Density
74  real(r_kind),intent(in) :: ye !< Electron fraction
75  real(r_kind),intent(in) :: rkm !< Radius in km
76  real(r_kind),intent(out),optional :: rat_calc !< Calculated reaction rate
77  ! Internal variables
78  character*4 :: src !< Source flag of reaction
79  logical :: is_same_step !< Flag that determines if it is the same step
80  ! or if the conditions changed
81  real(r_kind) :: eta_e,eta_p
82  real(r_kind) :: elnd !< Electron density
83  integer :: reac_origin !< Origin of the reaclib rate (tabulated, reaclib, ...)
84 
85 
86  ! Check if indices and other things have to be updated
87  if ((old_time .eq. time) .and. (old_temp .eq. temp) .and. &
88  (old_dens .eq. rho) .and. (old_ye .eq. ye) .and.&
89  (old_rad .eq. rkm)) then
90  is_same_step = .true.
91  else
92  old_time = time
93  old_temp = temp
94  old_dens = rho
95  old_ye = ye
96  old_rad = rkm
97  is_same_step = .false.
98  end if
99 
100  ! NOTE, MR: Probably one could implement a flag for an hydrostatic run here
101  ! to avoid calculating the rates again for this case.
102 
103  ! Update general things as indices and the chemical potential
104  if (is_same_step .eqv. .false.) then
105  ! t9_pow calculates powers of t9 and rho needed to evaluate reaction rates
106  call calc_t9_pow(temp)
107 
108  ! inter_partf interpolates the partition functions for a given temperature
109  call inter_partf (temp, pf)
110 
111  ! screen (by U.Frischknecht) calculates the screening coefficients hv
112  if(iscreen) call screen(temp,rho,nreac,ye,0) ! Calculates coefficient hv
113 
114  ! tabulated_index determines the boundaries for the temp interpolation
115  if (tabulated) call tabulated_index (temp)
116 
117  ! Get the chemical potential for theoretical weak rates
118  if (weak .and. (iwformat .eq. 2) .and. use_timmes_mue) then
119  call chempot(1.d9*temp,rho,ye,eta_e,eta_p)
120  mue = eta_e * temp * 1.d9 * unit%k_MeV
121  mue = mue + unit%mass_e
122  end if
123 
124  ! ! Interpolate neutrino quantities at given time
125  if ((nuflag.ge.1) .and. ((time .lt. nu_max_time) .or. (nu_max_time .eq. -1d0))) then
126  call nuflux(time, rkm) ! returns fluxnu(4)
127  call nutemp(time) ! returns tempnu(4)
128  call nucs()
129  end if
130  end if
131 
132  ! If no rate is present exit here
133  if (present(rrate_array).eqv..false.) return
134 
135  ! Get the source flag and origin of the rate, depending on the flag the calculation
136  ! of the rate differs
137  src = rrate_array(idx)%source
138  reac_origin = rrate_array(idx)%reac_src
139 
140  ! Calculate of the reaction rates
141  ! theoretical weak rates.
142  ! Here is the place to implement new type of reactions
143  if (reac_origin .eq. rrs_twr) then
144  call calculate_twr_rate(rrate_array(idx), temp, rho, ye, rat_calc,.true.)
145  ! tabulated rates
146  else if (reac_origin .eq. rrs_tabl) then
147  call calculate_tab_rate(rrate_array(idx), temp, rat_calc)
148  ! Neutrino reactions
149  else if (reac_origin .eq. rrs_nu) then
150  call calculate_nu_rate(rrate_array(idx),rat_calc)
151  ! Detailed balance rate
152  else if (reac_origin .eq. rrs_detb) then
153  call calculate_detailed_balance(temp,rrate_array,rrate_array(idx),rat_calc)
154  ! Fission rate (treat like reaclib)
155  else if (reac_origin .eq. rrs_fiss) then
156  call calculate_reacl_rate(rrate_array(idx),rat_calc)
157  ! Beta delayed neutron emission format (treat like reaclib)
158  else if (reac_origin .eq. rrs_wext) then
159  call calculate_reacl_rate(rrate_array(idx),rat_calc)
160  ! Additional alpha decays (treat like reaclib)
161  else if (reac_origin .eq. rrs_aext) then
162  call calculate_reacl_rate(rrate_array(idx),rat_calc)
163  ! Reaclib rate
164  else if (reac_origin .eq. rrs_reacl) then
165  call calculate_reacl_rate(rrate_array(idx),rat_calc)
166  ! Not known -> throw exception
167  else
168  call raise_exception("Reaction origin not known, got '"//int_to_str(reac_origin)//&
169  "'."//new_line("A")//"Reaction source is: "//src,&
170  "calculate_reaction_rate", 280011)
171  end if
172 
173  ! Cut the rate here and at the end already to avoid overflows
174  if(rat_calc.gt.rate_max_cutoff) rat_calc=rate_max_cutoff
175 
176  ! Save the result somewhere
177  rrate_array(idx)%cached_p = rat_calc
178 
179  ! Apply screening corrections
180  if(iscreen .eqv. .true.) rat_calc=rat_calc*dexp(hv(idx))
181 
182  ! Take care of double counting factor
183  rat_calc = rat_calc * rrate_array(idx)%one_over_n_fac
184 
185  ! For electron captures the amount of electrons, i.e., the electron density
186  ! has to be known.
187  elnd = rho * ye
188  if (trim(adjustl(src)) .eq. 'ec') rat_calc = rat_calc * elnd
189 
190  ! Apply partition functions for inverse rates and multiply density
191  select case (rrate_array(idx)%group)
192  case(1:3,11)
193  if (rrate_array(idx)%is_reverse) then
194  rat_calc = rat_calc * (pf(rrate_array(idx)%parts(2))*pf(rrate_array(idx)%parts(3))* &
195  pf(rrate_array(idx)%parts(4))*pf(rrate_array(idx)%parts(5)))/ &
196  pf(rrate_array(idx)%parts(1))
197  end if
198  case(4:7)
199  rat_calc = rat_calc * rho
200  if (rrate_array(idx)%is_reverse) then
201  rat_calc = rat_calc * (pf(rrate_array(idx)%parts(3))*pf(rrate_array(idx)%parts(4)) * &
202  pf(rrate_array(idx)%parts(5))*pf(rrate_array(idx)%parts(6))) / &
203  (pf(rrate_array(idx)%parts(1))*pf(rrate_array(idx)%parts(2)))
204  end if
205  case(8:9)
206  rat_calc = rat_calc * rho**2
207  if (rrate_array(idx)%is_reverse) then
208  rat_calc = rat_calc * (pf(rrate_array(idx)%parts(4))*pf(rrate_array(idx)%parts(5)) &
209  / (pf(rrate_array(idx)%parts(1))*pf(rrate_array(idx)%parts(2)) &
210  *pf(rrate_array(idx)%parts(3))))
211  end if
212  case(10)
213  rat_calc = rat_calc * rho**3
214  if (rrate_array(idx)%is_reverse) then
215  rat_calc = rat_calc * (pf(rrate_array(idx)%parts(5))*pf(rrate_array(idx)%parts(6))) &
216  / (pf(rrate_array(idx)%parts(1))*pf(rrate_array(idx)%parts(2)) &
217  *pf(rrate_array(idx)%parts(3))*pf(rrate_array(idx)%parts(4)))
218  end if
219  case default
220  ! Throw exception
221  call raise_exception("Got unknown reaclib chapter ("// &
222  int_to_str(rrate_array(idx)%group)//"). ", &
223  "calculate_reaction_rate",280009)
224  end select
225 
226  ! Finally check overflows or too low rates
227  ! to prevent bad rate fits producing NaN errors
228  if(rat_calc.gt.rate_max_cutoff) rat_calc=rate_max_cutoff
229 
230  ! Cut the rate if it is too low
231  if(rat_calc.lt.rate_min_cutoff) rat_calc=0.d0
232 
233  ! Cache the rate
234  rrate_array(idx)%cached = rat_calc
235 
236 end subroutine calculate_reaction_rate
237 
238 
239 
240 !>
241 !! This subroutine calculates the change in abundances (dYdt) due to
242 !! reaction rates at given temperature (temp) and density (rho).
243 !!
244 !! The underlying differential equation is given by:
245 !!
246 !! \f[
247 !! \mathrm{dYdt}_i = \underbrace{\sum _j N_j ^i \lambda _j Y_j}_\text{Decays and photodisintegrations} +
248 !! \underbrace{\sum _{j,k} \frac{N^i _{j,k}}{1+\delta _{jk}}\rho N_{\mathrm{A}} \langle \sigma v
249 !! \rangle _{j,k}Y_jY_k}_\text{two-body reactions}+\underbrace{\sum _{j,k,l}\frac{N^i_{j,k,l}}
250 !! {1+\Delta_{jkl}}\rho ^2N_{\mathrm{A}}^2\langle \sigma v\rangle _{j,k,l} Y_j Y_k Y_l}_\text{three-body reactions}
251 !! \f]
252 !!
253 !! where the amount of synthesized and destroyed nuclei N_j is stored in
254 !! global_class::rrate\%ch_amount, the reaction rates come from various sources,
255 !! but mostly from reaclib (see \ref network_init_module::network_init, nucstuff_class::calc_t9_pow).
256 !! The individual terms in the equation above are treated with the help of the reaclib chapters,
257 !! the first term is given by chapter 1-3, the second one by 4-7, the third one 8-9
258 !! (see also [Reaclib chapters](https://reaclib.jinaweb.org/help.php?topic=reaclib_format&intCurrentNum=0)).
259 !! <table>
260 !! <caption id="multi_row">Reaclib chapters</caption>
261 !! <tr><th> Chapter <th> Equation
262 !! <tr><td> 1 <td> \f$ e_1 \rightarrow e_2 \f$
263 !! <tr><td> 2 <td> \f$ e_1 \rightarrow e_2 + e_3 \f$
264 !! <tr><td> 3 <td> \f$ e_1 \rightarrow e_2 + e_3 + e_4 \f$
265 !! <tr><td> 4 <td> \f$ e_1 + e_2 \rightarrow e_3 \f$
266 !! <tr><td> 5 <td> \f$ e_1 + e_2 \rightarrow e_3 + e_4 \f$
267 !! <tr><td> 6 <td> \f$ e_1 + e_2 \rightarrow e_3 + e_4 + e_5 \f$
268 !! <tr><td> 7 <td> \f$ e_1 + e_2 \rightarrow e_3 + e_4 + e_5 +e_6\f$
269 !! <tr><td> 8 <td> \f$ e_1 + e_2 + e_3 \rightarrow e_4 (+ e_5 + e_6) \f$
270 !! </table>
271 !!
272 !! @note When single_zone_vars::evolution_mode is equal to EM_NSE,
273 !! this subroutine will ignore strong reactions and only
274 !! calculate the contribution of weak reactions.
275 !!
276 !! @note This routine can be used to calculate the jacobian of the original Reaclib format
277 !! without chapter 9-11 as well as the modern format with chapter 9-11.
278 !!
279 !! @see jacobi_init,
280 !! [Hix & Thielemann 1999](https://ui.adsabs.harvard.edu/abs/1999JCoAM.109..321H/abstract),
281 !! [Winteler 2013](https://edoc.unibas.ch/29895/),
282 !! [Lippuner & Roberts 2017](https://ui.adsabs.harvard.edu/abs/2017ApJS..233...18L/abstract)
283 !!
284 !! \b Edited:
285 !! - 12.01.14
286 !! - 26.07.22, MR: Cleaned up the subroutine
287 !! - 06.02.23, MR: Implemented parameter freeze_rate_temp.
288 !! .
289 subroutine abchange (time, itemp, rho, Ye, rkm, Y, dYdt, evolution_mode)
290  use global_class, only: nreac, rrate, net_names
293  implicit none
294 
295  real(r_kind),intent(in) :: time !< time [s]
296  real(r_kind),intent(in) :: itemp !< temperature in units of 10**9 K
297  real(r_kind),intent(in) :: rho !< baryon density [g/cm^3]
298  real(r_kind),intent(in) :: ye !< electron fraction
299  real(r_kind),intent(in) :: rkm !< current radius im km
300  real(r_kind),dimension(:),intent(in) :: y !< isotope abundances
301  real(r_kind),dimension(:),intent(inout) :: dydt !< change in abundances due to reaction rates
302  integer,intent(in) :: evolution_mode !< state of the network
303  !
304  real(r_kind) :: rat
305  integer :: i, j
306  real(r_kind) :: infty
307  real(r_kind) :: temp
308 
309  infty = huge(infty)
310 
311  dydt = 0.d0
312 
313  ! Freeze the rates at the minimum valid temperature, 1d-2GK
314  if (itemp.le.freeze_rate_temp) then
315  temp = freeze_rate_temp
316  if (.not. freeze_rate_indicator) then
317  print *,"Freezing rates at "//num_to_str(freeze_rate_temp)//" GK"
318  freeze_rate_indicator = .true.
319  endif
320  else
321  temp = itemp
322  end if
323 
324  ! Shut off neutrinos
325  if (nuflag .ge. 1) then
326  if ((time .gt. nu_max_time) .and. (nu_max_time .ne. -1d0)) then
327  if (.not. nu_shutoff_indicator) then
328  print *,"Shutting off neutrino reactions at "//num_to_str(nu_max_time)//" s"
329  nu_shutoff_indicator = .true.
330  end if
331  end if
332  end if
333 
334  ! Be sure to call the reaction rate calculation at least ones to initialize
335  ! (important for fission later on)
336  call calculate_reaction_rate(time, temp, rho, ye, rkm)
337 
338  ! Loop through all reactions
339  outer: do i=1,nreac
340 
341  ! Only consider weak reactions in NSE
342  if ((evolution_mode.eq.em_nse).and.(rrate(i)%is_weak.eqv..false.)) cycle outer
343 
344  ! Check if neutrino rates are still necessary
345  if ((nuflag .ge. 1) .and. (nu_max_time .ne. -1d0) .and. (time .ge. nu_max_time) .and. &
346  (rrate(i)%reac_src .eq. rrs_nu)) then
347  cycle outer
348  end if
349 
350  ! Calculate the reaction rate
351  call calculate_reaction_rate(time, temp, rho, ye, rkm, rrate, i, rat)
352 
353  ! Check if one can ignore the rate
354  if (skip_rate(rat, rrate(i),y)) cycle outer
355 
356  ! Don't do fission
357  if ((rrate(i)%reac_type .eq. rrt_nf) .or. &
358  (rrate(i)%reac_type .eq. rrt_bf) .or. &
359  (rrate(i)%reac_type .eq. rrt_sf)) then
360  cycle outer
361  end if
362 
363  ! Create DGL
364  select case (rrate(i)%group)
365  case(1:3,11)
366  do j = 1, 5
367  if (rrate(i)%parts(j) .eq. 0) exit
368  dydt(rrate(i)%parts(j)) = dydt(rrate(i)%parts(j)) + rat * &
369  rrate(i)%ch_amount(j) * y(rrate(i)%parts(1))
370  end do
371  case(4:7)
372  do j = 1, 6
373  if (rrate(i)%parts(j) .eq. 0) exit
374  dydt(rrate(i)%parts(j)) = dydt(rrate(i)%parts(j)) + rat * &
375  rrate(i)%ch_amount(j) * y(rrate(i)%parts(1)) * &
376  y(rrate(i)%parts(2))
377  end do
378  case(8:9)
379  do j = 1, 6
380  if (rrate(i)%parts(j) .eq. 0) exit
381  dydt(rrate(i)%parts(j)) = dydt(rrate(i)%parts(j)) + rat * &
382  rrate(i)%ch_amount(j) * y(rrate(i)%parts(1)) * &
383  y(rrate(i)%parts(2)) * y(rrate(i)%parts(3))
384  end do
385  case(10)
386  do j = 1, 6
387  if (rrate(i)%parts(j) .eq. 0) exit
388  dydt(rrate(i)%parts(j)) = dydt(rrate(i)%parts(j)) + rat * &
389  rrate(i)%ch_amount(j) * y(rrate(i)%parts(1)) * &
390  y(rrate(i)%parts(2)) * y(rrate(i)%parts(3)) * &
391  y(rrate(i)%parts(4))
392  end do
393  case default
394  ! Throw exception
395  call raise_exception("Got unknown reaclib chapter ("//&
396  int_to_str(rrate(i)%group)//"). "&
397  ,"abchange",280009)
398  end select
399 
400  ! Check for infinity rates
401  if ((rat .ge. infty) .or. (rat .ne. rat)) then
402  call raise_exception("The rate: "//new_line("A")//&
403  trim(adjustl(reaction_string(rrate(i))))//&
404  new_line("A")//"was infinity or NaN.",&
405  "abchange",280003)
406  end if
407  end do outer
408 
409  ! MR: Changed that fission reactions are not taken into account in NSE
410  if ((fissflag.ne.0) .and. (evolution_mode.ne.em_nse)) then
411  do i=1,nfiss ! loop over fission reactions
412  rat = 0.d0
413  do j=1,9
414  rat = rat +fissrate(i)%param(j)*t9_pow(j)
415  end do
416 
417  ! Check overflows
418  if (rat .lt. dlog(rate_max_cutoff)) then
419  rat = dexp(rat)
420  else
421  rat = rate_max_cutoff
422  end if
423 
424  if(rat.lt.rate_min_cutoff) rat=0.d0
425 
426  if ((fissrate(i)%reac_type .eq. rrt_bf) .or. (fissrate(i)%reac_type .eq. rrt_sf)) then
427  ! Check rate for infinity or nan
428  if ((rat .ge. infty) .or. (rat .ne. rat)) then
429  call raise_exception("Fission rate (spont. and b-delayed) of "//&
430  trim(adjustl(net_names(fissrate(i)%fissparts(1))))//&
431  " was infinity or NaN.","abchange",280004)
432  end if
433  if (y(fissrate(i)%fissparts(1)) .eq. 0) then
434  do j = 1,fissrate(i)%dimens
435  ! Calculate the equation
436  dydt(fissrate(i)%fissparts(j)) = &
437  dydt(fissrate(i)%fissparts(j)) + &
438  rat * fissrate(i)%ch_amount(j) * y(fissrate(i)%fissparts(1))
439  end do
440  end if
441  else if (fissrate(i)%reac_type .eq. rrt_nf) then ! n-induced fission
442  rat = rat * rho
443  ! Avoid multiplying when it will be zero anyways, this also prevents things to get done
444  ! when a rate is possible infinity
445  ! Check rate for infinity or nan
446  if ((rat .ge. infty) .or. (rat .ne. rat)) then
447  call raise_exception("Neutron induced fission rate of "//&
448  trim(adjustl(net_names(fissrate(i)%fissparts(2))))//&
449  " was infinity or NaN.","abchange",280005)
450  end if
451  if (y(fissrate(i)%fissparts(1))*y(fissrate(i)%fissparts(2)) .eq. 0) then
452  do j = 1,fissrate(i)%dimens
453  ! Calculate the equation
454  dydt(fissrate(i)%fissparts(j)) = &
455  dydt(fissrate(i)%fissparts(j)) + &
456  rat * fissrate(i)%ch_amount(j) * y(fissrate(i)%fissparts(1)) * y(fissrate(i)%fissparts(2))
457  end do
458  end if
459  end if
460 
461  end do
462  end if
463 
464 
465  return
466 
467 end subroutine abchange
468 
469 
470 
471 !> Function to decide whether a rate can contribute or not
472 !!
473 !! This function returns true if the rate should not
474 !! be considered in the differential equation.
475 !! This can happen by a small value of the rate or
476 !! by zero abundance of the reactants.
477 !!
478 !! @author M. Reichert
479 !! @date 14.02.23
480 function skip_rate(rat, rrate_in,Y) result(res)
482  implicit none
483  real(r_kind),intent(in) :: rat
484  type(reactionrate_type),intent(in) :: rrate_in
485  real(r_kind), dimension(net_size), intent(in) :: y
486  logical :: res
487  integer :: i
488  integer :: zero_count
489 
490  res = .false.
491 
492  ! Ignore negligible rates
493  if (rat .lt. rate_min_cutoff) res = .true.
494 
495  ! Don't do fission
496  if ((rrate_in%reac_type .eq. rrt_nf) .or. &
497  (rrate_in%reac_type .eq. rrt_bf) .or. &
498  (rrate_in%reac_type .eq. rrt_sf)) then
499  res = .true.
500  end if
501 
502  ! Check if the reaction can be skipped
503  zero_count = 0
504  do i=1,get_nr_reactants(rrate_in%group)
505  if (y(rrate_in%parts(i)) .le. 0) zero_count = zero_count+1
506  if (zero_count .gt. 1) exit
507  end do
508  if (zero_count .gt. 1) res = .true.
509 
510 
511 end function skip_rate
512 
513 
514 !>
515 !! This subroutine calculates the entries in the jacobian and the
516 !! right-hand side of the numerical integration scheme (rhs).
517 !!
518 !! The jacobian is calculated by
519 !! \f[ J = \frac{\mathrm{dYdt}}{dY}. \f]
520 !! The values are directly stored into a sparse format (see \ref pardiso_class::vals).
521 !!
522 !! @note When single_zone_vars::evolution_mode is equal to EM_NSE,
523 !! this subroutine will ignore strong reactions and only
524 !! calculate the contribution of weak reactions.
525 !!
526 !! @note This routine can be used to calculate the jacobian of the original Reaclib format
527 !! without chapter 9-11 as well as the modern format with chapter 9-11.
528 !!
529 !! @see abchange,
530 !! [Hix & Thielemann 1999](https://ui.adsabs.harvard.edu/abs/1999JCoAM.109..321H/abstract),
531 !! [Winteler 2013](https://edoc.unibas.ch/29895/),
532 !! [Lippuner & Roberts 2017](https://ui.adsabs.harvard.edu/abs/2017ApJS..233...18L/abstract)
533 !!
534 !! \b Edited:
535 !! - 26.07.22, MR: Cleaned up the subroutine
536 !! - 06.02.23, MR: Implemented parameter freeze_rate_temp.
537 !! .
538 subroutine jacobi_init (time, itemp, rho, rkm, Y, Y_p, dYdt, rhs, h, evolution_mode)
542  use pardiso_class, only: dia, pt_e, pt_b, rows
546  use screening_module, only: hv, iscreen
547 
548  real(r_kind),intent(in) :: time !< time [s]
549  real(r_kind),intent(in) :: itemp !< initial temperature in units of 10**9 K
550  real(r_kind),intent(in) :: rho !< baryon density [g/cm^3]
551  real(r_kind),intent(in) :: rkm !< current radius im km
552  real(r_kind),dimension(:),intent(in) :: y !< current isotope abundances
553  real(r_kind),dimension(:),intent(in) :: y_p !< isotope abundances for the previous step
554  real(r_kind),dimension(:),intent(inout) :: dydt !< change in abundances due to reaction rates
555  real(r_kind),dimension(:),intent(inout) :: rhs !< right-hand side of the num. integration scheme
556  real(r_kind),intent(in) :: h !< timestep size
557  integer,intent(in) :: evolution_mode !< Evolution mode of the network
558  ! Internal variables
559  integer :: i, j !< Loop variables
560  real(r_kind) :: d !< Diagonals
561  real(r_kind) :: temp !< Temperature [GK]
562  real(r_kind) :: rat !< Reaction rate
563  real(r_kind) :: ye !< electron fraction
564  type(reactionrate_type) :: rr_tmp !< Reaction rate instance
565  character*1,dimension(6) :: descra !< Descriptor for sparse matrix multiplication
566  real(r_kind) :: infty !< Infinity to check for errors
567  integer :: fl_c !< fission loop count
568  real(r_kind) :: l_1
569 
570 
571  info_entry("jacobi_init")
572 
573  ! Initialize variable for infinity checks
574  infty = huge(infty)
575 
576  ! Descriptor for sparse matrix multiplication
577  descra = (/"G"," "," ","F"," "," "/)
578  ! The diagonal value
579  d = 1.d0/h
580 
581 !-----compute electron fraction and molar density
582  ye= sum(isotope(1:net_size)%p_nr*y(1:net_size))
583 
584  ! Reset the qdot for the nuclear heating
585  call reset_qdot(time)
586 
587  ! Check Ye
588  if (ye.ne.ye) then
589  call raise_exception('Ye is NaN','jacobi_init',280006)
590  elseif (ye.lt.0) then
591  call raise_exception('Ye is negative ('//trim(adjustl(num_to_str(ye)))//").",&
592  'jacobi_init',280007)
593  end if
594 
595  ! Check Rho * ye
596  if(dlog10(rho*ye).ne.dlog10(rho*ye)) then
597  ! Raise an exception
598  call raise_exception('log10(rho*ye) is NaN.'//new_line("A")//&
599  "Density is : "//trim(adjustl(num_to_str(rho)))//" [g/ccm]."//new_line("A")//&
600  "Ye is : "//trim(adjustl(num_to_str(ye))),&
601  'jacobi_init',280009)
602  end if
603 
604  ! Freeze the rates at the minimum valid temperature, 1d-2GK
605  if (itemp.le.freeze_rate_temp) then
606  temp = freeze_rate_temp
607  if (.not. freeze_rate_indicator) then
608  print *,"Freezing rates at "//num_to_str(freeze_rate_temp)//" GK"
609  freeze_rate_indicator = .true.
610  endif
611  else
612  temp = itemp
613  end if
614 
615  ! Shut off neutrinos
616  if (nuflag .ge. 1) then
617  if ((time .gt. nu_max_time) .and. (nu_max_time .ne. -1d0)) then
618  if (.not. nu_shutoff_indicator) then
619  print *,"Shutting off neutrino reactions at "//num_to_str(nu_max_time)//" s"
620  nu_shutoff_indicator = .true.
621  end if
622  end if
623  end if
624 
625  ! Initialize dydt and vals
626  vals = 0.d0
627  dydt = 0.d0
628 
629  ! switch between different solvers
630  if(solver==0) then ! implicit Euler
631  do i=1,net_size
632  vals(dia(i)) = 1.d0/h
633  end do
634  elseif(solver==1) then ! Gear's method
635  l_1 = get_l1()
636  do i=1,net_size
637  vals(dia(i)) = l_1/h
638  end do
639  endif
640 
641 
642  ! Be sure to call the reaction rate calculation at least ones to initialize
643  ! (important for fission later on)
644  call calculate_reaction_rate(time, temp, rho, ye, rkm)
645 
646  ! Loop through reactions
647  outer: do i=1,nreac
648  rr_tmp = rrate(i)
649 
650  ! Consider only weak reactions in NSE
651  if ((evolution_mode.eq.em_nse).and.(rr_tmp%is_weak.eqv..false.)) cycle outer
652 
653  ! Check if neutrino rates are still necessary
654  if ((nuflag .ge. 1) .and. (nu_max_time .ne. -1d0) .and. (time .ge. nu_max_time) .and. &
655  (rr_tmp%reac_src .eq. rrs_nu)) then
656  cycle outer
657  end if
658 
659 
660  ! Calculate the reaction rate
661  call calculate_reaction_rate(time, temp, rho, ye, rkm, rrate, i, rat)
662 
663  ! Check if one can ignore the rate
664  if (skip_rate(rat, rrate(i),y)) cycle outer
665 
666  ! Create the jacobian and the DGLs
667  select case (rr_tmp%group)
668  ! Chapter 1-3: one reactant
669  case(1:3,11)
670  do j = 1, 5
671  if (rr_tmp%parts(j) .eq. 0) exit
672  dydt(rr_tmp%parts(j)) = dydt(rr_tmp%parts(j)) + rat * &
673  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1))
674 
675  vals(rr_tmp%cscf_ind(1,j)) = vals(rr_tmp%cscf_ind(1,j)) - rat * &
676  rr_tmp%ch_amount(j)
677  end do
678  ! Chapter 1-4: two reactants
679  case(4:7)
680  do j = 1, 6
681  if (rr_tmp%parts(j) .eq. 0) exit
682  dydt(rr_tmp%parts(j)) = dydt(rr_tmp%parts(j)) + rat * &
683  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1)) * &
684  y(rr_tmp%parts(2))
685 
686  vals(rr_tmp%cscf_ind(1,j)) = vals(rr_tmp%cscf_ind(1,j)) - rat * &
687  rr_tmp%ch_amount(j) * y(rr_tmp%parts(2))
688  vals(rr_tmp%cscf_ind(2,j)) = vals(rr_tmp%cscf_ind(2,j)) - rat * &
689  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1))
690  end do
691  ! Chapter 8-9: three reactants
692  case(8:9)
693  do j = 1, 6
694  if (rr_tmp%parts(j) .eq. 0) exit
695  dydt(rr_tmp%parts(j)) = dydt(rr_tmp%parts(j)) + rat * &
696  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1)) * &
697  y(rr_tmp%parts(2)) * y(rr_tmp%parts(3))
698 
699  vals(rr_tmp%cscf_ind(1,j)) = vals(rr_tmp%cscf_ind(1,j)) - rat * &
700  rr_tmp%ch_amount(j) * y(rr_tmp%parts(2)) * &
701  y(rr_tmp%parts(3))
702  vals(rr_tmp%cscf_ind(2,j)) = vals(rr_tmp%cscf_ind(2,j)) - rat * &
703  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1)) * &
704  y(rr_tmp%parts(3))
705  vals(rr_tmp%cscf_ind(3,j)) = vals(rr_tmp%cscf_ind(3,j)) - rat * &
706  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1)) * &
707  y(rr_tmp%parts(2))
708  end do
709  ! Chapter 10: four reactants
710  case(10)
711  do j = 1, 6
712  if (rr_tmp%parts(j) .eq. 0) exit
713  dydt(rr_tmp%parts(j)) = dydt(rr_tmp%parts(j)) + rat * &
714  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1)) * &
715  y(rr_tmp%parts(2)) * y(rr_tmp%parts(3)) * y(rr_tmp%parts(4))
716 
717  vals(rr_tmp%cscf_ind(1,j)) = vals(rr_tmp%cscf_ind(1,j)) - rat * &
718  rr_tmp%ch_amount(j) * y(rr_tmp%parts(2)) * &
719  y(rr_tmp%parts(3)) * y(rr_tmp%parts(4))
720  vals(rr_tmp%cscf_ind(2,j)) = vals(rr_tmp%cscf_ind(2,j)) - rat * &
721  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1)) * &
722  y(rr_tmp%parts(3)) * y(rr_tmp%parts(4))
723  vals(rr_tmp%cscf_ind(3,j)) = vals(rr_tmp%cscf_ind(3,j)) - rat * &
724  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1)) * &
725  y(rr_tmp%parts(2)) * y(rr_tmp%parts(4))
726  vals(rr_tmp%cscf_ind(4,j)) = vals(rr_tmp%cscf_ind(4,j)) - rat * &
727  rr_tmp%ch_amount(j) * y(rr_tmp%parts(1)) * &
728  y(rr_tmp%parts(2)) * y(rr_tmp%parts(3))
729  end do
730  case default
731  ! Throw exception
732  call raise_exception("Got unknown reaclib chapter ("//&
733  int_to_str(rr_tmp%group)//"). " &
734  ,"jacobi_init",280009)
735  end select
736 
737  ! Cache the rate with the densities included
738  rrate(i)%cached = rat
739 
740  ! Check for infinity rates
741  ! In jacobi init it may not occur as there are several statements setting
742  ! the rate to 1e99 if it is greater than this
743  if ((rat .gt. infty) .or. (rat .ne. rat)) then
744  if (iscreen) then
745  call raise_exception("The rate: "//new_line("A")//&
746  trim(adjustl(reaction_string(rrate(i))))//&
747  new_line("A")//"was infinity or NaN."//new_line("A")//&
748  "Logarithm of screening factor was "//num_to_str(hv(i)),&
749  "jacobi_init",280003)
750  else
751  call raise_exception("The rate: "//new_line("A")//&
752  trim(adjustl(reaction_string(rrate(i))))//&
753  new_line("A")//"was infinity or NaN.",&
754  "jacobi_init",280003)
755  end if
756  end if
757 
758  ! Call the function to calculate the qdot for heating
759  call calculate_qdot(rrate(i),y,h)
760 
761  end do outer
762 
763  !Fission reactions are not taken into account in NSE
764  if ((fissflag.ne.0) .and. (evolution_mode.ne.em_nse)) then
765  fissloop: do i=1,nfiss ! loop over fission reactions to implement correct equations for the fragments
766  rat = 0.d0
767  do j=1,9
768  rat = rat +fissrate(i)%param(j)*t9_pow(j)
769  end do
770 
771  ! Check overflows
772  if (rat .lt. dlog(rate_max_cutoff)) then
773  rat = dexp(rat)
774  else
775  ! Say something for higher verbose levels
776  if (verbose_level .ge. 2) then
777  if (fissrate(i)%fissparts(1) .ne. ineu) then
778  write(*,*)"Fission rate is overflowing. Fissioning nucleus is "//&
779  trim(adjustl(isotope(fissrate(i)%fissparts(1))%name))
780  else
781  write(*,*)"Fission rate is overflowing. Fissioning nucleus is "//&
782  trim(adjustl(isotope(fissrate(i)%fissparts(2))%name))
783  end if
784  end if
785  rat = rate_max_cutoff
786  end if
787 
788  if(rat.ge.rate_min_cutoff) then
789 
790  if ((fissrate(i)%reac_type .eq. rrt_bf) .or. (fissrate(i)%reac_type .eq. rrt_sf)) then ! Spontaneous and beta delayed fission
791  ! Check if the parent nucleus is present
792  ! If not, the reaction is not possible and may not be evaluated. Note that this
793  ! can cause problems as even for a zero value the jacobian will have an entry.
794  ! Do this also only for implicit euler as gear calls the jacobian with a delta
795  ! instead of abundances.
796  if ((y(fissrate(i)%fissparts(1)) .le. 0) .and. (solver .eq. 0)) then
797  ! Since we ordered them, the most important nuclei are at the begining of the
798  ! fissparts. We can therefore approximate the jacobian by the first few entries.
799  fl_c = min(fissrate(i)%dimens, fiss_neglect)
800  else
801  ! If the parent nucleus is present, we can calculate the full jacobian
802  fl_c = fissrate(i)%dimens
803  end if
804 
805  do j = 1, fl_c
806  dydt(fissrate(i)%fissparts(j)) = &
807  dydt(fissrate(i)%fissparts(j)) + &
808  rat * fissrate(i)%ch_amount(j) * y(fissrate(i)%fissparts(1))
809  vals(fissrate(i)%cscf_ind(1,j)) = vals(fissrate(i)%cscf_ind(1,j)) - rat * fissrate(i)%ch_amount(j)
810  end do
811 
812  else if (fissrate(i)%reac_type .eq. rrt_nf) then ! n-induced fission
813  rat = rat * rho
814  ! Also check here if the parent nucleus is present
815  ! If not, the reaction is not possible and may not be evaluated. Note that this
816  ! can cause problems as even for a zero value the jacobian will have an entry.
817  ! Therefore we set at least the first few entries.
818  if ((y(fissrate(i)%fissparts(1)) * y(fissrate(i)%fissparts(2)) .le. 0) .and. (solver .eq. 0)) then
819  ! Since we ordered them, the most important nuclei are at the begining of the
820  ! fissparts. We can therefore approximate the jacobian by the first few entries.
821  fl_c = min(fissrate(i)%dimens, fiss_neglect)
822  else
823  ! If the parent nucleus is present, we can calculate the full jacobian
824  fl_c = fissrate(i)%dimens
825  end if
826 
827  do j = 1,fl_c
828  dydt(fissrate(i)%fissparts(j)) = &
829  dydt(fissrate(i)%fissparts(j)) + &
830  rat * fissrate(i)%ch_amount(j) * y(fissrate(i)%fissparts(1)) * y(fissrate(i)%fissparts(2))
831  vals(fissrate(i)%cscf_ind(1,j)) = vals(fissrate(i)%cscf_ind(1,j)) - rat * fissrate(i)%ch_amount(j) * y(fissrate(i)%fissparts(2))
832  vals(fissrate(i)%cscf_ind(2,j)) = vals(fissrate(i)%cscf_ind(2,j)) - rat * fissrate(i)%ch_amount(j) * y(fissrate(i)%fissparts(1))
833  end do
834 
835  end if
836 
837  end if
838 
839  if(rat.lt.rate_min_cutoff) rat=0.d0
840  fissrate(i)%cached = rat
841  end do fissloop
842  end if
843 
844 
845  ! switch between different solvers
846  if(solver==0) then ! implicit Euler
847  ! additional check for input into pardiso
848  if (verbose_level .ge. 2) then
849  do i=1,net_size
850  if (dydt(i).ne.dydt(i)) then
851  call raise_exception("dYdt of "//trim(adjustl(net_names(i)))//" is NaN.",&
852  "jacobi_init",280010)
853  end if
854  end do
855  end if
856  rhs = dydt + d*(y_p - y)
857  ! computes matrix-vector product for a sparse matrix in the CSC format:
858  call mkl_dcscmv('T',net_size,net_size,1.d0,descra,vals,rows,pt_b, &
859  pt_e,y,1.d0,rhs)
860  elseif(solver==1) then ! Gear's method
861  rhs = -(y - get_predictor_y())*(l_1/h) + (dydt - get_predictor_dydt()/h)
862  endif
863  dydt = dydt + d*(y_p-y)
864 
865  info_exit("jacobi_init")
866 
867 end subroutine jacobi_init
868 
869 
870 end module jacobian_class
parameter_class::iwformat
integer iwformat
defines format of the weak rates (0 = tabulated, 1 = log<ft>)
Definition: parameter_class.f90:81
gear_module::get_predictor_dydt
real(r_kind) function, dimension(net_size), public get_predictor_dydt()
Determines the predicted dydt_next.
Definition: gear_module.f90:332
screening_module
Module to calculate electron screening.
Definition: screening_module.f90:17
pardiso_class::vals
real(r_kind), dimension(:), allocatable, public vals
contains non-zero matrix elements (of the Jacobian)
Definition: pardiso_class.f90:30
parameter_class::freeze_rate_temp
real(r_kind) freeze_rate_temp
Tmperature at which rates get frozen (for reacl. rates this should be 1d-2GK)
Definition: parameter_class.f90:84
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
global_class::reactionrate_type
reaction rate type
Definition: global_class.f90:44
global_class::rrate
type(reactionrate_type), dimension(:), allocatable, public rrate
array containing all reaction rates used in the network
Definition: global_class.f90:65
nuflux_class::calculate_nu_rate
subroutine, public calculate_nu_rate(rrate, rat_calc)
Calculates the cross section times the neutrino flux.
Definition: nuflux_class.f90:336
reaclib_rate_module
Module that deals with reaclib reaction rates.
Definition: reaclib_rate_module.f90:13
nuclear_heating
Takes care of the temperature and entropy updates due to the nuclear energy release.
Definition: nuclear_heating.f90:11
jacobian_class::rate_min_cutoff
real(r_kind), parameter, private rate_min_cutoff
Minimum cutoff for the reaction rates.
Definition: jacobian_class.f90:25
rrs_reacl
#define rrs_reacl
Definition: macros.h:49
error_msg_class
Error handling routines.
Definition: error_msg_class.f90:16
jacobian_class::old_dens
real(r_kind), private old_dens
Definition: jacobian_class.f90:29
benam_class::reaction_string
character(50) function, public reaction_string(reac)
Return a string to represent a given reaction.
Definition: benam_class.f90:119
fission_rate_module
Module to deal with fission reactions.
Definition: fission_rate_module.f90:16
nucstuff_class::pf
real(r_kind), dimension(:), allocatable, public pf
partition functions
Definition: nucstuff_class.f90:18
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
rrs_aext
#define rrs_aext
Definition: macros.h:56
pardiso_class::dia
integer, dimension(:), allocatable, public dia
dia(j) gives the index into vals that contains the (j,j) diagonal element of the matrix
Definition: pardiso_class.f90:34
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
jacobian_class::skip_rate
logical function skip_rate(rat, rrate_in, Y)
Function to decide whether a rate can contribute or not.
Definition: jacobian_class.f90:481
jacobian_class::old_temp
real(r_kind), private old_temp
Definition: jacobian_class.f90:29
fission_rate_module::nfiss
integer, public nfiss
Amount of fission rates.
Definition: fission_rate_module.f90:68
pardiso_class::pt_e
integer, dimension(:), allocatable, public pt_e
pt_e(j)-pt_b(j) gives the index into vals that contains the LAST non-zero element of column j of the ...
Definition: pardiso_class.f90:33
parameter_class::use_timmes_mue
logical use_timmes_mue
Use electron chemical potentials from timmes EOS for theoretical weak rates.
Definition: parameter_class.f90:96
jacobian_class::abchange
subroutine, public abchange(time, itemp, rho, Ye, rkm, Y, dYdt, evolution_mode)
This subroutine calculates the change in abundances (dYdt) due to reaction rates at given temperature...
Definition: jacobian_class.f90:290
jacobian_class::nu_shutoff_indicator
logical, private nu_shutoff_indicator
Indicator for debug statement.
Definition: jacobian_class.f90:28
jacobian_class::old_time
real(r_kind), private old_time
Definition: jacobian_class.f90:29
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
tw_rate_module::mue
real(r_kind), public mue
chemical potential of the electron
Definition: tw_rate_module.f90:62
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
pardiso_class::jind
integer, dimension(:,:), allocatable, public jind
jind(i,j) contains the index of jacobian entry in vals
Definition: pardiso_class.f90:35
rrs_wext
#define rrs_wext
Definition: macros.h:55
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
tw_rate_module::weak
logical, public weak
switch for weak rates
Definition: tw_rate_module.f90:58
jacobian_class::old_ye
real(r_kind), private old_ye
Definition: jacobian_class.f90:29
detailed_balance
Module that deals with inverse reaction rates.
Definition: detailed_balance.f90:57
gear_module::get_l1
real(r_kind) function, public get_l1()
The current l_1 (in Fortran: l(2))
Definition: gear_module.f90:281
rrs_twr
#define rrs_twr
Definition: macros.h:52
global_class::net_size
integer, public net_size
total number of isotopes (network size)
Definition: global_class.f90:93
effphase_class
Calculate the effective phase space integral needed for the log(ft) weak rates.
Definition: effphase_class.f90:18
parameter_class::unit
type(unit_type), public unit
constants and unit conversion factors
Definition: parameter_class.f90:54
jacobian_class::rate_max_cutoff
real(r_kind), parameter, private rate_max_cutoff
Maximum cutoff for the reaction rates.
Definition: jacobian_class.f90:26
rrs_nu
#define rrs_nu
Definition: macros.h:51
gear_module::get_predictor_y
real(r_kind) function, dimension(net_size), public get_predictor_y()
Determines the predicted y_next.
Definition: gear_module.f90:314
fission_rate_module::fissrate
type(fissionrate_type), dimension(:), allocatable, public fissrate
Array storing fission reactions.
Definition: fission_rate_module.f90:39
jacobian_class::old_rad
real(r_kind), private old_rad
Definition: jacobian_class.f90:29
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
nuclear_heating::reset_qdot
subroutine reset_qdot(time)
Reset the qdot variable.
Definition: nuclear_heating.f90:155
tabulated_rate_module::tabulated
logical, public tabulated
switch for tabulated rates
Definition: tabulated_rate_module.f90:39
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
pardiso_class
Contains subroutines for sparse matrix assembly and the solver core.
Definition: pardiso_class.f90:24
pardiso_class::rows
integer, dimension(:), allocatable, public rows
rows(i) is the number of the row in the matrix that contains the i-th value in vals
Definition: pardiso_class.f90:31
r_kind
#define r_kind
Definition: macros.h:46
tabulated_rate_module::tabulated_index
subroutine, public tabulated_index(temp)
Set tab_index for a given temperature.
Definition: tabulated_rate_module.f90:537
chempot
subroutine chempot(temp, den, ye, etaele, etapos)
Given a temperature temp [K], density den [g/cm**3], and a composition characterized by y_e,...
Definition: chem_pot.f90:25
screening_module::hv
real(r_kind), dimension(:), allocatable, public hv
Screening correction.
Definition: screening_module.f90:20
nuclear_heating::calculate_qdot
subroutine calculate_qdot(rrate, Y, h)
Definition: nuclear_heating.f90:201
jacobian_class::freeze_rate_indicator
logical, private freeze_rate_indicator
Indicator for debug statement.
Definition: jacobian_class.f90:27
fission_rate_module::fiss_neglect
integer, parameter, public fiss_neglect
Amount of fission fragments not to be neglected.
Definition: fission_rate_module.f90:66
jacobian_class::jacobi_init
subroutine, public jacobi_init(time, itemp, rho, rkm, Y, Y_p, dYdt, rhs, h, evolution_mode)
This subroutine calculates the entries in the jacobian and the right-hand side of the numerical integ...
Definition: jacobian_class.f90:539
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
jacobian_class
Contains subroutines to assemble the system Jacobian and changes in the abundances.
Definition: jacobian_class.f90:12
nucstuff_class::t9_pow
real(r_kind), dimension(9), public t9_pow
Powers of T, used for the rates.
Definition: nucstuff_class.f90:15
screening_module::screen
subroutine, public screen(t9, rho, n, ye, mode)
This function calculates the screening coefficients hv.
Definition: screening_module.f90:78
rrs_fiss
#define rrs_fiss
Definition: macros.h:54
tabulated_rate_module
This module contains everything for the tabulated rates that can replace reaclib rates.
Definition: tabulated_rate_module.f90:28
pardiso_class::pt_b
integer, dimension(:), allocatable, public pt_b
pt_b(j) gives the index into vals that contains the FIRST non-zero element of column j of the matrix
Definition: pardiso_class.f90:32
nucstuff_class::inter_partf
subroutine, public inter_partf(temp, interpol)
Calculates partition function.
Definition: nucstuff_class.f90:132
global_class
Contains types and objects shared between multiple modules.
Definition: global_class.f90:19
parameter_class::nu_max_time
real(r_kind) nu_max_time
Maximum time for neutrino reactions to react.
Definition: parameter_class.f90:198
tabulated_rate_module::calculate_tab_rate
subroutine, public calculate_tab_rate(rrate, temp, rat_calc)
Calculates the tabulated rate.
Definition: tabulated_rate_module.f90:191
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
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
rrt_sf
#define rrt_sf
Definition: macros.h:80
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
jacobian_class::calculate_reaction_rate
subroutine, private calculate_reaction_rate(time, temp, rho, Ye, rkm, rrate_array, idx, rat_calc)
Subroutine to calculate the reaction rates.
Definition: jacobian_class.f90:57
rrs_detb
#define rrs_detb
Definition: macros.h:53
parameter_class::nuflag
integer nuflag
defines type of neutrino reactions used
Definition: parameter_class.f90:85
screening_module::iscreen
logical, public iscreen
Flag whether screening is enabled or not.
Definition: screening_module.f90:24
rrs_tabl
#define rrs_tabl
Definition: macros.h:50
gear_module
gear_module contains adaptive high-order Gear solver
Definition: gear_module.f90:37
parameter_class
Contains all runtime parameters as well as phys and math constants.
Definition: parameter_class.f90:24
tw_rate_module::calculate_twr_rate
subroutine, public calculate_twr_rate(rrate, temp, rho, Ye, rat_calc, nuloss)
Calculate the theoretical weak rate.
Definition: tw_rate_module.f90:485
benam_class
Subroutines needed to initialise the network.
Definition: benam_class.f90:11