Files
karl/include/simulation/kinematic.h
T

122 lines
5.4 KiB
C++
Executable File

#ifndef KINEMATIC_H
#define KINEMATIC_H
#include "simulation/coordinates.h"
namespace kinematic {
// calculate the velocity of the center off mass, where velocity_1 (cartesian vector, m/s) and
// mass_1 (kg) belong to the same particle and velocity_2 (cartesian vector, m/s) and mass_2 (kg) belong
// to the same particle
blitz::TinyVector<double, 3> velocityOfCenterOfMass(
const blitz::TinyVector<double, 3>& velocity_1,
const blitz::TinyVector<double, 3>& velocity_2,
double mass_1,
double mass_2);
// Galileo transformation to the rest frame of the second particle
// both velocities are in m/s and both masses in kg
blitz::TinyVector<double, 3> velocityTargetFixed(
const blitz::TinyVector<double, 3>& velocity_1,
const blitz::TinyVector<double, 3>& velocity_2,
double mass_1,
double mass_2);
// rotates the vector (cartesian) v by the polar angle theta and the azimuthal angle phi
// in the frame where v is aligned with the z-axis
// returns the rotated vector as a blitz::TinyVector in cartesian coordinates in the
// original frame where v is not (not neccessarily) aligned with the z-axis (all in SI units)
blitz::TinyVector<double, 3> rotateVector(const blitz::TinyVector<double, 3>& v,
double theta,
double phi);
// transform velocity_1 into the center of mass frame defined by
// velocity_1, mass_1 and velocity_2 and mass_2 (vectors are cartesian)
// velocity_1_centerOfMass is then rotated by the polar angle theta and the
// azimuthal angle phi in the frame in which velocity_1_centerOfMass is aligned with
// the z-axis
// returns the rotated velocity_1 vector in the original non-center of mass frame (cartesian coordinates)
// (all in SI units)
blitz::TinyVector<double, 3> rotateVelocityInCenterOfMassFrame(
const blitz::TinyVector<double, 3>& velocity_1,
const blitz::TinyVector<double, 3>& velocity_2,
double mass_1,
double mass_2,
double theta,
double phi);
// return the non-relativistic kinetic energy (J) defined by the cartesian velocity (m/s)
// and the mass (kg)
double kineticEnergy(const blitz::TinyVector<double, 3>& velocity, double mass);
// transform the temperature (K) into an energy in eV
double thermalEnergy(double temperature_K);
// returns the modulus of the velocity (m/s) of the kinetic energy (eV)
// and the mass (kg) (non-relativistic)
double velocity(double energy_eV, double mass_kg);
// transform the cartesian velocity v2 in the frame moving with cartesian velocity v1
// into the laboratory frame (both velocities in m/s)
// returns the boosted vector in cartesian coordinates
blitz::TinyVector<double, 3> relativisticBoost(
const blitz::TinyVector<double, 3>& v1,
const blitz::TinyVector<double, 3>& v2);
// calculate gamma from velocity from the given cartesian velocity (in SI units)
// where the velocity is the realtivistic 3 momentum divided by the rest mass of the particle
double relativisticGamma(const blitz::TinyVector<double, 3>& velocity);
// calculates the Lorentz factor given the kinetic energy in eV and the
// rest mass of the particle transformed to eV
double relativisticGamma(double kin_energy_eV, double mass_eV);
// return the cartesian velocity (m/s) devided by the speed of light
double relativisticBeta(double velocity_ms);
// calculates the relativistic beta (velocity/speed of light) given the kinetic energy in eV and the
// rest mass of the particle transformed to eV
double relativisticBeta(double kin_energy_eV, double mass_eV);
// Note: what units does the relativisitvMomentum function "return"?
// calculate the modulus of the realtivistic momentum from the kinetic energy in eV
// and the mass in eV
double relativisticMomentum(double energy_eV, double mass_eV);
// returns the norm of the vector
double norm(const blitz::TinyVector<double, 3>& vector);
// calculates the distance between the two points position_1 and position_2
// which are both in cylinder coordinates (r, phi, z)
double distanceInCylinder(const blitz::TinyVector<double, 3>& position_1,
const blitz::TinyVector<double, 3>& position_2);
// calculate v_perp, s.t. vector = v_perp + v_parallel, with
// v_perp perpendicular to the vector direction and v_parallel parallel to the vector direction
// (both vectors cartesian)
blitz::TinyVector<double, 3> perpendicularVector(
const blitz::TinyVector<double, 3>& vector,
const blitz::TinyVector<double, 3>& direction);
// calculate v_parallel, s.t. vector = v_perp + v_parallel, with
// v_perp perpendicular to the vector direction and v_parallel parallel to the vector direction
// (both vectors cartesian)
blitz::TinyVector<double, 3> parallelVector(
const blitz::TinyVector<double, 3>& vector,
const blitz::TinyVector<double, 3>& direction);
// rotate vector around rotation_axis about the angle angle
// (vectors cartesian) according to the right hand rule
// using Rogrigues' formula
blitz::TinyVector<double, 3> rotateVector(
const blitz::TinyVector<double, 3>& vector,
const blitz::TinyVector<double, 3>& rotation_axis,
double angle);
// return the random_unit_vector scaled by the modulus of the non-relativistic velocity
// defined by the kinetic energy energy_eV (eV) and mass mass_kg (kg)
blitz::TinyVector<double, 3> velocityVector(
double energy_eV,
const blitz::TinyVector<double, 3>& random_unit_vector,
double mass_kg);
}; // namespace kinematic
#endif /* KINEMATIC_H */