Skip to content

Commit 842c113

Browse files
authored
Merge pull request #18 from tum-pbs/develop
FP Precision
2 parents f3090a6 + 7fb033d commit 842c113

96 files changed

Lines changed: 1361 additions & 703 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
webglviewer/webglviewer.min.js linguist-vendored

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: python
22

33
python:
4-
- "2.7"
54
- "3.6"
65
- "3.7"
76
- "3.8"
@@ -17,7 +16,6 @@ install:
1716
- if [[ $TRAVIS_PYTHON_VERSION != 3.8 ]]; then pip install --quiet tensorflow==1.14.0; fi
1817
- if [[ $TRAVIS_PYTHON_VERSION == "3.8" ]]; then pip install --quiet https://github.com/ppwwyyxx/tensorflow-wheels/releases/download/v0.2/tensorflow-1.15.0-cp38-cp38-linux_x86_64.whl numba llvmlite pytest; fi
1918
- pip install torch==1.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
20-
- if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]]; then pip install future; fi
2119
- pip install nbformat ipython pylint;
2220
- pip install .
2321

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include phi/VERSION
2+
include documentation/Package_Info.md
23
recursive-include phi/tf/cuda/build *
34
recursive-include webglviewer *

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
![Gui](documentation/figures/WebInterface.png)
99

10-
Φ<sub>Flow</sub> is a research-oriented, open-source fluid simulation toolkit.
11-
It is written mostly in Python and can use both NumPy and TensorFlow for execution.
10+
Φ<sub>Flow</sub> is a research-oriented, open-source PDE solving toolkit that is fully differentiable.
11+
It is written mostly in Python and can use both NumPy, TensorFlow and PyTorch for execution.
1212

13-
Having all functionality of a fluid simulation running in TensorFlow opens up the possibility of back-propagating gradients through the simulation as well as running the simulation on GPUs.
13+
Having all functionality of a fluid simulation running in a deep learning framework opens up the possibility of back-propagating gradients through the simulation as well as running the simulation on GPUs.
1414

1515
## Features
1616

@@ -23,10 +23,11 @@ Having all functionality of a fluid simulation running in TensorFlow opens up th
2323
## Publications
2424

2525
- [Learning to Control PDEs with Differentiable Physics](https://ge.in.tum.de/publications/2020-iclr-holl/), *Philipp Holl, Vladlen Koltun, Nils Thuerey*, ICLR 2020.
26+
- [Solver-in-the-Loop: Learning from Differentiable Physics to Interact with Iterative PDE-Solvers](https://ge.in.tum.de/publications/2020-um-solver-in-the-loop/), *Kiwon Um, Yun Fei, Robert Brand, Philipp Holl, Nils Thuerey*, pre-print 2020.
2627

2728
## Installation
2829

29-
To install Φ<sub>Flow</sub> with web interface, run:
30+
To install Φ<sub>Flow</sub> with its web interface, run:
3031

3132
```bash
3233
$ pip install phiflow[gui]

demos/fluid_logo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
def create_tum_logo():
1919
for x in range(1, 10, 2):
20-
world.add(Obstacle(box[41:83, 15 + x * 7:15 + (x+1) * 7]))
20+
world.add(Obstacle(box[41:83, 15 + x * 7:15 + (x + 1) * 7]))
2121
world.add_all(Obstacle(box[41:48, 43:50]), Obstacle(box[83:90, 15:43]), Obstacle(box[83:90, 50:85]))
2222

2323

demos/kuramoto_sivashinsky.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from phi.flow import *
2+
from phi.physics.flame import KuramotoSivashinsky
3+
4+
5+
flame1 = CenteredGrid.sample(Noise(scale=5) * 2, Domain([32], PERIODIC, box=box(32)), name='flame1')
6+
flame2 = (flame1 + Noise(scale=1) * 0.3).at(flame1).copied_with(name='flame2')
7+
world.add(flame1, KuramotoSivashinsky())
8+
world.add(flame2, KuramotoSivashinsky())
9+
10+
app = App('Kuramoto-Sivashinsky', 'Chaotic flame simulation', dt=0.1, framerate=10)
11+
show(app)

demos/manual_fluid_numpy_or_tf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444

4545
SAVE_IMAGES = True
4646

47-
4847
def save_img(array, scale, name, idx=0):
4948
if len(array.shape) <= 4:
5049
ima = np.reshape(array[idx], [array.shape[1], array.shape[2]]) # remove channel dimension , 2d
@@ -104,4 +103,3 @@ def save_img(array, scale, name, idx=0):
104103

105104
print("Step SESSION.run %04d done, DENSITY shape %s, means %s %s" %
106105
(i, FLOW.density.data.shape, np.mean(FLOW.density.data), np.mean(FLOW.velocity.staggered_tensor())))
107-

demos/marker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010

1111
def checkerboard(resolution, size=8, offset=2):
12-
data = math.zeros([1]+list(resolution)+[1])
12+
data = math.zeros([1] + list(resolution) + [1])
1313
for y in range(size):
1414
for x in range(size):
15-
data[:, y+offset::size*2, x+offset::size*2, :] = 1
15+
data[:, y + offset::size * 2, x + offset::size * 2, :] = 1
1616
return data
1717

1818

demos/optimize_pressure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self):
2222
with self.model_scope():
2323
initial_velocity = randn(domain.staggered_grid(0).shape) * 0.2
2424
optimizable_velocity = variable(initial_velocity)
25-
velocity = optimizable_velocity * mask(box[0:62, 0:31])
25+
velocity = optimizable_velocity * mask(box[0:62, 0:31]).at(optimizable_velocity)
2626
velocity = divergence_free(velocity, domain)
2727
# --- Target ---
2828
y, x = np.meshgrid(*[np.arange(-0.5, dim + 0.5) for dim in domain.resolution])

demos/rotating_bar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
physics_config.x_first()
33

44

5-
def update_obstacle(obstacle, dt, angular_velocity=0.05):
5+
def update_obstacle(obstacle, dt, angular_velocity=0.1):
66
geometry = obstacle.geometry.rotated(angular_velocity * dt)
77
return obstacle.copied_with(geometry=geometry, angular_velocity=angular_velocity)
88

99

1010
world.add(Fluid(Domain([128, 128], CLOSED, box=box([100, 100]))), physics=IncompressibleFlow())
11-
world.add(Obstacle(box[20:80, 48:52], name='bar'), physics=update_obstacle)
11+
world.add(Obstacle(box[10:90, 48:52], name='bar'), physics=update_obstacle)
1212
world.step()
1313

1414
app = App('Moving Objects Demo', framerate=10)

0 commit comments

Comments
 (0)