ASCOT Fusion Source Integrator AFSI.
More...
#include <string.h>
#include <math.h>
#include <hdf5_hl.h>
#include "ascot5.h"
#include "print.h"
#include "gitver.h"
#include "physlib.h"
Go to the source code of this file.
|
void | afsi_compute_product_momenta_2d (int i, real m1, real m2, real mprod1, real mprod2, real Q, int prodmomspace, real *ppara1, real *pperp1, real *ppara2, real *pperp2, real *vcom2, real *prod1_p1, real *prod1_p2, real *prod2_p1, real *prod2_p2) |
| Compute momenta of reaction products.
|
|
void | afsi_sample_reactant_momenta_2d (sim_data *sim, afsi_data *afsi, real mass1, real mass2, real vol, int nsample, size_t i0, size_t i1, size_t i2, real r, real phi, real z, real time, real rho, real *density1, real *ppara1, real *pperp1, real *density2, real *ppara2, real *pperp2) |
| Sample velocities from reactant distributions.
|
|
void | afsi_sample_beam_2d (histogram *hist, real mass, real vol, int nsample, size_t i0, size_t i1, size_t i2, real *density, real *ppara, real *pperp) |
| Sample ppara and pperp from a 5D distribution.
|
|
void | afsi_sample_thermal_2d (sim_data *sim, int ispecies, real mass, int nsample, real r, real phi, real z, real time, real rho, real *density, real *ppara, real *pperp) |
| Sample ppara and pperp from a thermal (Maxwellian) population.
|
|
void | afsi_run (sim_data *sim, afsi_data *afsi, int n, histogram *prod1, histogram *prod2) |
| Calculate fusion source from two arbitrary ion distributions.
|
|
ASCOT Fusion Source Integrator AFSI.
Definition in file afsi.c.
◆ afsi_compute_product_momenta_2d()
void afsi_compute_product_momenta_2d |
( |
int | i, |
|
|
real | m1, |
|
|
real | m2, |
|
|
real | mprod1, |
|
|
real | mprod2, |
|
|
real | Q, |
|
|
int | prodmomspace, |
|
|
real * | ppara1, |
|
|
real * | pperp1, |
|
|
real * | ppara2, |
|
|
real * | pperp2, |
|
|
real * | vcom2, |
|
|
real * | prod1_p1, |
|
|
real * | prod1_p2, |
|
|
real * | prod2_p1, |
|
|
real * | prod2_p2 ) |
Compute momenta of reaction products.
- Parameters
-
i | marker index on input velocity and output momentum arrays. |
m1 | mass of reactant 1 [kg]. |
m2 | mass of reactant 2 [kg]. |
mprod1 | mass of product 1 [kg]. |
mprod2 | mass of product 2 [kg]. |
Q | energy released in the reaction [eV]. |
ppara1 | the parallel momentum of react1 |
pperp1 | the perpendicular momentum of react1 |
ppara2 | the parallel momentum of react2 |
pperp2 | the perpendicular momentum of react2 |
vcom2 | pointer for storing relative velocity of i'th reactants |
pparaprod1 | array where parallel momentum of product 1 is stored. |
pperpprod1 | array where perpendicular momentum of product 1 is stored. |
pparaprod2 | array where parallel momentum of product 2 is stored. |
pperpprod2 | array where perpendicular momentum of product 2 is stored. |
Definition at line 308 of file afsi.c.
◆ afsi_sample_reactant_momenta_2d()
void afsi_sample_reactant_momenta_2d |
( |
sim_data * | sim, |
|
|
afsi_data * | afsi, |
|
|
real | mass1, |
|
|
real | mass2, |
|
|
real | vol, |
|
|
int | nsample, |
|
|
size_t | i0, |
|
|
size_t | i1, |
|
|
size_t | i2, |
|
|
real | r, |
|
|
real | phi, |
|
|
real | z, |
|
|
real | time, |
|
|
real | rho, |
|
|
real * | density1, |
|
|
real * | ppara1, |
|
|
real * | pperp1, |
|
|
real * | density2, |
|
|
real * | ppara2, |
|
|
real * | pperp2 ) |
Sample velocities from reactant distributions.
- Parameters
-
react1 | reactant 1 distribution data. |
react2 | reactant 2 distribution data. |
m1 | mass of reactant 1 [kg]. |
m2 | mass of reactant 2 [kg]. |
n | number of samples. |
iR | R index of the distribution cell where sampling is done. |
iphi | phi index of the distribution cell where sampling is done. |
iz | z index of the distribution cell where sampling is done. |
ppara1 | array where the parallel momentum of react1 will be stored |
pperp1 | array where the perpendicular momentum of react1 will be stored |
ppara2 | array where the parallel momentum of react2 will be stored |
pperp2 | array where the perpendicular momentum of react2 will be stored |
Definition at line 397 of file afsi.c.
◆ afsi_sample_beam_2d()
void afsi_sample_beam_2d |
( |
histogram * | hist, |
|
|
real | mass, |
|
|
real | vol, |
|
|
int | nsample, |
|
|
size_t | i0, |
|
|
size_t | i1, |
|
|
size_t | i2, |
|
|
real * | density, |
|
|
real * | ppara, |
|
|
real * | pperp ) |
Sample ppara and pperp from a 5D distribution.
- Parameters
-
dist | pointer to the distribution data. |
nsample | number of values to be sampled. |
spatial_index | spatial index where sampling is done. |
ppara | pointer to array where sampled parallel momenta are stored. |
pperp | pointer to array where sampled perpedicular momenta are stored. |
Definition at line 430 of file afsi.c.
◆ afsi_sample_thermal_2d()
void afsi_sample_thermal_2d |
( |
sim_data * | sim, |
|
|
int | ispecies, |
|
|
real | mass, |
|
|
int | nsample, |
|
|
real | r, |
|
|
real | phi, |
|
|
real | z, |
|
|
real | time, |
|
|
real | rho, |
|
|
real * | density, |
|
|
real * | ppara, |
|
|
real * | pperp ) |
Sample ppara and pperp from a thermal (Maxwellian) population.
Sampling from Maxwellian distribution is done using Eq. (7) in "Efficient Algorithm for Generating Maxwell Random Variables", N. Mohamed, DOI 10.1007/s10955-011-0364-y
- Parameters
-
data | pointer to the thermal data. |
mass | mass of the particle species. |
nsample | number of values to be sampled. |
spatial_index | spatial index where sampling is done. |
ppara | pointer to array where sampled parallel momenta are stored. |
pperp | pointer to array where sampled perpedicular momenta are stored. |
Definition at line 516 of file afsi.c.
◆ afsi_run()
Calculate fusion source from two arbitrary ion distributions.
Inputs and outputs are expected to have same physical (R, phi, z) dimensions.
- Parameters
-
sim | pointer to simulation data |
reaction | fusion reaction type, see the description |
n | number of Monte Carlo samples to be used |
react1 | reactant 1 distribution data |
react2 | reactant 2 distribution data |
mult | factor by which the output is scaled |
prod1_data | distribution data for product 1 output |
prod2_data | distribution data for product 2 output |
Definition at line 60 of file afsi.c.
◆ rdata
Random number generator used by AFSI
Definition at line 26 of file afsi.c.