All Projects → FlowModelingControl → flowtorch

FlowModelingControl / flowtorch

Licence: GPL-3.0 license
flowTorch - a Python library for analysis and reduced-order modeling of fluid flows

Programming Languages

python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language
shell
77523 projects
TeX
3793 projects

Projects that are alternatives of or similar to flowtorch

Visidata
A terminal spreadsheet multitool for discovering and arranging data
Stars: ✭ 4,606 (+9700%)
Mutual labels:  csv, hdf5
woss-ns3
WOSS is a multi-threaded C++ framework that permits the integration of any existing underwater channel simulator that expects environmental data as input and provides as output a channel realization. Currently, WOSS integrates the Bellhop ray-tracing program. Thanks to its automation the user only has to specify the location in the world and the…
Stars: ✭ 20 (-57.45%)
Mutual labels:  netcdf, hdf5
30 Days Of Python
Learn Python for the next 30 (or so) Days.
Stars: ✭ 1,748 (+3619.15%)
Mutual labels:  csv, jupyter
netcdf-java
The Unidata netcdf-java library
Stars: ✭ 84 (+78.72%)
Mutual labels:  netcdf, hdf5
California Coronavirus Data
The Los Angeles Times' independent tally of coronavirus cases in California.
Stars: ✭ 188 (+300%)
Mutual labels:  csv, jupyter
rhdf5
Package providing an interface between HDF5 and R
Stars: ✭ 50 (+6.38%)
Mutual labels:  hdf5
tabular-stream
Detects tabular data (spreadsheets, dsv or json, 20+ different formats) and emits normalized objects.
Stars: ✭ 34 (-27.66%)
Mutual labels:  csv
grafana-csv-plugin
CSV datasource for Grafana 6.x.x / 7.x.x
Stars: ✭ 33 (-29.79%)
Mutual labels:  csv
ipychart
The power of Chart.js with Python
Stars: ✭ 48 (+2.13%)
Mutual labels:  jupyter
DataProfiler
What's in your data? Extract schema, statistics and entities from datasets
Stars: ✭ 843 (+1693.62%)
Mutual labels:  csv
import-cli-simple
This the meta package for Pacemaker Community, a Symfony based CLI application that provides import functionality for products, categories, attributes, and attribute-sets. The default format is CSV, adapters for XML are also available. The application can be declaratively extended by additional operations, which can be used to reassemble and exe…
Stars: ✭ 69 (+46.81%)
Mutual labels:  csv
opssight-connector
OpsSight Connector documentation
Stars: ✭ 15 (-68.09%)
Mutual labels:  pod
cognipy
In-memory Graph Database and Knowledge Graph with Natural Language Interface, compatible with Pandas
Stars: ✭ 31 (-34.04%)
Mutual labels:  jupyter
How-to-score-0.8134-in-Titanic-Kaggle-Challenge
Solution of the Titanic Kaggle competition
Stars: ✭ 114 (+142.55%)
Mutual labels:  jupyter
Textrude
Code generation from YAML/JSON/CSV models via SCRIBAN templates
Stars: ✭ 79 (+68.09%)
Mutual labels:  csv
enhancement-proposals
Enhancement proposals for the Jupyter Ecosystem
Stars: ✭ 97 (+106.38%)
Mutual labels:  jupyter
COVID-19-Greece
A python-generated website for visualizing the novel coronavirus (COVID-19) data for Greece.
Stars: ✭ 21 (-55.32%)
Mutual labels:  csv
phpunit-extensions
📦 Some cool extensions for PHPUnit
Stars: ✭ 28 (-40.43%)
Mutual labels:  csv
CsvTextFieldParser
A simple CSV parser based on Microsoft.VisualBasic.FileIO.TextFieldParser.
Stars: ✭ 40 (-14.89%)
Mutual labels:  csv
SSCycleScrollView
轮播终结者,用swift完成,易用集成
Stars: ✭ 39 (-17.02%)
Mutual labels:  pod

FOR2895Logo

flowTorch

status

flowTorch - a Python library for analysis and reduced order modeling of fluid flows

flowTorch is developed primarily by @AndreWeiner in the Flow Modeling and Control group led by Richard Semaan. The development is financed by the German Research Foundation (DFG) within the research program FOR 2895

unsteady flow and interaction phenomena at high speed stall conditions

with the primary goal to investigate flow conditions that lead to buffeting at airfoils in the transonic flow regime. The animation below shows the shock buffet on a NACA-0012 airfoil at Re=10^7, Ma=0.75, and 4 degrees angle of attack. The simulation was conducted in OpenFOAM; follow this link for more information about the setup.

buffet_10fps.mp4

Why flowTorch?

The flowTorch project was started to make the analysis and modeling of fluid data easy and accessible to everyone. The library design intends to strike a balance between usability and flexibility. Instead of a monolithic, black-box analysis tool, the library offers modular components that allow assembling custom analysis and modeling workflows with ease. flowTorch helps to fuse data from a wide range of file formats typical for fluid flow data, for example, to compare experiments simulations. The available analysis and modeling tools are rigorously tested and demonstrated on a variety of different fluid flow datasets. Moreover, one can significantly accelerate the entire process of accessing, cleaning, analysing, and modeling fluid flow data by starting with one of the pipelines available in the flowTorch documentation.

To get a first impression of how working with flowTorch looks like, the code snippet below shows part of a pipeline for performing a dynamic mode decomposition (DMD) of a transient OpenFOAM simulation.

import torch as pt
from flowtorch import DATASETS
from flowtorch.data import FOAMDataloader, mask_box
from flowtorch.analysis.dmd import DMD

path = DATASETS["of_cylinder2D_binary"]
loader = FOAMDataloader(path)

