ASCOT5
|
Marker simulation end conditions. More...
#include <math.h>
#include "endcond.h"
#include "particle.h"
#include "simulate.h"
#include "physlib.h"
#include "consts.h"
#include "plasma.h"
Go to the source code of this file.
Functions | |
void | endcond_check_fo (particle_simd_fo *p_f, particle_simd_fo *p_i, sim_data *sim) |
Check end conditions for FO markers. | |
void | endcond_check_gc (particle_simd_gc *p_f, particle_simd_gc *p_i, sim_data *sim) |
Check end conditions for GC markers. | |
void | endcond_check_ml (particle_simd_ml *p_f, particle_simd_ml *p_i, sim_data *sim) |
Check end conditions for ML markers. | |
void | endcond_parse (int endcond, int *endconds) |
Split endcond to an array of end conditions. | |
void | endcond_parse2str (int endcond, char *str) |
Represent end condition in human-readable format. | |
Marker simulation end conditions.
In the absence of errors, marker simulation is ended when marker meets even one of the active end conditions. User can choose which end conditions are active.
The end conditions are:
As magnetic field lines have no energy, emin and therm are never checked for them. Guiding centers are the only markers for which hybrid is checked.
In the code, the end conditions are represented as bit arrays with each bit corresponding to a specific end condition. Each marker has a field "endcond", and when marker meets an end condition, the corresponding bit is flagged. This way if marker simultaneously meets several end conditions, all can be flagged.
Additionally, when marker meets an end condition, its running state is set to False which notates its simulation should be discontinued. If the end condition is wall collision, the ID of the wall element the marker collided with is stored in the marker fields.
Definition in file endcond.c.
void endcond_check_fo | ( | particle_simd_fo * | p_f, |
particle_simd_fo * | p_i, | ||
sim_data * | sim ) |
Check end conditions for FO markers.
The end conditions are checked for all markers within the SIMD marker struct.
p_f | pointer to SIMD struct storing marker states at the end of current time-step |
p_i | pointer to SIMD struct storing marker states at the beginning of current time-step |
sim | pointer to simulation data struct |
void endcond_check_gc | ( | particle_simd_gc * | p_f, |
particle_simd_gc * | p_i, | ||
sim_data * | sim ) |
Check end conditions for GC markers.
The end conditions are checked for all markers within the SIMD marker struct.
p_f | pointer to SIMD struct storing marker states at the end of current time-step |
p_i | pointer to SIMD struct storing marker states at the beginning of current time-step |
sim | pointer to simulation data struct |
void endcond_check_ml | ( | particle_simd_ml * | p_f, |
particle_simd_ml * | p_i, | ||
sim_data * | sim ) |
Check end conditions for ML markers.
The end conditions are checked for all markers within the SIMD marker struct.
p_f | pointer to SIMD struct storing marker states at the end of current time-step |
p_i | pointer to SIMD struct storing marker states at the beginning of current time-step |
sim | pointer to simulation data struct |
void endcond_parse | ( | int | endcond, |
int * | endconds ) |
Split endcond to an array of end conditions.
This function splits the bit array end condition to an array where the active end conditions are presented by numbers. Number for each end condition are defined in this function.
endcond | bit array representing marker end conditions |
endconds | integer array large enough to hold all end conditions |
void endcond_parse2str | ( | int | endcond, |
char * | str ) |
Represent end condition in human-readable format.
This function takes end condition represented as integer, as given by endcond_parse().
endcond | end condition integer representation |
str | end condition as human-readable string |