winnse_module Module Reference

Module to calculate NSE. More...

Functions/Subroutines

subroutine, public nse_init ()
 Allocates and initialises various arrays needed for the nse calculation. More...
 
subroutine, public winnse_guess (t9, rho, ye, yn_guess, yp_guess, ysol)
 Calculate NSE composition with an initial guess. More...
 
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 accurately predicted, to the desired temperature. More...
 
subroutine, private winnse_calc (t9, rho, ye, yn, yp, imax, kit)
 Solves the nse-equations. More...
 
subroutine, private winnse_calc_hybrid_powell (t9, rho, ye, yn, yp, imax, kit)
 Solves the nse-equations using the Powell hybrid method. More...
 
subroutine, private winnse_calc_nr (t9, rho, ye, yn, yp, imax, kit)
 Solves the nse-equations using a 2-dimensional newton-raphson scheme. More...
 
subroutine, private nse_screen (t9, rho, ye)
 Calls screening subroutine and adds subsequent proton capture screening corrections in scrn(1:zmax). More...
 
subroutine, private wincnse_calc (t9, rho)
 Calculates the nse coefficients C, as given in Hix,Thielemann '99, Eq.25. More...
 

Variables

real(r_kind), dimension(:), allocatable, public ynse
 NSE abundances. More...
 
real(r_kind), dimension(:), allocatable, public pf
 Partition function for a given temperature. More...
 
real(r_kind), dimension(:), allocatable, private gg
 \( G(Z,A)=(2J_0+1) \) where \( J_0 \) is the spin of the ground state More...
 
real(r_kind), dimension(:), allocatable, private be
 Binding energy, calculated using mass excesses. More...
 
real(r_kind), dimension(:), allocatable, private scrn
 Screening correction (details see nse_screen) More...
 
real(r_kind), dimension(:), allocatable, public cnse
 NSE coefficients (details see cnsecalc) More...
 
real(r_kind), public ye_ext
 Electron fraction to pass to external function. More...
 
integer, dimension(:), allocatable, public aa
 Mass number. More...
 
integer, dimension(:), allocatable, public zz
 Proton number. More...
 
integer, dimension(:), allocatable, public nn
 Neutron number. More...
 
integer, private zmax
 Highest proton number occuring in network. More...
 

Detailed Description

Module to calculate NSE.

The winnse_module calculates NSE composition (with or without screening corrections). For this it uses various inputs as, e.g., the partition functions, binding energies, and the spin of the ground state of each nucleus. The necessary data is stored in global_class::isotope.

The NSE composition favors different nuclei, dependent on the conditions. A rough overview is given by:

Dominant nuclear species when assuming NSE for different conditions.
See also
Hix & Thielemann 1999, Winteler 2013, Lippuner & Roberts 2017, Smith et al. 2023

Function/Subroutine Documentation

◆ nse_init()

subroutine, public winnse_module::nse_init

Allocates and initialises various arrays needed for the nse calculation.

This subroutine also writes the content of global_class::isotope into shorter variables, such as aa, nn, and gg. In addition it calculates the binding energy

\[ Be(i) = Z(i) \cdot (Z_{me} + e_{m}) + N(i) \cdot N_{me} - M_{exc}(i) \]

with the mass excess of protons (Z), neutrons (N), and the isotope (i), \( Z_{me} \), \( N_{me} \), and \( M_{exc} \). The mass of the electrons (e) is given by \( e_{m} \). Furthermore it calculates \( 1 + 2 \cdot J \) with J being the spin of the ground state.

Edited: 12.01.14

Definition at line 74 of file winnse_module.f90.

◆ nse_screen()

subroutine, private winnse_module::nse_screen ( real(r_kind), intent(in)  t9,
real(r_kind), intent(in)  rho,
real(r_kind), intent(in)  ye 
)
private

Calls screening subroutine and adds subsequent proton capture screening corrections in scrn(1:zmax).

This subroutine iterates over all possible amount of protons of a nucleus (up to zmax). It uses the subroutine screen to calculate the screening corrections. After it has been called, the array scrn contains summed screening corrections for proton captures from z=1 to z=i for scrn(i) on symmetric nuclei ( \( A = 2 \cdot Z \)).

Edited:

  • 12.01.14
Parameters
[in]t9temperature in GK
[in]rhodensity in g/cm^3
[in]yeelectron fraction

Definition at line 584 of file winnse_module.f90.

◆ wincnse_calc()

subroutine, private winnse_module::wincnse_calc ( real(r_kind), intent(in)  t9,
real(r_kind), intent(in)  rho 
)
private

