ASCOT5
|
Contains the functions to be called from the simulation loop when using ICRH. More...
Go to the source code of this file.
Data Structures | |
struct | rfof_marker |
Reusable struct for storing marker specific data during the simulation loop. More... | |
struct | rfof_data |
RFOF simulation input data. More... | |
Typedefs | |
typedef struct rfof_marker | rfof_marker |
Reusable struct for storing marker specific data during the simulation loop. | |
Functions | |
void | rfof_init (rfof_data *rfof) |
Initialise input data. | |
void | rfof_free (rfof_data *rfof) |
Deallocates the rfof_input_param struct on the fortran side. | |
void | rfof_set_marker_manually (rfof_marker *rfof_mrk, int *id, real *weight, real *R, real *phi, real *z, real *psi, real *charge, real *mass, real *Ekin, real *vnorm, real *mu, real *Pphi, real *vpar, real *vperp, real *gyrof, real *vdriftRho, real *acceleration, int *is_accelerated, int *is_already_allocated) |
Explicitly set the coordinates in a marker struct. | |
void | rfof_set_up (rfof_marker *rfof_mrk, rfof_data *rfof_data) |
Initialises resonance history, diagnostics, and the marker struct. | |
void | rfof_tear_down (rfof_marker *rfof_mrk) |
Deallocates the data structs used by the RFOF marker simulation data. | |
void | rfof_clear_history (rfof_marker *rfof_mrk, int imrk) |
Clears resonance history of an RFOF marker. | |
void | rfof_resonance_check_and_kick_gc (particle_simd_gc *p, real *hin, real *hout_rfof, rfof_marker *rfof_mrk, rfof_data *rfof_data, B_field_data *Bdata) |
Check if the marker is in resonance and apply kick. | |
void | rfof_eval_rf_wave (real *e_plus_real, real *e_minus_real, real *e_plus_imag, real *e_minus_imag, real R, real z, rfof_data *rfof) |
Calculate the local E+ and E- values of the ICRH field. | |
void | rfof_eval_resonance_function (real *omega_res, int *nharm, rfof_marker *rfof_mrk, rfof_data *rfof) |
Evaluate the value of resonance function (zero at the resonance) | |
Contains the functions to be called from the simulation loop when using ICRH.
Definition in file rfof.h.
typedef struct rfof_marker rfof_marker |
Reusable struct for storing marker specific data during the simulation loop.
The data in this struct is altered during the simulation. Only pointers are stored as the actual data is stored on the Fortran side.
void rfof_init | ( | rfof_data * | rfof_data | ) |
void rfof_free | ( | rfof_data * | rfof | ) |
Deallocates the rfof_input_param struct on the fortran side.
There exists only one copy of this struct and therefore it is to be deallocated in the simulate.c after the loop is completed.
void rfof_set_marker_manually | ( | rfof_marker * | rfof_mrk, |
int * | id, | ||
real * | weight, | ||
real * | R, | ||
real * | phi, | ||
real * | z, | ||
real * | psi, | ||
real * | charge, | ||
real * | mass, | ||
real * | Ekin, | ||
real * | vnorm, | ||
real * | mu, | ||
real * | Pphi, | ||
real * | vpar, | ||
real * | vperp, | ||
real * | gyrof, | ||
real * | vdriftRho, | ||
real * | acc, | ||
int * | is_accelerated, | ||
int * | is_already_allocated ) |
Explicitly set the coordinates in a marker struct.
This routine is only used for testing and in libascot. Only the first marker in the NSIMD array of rfof_marker is manipulated.
rfof_mrk | pointer to the RFOF marker data |
id | marker identifier |
weight | marker weight [prt/s] |
R | major radius [m] |
phi | toroidal angle [rad] |
z | z coordinate [m] |
psi | poloidal flux [Wb/rad] |
charge | particle charge [C] |
mass | particle mass [kg] |
Ekin | kinetic energy [J] |
vnorm | velocity [m/s] |
mu | magnetic moment [J/T] |
Pphi | canonical toroidal angular momentum [kg*m/s] |
vpar | perpendicular velocity [m/s] |
vperp | parallel velocity [m/s] |
gyrof | gyrofrequency [rad/s] |
vdriftRho | drift velocity in radial direction |
acc | accleration factor, should be 1.0 always |
is_accelerated | flag indicating whether acceleration is used, false always |
is_already_allocated | flag whether to allocate a new marker struct, should be false always |
void rfof_set_up | ( | rfof_marker * | rfof_mrk, |
rfof_data * | rfof ) |
void rfof_tear_down | ( | rfof_marker * | rfof_mrk | ) |
void rfof_clear_history | ( | rfof_marker * | rfof_mrk, |
int | i ) |
Clears resonance history of an RFOF marker.
History should be cleared whenever a marker finishes simulation. The new marker cannot receive ICRH kicks during the first two time steps as its resonance history must have at least two data points stored to estimate the resonance location.
rfof_mrk | pointer to the RFOF marker simulation data |
i | index in the NSIMD array for the marker whose history is cleared |
void rfof_resonance_check_and_kick_gc | ( | particle_simd_gc * | p, |
real * | hin, | ||
real * | hout, | ||
rfof_marker * | rfof_mrk, | ||
rfof_data * | rfof_data, | ||
B_field_data * | Bdata ) |
Check if the marker is in resonance and apply kick.
The time step can fail if the marker overshoots the resonance.
p | pointer to marker simulation struct |
hin | current time step |
hout | suggestion for the next time step with negative sign indicating a failed step |
rfof_mrk | pointer to the rfof marker simulation struct |
rfof_data | pointer to the shared rfof data |
Bdata | pointer to the magnetic field data needed to evaluate psi |
void rfof_eval_rf_wave | ( | real * | e_plus_real, |
real * | e_minus_real, | ||
real * | e_plus_imag, | ||
real * | e_minus_imag, | ||
real | R, | ||
real | z, | ||
rfof_data * | rfof ) |
Calculate the local E+ and E- values of the ICRH field.
The definitions of E+ and E- sometimes differ. In this context, E+ = E_LH * (cos(phi) + i sin(phi)), where E_LH is the magnitude of the left-hand polarised (rotating) component and phi is its phase. That is, E_LH and phi are real. Often, however, E_LH is called E+ which creates confusion. Afterall, in this function, E+ is a complex number.
e_plus_real | Re("E+"") component of the local wave field @param e_minus_real Re("E-"") component of the local wave field |
e_plus_imag | Im("E+"") component of the local wave field @param e_minus_imag Im("E-"") component of the local wave field |
R | major radius coordinate [m] |
z | z-coordinate [m] |
rfof | pointer to the RFOF data structure |
void rfof_eval_resonance_function | ( | real * | omega_res, |
int * | nharm, | ||
rfof_marker * | rfof_mrk, | ||
rfof_data * | rfof ) |
Evaluate the value of resonance function (zero at the resonance)
This function finds the closest resonance and in addition to evaluating the resonance function it also returns the corresponding harmonic value.
The resonance is evaluated for the first marker in the NSIMD array in rfof_marker fields.
cptr_marker | void pointer to the rfof_marker |
rfof_data | pointer to the RFOF data structure |
omega_res | evaluated value of the resonance function |
nharm | the number of the closest harmonic found |