Coder Social home page Coder Social logo

thomashelfer / torchgrtl Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 0.0 614.06 MB

A translation of crucial parts of GRTL in torch for accelerated learning

License: MIT License

Python 38.74% Jupyter Notebook 61.26%
deep-learning numerical-relativity pytorch

torchgrtl's Introduction

Unittest License: MIT

TorchGRTL - Numerical General Relativity in PyTorch

no alignment

Overview

TorchGRTL is a Python library that provides a PyTorch-based implementation of key components of GRTL codebase . It uses GPU optimisation and Autodiff of PyTorch to accelerate computations to improve black hole simulations.

Installation

Prerequisites

Before installing TorchGRTL, ensure you have the following prerequisites:

  • Python 3.8 or higher
  • pip package manager

Steps

  1. Clone the TorchGRTL repository:

    git clone https://github.com/ThomasHelfer/TorchGRTL.git
    cd TorchGRTL
  2. Install the package:

    pip install .
  3. (Optional) Set up pre-commit hooks for code formatting and linting:

    pre-commit install

Usage

The TorchGRTL library offers powerful tools to compute a variety of quantities essential in numerical relativity. Here are some examples of how you can use the library:

Computing Christoffel Symbols

You can compute the Christoffel symbols, which are crucial in the context of general relativity for defining the Levi-Civita connection and geodesic equations:

# Compute the Christoffel symbols using the standard method
chris = compute_christoffel(d1['h'], h_UU)

In these examples, d1['h'] refers to the first derivatives of the metric tensor, and h_UU is the inverse metric tensor.

Calculating Hamiltonian and Momentum Constraints The library can also compute more complex quantities like the Hamiltonian and Momentum constraints, which are fundamental in ensuring the consistency of solutions in numerical relativity:

# Compute the Hamiltonian and Momentum constraints
out = constraint_equations(vars, d1, d2, h_UU, chris)

Here, vars contains various tensor fields, d1 and d2 are the first and second derivatives of these tensor fields, and chris is the computed Christoffel symbols.

Self-Contained Example

For a full, self-contained example that demonstrates the library's capabilities, refer to example.py in the repository. This example will guide you through a typical use case, showing how to leverage TorchGRTL for numerical relativity simulations and calculations.

License

TorchGRTL is released under the MIT License. See LICENSE for more details.

Contact

For questions or support, please contact Thomas Helfer at [email protected].

torchgrtl's People

Contributors

thomashelfer avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.