SPECTRAX: Hermite-Fourier Vlasov solver in JAX
Project description
❯ spectrax: Hermite-Fourier Vlasov equation solver in JAX to simulate plasmas
Table of Contents
- Overview
- Features
- Project Structure
- Getting Started
- Project Roadmap
- Contributing
- License
- Acknowledgments
Overview
SPECTRAX is an open-source project in Python that uses JAX to speedup simulations, leading to a simple to use, fast and concise code. It can be imported in a Python script using the spectrax package, or run directly in the command line as spectrax. To install it, use
pip install spectrax
Alternatively, you can install the Python dependencies jax, jax_tqdm and matplotlib, and run the example script in the repository after downloading it as
git clone https://github.com/uwplasma/SPECTRAX
python example_script.py
This allows SPECTRAX to be run without any installation.
The project can be downloaded in its GitHub repository
Features
SPECTRAX can run in CPUs, GPUs and TPUs, has autodifferentiation and just-in-time compilation capabilities, is based on rigorous testing, uses CI/CD via GitHub actions and has detailed documentation.
Currently, it evolves particles using the non-relativisic Lorentz force $\mathbf F = q (\mathbf E + \mathbf v \times \mathbf B)$, and evolves the electric $\mathbf E$ and magnetic $\mathbf B$ field using Maxwell's equations.
Plenty of examples are provided in the examples folder, and the documentation can be found in Read the Docs.
Project Structure
└── SPECTRAX/
├── LICENSE
├── docs
├── examples
│ ├── 1D_two-stream.py
│ ├── 1D_landau_damping.py
│ └── 2D_orszag_tang.py
├── spectrax
│ ├── file1.py
│ ├── file2.py
│ └── file3.py
└── tests
└── test1.py
Getting Started
Prerequisites
- Programming Language: Python
Besides Python, SPECTRAX has minimum requirements. These are stated in requirements.txt, and consist of the Python libraries jax, jax_tqdm and matplotlib.
Installation
Install SPECTRAX using one of the following methods:
Using PyPi:
- Install SPECTRAX from anywhere in the terminal:
pip install spectrax
Build from source:
- Clone the SPECTRAX repository:
git clone https://github.com/uwplasma/SPECTRAX
- Navigate to the project directory:
cd SPECTRAX
- Install the project dependencies:
pip install -r /path/to/requirements.txt
- Install SPECTRAX:
pip install -e .
Usage
To run a simple case of SPECTRAX, you can simply call spectrax from the terminal
spectrax
This runs SPECTRAX using standard input parameters of the two stream instability. To change input parameters, use a TOML file similar to the example input present in the repository as
spectrax example_input.toml
Additionally, it can be run inside a script, as shown in the example script file
python example_script.py
There, you can find most of the input parameters needed to run many test cases, as well as resolution parameters.
The spectrax package has a single function simulation() that takes as arguments a dictionary input_parameters, the number of grid points, number of pseudoelectrons, total number of time steps, and the field solver to use.
In the example script file we write as inline comments the meaning of each input parameter.
Testing
Run the test suite using the following command:
pytest .
Project Roadmap
-
Task 1: Task 1. -
Task 2: Task 2. -
Task 3: Task 3.
Contributing
- 💬 Join the Discussions: Share your insights, provide feedback, or ask questions.
- 🐛 Report Issues: Submit bugs found or log feature requests for the
SPECTRAXproject. - 💡 Submit Pull Requests: Review open PRs, and submit your own PRs.
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/uwplasma/SPECTRAX
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to github: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
License
This project is protected under the MIT License. For more details, refer to the LICENSE file.
Acknowledgments
- We acknowledge the help of the whole UWPlasma plasma group.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spectrax-0.1.2.tar.gz.
File metadata
- Download URL: spectrax-0.1.2.tar.gz
- Upload date:
- Size: 51.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ebbe761ac378a273bf245def079e0775c5ab453da8530cf252e9ffcda6f1701
|
|
| MD5 |
644ff32cb4394479a840c9b93fef583d
|
|
| BLAKE2b-256 |
b67f3335afc0ba81bd621a83fef4a9b8e2fb84802d607be076c9d8fd028ec0a6
|
Provenance
The following attestation bundles were made for spectrax-0.1.2.tar.gz:
Publisher:
pypi_publish.yml on uwplasma/SPECTRAX
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spectrax-0.1.2.tar.gz -
Subject digest:
4ebbe761ac378a273bf245def079e0775c5ab453da8530cf252e9ffcda6f1701 - Sigstore transparency entry: 207606235
- Sigstore integration time:
-
Permalink:
uwplasma/SPECTRAX@b05af6e3be757a9d36432ccff97744f9a0354477 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/uwplasma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@b05af6e3be757a9d36432ccff97744f9a0354477 -
Trigger Event:
push
-
Statement type:
File details
Details for the file spectrax-0.1.2-py3-none-any.whl.
File metadata
- Download URL: spectrax-0.1.2-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cfe21a9df5d87db559d6ab8e307dfdf2e8c2cc110f60591d3e434b6fb4df46d
|
|
| MD5 |
444001505f0e150ca474fd2eda375b3e
|
|
| BLAKE2b-256 |
1531882e94221ee28674b380e719a06ab89bb5fbb49cf6e529a0427dc40f8ff2
|
Provenance
The following attestation bundles were made for spectrax-0.1.2-py3-none-any.whl:
Publisher:
pypi_publish.yml on uwplasma/SPECTRAX
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spectrax-0.1.2-py3-none-any.whl -
Subject digest:
7cfe21a9df5d87db559d6ab8e307dfdf2e8c2cc110f60591d3e434b6fb4df46d - Sigstore transparency entry: 207606237
- Sigstore integration time:
-
Permalink:
uwplasma/SPECTRAX@b05af6e3be757a9d36432ccff97744f9a0354477 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/uwplasma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@b05af6e3be757a9d36432ccff97744f9a0354477 -
Trigger Event:
push
-
Statement type: