Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
relativistic_math.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This file is part of Vlasiator.
4 * Copyright 2010-2016 Finnish Meteorological Institute
5 *
6 * For details of usage, see the COPYING file and read the "Rules of the Road"
7 * at http://www.physics.helsinki.fi/vlasiator/
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23#include <Eigen/Dense>
24#define Vec3d Eigen::Vector3d
25#define cross_product(av,bv) (av).cross(bv)
26#define dot_product(av,bv) (av).dot(bv)
27#define vector_length(v) (v).norm()
28#define normalize_vector(v) (v).normalized()
29
30#include "physconst.h"
31
32static double gamma(Vec3d v) {
33 double uq = dot_product(v,v);
35}
36
37/* Lorentz-boost */
38static Vec3d lorentzBoost(Vec3d& u, Vec3d& v) {
39 /* Transform velocities into betas */
40 Vec3d uprime = u / PhysicalConstantsSI::c;
41 Vec3d vprime = v / PhysicalConstantsSI::c;
42
43 double udotv = dot_product(uprime,vprime);
44 double vsqr = dot_product(vprime,vprime);
45
46 if(vsqr == 0) { return u; }
47
48 Vec3d uparallel = udotv / vsqr * vprime;
49 Vec3d uperp = uprime - uparallel;
50
51 return PhysicalConstantsSI::c * (vprime + uparallel + sqrt(1 - vsqr) * uperp) / (1 + udotv);
52}
53
54/* Lorentz transform of E and B fields */
56
57 Vec3d nv = normalize_vector(v);
58 double g = gamma(v);
59
60 return g * (E + cross_product(v,B)/PhysicalConstantsSI::c) - (g-1.)*dot_product(E,nv)*nv;
61}
63 Vec3d nv = normalize_vector(v);
64 double g = gamma(v);
65
66 return g * (B - cross_product(v,E)/PhysicalConstantsSI::c) - (g-1.)*dot_product(B,nv)*nv;
67}
gamma
Definition Dispersion.m:52
sqrt(1.0+vA *vA/(c *c))) % Ion-acoustic wave cS
static const double c
Definition physconst.h:56
#define Vec3d
#define normalize_vector(v)
static Vec3d lorentz_transformed_E(Vec3d &E, Vec3d &B, Vec3d &v)
#define dot_product(av, bv)
static Vec3d lorentz_transformed_B(Vec3d &E, Vec3d &B, Vec3d &v)
#define cross_product(av, bv)
static Vec3d lorentzBoost(Vec3d &u, Vec3d &v)