Motion4D
Motion4D - A library for lightrays and timelike worldlines in the theory of relativity
Install / Use
/learn @tauzero7/Motion4DREADME
libMotion4D - The Motion4D-library
libMotion was first developed by Thomas Müller and Frank Grave at the Visualization Research Center, University of Stuttgart, Germany (2009-2015).
Current contact:
Dr. Thomas Müller
Haus der Astronomie/Max Planck Institute for Astronomy
69117 Heidelberg, Germany
Email: tmueller [at] mpia.de
Brief description:
The Motion4D-library solves the geodesic equation as well as the parallel- and Fermi-Walker-transport in four-dimensional spacetimes numerically. Initial conditions are given with respect to natural local tetrads which are adapted to the symmetries or the coordinates of the spacetime. Beside some already implemented metrics like the Schwarzschild and Kerr metric, the object oriented structure of the library permits to implement other metrics or integrators in a straightforward manner.
The Motion4D-library is published in Computer Physics Communications:
-
T. Müller
Motion4D-library extended (New Version Announcement)
Computer Physics Communications 185, 2798-2799 (2014)
DOI: 10.1016/j.cpc.2014.04.020 -
T. Müller
Motion4D-library extended (New Version Announcement)
Computer Physics Communications 182, 1386-1388 (2011)
DOI: 10.1016/j.cpc.2011.02.009 -
T. Müller, F. Grave
An updated version of the Motion4D library (New Version Announcement)
Computer Physics Communications 181, 703 (2010)
DOI: 10.1016/j.cpc.2009.10.021 -
T. Müller, F. Grave
Motion4D - A library for lightrays and timelike worldlines in the theory of relativity
Computer Physics Communications 180, 2355-2360 (2009)
DOI: 10.1016/j.cpc.2009.07.014
Details to the implemented spacetimes can be found also in the "Catalogue of Spacetimes".
Prerequisits:
- You need the GNU Scientific Library which is available here
for Linux systems. A cmake-Version which can also be used for Windows/Visual Studio 2019 can be found here. - If you want to use lua scripting, then you also need lua.
Installation with cmake (linux):
You have to have cmake 2.6 or higher available.
-
Build two new folders:
mkdir -p build/debug
mkdir -p build/release -
Enter the folder
build/Debugorbuild/Release. -
Call
ccmake ../..and press 'c'. -
Configure cmake build stuff:
If your compiler supports C++11, then setCMAKE_CXX_FLAGSto-std=c++11- Set the build type:
DebugorRelease. - Set the installation path.
- Adjust the path to the GNU Scientific Library and its library.
For example:
GSL_DIR /usr/local/gsl/2.5
GSL_LIB_DIR /usr/local/gsl/2.5/lib64 - If the test programs shall be build, then set
COMPILE_TEST_PRGS ON - If you have 'lua' available, then set
LUA_AVAILABLE ON
LUA_DIR /usr/local/lua/5.3.5
LUA_LIB_DIR /usr/local/lua/5.3.5/lib
- Set the build type:
Press 'c' and 'g' when you are finished.
-
make
make install -
Run the test programs:
- Change to the
testdirectory. ./testAll.bash [debug]`
- Change to the
Note, if you have only compiled the debug version you have to add debug when
running testAll!
Install with cmake and Visual Studio 2019
You need GSL for Windows. There is a cmake-Version which can be found here.
If you also want to use LUA, download the sources from here.
You might need 7-zip or something else to extract the .tar.gz file.
Take care that you always choose the same configuration (Debug/Release), (Win32/x64) for all libraries.
Compile this GSL version with cmake/vs 2019 (64bit):
- Open "CMakeLists.txt" in cmake-gui and set source code and build paths.
- Run 'Configure' and select Visual Studio version as well as platform (x64).
- Set CMAKE_INSTALL_PREFIX to e.g. "D:/local/ampl_gsl_vs2019"
- Run 'Configure'
- Run 'Generate'
- Click 'Open Project' or open "GSL.sln" within Visual Studio 2019
- Set 'Solution Configurations' to 'Release'.
- Run 'Build Solution'
- Go to the "INSTALL" entry and run 'Build INSTALL' to install into "CMAKE_INSTALL_PREFIX".
Compile libMotion4D
- Open "CMakeLists.txt" in cmake-gui and set source code and build paths.
- Run 'Configure' and select Visual Studio version as well as platform (x64).
- Check 'COMPILE_ALL_METRICS' (voluntary) and 'COMPILE_TEST_PRGS'
- Set GSL_DIR to e.g. "D:\local\ampl_gsl_vs2019"
- Set GSL_LIB_DIR to e.g. "D:\local\ampl_gsl_vs2019\lib"
- Run 'Configure'
- Run 'Generate'
- Click 'Open Project' or open "libmotion4d.sln" within Visual Studio 2019
- Run 'Build Solution'
- If you like, go to the "INSTALL" entry and run 'Build INSTALL' to install into "CMAKE_INSTALL_PREFIX".
Add new metric
First, a few preliminary steps which are necessary to find your metric.
-
Open "src/metric/m4dMetricList.h" and increase 'NUM_METRICS'. Append an 'enum' entry at the end of the 'enum_metric' list. Append an 'include' entry at the end of the '#include's.
-
Open "src/metric/m4dMetricList.cpp" and append the name of the new metric at the end of the "stl_metric_names" list.
-
Open "src/metric/m4dMetricDatabase.cpp" and append a 'case' entry for your new metric in 'initializeMetric()'
-
You can now start writing your own metric class. For that, have a look e.g. into 'm4dMetricMinkowski' or copy the header and source file and rename the class. Take care that 'mMetricName' and the name of your metric in "stl_metric_names" are the same.
There are a few abstract methods, which you have to overwrite (see m4dMetric.h):
- calculateMetric
- calculateChristoffels
- localToCoord
- coordToLocal
- breakCondition
For use in GeodesicViewer, you have to add your metric files also in 'm4d_sources.pri'.
Related Skills
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
