https://github.com/ginkobalboa/parfis
Particles and field simulator. Written in C++ with Python bindings. The algorithm is based on the particle-in-cell (PIC) method used for interacting many-particle systems.
https://github.com/ginkobalboa/parfis
cpp cuda physics-simulation python
Last synced: about 2 months ago
JSON representation
Particles and field simulator. Written in C++ with Python bindings. The algorithm is based on the particle-in-cell (PIC) method used for interacting many-particle systems.
- Host: GitHub
- URL: https://github.com/ginkobalboa/parfis
- Owner: GinkoBalboa
- License: gpl-3.0
- Created: 2021-12-06T16:32:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-02T00:35:52.000Z (over 3 years ago)
- Last Synced: 2025-03-13T17:53:51.754Z (over 1 year ago)
- Topics: cpp, cuda, physics-simulation, python
- Language: C++
- Homepage: https://www.parfis.com
- Size: 4.09 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Parfis


[](https://github.com/GinkoBalboa/parfis/actions)
Parfis is an acronym for Particles and Field Simulator. Parfis is written in
C++ with Python bindings. The algorithm is based on the particle-in-cell
(PIC) method used for interacting many-particle systems. In the PIC method
individual particles (or fluid elements) in a Lagrangian frame are tracked
in a continuous phase space, whereas moments of the distribution such as
densities and currents are computed simultaneously on Eulerian (stationary)
mesh points.
## Quick start
You can quickly install and try parfis by doing the following in your terminal:
``` bash
pip install parfis
```
After installing you can try if the library loads and check the info of
the istalled build with the following three commands from your python terminal:
``` python
from parfis import Parfis
Parfis.load_lib()
print(Parfis.info())
```
## Explore more possibilities
Explore the possibilities by checking some of the examples given in the
[demo](https://www.parfis.com/demo.html) section of the [doc web-site](https://www.parfis.com).
## Building from source
The build configuration is generated with CMake. After obtaining the source from the
GitHub repo, run the CMake commands shown here.
### Simple build (no googletest)
For building the dynamic library you will need cmake and cxx compiler. For running cpp
tests you will need to pull and build googletest. On Linux the following commands
will install cmake and cxx compiler, and the scripts build the parfis lib for the two
versions of the state variable (float and double) and run the python tests:
``` bash
sudo apt get install cmake
sudo apt get install g++
cd scripts
./buildParfis.sh
./buildParfis.sh float
./installParfisLocally.sh
./runPythonTests.sh
```
### Building with googletest
If you plan to run googletests on the pure cpp library. You should install google test
first and set the cmake script build you the tests from `cpp_test` folder. This is written
in the following scripts (for debug mode and state type double).
``` bash
cd scripts
./buildGoogletest.sh
./buildParfis.sh Debug gtestAll
./runDebugGtestAll.sh
```
### Building on Linux and Windows from terminal
Building on Linux and Windows is the same, presumably you have CMake installed:
``` bash
cd parfis
mkdir build
cd build
cmake ..
cmake --build . --config Release
```
For more info on building from source check [build](https://www.parfis.com/build.html) section
from the doc web-size.
### Building with conda
You can use the supplied conda environment `.yml` file to create an
environment `parfis` from which you can perform all the compilation, google testing,
pytesting and doc generation.
To create a `parfis` environment run:
``` bash
cd script
conda env create -n parfis --file ./parfisCondaEnv.yml
conda activate parfis
```
To run python tests:
- Install the requred python modules from the requrements file in the script directory.
- Run local installation of parfis.
``` bash
pip install -r requirements.txt
./installParfisLocally.sh
```
Since the `requirements.txt` has all the needed modules to generate
documentation, the later is generated by calling the following scirpt.
``` bash
./buildDocOnly.sh
```