Calculates the nse coefficients C, as given in Hix,Thielemann '99, Eq.25.

This subroutine calculates:

\[ \frac{G(^A Z)}{2^A} \left( \frac{ \rho N_A }{\theta} \right)^{A-1} A^{\frac{3}{2}} \exp{ \left( \frac{B(^A Z)}{k_B T} \right)} \]

,where \( G \) are the partition functions, A the mass number, \( \rho \) the density, \( N_A \) avogadros number, B the binding energy, \( k_B \) the boltzman constant, and T the temperature. Theta is a helper variable and given by:

\[ \theta = \left( \frac{m_u k_B T}{2\pi \hbar^2} \right) \]

The result is stored in the array cnse.

Edited:

  • 12.01.14
Parameters
[in]t9temperature in GK
[in]rhodensity in g/cm^3

Definition at line 626 of file winnse_module.f90.

Here is the call graph for this function:

◆ winnse_calc()

subroutine, private winnse_module::winnse_calc ( real(r_kind), intent(in)  t9,
real(r_kind), intent(in)  rho,
real(r_kind), intent(in)  ye,
real(r_kind), intent(inout)  yn,
real(r_kind), intent(inout)  yp,
integer, intent(in)  imax,
integer, intent(out)  kit 
)
private

Solves the nse-equations.

This subroutine solves the NSE equations. It hereby choses between two different solvers as defined by the parameter parameter_class::nse_solver that is defined as in the following table:

nse_solver Solver
0 Newton-Raphson
1 Powell's hybrid method
Author
M. Reichert
Date
14.06.23
Parameters
[in]t9temperature in GK
[in]rhodensity in g/cm^3
[in]yeelectron fraction
[in,out]ynneutron abundance
[in,out]ypproton abundance
[in]imaxmax. number of iterations
[out]kitactual number of iterations

Definition at line 274 of file winnse_module.f90.

Here is the call graph for this function:

◆ winnse_calc_hybrid_powell()

subroutine, private winnse_module::winnse_calc_hybrid_powell ( real(r_kind), intent(in)  t9,
real(r_kind), intent(in)  rho,
real(r_kind), intent(in)  ye,
real(r_kind), intent(inout)  yn,
real(r_kind), intent(inout)  yp,
integer, intent(in)  imax,
integer, intent(out)  kit 
)
private

Solves the nse-equations using the Powell hybrid method.

This subroutine solves the NSE equations. It's two dimensional as the unknowns are the neutron abundances Yn and proton abundances Yp. The underlying constraints are mass conservation \( \sum X_i = \sum Y_i \cdot A_i = 1 \) and charge conservation \( \sum Y_i \cdot Z_i = y_e \). The subroutine makes use of the minpack routine fsolve.

Author
M. Reichert
Date
14.06.23
Parameters
[in]t9temperature in GK
[in]rhodensity in g/cm^3
[in]yeelectron fraction
[in,out]ynneutron abundance
[in,out]ypproton abundance
[in]imaxmax. number of iterations
[out]kitactual number of iterations

Definition at line 322 of file winnse_module.f90.

Here is the call graph for this function:

◆ winnse_calc_nr()

subroutine, private winnse_module::winnse_calc_nr ( real(r_kind), intent(in)  t9,
real(r_kind), intent(in)  rho,
real(r_kind), intent(in)  ye,
real(r_kind), intent(inout)  yn,
real(r_kind), intent(inout)  yp,
integer, intent(in)  imax,
integer, intent(out)  kit 
)
private

Solves the nse-equations using a 2-dimensional newton-raphson scheme.

This subroutine solves the NSE equations. It's two dimensional as the unknowns are the neutron abundances Yn and proton abundances Yp. The underlying constraints are mass conservation \( \sum X_i = \sum Y_i \cdot A_i = 1 \) and charge conservation \( \sum Y_i \cdot Z_i = y_e \). Furthermore it uses the so called saha equation:

\[ Y(N,Z) = G_{N,Z}(\rho N_A)^{N+Z-1}\frac{\left( N +Z \right)^{3/2}}{2^{N+Z}}\left(\frac{2\pi \hbar} {m_\mathrm{u} k_{\mathrm{B}}T}\right)^{\frac{3}{2}(N+Z-1)} \mathrm{exp}(B_{N,Z}/ k_B T)Y^{N}_\mathrm{n} Y^Z_\mathrm{p}, \]

Warning
Here, the abundance of neutrons and protons are used explicitely. A simulation without neutrons and protons specified in the sunet that tries to calculate NSE will result in an error!
See also
wincnse_calc

