LoKI-B++ is a numerical Boltzmann solver for the two-term approximation of the Boltzmann equation for electrons. It is based on the equivalent matlab version LoKI-B MATLAB. The relevant documentation can be found here.
A Clang format style file is present at the root of this repository
(.clang-format). To format all the source files, you can issue the following
command from the repository root.
clang-format -i -style=file source/*.cpp LoKI-B/*.h app/*.cpp tests/*.cpp ideas/*.cpp web/bindings.cpp- Make sure Git and CMake are installed on your system as well as a suitable C/C++ compiler (i.e. gcc/g++ on Linux, MSVC on Windows and Apple Clang on Mac OS).
- LoKI-B relies on two dependencies, Eigen for linear algebra, and nlohmann-json for JSON handling.
- Open a terminal and navigate to the folder where you want to save the LoKI-B++ project folder.
- Clone the
LoKI-B-cpprepository:git clone [email protected]:LoKI-Suite/LoKI-B-cpp.gitandcdinto the newly createdLoKI-B-cppfolder.
- run:
cmake -DCMAKE_BUILD_TYPE=Release -D<BACKEND_FLAG>=ON -B build - run:
cmake --build build -j <NUM_JOBS>- Where
<NUM_JOBS>is the maximum number of jobs to run simultaneously when compiling; just use the number of physical cores in your system. Omit this flag to use the default settings.
- Where
Linux using Nix
-
Setting up the LoKI-B development environment.
To launch a development shell use
nix develop
in the root of the repository. This shell will contain all necessary dependencies to build LoKI-B. Additionally, all binaries can be built using
nix build
Alternatively, a Cobertura coverage report can be generated using
nix build .#coverageThe resulting output will be available in
<repo_root>/result. -
Installing LoKI-B without manually cloning the repository.
The LoKI-B binary can be built and run anywhere by issuing
nix run github:loki-suite/loki-b-cpp <input_file>
Similarly, a shell can be launched with access to the
lokibinary usingnix shell github:loki-suite/loki-b-cpp
Note: the web version available in this repository is outdated, for an updated version see LoKI-Web. The web version (using WebAssembly) can be built using the
loki-webpackage.nix build github:loki-suite/loki-b-cpp#loki-web
To serve the pages you can then e.g. use the python http server.
python -m http.server -d result/share/loki-web
- run:
cmake -D<BACKEND_FLAG>=ON -B build- where
<BACKEND_FLAG>=LOKIB_USE_MKL/LOKIB_USE_OPENBLAS, specifying the backend to supply to Eigen - this flag can also be omitted to build with pure Eigen
- where
- run:
cmake --build build --config Release -j <NUM_JOBS>- where
<NUM_JOBS>is the maximum number of jobs to run simultaneously when compiling; just use the number of physical cores in your system. Omit this flag to use the default settings.
- where
As of yet, LoKI-B++ is locally run from the command line. To plot the computed eedf you can install gnuplot. The execution on different operating systems is very similar.
- Make sure gnuplot is available on your system.
- After compiling the
lokiexecutable, run the following command in the root of the repository:./build/app/loki <INPUT_FILE> | gnuplot --persist.- Where
<INPUT_FILE>is the path to the input file relative to the current working directory. - The output from LoKI-B++ is then piped into gnuplot, where the
--persistflag avoids gnuplot from immediately closing after plotting.
- Where
- Make sure gnuplot is available on your system.
- Run the following command:
.\build\app\loki.exe <INPUT_FILE> | gnuplot --persist.- Where
<INPUT_FILE>is the path to the input file relative to the current working directory. - The output from LoKI-B++ is then piped into gnuplot, where the
--persistflag avoids gnuplot from immediately closing after plotting.
- Where
Alternatively, LoKI-B++ runs natively in a web browser through compilation to WebAssembly. The web deployment of LoKI-B++ is available at https://loki-suite.github.io/LoKI-Web/. The source code for the web app can be found in LoKI-Web.