@brief Module that contains subroutines and functions to sample various energy distributions.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(GAMMA_PARAMS), | private | :: | gamma_pdf_params | ||||
real(kind=rp), | private, | parameter | :: | co | = | (C_E*1.0E6)/(C_ME*C_C**2) | @f$f_\Gamma(\mathcal{E},\kappa,\theta)@f$ from MeV to Joules. |
real(kind=rp), | private, | parameter | :: | minmax_buffer_size | = | 10.0_rp | using a Metropolis-Hastings method to sample a distribution. |
@brief KORC derived type that contains information about a given Gamma distribution function @f$f_\Gamma(x,\kappa,\theta)@f$. @details We write a given Gamma distribution function in terms of its shape factor @f$\kappa@f$ and scale factor @f$\theta@f$, so that:
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rp), | public | :: | min_energy | ||||
real(kind=rp), | public | :: | max_energy | ||||
real(kind=rp), | public | :: | min_p | ||||
real(kind=rp), | public | :: | max_p | ||||
real(kind=rp), | public | :: | k | ||||
real(kind=rp), | public | :: | t |
@brief Function that converts @f$x@f$ from degrees to radians.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | x |
@brief Function that calculates the value of the Gamma distribution @f$f_\Gamma(x,\kappa,\theta) = \frac{1}{\Gamma(\kappa) \theta^\kappa}x^{\kappa-1}\exp{\left(-x/\theta\right)}@f$.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | x | |||
real(kind=rp), | intent(in) | :: | k | |||
real(kind=rp), | intent(in) | :: | t |
Evaluation of the energy distribution function @f$f_{RE}(\mathcal{E})@f$ of runaway electrons as function of the normalized momentum @f$p' = p/m_ec@f$. Here, @f$p'@f$ is the normalized momentum and @f$m_e@f$ and @f$c@f$ are the electron mass and the speed of light.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | p |
@brief Gaussian random number generator. @details This function returns a deviate of a Gaussian distribution @f$f_G(x;\mu,\sigma) = \frac{1}{\sigma\sqrt{2\pi}} \exp{\left( -(x-\mu)^2/2\sigma^2 \right)}@f$, with mean @f$\mu@f$, and standard deviation @f$\sigma@f$.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | mean | |||
real(kind=rp), | intent(in) | :: | sigma |
@brief Subroutine that contains calls to subroutine to generate a gamma distribution for the energy distribution of a given species in the simulation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | |||
real(kind=rp), | intent(inout), | DIMENSION(:), ALLOCATABLE | :: | g | ||
real(kind=rp), | intent(out) | :: | go |
@brief Subroutine that reads from the input file the parameters of the Gamma distribution @f$f_\Gamma(x,\kappa,\theta) = \frac{1}{\Gamma(\kappa) \theta^\kappa}x^{\kappa-1}\exp{\left(-x/\theta\right)}@f$.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params |
@brief Subroutine that samples a Gamma distribution representing the runaways' (marginal) energy distribution function. @details This subroutine uses the Metropolis-Hastings method for sampling the Gamma distribution representing the runaways' (marginal) energy distribution function. Unlike the typical Metropolis-Hasting method, after setting the boundaries of the region we want to sample, we perform a sampling in a larger region that contains the original sampling area plus a buffer region. After finishing the first sampling, we only keep the particles in the original sampling region, the particles in the p_buffer are sampled again until all of them lie within the original sampling region. This method ensures that the boundaries are well sampled.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | |||
real(kind=rp), | intent(inout), | DIMENSION(:), ALLOCATABLE | :: | g | ||
real(kind=rp), | intent(out) | :: | go |
@brief Surboutine that saves the Gamma distribution parameters to the HDF5 file gamma_distribution_parameters.h5.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params |