Simulation data structure

The data structure is used for keeping track of the simulation data, particles, fields and data that changes throughout the simulation. The simulation data is kept in a member variable inside the Parfis class. There is a complete structure defined that holds vectors of data concerning different aspects of the system.

struct SimData

Simulation data.

Public Functions

int setPySimData()

Sets the PySimData pointers to coresponding references from SimData.

PySimData is used to wrap the data structure in order to be usable by python through ctypes. The need for this structure is mainly because in ctypes there isn’t a built-in representation of the std::vector structure.

Returns

int Zero on success

int calculateColProb(const CfgData *pCfgData)

Calculates collision probability from the cx.

Returns

int Zero on success

Public Members

std::vector<Cell> cellVec

Vector of cells.

std::vector<nodeFlag_t> nodeFlagVec

Vector of pointers to the cellVec.

Maping of absolute cell id (calculated) to real cell id which is the position in the cellVec vector Vector of nodeFlags for each cell in the geometry - corresponds to cellVec

std::vector<cellId_t> cellIdAVec

Vector of pointer to cells of group A.

Groups are used to classify cells, for examples cells that lie fully inside the geometry (group A) and those that don’t (group B). In different cases the classification can have different meanings.

std::vector<cellId_t> cellIdBVec

Vector of pointer to cells of group B.

std::vector<State> stateVec

Vector of states.

std::vector<stateFlag_t> stateFlagVec

Vector of state flags - corresponds to stateVec.

std::vector<stateId_t> headIdVec

Vector of pointers to head states.

Head state is the first state in the doubly linked list of states that belong to a certain cell. For every cell there are as many heads as there are species in the simulation. This structure is a matrix written in one dimension since the number of elements is cellVec.size()*specieVec.size()

std::vector<Specie> specieVec

Vector of species.

std::vector<Gas> gasVec

Vector of gases.

std::vector<randEngine_t> randomEngineVec

Engines used to generate random numbers.

std::vector<GasCollision> gasCollisionVec

Vector of gas collision data.

std::vector<PyGasCollision> pyGasCollisionVec

Vector for the ctypes wrapper.

std::vector<FuncTable> gasCollisionProbVec

Vector of total gas collision probability data.

std::vector<PyFuncTable> pyGasCollisionProbVec

Vector for the ctypes wrapper.

Field field

Field data.

PySimData pySimData

PySimData points to data of this object.

uint64_t evolveCnt

Evolution counter.

struct State

Specie state.

One state is defined as a point in the phase space. The next and prev pointers work as a double linked list connecting all states that belong to a single cell.

Public Members

stateId_t next

Pointer to the next state from the same cell, Const::noStateId for the last state.

stateId_t prev

Pointer to the previous state from the same cell, Const::noStateId for the head state.

Vec3D<state_t> pos

Position vector.

Vec3D<state_t> vel

Velocity vector.

struct GasCollision

Holds information about collisions with gas particles.

Public Functions

int calculateColFreq(const Specie &specie, const Gas &gas)

Calculates the collision frequency.

Returns

int Zero on success

Public Members

uint32_t id

Id from the gas collision vector in CfgData.

const char *name

Collision name.

const char *fileName

Cross section file name.

uint32_t specieId

Id from the specie vector.

uint32_t gasId

Id from the gas vector.

double threshold

Threshold in eV.

int type

Type of collision (elastic, inelastic)

std::vector<double> scatterAngle

Scattering angle (random number sampled with scatterAngle gives deflection in radians)

FuncTable xSecFtab

Cross section in angstroms, with x-axis is in eV.

FuncTable freqFtab

Collision frequency, x-axis is in code velocity squared.

typedef uint32_t parfis::stateId_t

Type for the state id.

Particle data

The particle data is organized in the following manner:

  • The vector with raw states parfis::SimData::stateVec holds the state in the phase space for every particle in the system regardless of its specie. This is the largest memory structure in the program when initialized. The elements of the vector are of type parfis::State. Every state structure beside the phase space vector holds data of other state ids from the same cell, thus forming a doubly connected list (per cell). The size of the State structure depends on the library version, i.e. the size of the state_t type.

    _images/particle_memory.png
  • Vector of head ids parfis::SimData::headIdVec holds id of the first state, of each specie, of each cell.