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 "consts.h"
#include "random.h"
#include "simulate.h"
#include "boschhale.h"
#include "diag/dist_5D.h"
#include "hdf5_interface.h"
#include "hdf5io/hdf5_helpers.h"
#include "hdf5io/hdf5_dist.h"
#include "afsi.h"
Go to the source code of this file.
|
void | afsi_sample_reactant_momenta (afsi_data *react1, afsi_data *react2, real m1, real m2, int n, int iR, int iphi, int iz, real *ppara1, real *pperp1, real *ppara2, real *pperp2) |
| Sample velocities from reactant distributions.
|
|
void | afsi_compute_product_momenta (int i, real m1, real m2, real mprod1, real mprod2, real Q, real *ppara1, real *pperp1, real *ppara2, real *pperp2, real *vcom2, real *pparaprod1, real *pperpprod1, real *pparaprod2, real *pperpprod2) |
| Compute momenta of reaction products.
|
|
void | afsi_sample_5D (dist_5D_data *dist, int n, int iR, int iphi, int iz, real *ppara, real *pperp) |
| Sample ppara and pperp from a 5D distribution.
|
|
void | afsi_sample_thermal (afsi_thermal_data *data, real mass, int n, int iR, int iphi, int iz, real *ppara, real *pperp) |
| Sample ppara and pperp from a thermal (Maxwellian) population.
|
|
real | afsi_get_density (afsi_data *dist, int iR, int iphi, int iz) |
| Get particle density.
|
|
real | afsi_get_volume (afsi_data *dist, int iR) |
| Get physical volume of a distribution cell.
|
|
void | afsi_run (sim_offload_data *sim, Reaction reaction, int n, afsi_data *react1, afsi_data *react2, real mult, dist_5D_offload_data *prod1_offload_data, dist_5D_offload_data *prod2_offload_data, real *prod1_offload_array, real *prod2_offload_array) |
| Calculate fusion source from two arbitrary ion distributions.
|
|
void | afsi_test_dist (dist_5D_data *dist1) |
| Test distribution.
|
|
void | afsi_test_thermal () |
| Test thermal source.
|
|
ASCOT Fusion Source Integrator AFSI.
Definition in file afsi.c.
◆ afsi_sample_reactant_momenta()
void afsi_sample_reactant_momenta |
( |
afsi_data * | react1, |
|
|
afsi_data * | react2, |
|
|
real | m1, |
|
|
real | m2, |
|
|
int | n, |
|
|
int | iR, |
|
|
int | iphi, |
|
|
int | iz, |
|
|
real * | ppara1, |
|
|
real * | pperp1, |
|
|
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 278 of file afsi.c.
◆ afsi_compute_product_momenta()
void afsi_compute_product_momenta |
( |
int | i, |
|
|
real | m1, |
|
|
real | m2, |
|
|
real | mprod1, |
|
|
real | mprod2, |
|
|
real | Q, |
|
|
real * | ppara1, |
|
|
real * | pperp1, |
|
|
real * | ppara2, |
|
|
real * | pperp2, |
|
|
real * | vcom2, |
|
|
real * | pparaprod1, |
|
|
real * | pperpprod1, |
|
|
real * | pparaprod2, |
|
|
real * | pperpprod2 ) |
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 318 of file afsi.c.
◆ afsi_sample_5D()
void afsi_sample_5D |
( |
dist_5D_data * | dist, |
|
|
int | n, |
|
|
int | iR, |
|
|
int | iphi, |
|
|
int | iz, |
|
|
real * | ppara, |
|
|
real * | pperp ) |
Sample ppara and pperp from a 5D distribution.
- Parameters
-
dist | pointer to the distribution data. |
n | number of values to be sampled. |
iR | R index where sampling is done. |
iphi | phi index where sampling is done. |
iz | z 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 392 of file afsi.c.
◆ afsi_sample_thermal()
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. |
n | number of values to be sampled. |
iR | R index where sampling is done. |
iphi | phi index where sampling is done. |
iz | z 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 451 of file afsi.c.
◆ afsi_get_density()
real afsi_get_density |
( |
afsi_data * | dist, |
|
|
int | iR, |
|
|
int | iphi, |
|
|
int | iz ) |
Get particle density.
- Parameters
-
dist | pointer to afsi data. |
iR | R index at which density is queried. |
iphi | phi index at which density is queried. |
iz | z index at which density is queried. |
- Returns
- density [m^-3] or zero if type was unknown.
Definition at line 479 of file afsi.c.
◆ afsi_get_volume()
Get physical volume of a distribution cell.
- Parameters
-
dist | distribution. |
iR | radial index of the cell. |
- Returns
- cell volume [m^3].
Definition at line 514 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 offload 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_offload_data | distribution data for product 1 output |
prod2_offload_data | distribution data for product 2 output |
prod1_offload_array | array where product 1 distribution is stored |
prod2_offload_array | array where product 2 distribution is stored |
Definition at line 55 of file afsi.c.
◆ afsi_test_dist()
Test distribution.
- Parameters
-
dist1 | distribution to be tested. |
Definition at line 538 of file afsi.c.
◆ afsi_test_thermal()
void afsi_test_thermal |
( |
| ) |
|
Test thermal source.
Definition at line 561 of file afsi.c.
◆ rdata
Random number generator used by AFSI
Definition at line 22 of file afsi.c.