# select a subset of the available snapshots
times = loader.write_times
window_times = [time for time in times if float(time) >= 4.0]

# load vertices, discard z-coordinate, and create a mask
vertices = loader.vertices[:, :2]
mask = mask_box(vertices, lower=[0.1, -1], upper=[0.75, 1])

# assemble the data matrix
data_matrix = pt.zeros((mask.sum().item(), len(window_times)), dtype=pt.float32)
for i, time in enumerate(window_times):
    # load the vorticity vector field, take the z-component [:, 2], and apply the mask
    data_matrix[:, i] = pt.masked_select(loader.load_snapshot("vorticity", time)[:, 2], mask)

# perform DMD
dmd = DMD(data_matrix, rank=19)
# analyse dmd.modes or dmd.eigvals
# ...

Currently, the following sub-packages are under active development. Note that some of the components are not yet available in the public release because further developments and testing are required:

package content
flowtorch.data data loading, domain reduction (masked selection)
flowtorch.analysis algorithms for dimensionality reduction, including proper orthogonal decomposition (POD), dynamic mode decomposition (DMD), autoencoders, and variants thereof
flowtorch.rom reduced-order modeling using cluster-based network models (CNM)

flowTorch uses the PyTorch library as a backend for data structures, data types, and linear algebra operations on CPU and GPU. Some cool features of flowTorch include:

  • data accessors return PyTorch tensors, which can be used directly within your favorite machine learning library, e.g., PyTorch, SkLearn or Tensorflow
  • most algorithms run on CPU as well as on GPU
  • mixed-precision operations (single/double); switching to single precision makes your life significantly easier when dealing with large datasets
  • user-friendly Python library that integrates easily with popular tools and libraries like Jupyterlab, Matplotlib, Pandas, or Numpy
  • a rich tutorial collection to help you getting started
  • interfaces to common data formats like OpenFOAM, VTK (for Flexi and SU2), TAU, iPSP, CSV (for DaVis PIV data and raw OpenFOAM output)

flowTorch can be also used easily in combination with existing Python packages for analysis and reduced-order modeling thanks to the interoperability between PyTorch and NumPy. Great examples are (by no means a comprehensive list):

  • PyDMD - Python Dynamic Mode Decomposition
  • PySINDy - sparse identification of nonlinear dynamical systems from data

Getting started

The easiest way to install flowTorch is as follows:

# install via pip
pip3 install git+https://github.com/FlowModelingControl/flowtorch
# to uninstall flowTorch, run
pip3 uninstall flowtorch

Alternatively, you can also clone the repository manually by running

git clone [email protected]:FlowModelingControl/flowtorch.git

and install the dependencies listed in requirements.txt:

pip3 install -r requirements.txt

To get an overview of what flowTorch can do for you, have a look at the online documentation. The examples presented in the online documentation are also contained in this repository. In fact, the documentation is a static version of several Jupyter labs with start-to-end analyses. If you are interested in an interactive version of one particular example, navigate to ./docs/source/notebooks and run jupyter lab. Note that to execute some of the notebooks, the corresponding datasets are required. The datasets can be downloaded here (~1.4GB). If the data are only required for unit testing, a reduced dataset may be downloaded here (~384MB). Download the data into a directory of your choice and navigate into that directory. To extract the archive, run:

# full dataset
tar xzf datasets_29_10_2021.tar.gz
# reduced dataset
tar xzf datasets_minimal_29_10_2021.tar.gz

To tell flowTorch where the datasets are located, define the FLOWTORCH_DATASETS environment variable:

# add export statement to bashrc; assumes that the extracted 'datasets' or 'datasets_minimal'
# folder is located in the current directory
# full dataset
echo "export FLOWTORCH_DATASETS=\"$(pwd)/datasets/\"" >> ~/.bashrc
# reduced dataset
echo "export FLOWTORCH_DATASETS=\"$(pwd)/datasets_minimal/\"" >> ~/.bashrc
# reload bashrc
. ~/.bashrc

Development

Documentation

To build the flowTorch documentation, the following additional packages are required:

pip3 install sphinx sphinx_rtd_theme nbsphinx recommonmark

To build the HTML version of the API documentation, navigate to ./docs and run:

make html

Unit testing

All sub-packages contain unit tests, which require the installation of PyTest:

pip3 install pytest

Moreover, the flowTorch datasets must be downloaded and referenced as described in the previous section. To run all unit tests of all sub-packages, execute:

pytest flowtorch

You can also execute all tests in a sub-package, e.g., data

pytest flowtorch/data

or run individual test modules, e.g.,

pytest flowtorch/data/test_FOAMDataloader.py

Getting help

If you encounter any issues using flowTorch or if you have any questions regarding current and future development plans, please use the repository's issue tracker. Consider the following steps before and when opening a new issue:

  1. Have you searched for similar issues that may have been already reported? The issue tracker has a filter function to search for keywords in open issues.
  2. Click on the green New issue button in the upper right corner and describe your problem as detailed as possible. The issue should state what the problem is, what the expected behavior should be, and, maybe, suggest a solution. Note that you can also attach files or images to the issue.
  3. Select a suitable label from the drop-down menu called Labels.
  4. Click on the green Submit new issue button and wait for a reply.

Reference

If flowTorch aids your work, you may support our work by referencing the following software article:

@article{Weiner2021,
  doi = {10.21105/joss.03860},
  url = {https://doi.org/10.21105/joss.03860},
  year = {2021},
  publisher = {The Open Journal},
  volume = {6},
  number = {68},
  pages = {3860},
  author = {Andre Weiner and Richard Semaan},
  title = {flowTorch - a Python library for analysis and reduced-order modeling of fluid flows},
  journal = {Journal of Open Source Software}
}

License

flowTorch is GPLv3-licensed; refer to the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].