xphysics.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "xunits.h"
4 #include <gsl/gsl_const_mksa.h>
5 
6 namespace nmx {
7 
11 namespace gravitation {
12 
13 //Astronomische Daten
14 struct Astronomy {
15  inline static double G{ GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT };
16 };
17 
18 //Erddaten
19 struct Earth {
20  inline static constexpr double g{ GSL_CONST_MKSA_GRAV_ACCEL };
21  inline static constexpr double mass{ 5.9722e24 };
22  //zur Initialisierung des Erdradius wird das benutzerdefinierte
23  // Literal km benutzt
24  inline static constexpr double radius{ 6378.137_km };
25 };
26 } // namespace gravitation
27 
31 struct Mechanics {
38  inline static double kinetic_energy(double mass, double velocity) {
39  return 0.5 * mass * pow(velocity, 2);
40  }
41 
48  inline static double potential_energy(double mass, double height) {
49  return mass * gravitation::Earth::g * height;
50  }
51 }; //Mechanics
52 } // namespace nmx
The Mechanics struct Formeln aus der Mechanik.
Definition: xphysics.h:31
static double kinetic_energy(double mass, double velocity)
kinetic_energy Hilfsfunktion
Definition: xphysics.h:38
static double potential_energy(double mass, double height)
potential_energy Hilfsfunktion
Definition: xphysics.h:48
static constexpr double g
Definition: xphysics.h:20