7. Useful Functions
This chapter contains a summary of useful functions and subroutines that might be re-used in the future.
7.1. General Functions and Subroutines
Function |
Module |
Input |
Output |
Description |
---|---|---|---|---|
|
|
3D vector |
3D vector |
Normalizes a given vector by dividing all vectors entries by the vector’s magnitude |
|
|
two 3D vectors |
3D vector |
Computes the cross product of two 3-dimensional vectors: cross=v1 x v2 and normalizes the resulting vector |
|
|
two 3D vectors |
3D vector |
Computes the cross product of two 3-dimensional vectors: cross=v1 x v2 |
|
|
3D vector |
|
Computes the Euclidean norm (length) of a vector |
|
|
3D vector |
|
Computes the dot product of a vector with itself |
7.2. Particle Functions and Subroutines
Function (Module) |
Input |
Output |
Description |
---|---|---|---|
|
particle ID |
|
Check if particle has charge unequal to zero |
|
particle ID |
|
Check if particle is an electron by checking if the charge is equal to 1.602176634e-19 (division and nearest integer) |
|
particle ID |
|
Check if particle is to be deposited on the grid |
|
particle ID |
|
Check if particle is to be pushed (integrated in time) |
|
particle ID |
|
Check if the field at a particle’s is to be interpolated (accelerated) |
|
distribution type, Tempergy |
3D vector |
WIP, Calculates a velocity vector from a defined velocity distribution and Tempergy (temperature [K] or energy [J] or velocity [m/s]) |
|
|
3D vector |
Calculates a normalized vector in 3D (unit space) in random direction |
|
cRela2(post-collison), alphaVSS(iSpecA,iSpecB) |
3D vector |
Calculates scaled post-collision relative velocity vector in center-of-mass frame |
if alphaVSS>1 (VSS) also: , cRelaX,cRelaY,cRelaZ (pre-collision) |
VSS case includes coordinate transformation due to anisotropic scattering |
||
|
species ID, position, element ID, velocity and internal energies |
particle ID (optional) |
Creates a new particle at a given position and energetic state and return the new particle ID (optional) |
|
particle ID |
|
Determines the weighting factor of a particle |