This release is a pre-release and may not be stable for production use.
MMFT Hybrid Simulator
A Hybrid Simulator for Microfluidic Devices developed by the Chair for Design Automation at the Technical University of Munich as part of the Munich MicroFluidic Toolkit (MMFT). This simulator exploits the Modified Nodal Analysis (which is a simulation method on a high level of abstraction) to accelerate CFD simulations (using the LBM as implemented in the OpenLB library) of microfluidic devices.
For more information about our work on Microfluidics, please visit https://www.cda.cit.tum.de/research/microfluidics/.
If you have any questions, feel free to contact us via microfluidics.cda@xcit.tum.de or by creating an issue on GitHub.
System Requirements
The implementation should be compatible with any current C++ compiler supporting C++17 and a minimum CMake version 3.21. The python package requires Python version 3.7 or newer. The package is currently tested for Linux distributions.
Usage
C++
To use this library, include the following code in your cmake file:
include(FetchContent)
FetchContent_Declare(
hybridsim
GIT_REPOSITORY https://github.com/cda-tum/mmft-hybrid-simulator.git
GIT_TAG master
)
FetchContent_MakeAvailable(hybridsim)
target_link_libraries(${TARGET} PRIVATE hybridsim)
and include the library API header in your project file:
#include <baseSimulator.h>
#include <baseSimulator.hh>
Python
Install the python package
pip install mmft.hybridsim
and import the hybrid simulator in your code
from mmft import hybridsim
Example
To use the hybrid simulator, the network must be defined in a Network.JSON file.
A network is defined as a set of Nodes, Channels and CFD Modules.
A Node contains the x and y position on a Cartesian coordinate system, where the origin is the bottom-left corner of the microfluidic device:
{
"iD": 1,
"x": 2e-3,
"y": 1e-3
}
A Channel connects two nodes (nA and nB) and has a width and a height:
{
"iD": 1,
"nA": 1,
"nB": 2,
"width": 1e-4,
"height": 1e-4
}
A CFD Module is defined with type "LBM" and contains paramaters for the LBM solver instance and information on the geometry of the CFD instance:
{
"iD": 0,
"Type":"LBM",
"name": "Test1-cross-0",
"stlFile": "/path/to/cross.stl",
"charPhysLength": 1e-4,
"charPhysVelocity": 1e-2,
"alpha": 0.1,
"resolution": 20,
"epsilon": 0.5,
"posX": 3.75e-3,
"posY": 0.75e-3,
"sizeX": 5e-4,
"sizeY": 5e-4,
"Openings":
[
{
"nodeId": 4,
"normalX": 1.0,
"normalY": 0.0,
"width": 1e-4
},
{
"nodeId": 8,
"normalX": 0.0,
"normalY": -1.0,
"width": 1e-4
},
{
"nodeId": 9,
"normalX": 0.0,
"normalY": 1.0,
"width": 1e-4
},
{
"nodeId": 10,
"normalX": -1.0,
"normalY": 0.0,
"width": 1e-4
}
]
}
Most importantly, the geometry of the CFD Module is described by a .STL file. The in-/outflow boundaries of the CFD Module are described by the Openings. Each opening is coupled to a single Node (located in the middle of the opening), has a normal direction and a width.
Examples of networks can be found in the examples folder.
C++
The simulation case is defined in main.cpp. An example of a simulation case in c++ is given here:
#include <iostream>
#include <baseSimulator.h>
#include <baseSimulator.hh>
using T = double;
int main(int argc, char const* argv []) {
// New simulation object
std::cout << "[Main] Create simulation object..." << std::endl;
sim::Simulation<T> simulation = sim::Simulation<T>();
// Load and set the network from a JSON file
std::cout << "[Main] Load the JSON network..." << std::endl;
std::string file = "/path/to/Network.JSON";
arch::Network<T>* network = new arch::Network<T>(file);
simulation.setNetwork(network);
// Add Pressure and/or Flow Rate Pumps
std::cout << "[Main] Add pressure and Flow rate pumps..." << std::endl;
network->setPressurePump(0, T(1e3));
// Define and set the continuous phase fluid
std::cout << "[Main] Set the continuous phase fluid..." << std::endl;
sim::Fluid<T>* fluid = new sim::Fluid<T>(0, T(1000), T(1e-3));
fluid->setName("Water");
simulation.setContinuousPhase(fluid);
// Define and set the resistance model
std::cout << "[Main] Set the resistance model..." << std::endl;
sim::ResistanceModel1D<T>* resistanceModel = new sim::ResistanceModel1D<T>(fluid->getViscosity());
simulation.setResistanceModel(resistanceModel);
// Perform simulation and store results
std::cout << "[Main] Simulation..." << std::endl;
simulation.simulate();
// Print the results
std::cout << "[Main] Results..." << std::endl;
simulation.printResults();
return 0;
}
Python
The simulation case can be defined once the mmft.hybridsim package is installed. An example for a simulation case in python is given here:
from mmft import hybridsim
# New simulation object
simulation = hybridsim.Simulation()
# Load and set the network from a JSON file
network = hybridsim.Network("/path/to/Network.JSON")
simulation.setNetwork(network)
# Add Pressure and/or Flow Rate Pumps
network.setPressurePump(0, 1e3)
# Define and set the continuous phase fluid
fluid = hybridsim.Fluid(0, 1000, 1e-3)
simulation.setContinuousPhase(fluid)
# Define and set the resistance model
resistanceModel = hybridsim.ResistanceModel(fluid.getViscosity())
simulation.setResistanceModel(resistanceModel)
# Perform simulation and store results
simulation.simulate()
# Print the results
simulation.print()
Metadata
Release files for mmft.hybridsim 0.1.1rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mmft.hybridsim-0.1.1rc1.tar.gz | 920.5 kB | Without provenance | Details for mmft.hybridsim-0.1.1rc1.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| mmft.hybridsim-0.1.1rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.17+ x86-64 | Details for mmft.hybridsim-0.1.1rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| mmft.hybridsim-0.1.1rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.17+ x86-64 | Details for mmft.hybridsim-0.1.1rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| mmft.hybridsim-0.1.1rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.17+ x86-64 | Details for mmft.hybridsim-0.1.1rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| mmft.hybridsim-0.1.1rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.17+ x86-64 | Details for mmft.hybridsim-0.1.1rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
Total release size: 3.0 MB
Release files / mmft.hybridsim-0.1.1rc1.tar.gz
| Download URL | mmft.hybridsim-0.1.1rc1.tar.gz |
|---|---|
| Size | 920.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d83c63aced872fbb39e1eb97ccea6a81ce4387cb4b20066422599916d0dd453
|
|
BLAKE2b-256 checksum How to use checksums |
1e116b171ff0c4cdc46271ad042fefc9b35292fa65eeb67de1dbeca61656b40a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / mmft.hybridsim-0.1.1rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | mmft.hybridsim-0.1.1rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 522.6 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
85eb29d2e370699f4fc936a4a479b779a751ea6f7e67f1ee4bbecf2211a7defa
|
|
BLAKE2b-256 checksum How to use checksums |
3171ddc24ef383c61f0d71add273ba3ea3337a49d48366b32c6b184ca1df9a1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / mmft.hybridsim-0.1.1rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | mmft.hybridsim-0.1.1rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 522.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
b864de930ca53a38a346a47d472fd1b58f3cfba98542a67e5dd08da851bd315b
|
|
BLAKE2b-256 checksum How to use checksums |
a0a6a92206fa2d6c53f08ca8384de8e276077c1b2c21c00c5cd6a2ae56c60d38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / mmft.hybridsim-0.1.1rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | mmft.hybridsim-0.1.1rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 522.8 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8a8ccfdc884cc8e9d90fb052ef0b0916d4eff19b018842e5e289a3136cf48361
|
|
BLAKE2b-256 checksum How to use checksums |
0f069fe93dc98a38780fb1f342eaeed8592a9b07ac54a29494de40ebc16c77f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / mmft.hybridsim-0.1.1rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | mmft.hybridsim-0.1.1rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 522.3 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
50cb1ffe39f2473cc4db24e7f72bddfc367b0df9766124d627a84ed72a78cc4a
|
|
BLAKE2b-256 checksum How to use checksums |
38e0bedf656d4aea6d43aa51c63d50296b69c6d47df2a26b62460c6a8d772b88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for mmft.hybridsim 0.1.1rc1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.