Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Geneva committed Nov 30, 2020
1 parent b4faed1 commit 9cc0393
Show file tree
Hide file tree
Showing 42 changed files with 5,097 additions and 3 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# Predicting Turbulent Fluid Flows with Generative Deep Learning
Multi-fidelity Generative Deep Learning Turbulent Flows [[JCP]()][[ArXiv](https://arxiv.org/abs/2006.04731)]
Multi-fidelity Generative Deep Learning Turbulent Flows [[FoDS]()][[ArXiv](https://arxiv.org/abs/2006.04731)]

[Nicholas Geneva](http:https://nicholasgeneva.com/), [Nicholas Zabaras](https://cics.nd.edu)

---
[![Documentation Status]()]() ![liscense](https://img.shields.io/github/license/zabaras/deep-turbulence)

This paper is currently in the review process. The code is also being prepared for release in the near future.
A novel multi-fidelity deep generative model is introduced for the surrogate modeling of high-fidelity turbulent flow fields given the solution of a computationally inexpensive but inaccurate low-fidelity solver.

Star this repository for updates. Thank you for your patience.
- Getting Started
- Documentation
- Data Repository

## Citation
Cite us with:
```latex
@article{geneva2020multi,
title={Multi-fidelity Generative Deep Learning Turbulent Flows},
author={Geneva, Nicholas and Zabaras, Nicholas},
journal={arXiv preprint arXiv:2006.04731},
year={2020}
}
```
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http:https://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
73 changes: 73 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Configuration file for the Sphinx documentation builder.
#
# To auto-generate rst files for the program use the command:
# sphinx-apidoc -f -o ./source/tmglow/ ../tmglow/
# Use "make clean" and "make html" to build the docs

import sphinx_rtd_theme

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../../tmglow'))

from sphinx.ext.autodoc import between

def setup(app):
# Register a sphinx.ext.autodoc.between listener to ignore everything
# between lines that contain the word ======
app.connect('autodoc-process-docstring', between('^.*=====.*$', exclude=True))
return app

# -- Project information -----------------------------------------------------

project = 'Multi-fidelity Generative Deep Learning Turbulent Flows'
copyright = '2020, Nicholas Geneva'
author = 'Nicholas Geneva'

# The full version, including alpha/beta/rc tags
release = '0.0.1'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
'sphinx.ext.todo',
"sphinx_rtd_theme",
"sphinx.ext.mathjax",
'sphinx.ext.ifconfig'
]


# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
46 changes: 46 additions & 0 deletions docs/source/faq.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
F.A.Q.
=======
Here are a few questions that may perhaps come up.

- **Where can I download the training/testing data?**

Check the :ref:`getting_started` section for those details.

- **What Python packages do I need?**

Please see the requirements.txt or readme on Github.

- **Where in the code of the actual TM-Glow model?**

The class you want to start at is :class:`nn.tmGlow.TMGlow`.

- **Why use an INN instead of a VAE or GANs?**

VAEs have long suffered a lack of ability to yield crisp, complex images.
GANs can be extremely unstable and were tested at the early stages of this work
without success.
Additionally, the INN has very nice probabilistic properties which is good for UQ.

- **My model is unstable during training!?!? Help!**

Restart training at a checkpoint before your model diverged with :code:`--epoch-start #` parameter.
Consider increasing gradient clipping, lower learning rate, increasing weight decay, etc. There are a lot
of options to play with. Which Glow is much more stable than GANs it can still be unstable at points.

- **Why are some of the sections of the program not fully documented?**

Documenting takes time and energy. I'm working on slowly improving the docs, but it was my main focus to get
the model and its components documented so people can understand what is going on under the hood.

- **How should I cite this?**

Cite the paper!

.. code-block:: text
@article{geneva2020multi,
title={Multi-fidelity Generative Deep Learning Turbulent Flows},
author={Geneva, Nicholas and Zabaras, Nicholas},
journal={arXiv preprint arXiv:2006.04731},
year={2020}
}
3 changes: 3 additions & 0 deletions docs/source/help.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Contact
=======
Have a question, issue or found a bug? Best way to get into contact is through an issue on our github page!
42 changes: 42 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

Multi-fidelity Generative Deep Learning Turbulent Flows
===================================================================================
Nicholas Geneva, Nicholas Zabaras


Documentation transient multi-fidelity Glow (TM-Glow) used for predicting high-fidelity turbulence
given a low-fidelity simulation.
Please see the paper for additional information regarding the model used and the underlying
theory `[JCP] <https://arxiv.org/abs/2006.04731>`_ `[Arxivs] <https://arxiv.org/abs/2006.04731>`_.

User Guide
-------------
.. toctree::
:maxdepth: 2

start
faq

API Reference
-------------

If you are looking for information on a specific function, class or
method, this part of the documentation is for you.

.. toctree::
:maxdepth: 2

tmglow/main
tmglow/args
tmglow/nn
tmglow/pc
tmglow/utils

Additional Information
-------------
.. toctree::
:maxdepth: 2

resources
help
liscense
24 changes: 24 additions & 0 deletions docs/source/liscense.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
License
=======

MIT License

Copyright (c) 2020 Scientific Computing and Artificial Intelligence

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions docs/source/resources.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Resources
=======
For additional information on the use of invertible neural networks, please refer to the following select papers:

- D. Kingma, P. Dhariwal, Glow: Generative flow with invertible 1x1 convolutions, in: Advances in Neural Information Processing Systems, 2018, pp. 10215–10224. `[Link] <http:https://papers.nips.cc/paper/8224-glow-generative-flow-with-invertible-1x1-con>`_

- L. Dinh, J. Sohl-Dickstein, S. Bengio, Density estimation using real nvp, arXiv preprint arXiv:1605.08803 `[Link] <https://arxiv.org/abs/1605.08803>`_

- L. Dinh, D. Krueger, Y. Bengio, Nice: Non-linear independent components estimation, arXiv preprint arXiv:1410.8516. `[Link] <https://arxiv.org/abs/1410.8516>`_

- Y. Zhu, N. Zabaras, P.-S. Koutsourelakis, P. Perdikaris, Physics-constrained deep learning for high-dimensional surrogate modeling and uncertainty quantification without labeled data, Journal of Computational Physics 394 (2019) 56 – 81. `[Link] <https://doi.org/10.1016/j.jcp.2019.05.024>`_
56 changes: 56 additions & 0 deletions docs/source/start.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.. _getting_started:

Getting Started
===============

1. Clone the repository
-----------------------
Start with cloning the repository to your local machine using:
``git clone [email protected]:zabaras/deep-turbulence.git``

2. Downloading Data
-------------------
To download both the training and testing data for both of the numerical examples, visit the following Zenodo repository.
`https://doi.org/10.5281/zenodo.4298896 <https://doi.org/10.5281/zenodo.4298896>`_

Extract the data using ``tar –xvzf data-set-name.tar.gz``, and move the training and testing data the desired directory.

The default directories in the config are:

- ``/deep-turbulence/cylinder-training/``
- ``/deep-turbulence/cylinder-testing/``
- ``/deep-turbulence/step-training/``
- ``/deep-turbulence/step-testing/``

But custom paths can be easily adjusted in the configuration file.

3. Set-up Conda Python Environment
----------------------------------
For your convenience, a requirements.txt file is provided in ``/tmglow/`` which will allow the easy creation of a conda environment that contains
the required packages used.

``conda create --name <env_name> --file requirements.txt``

4. Start Training
-----------------
To start training the model simply run :doc:`tmglow/main`.
There are many customizable parameters you can change in :doc:`tmglow/args` which can be view with ``python main.py --help``.
Both numerical examples have pre-coded
configurations.

For example:

- Train the model for the backward-step example: ``python main.py --exp-type backward-step``
- Train the model for the backward-step example: ``python main.py --exp-type cylinder-array``
- Use a custom training directory: ``python main.py --training_data_dir <custom directory>``
- Change number of epochs: ``python main.py --epochs <# epochs>``

.. warning::
Memory constraints on the GPU will likely be of concern. Parallel training is supported but only on a single
node (not multiple CPU) which can be controlled through ``--n_gpu`` and ``--parallel`` options.
Support is not provided for debugging GPU memory or parallel issues.

4. Running Pre-trained Models
-----------------------------
Alternatively, you can skip the training and simply run a pre-trained models.
These can be found in the ``example`` folder where there are several scripts that demonstrate how to load and test a model.
7 changes: 7 additions & 0 deletions docs/source/tmglow/args.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
args module
===========

.. automodule:: args
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/tmglow/main.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
main module
===========

.. automodule:: main
:members:
:undoc-members:
:show-inheritance:
11 changes: 11 additions & 0 deletions docs/source/tmglow/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tmglow
======

.. toctree::
:maxdepth: 4

args
main
nn
pc
utils
Loading

0 comments on commit 9cc0393

Please sign in to comment.