Edited:

  • 12.01.14
  • 15.01.21
  • 23.01.21 MR, Fixed overflows in this routine
Parameters
[in]t9temperature in GK
[in]rhodensity in g/cm^3
[in]yeelectron fraction
[in,out]ynneutron abundance
[in,out]ypproton abundance
[in]imaxmax. number of iterations
[out]kitactual number of iterations

Definition at line 400 of file winnse_module.f90.

Here is the call graph for this function:

◆ winnse_descend()

subroutine, public winnse_module::winnse_descend ( real(r_kind), intent(in)  t9strt,
real(r_kind), intent(in)  t9fnl,
real(r_kind), intent(in)  rho,
real(r_kind), intent(in)  ye,
real(r_kind), intent(in)  yni,
real(r_kind), intent(in)  ypi,
real(r_kind), dimension(net_size), intent(inout)  ysol 
)

This routine descends from an initially high temperature, at which the NSE abudances can be accurately predicted, to the desired temperature.

At high temperatures, the solution is more stable and the solution of NSE at a high temperature can be used as an initial guess of a lower temperature. This increases the stability of the calculation and it can iterate to the input temperature "t9fnl". The temperature step is adaptive in this process, however, if it becomes too small ( \( 10^{-20} \) GK) an error is raised.

Parameters
[in]t9strthigh initial temperature in GK
[in]t9fnldesired temperature in GK
[in]rhodensity in g/cm^3
[in]yeelectron fraction
[in]ynineutron abundance
[in]ypiproton abundance
[in,out]ysol[out] nse abundances

Definition at line 176 of file winnse_module.f90.

Here is the call graph for this function:

◆ winnse_guess()

subroutine, public winnse_module::winnse_guess ( real(r_kind), intent(in)  t9,
real(r_kind), intent(in)  rho,
real(r_kind), intent(in)  ye,
real(r_kind), intent(in)  yn_guess,
real(r_kind), intent(in)  yp_guess,
real(r_kind), dimension(net_size), intent(inout)  ysol 
)

Calculate NSE composition with an initial guess.

The subroutine tries to calculate nse with an initial guess and if it does not converge, it descends from a high temperature. This routine is used if the parameter parameter_class::nse_calc_every is not equal to zero.

Author
Moritz Reichert
Parameters
[in]t9desired temperature in GK
[in]rhodensity in g/cm^3
[in]yeelectron fraction
[in]yn_guessneutron abundance
[in]yp_guessproton abundance
[in,out]ysol[out] nse abundances

Definition at line 115 of file winnse_module.f90.

Here is the call graph for this function:

Variable Documentation

◆ aa

integer, dimension(:), allocatable, public winnse_module::aa

Mass number.

Definition at line 45 of file winnse_module.f90.

◆ be

real(r_kind), dimension(:), allocatable, private winnse_module::be
private

Binding energy, calculated using mass excesses.

Definition at line 40 of file winnse_module.f90.

◆ cnse

real(r_kind), dimension(:), allocatable, public winnse_module::cnse

NSE coefficients (details see cnsecalc)

Definition at line 42 of file winnse_module.f90.

◆ gg

real(r_kind), dimension(:), allocatable, private winnse_module::gg
private

\( G(Z,A)=(2J_0+1) \) where \( J_0 \) is the spin of the ground state

Definition at line 39 of file winnse_module.f90.

◆ nn

integer, dimension(:), allocatable, public winnse_module::nn

Neutron number.

Definition at line 47 of file winnse_module.f90.

◆ pf

real(r_kind), dimension(:), allocatable, public winnse_module::pf

Partition function for a given temperature.

Definition at line 38 of file winnse_module.f90.

◆ scrn

real(r_kind), dimension(:), allocatable, private winnse_module::scrn
private

Screening correction (details see nse_screen)

Definition at line 41 of file winnse_module.f90.

◆ ye_ext

real(r_kind), public winnse_module::ye_ext

Electron fraction to pass to external function.

Definition at line 43 of file winnse_module.f90.

◆ ynse

real(r_kind), dimension(:), allocatable, public winnse_module::ynse

NSE abundances.

Definition at line 37 of file winnse_module.f90.

◆ zmax

integer, private winnse_module::zmax
private

Highest proton number occuring in network.

Definition at line 49 of file winnse_module.f90.

◆ zz

integer, dimension(:), allocatable, public winnse_module::zz

Proton number.

Definition at line 46 of file winnse_module.f90.