Skip to content

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.

License

GinkoBalboa/parfis

Repository files navigation

Parfis

GitHub tag (latest by date) GitHub Build and test Actions Status

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:

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:

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 section of the doc web-site.

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:

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).

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:

cd parfis
mkdir build
cd build
cmake ..
cmake --build . --config Release

For more info on building from source check build 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:

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.
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.

./buildDocOnly.sh

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published