Module with subroutines for generating the initial spatial distribution of the different partciles' species in the simulation.
Function used to find the zeros of of \ref korc_spatial_distribution.exponential_torus.
@param f Value of function. @param r Guess value of radial position of the particles. @param a Minor radius of the toroidal distribution @param ko Decay rate of radial distribution, see of \ref korc_spatial_distribution.exponential_torus. @param P Deviate of a random uniform distribution in the interval . @brief Subroutine that generates a exponentially decaying radial distribution of particles in a circular cross-section torus of major and minor radi and , respectively. @details We generate this exponentially decaying radial distribution following the same approach as in \ref korc_spatial_distribution.disk, but this time, the radial distribution is given by:
The radial position of the particles is obtained using the Inverse Trasnform Sampling method, finding numerically through the Newton-Raphson method. First, we calculate the particles' radial distribution in a disk centered at . Then, we transfor to a new set of coordinates where the disk is centered at . Finally, we generate the toroidal distribution by givin each particle a toroidal angle which follows a uniform distribution in the interval .
@param[in] params Core KORC simulation parameters. @param[in,out] spp An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. @param fl Variable used in the Newton-Raphson method for finding the radial position of each particle. @param fr Variable used in the Newton-Raphson method for finding the radial position of each particle. @param fm Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rl Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rr Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rm Variable used in the Newton-Raphson method for finding the radial position of each particle. @param relerr Tolerance used to determine when to stop iterating the Newton-Raphson method for finding . @param r Radial position of the particles . @param theta Uniform deviates in the range representing the uniform poloidal angle distribution of the particles. @param zeta Uniform deviates in the range representing the uniform toroidal angle distribution of the particles. @param pp Particle iterator. @brief Subroutine that generates an exponentially decaying radial distribution in an elliptic torus as the initial spatial condition of a given particle species in the simulation. @details As a first step, we generate an exponentially decaying radial distribution in a circular cross-section torus as in \ref korc_spatial_distribution.exponential_torus. Then we transform this spatial distribution to a one in an torus with an elliptic cross section, this following the same approach as in \ref korc_spatial_distribution.elliptic_torus.
@param[in] params Core KORC simulation parameters. @param[in,out] spp An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. @param fl Variable used in the Newton-Raphson method for finding the radial position of each particle. @param fr Variable used in the Newton-Raphson method for finding the radial position of each particle. @param fm Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rl Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rr Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rm Variable used in the Newton-Raphson method for finding the radial position of each particle. @param relerr Tolerance used to determine when to stop iterating the Newton-Raphson method for finding . @param rotation_angle This is the angle in \ref korc_spatial_distribution.elliptic_torus. @param r Radial position of the particles . @param theta Uniform deviates in the range representing the uniform poloidal angle distribution of the particles. @param zeta Uniform deviates in the range representing the uniform toroidal angle distribution of the particles. @param X Auxiliary vector used in the coordinate transformations. @param Y Auxiliary vector used in the coordinate transformations. @param X1 Auxiliary vector used in the coordinate transformations. @param Y1 Auxiliary vector used in the coordinate transformations. @param pp Particle iterator. @brief Subroutine that generates a Gaussian radial distribution in an elliptic torus as the initial spatial condition of a given particle species in the simulation. @details As a first step, we generate an Gaussian radial distribution in a circular cross-section torus as in \ref korc_spatial_distribution.gaussian_torus. Then we transform this spatial distribution to a one in an torus with an elliptic cross section, this following the same approach as in \ref korc_spatial_distribution.elliptic_torus.
@param[in] params Core KORC simulation parameters. @param[in,out] spp An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. @param rotation_angle This is the angle in \ref korc_spatial_distribution.elliptic_torus. @param r Radial position of the particles . @param theta Uniform deviates in the range representing the uniform poloidal angle distribution of the particles. @param zeta Uniform deviates in the range representing the uniform toroidal angle distribution of the particles. @param X Auxiliary vector used in the coordinate transformations. @param Y Auxiliary vector used in the coordinate transformations. @param X1 Auxiliary vector used in the coordinate transformations. @param Y1 Auxiliary vector used in the coordinate transformations. @param sigma Standard deviation of the radial distribution function. @param pp Particle iterator. @brief Subroutine that generates a Gaussian radial distribution of particles in a circular cross-section torus of major and minor radi and , respectively. @details We generate this exponentially decaying radial distribution following the same approach as in \ref korc_spatial_distribution.disk, but this time, the radial distribution is given by:
The radial position of the particles is obtained using the Inverse Trasnform Sampling method, finding numerically through the Newton-Raphson method. First, we calculate the particles' radial distribution in a disk centered at . Then, we transfor to a new set of coordinates where the disk is centered at . Finally, we generate the toroidal distribution by givin each particle a toroidal angle which follows a uniform distribution in the interval .
@param[in] params Core KORC simulation parameters. @param[in,out] spp An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. @param fl Variable used in the Newton-Raphson method for finding the radial position of each particle. @param fr Variable used in the Newton-Raphson method for finding the radial position of each particle. @param fm Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rl Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rr Variable used in the Newton-Raphson method for finding the radial position of each particle. @param rm Variable used in the Newton-Raphson method for finding the radial position of each particle. @param relerr Tolerance used to determine when to stop iterating the Newton-Raphson method for finding . @param r Radial position of the particles . @param theta Uniform deviates in the range representing the uniform poloidal angle distribution of the particles. @param zeta Uniform deviates in the range representing the uniform toroidal angle distribution of the particles. @param pp Particle iterator.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rp), | private, | parameter | :: | minmax_buffer_size | = | 10.0_rp |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | r | |||
real(kind=rp), | intent(in) | :: | a | |||
real(kind=rp), | intent(in) | :: | ko | |||
real(kind=rp), | intent(in) | :: | P |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | R | R-coordinate of MH sampled location |
||
real(kind=rp), | intent(in) | :: | R0 | R-coordinate of center of 2D Gaussian |
||
real(kind=rp), | intent(in) | :: | sigR | Variance of first dimension of 2D Gaussian |
||
real(kind=rp), | intent(in) | :: | Z | Z-coordinate of MH sampled location |
||
real(kind=rp), | intent(in) | :: | Z0 | Z-coordinate of center of 2D Gaussian |
||
real(kind=rp), | intent(in) | :: | sigZ | Variance of second dimension of 2D Gaussian |
||
real(kind=rp), | intent(in) | :: | theta | Angle of counter-clockwise rotation (in radians), of 2D Gaussian distribution relative to R,Z |
Argument of exponential comprising 2D Gaussian distribution
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | psi | |||
real(kind=rp), | intent(in) | :: | psi_max |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | mean | |||
real(kind=rp), | intent(in) | :: | sigma |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | R0 | |||
real(kind=rp), | intent(in) | :: | b | |||
real(kind=rp), | intent(in) | :: | w | |||
real(kind=rp), | intent(in) | :: | dlam | |||
real(kind=rp), | intent(in) | :: | R | |||
real(kind=rp), | intent(in) | :: | Z | |||
real(kind=rp), | intent(in) | :: | T |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(SPECIES), | intent(inout) | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
type(SPECIES), | intent(inout) | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
type(SPECIES), | intent(inout) | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
type(SPECIES), | intent(inout) | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | |||
type(SPECIES), | intent(inout) | :: | spp |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | |||
type(SPECIES), | intent(inout) | :: | spp |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | |||
type(SPECIES), | intent(inout) | :: | spp |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
type(SPECIES), | intent(inout) | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | |||
type(SPECIES), | intent(inout) | :: | spp |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
type(SPECIES), | intent(inout) | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(inout) | :: | params | Core KORC simulation parameters. |
||
type(SPECIES), | intent(inout) | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
||
type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(inout) | :: | params | Core KORC simulation parameters. |
||
type(SPECIES), | intent(inout), | DIMENSION(:), ALLOCATABLE | :: | spp | An instance of the derived type SPECIES containing all the parameters and simulation variables of the different species in the simulation. |
|
type(PROFILES), | intent(in) | :: | P | An instance of the KORC derived type PROFILES. |
||
type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |