Datasets:
Add files using upload-large-folder tool
Browse files- .gitattributes +20 -0
- README.md +121 -0
- acoustic_scattering_maze.yaml +28 -0
- data/test/acoustic_scattering_maze_chunk_18.hdf5 +3 -0
- data/test/acoustic_scattering_maze_chunk_19.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_0.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_1.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_10.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_11.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_12.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_13.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_14.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_15.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_2.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_3.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_4.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_5.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_6.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_7.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_8.hdf5 +3 -0
- data/train/acoustic_scattering_maze_chunk_9.hdf5 +3 -0
- data/valid/acoustic_scattering_maze_chunk_16.hdf5 +3 -0
- data/valid/acoustic_scattering_maze_chunk_17.hdf5 +3 -0
- generation/acoustics_2d_interface_maze.py +231 -0
- generation/generate_acoustics_data.py +166 -0
- generation/run_mazes.sh +12 -0
- gif/mazes_density.png +3 -0
- gif/pressure_normalized.gif +3 -0
- gif/pressure_unnormalized.gif +3 -0
- stats.yaml +14 -0
- visualization_acoustic_scattering_maze.ipynb +0 -0
.gitattributes
CHANGED
@@ -56,3 +56,23 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
56 |
# Video files - compressed
|
57 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
58 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
# Video files - compressed
|
57 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
58 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
59 |
+
data/train/acoustic_scattering_maze_chunk_2.hdf5 filter=lfs diff=lfs merge=lfs -text
|
60 |
+
data/train/acoustic_scattering_maze_chunk_15.hdf5 filter=lfs diff=lfs merge=lfs -text
|
61 |
+
data/valid/acoustic_scattering_maze_chunk_17.hdf5 filter=lfs diff=lfs merge=lfs -text
|
62 |
+
data/train/acoustic_scattering_maze_chunk_13.hdf5 filter=lfs diff=lfs merge=lfs -text
|
63 |
+
data/valid/acoustic_scattering_maze_chunk_16.hdf5 filter=lfs diff=lfs merge=lfs -text
|
64 |
+
data/train/acoustic_scattering_maze_chunk_10.hdf5 filter=lfs diff=lfs merge=lfs -text
|
65 |
+
data/train/acoustic_scattering_maze_chunk_5.hdf5 filter=lfs diff=lfs merge=lfs -text
|
66 |
+
data/train/acoustic_scattering_maze_chunk_3.hdf5 filter=lfs diff=lfs merge=lfs -text
|
67 |
+
data/train/acoustic_scattering_maze_chunk_6.hdf5 filter=lfs diff=lfs merge=lfs -text
|
68 |
+
data/train/acoustic_scattering_maze_chunk_4.hdf5 filter=lfs diff=lfs merge=lfs -text
|
69 |
+
data/train/acoustic_scattering_maze_chunk_14.hdf5 filter=lfs diff=lfs merge=lfs -text
|
70 |
+
data/train/acoustic_scattering_maze_chunk_0.hdf5 filter=lfs diff=lfs merge=lfs -text
|
71 |
+
data/train/acoustic_scattering_maze_chunk_1.hdf5 filter=lfs diff=lfs merge=lfs -text
|
72 |
+
data/test/acoustic_scattering_maze_chunk_18.hdf5 filter=lfs diff=lfs merge=lfs -text
|
73 |
+
data/train/acoustic_scattering_maze_chunk_8.hdf5 filter=lfs diff=lfs merge=lfs -text
|
74 |
+
data/train/acoustic_scattering_maze_chunk_7.hdf5 filter=lfs diff=lfs merge=lfs -text
|
75 |
+
data/train/acoustic_scattering_maze_chunk_11.hdf5 filter=lfs diff=lfs merge=lfs -text
|
76 |
+
data/train/acoustic_scattering_maze_chunk_12.hdf5 filter=lfs diff=lfs merge=lfs -text
|
77 |
+
data/train/acoustic_scattering_maze_chunk_9.hdf5 filter=lfs diff=lfs merge=lfs -text
|
78 |
+
data/test/acoustic_scattering_maze_chunk_19.hdf5 filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
license: cc-by-4.0
|
5 |
+
tags:
|
6 |
+
- physics
|
7 |
+
|
8 |
+
task_categories:
|
9 |
+
- time-series-forecasting
|
10 |
+
- other
|
11 |
+
task_ids:
|
12 |
+
- multivariate-time-series-forecasting
|
13 |
+
---
|
14 |
+
|
15 |
+
# How To Load from HuggingFace Hub
|
16 |
+
|
17 |
+
1. Be sure to have `the_well` installed (`pip install the_well`)
|
18 |
+
2. Use the `WellDataModule` to retrieve data as follows:
|
19 |
+
|
20 |
+
```python
|
21 |
+
from the_well.benchmark.data import WellDataModule
|
22 |
+
|
23 |
+
# The following line may take a couple of minutes to instantiate the datamodule
|
24 |
+
datamodule = WellDataModule(
|
25 |
+
"hf://datasets/polymathic-ai/",
|
26 |
+
"acoustic_scattering_maze",
|
27 |
+
)
|
28 |
+
train_dataloader = datamodule.train_dataloader()
|
29 |
+
|
30 |
+
for batch in dataloader:
|
31 |
+
# Process training batch
|
32 |
+
...
|
33 |
+
```
|
34 |
+
|
35 |
+
# Acoustic Scattering - Maze
|
36 |
+
|
37 |
+
**One line description of the data:** Simple acoustic wave propogation through maze-like structures.
|
38 |
+
|
39 |
+
**Longer description of the data:** These variable-coefficient acoustic equations describe the propogation of an acoustic pressure wave through maze-like domains. Pressure waves emerge from point sources and propogate through domains consisting of low density maze paths and orders of magnitude higher density maze walls. This is built primarily as a challenge for machine learning methods, though has similar properties to optimal placement problems like WiFi in a building.
|
40 |
+
|
41 |
+
**Domain expert**: [Michael McCabe](https://mikemccabe210.github.io/), Polymathic AI.
|
42 |
+
|
43 |
+
**Code or software used to generate the data**: Clawpack, adapted from [this example.](http://www.clawpack.org/gallery/pyclaw/gallery/acoustics_2d_interface.html)
|
44 |
+
|
45 |
+
**Equation**:
|
46 |
+
|
47 |
+
```math
|
48 |
+
\begin{align}
|
49 |
+
\frac{ \partial p}{\partial t} + K(x, y) \left( \frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} \right) &= 0 \\
|
50 |
+
\frac{ \partial u }{\partial t} + \frac{1}{\rho(x, y)} \frac{\partial p}{\partial x} &= 0 \\
|
51 |
+
\frac{ \partial v }{\partial t} + \frac{1}{\rho(x, y)} \frac{\partial p}{\partial y} &= 0
|
52 |
+
\end{align}
|
53 |
+
```
|
54 |
+
with \\(\rho\\) the material density, \\(u, v\\) the velocity in the \\(x, y\\) directions respectively, \\(p\\) the pressure, and \\(K\\) the bulk modulus.
|
55 |
+
|
56 |
+
Example material densities can be seen below:
|
57 |
+
|
58 |
+
![image](https://users.flatironinstitute.org/~polymathic/data/the_well/datasets/acoustic_scattering_maze/gif/mazes_density.png)
|
59 |
+
|
60 |
+
Traversal can be seen:
|
61 |
+
|
62 |
+
![Gif](https://users.flatironinstitute.org/~polymathic/data/the_well/datasets/acoustic_scattering_maze/gif/pressure_normalized.gif)
|
63 |
+
|
64 |
+
| Dataset | FNO | TFNO | Unet | CNextU-net
|
65 |
+
|:-:|:-:|:-:|:-:|:-:|
|
66 |
+
| `acoustic_scattering_maze` | 0.5062 | 0.5057| 0.0351| \\(\mathbf{0.0153}\\)|
|
67 |
+
|
68 |
+
Table: VRMSE metrics on test sets (lower is better). Best results are shown in bold. VRMSE is scaled such that predicting the mean value of the target field results in a score of 1.
|
69 |
+
|
70 |
+
# About the data
|
71 |
+
|
72 |
+
**Dimension of discretized data:** 201 steps of 256 \\(\times\\) 256 images.
|
73 |
+
|
74 |
+
**Fields available in the data:** pressure (scalar field), material density (constant scalar field), material speed of sound (constant scalar field), velocity field (vector field).
|
75 |
+
|
76 |
+
**Number of trajectories:** 2000.
|
77 |
+
|
78 |
+
**Estimated size of the ensemble of all simulations:** 311.3 GB.
|
79 |
+
|
80 |
+
**Grid type:** uniform, cartesian coordinates.
|
81 |
+
|
82 |
+
**Initial conditions:** Flat pressure static field with 1-6 high pressure rings randomly placed along paths of maze. The rings are defined with variable intensity \\(\sim \mathcal U(3., 5.)\\) and radius \\(\sim \mathcal U(.01, .04)\\). Any overlap with walls is removed.
|
83 |
+
|
84 |
+
**Boundary conditions:** Open domain in \\(y\\), reflective walls in \\(x\\).
|
85 |
+
|
86 |
+
**Simulation time-step:** Variable based on CFL with safety factor .25.
|
87 |
+
|
88 |
+
**Data are stored separated by (\\(\Delta t\\)):** 2/201.
|
89 |
+
|
90 |
+
**Total time range (\\(t_{min}\\) to \\(t_{max}\\)):** [0, 4.].
|
91 |
+
|
92 |
+
**Spatial domain size (\\(L_x\\), \\(L_y\\)):** [-1, 1] x [-1, 1].
|
93 |
+
|
94 |
+
**Set of coefficients or non-dimensional parameters evaluated:**
|
95 |
+
|
96 |
+
- \\(K\\) is fixed at 4.0.
|
97 |
+
|
98 |
+
- \\(\rho\\) is the primary coefficient here. We generated a maze with initial width between 6 and 16 pixels and upsample it via nearest neighbor resampling to create a 256 x 256 maze. The walls are set to \\(\rho=10^6\\) while paths are set to \\(\rho=3\\).
|
99 |
+
|
100 |
+
**Approximate time to generate the data:** ~20 minutes per simulation.
|
101 |
+
|
102 |
+
**Hardware used to generate the data and precision used for generating the data:** 64 Intel Icelake cores per simulation. Generated in double precision.
|
103 |
+
|
104 |
+
# What is interesting and challenging about the data:
|
105 |
+
|
106 |
+
This is an example of simple dynamics in complicated geometry. The sharp discontinuities can be a significant problem for machine learning models, yet they are a common feature in many real-world physics. While visually the walls appear to stop the signal, it is actually simply the case that the speed of sound is much much lower inside the walls leading to partial reflection/absorbtion at the interfaces.
|
107 |
+
|
108 |
+
|
109 |
+
Please cite the associated paper if you use this data in your research:
|
110 |
+
|
111 |
+
```
|
112 |
+
@article{mandli2016clawpack,
|
113 |
+
title={Clawpack: building an open source ecosystem for solving hyperbolic PDEs},
|
114 |
+
author={Mandli, Kyle T and Ahmadia, Aron J and Berger, Marsha and Calhoun, Donna and George, David L and Hadjimichael, Yiannis and Ketcheson, David I and Lemoine, Grady I and LeVeque, Randall J},
|
115 |
+
journal={PeerJ Computer Science},
|
116 |
+
volume={2},
|
117 |
+
pages={e68},
|
118 |
+
year={2016},
|
119 |
+
publisher={PeerJ Inc.}
|
120 |
+
}
|
121 |
+
```
|
acoustic_scattering_maze.yaml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
dataset_name: acoustic_scattering_maze
|
2 |
+
n_spatial_dims: 2
|
3 |
+
spatial_resolution:
|
4 |
+
- 256
|
5 |
+
- 256
|
6 |
+
scalar_names: []
|
7 |
+
constant_scalar_names: []
|
8 |
+
field_names:
|
9 |
+
0:
|
10 |
+
- pressure
|
11 |
+
1:
|
12 |
+
- velocity_x
|
13 |
+
- velocity_y
|
14 |
+
2: []
|
15 |
+
constant_field_names:
|
16 |
+
0:
|
17 |
+
- density
|
18 |
+
- speed_of_sound
|
19 |
+
1: []
|
20 |
+
2: []
|
21 |
+
boundary_condition_types:
|
22 |
+
- OPEN
|
23 |
+
- WALL
|
24 |
+
n_simulations: 2
|
25 |
+
n_steps_per_simulation:
|
26 |
+
- 202
|
27 |
+
- 202
|
28 |
+
grid_type: cartesian
|
data/test/acoustic_scattering_maze_chunk_18.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd7198b4227c902e258426d6dc99ca6bf5a28832abcb6050b0a7df303c8ab248
|
3 |
+
size 15980298240
|
data/test/acoustic_scattering_maze_chunk_19.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:927cc101432e0efe9bfe5808a0a4afb08c8176fb300431f7624e5fe0d8a835ef
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_0.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:93694c368e8bb7cec8bf4dc9524820981e4d02a4dc181a011ec3e41d7031c07e
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_1.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:92585de6aaf0a57562b4f83b776eec66715d15a52fb84b09de5ee28a3db97ce5
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_10.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:448436567a51940ed8bc5127d5465e0272604e4b009ab495373251ed568a2c18
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_11.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79aba95ca7fca3ad8d74970263f2c1a5dd1f36623666b3d3bd6ba594520529bf
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_12.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0f21aaf96fbf1be6699f6e6647c355df0e25f5bb3120768bbc04ead9a0609278
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_13.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d97d779f880b72caa10bdaffa2f049a1acf31b69ad59ce3596da1d0f3017c63
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_14.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8e7bb146d0f4af87ca0d7d11ae3830402bc084c7451720f4a84627c862e656e4
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_15.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:64bc378064b72534d88a2fe59d162599006938f250ce9638bf5f642a95e84a23
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_2.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de777cceebff1a0a1861ae1781e1a2edfdfc5bb805410481cfaf5dc25e6e7490
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_3.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:94a7f3155f36078244a2df857861be39a4a2cbd9ebba1690601adc16ff1996b6
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_4.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ebf5e08d3b9c60791a6a8fd3ca9da39587fe5b5100f3416e9f65ce94f024cd3b
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_5.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ff2a462d42006c0be6418faf43b141b757551fd0e769f94dcdcd47edc4813e31
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_6.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7e0d05bf5df449fefd005869c8d10041b6aba1d147fa160cd915475fb23e60e0
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_7.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2d122b10420393649f8612ab677fddd04ff8bf06e14dee51d6f873496effc8b2
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_8.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a857a307c96e34c1d62202e1082f4f60a8c82629b79085ee76817ef8b082e30b
|
3 |
+
size 15980298240
|
data/train/acoustic_scattering_maze_chunk_9.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3659717ee915394ffc6d9c3c9476bf54d40bfaa02dabc71f0af5b8ce49561270
|
3 |
+
size 15980298240
|
data/valid/acoustic_scattering_maze_chunk_16.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:36cca5d9775479f37d50ed94028d2e9590b369384da204adf1958e5091198ba4
|
3 |
+
size 15980298240
|
data/valid/acoustic_scattering_maze_chunk_17.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:70d471bb96ca25e3fc870c3da6ee2ccabea72656ee947c8ec243a55ad452c48d
|
3 |
+
size 15980298240
|
generation/acoustics_2d_interface_maze.py
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# encoding: utf-8
|
3 |
+
r"""
|
4 |
+
Two-dimensional variable-coefficient acoustics
|
5 |
+
==============================================
|
6 |
+
|
7 |
+
Solve the variable-coefficient acoustics equations in 2D:
|
8 |
+
|
9 |
+
.. math::
|
10 |
+
p_t + K(x,y) (u_x + v_y) & = 0 \\
|
11 |
+
u_t + p_x / \rho(x,y) & = 0 \\
|
12 |
+
v_t + p_y / \rho(x,y) & = 0.
|
13 |
+
|
14 |
+
Here p is the pressure, (u,v) is the velocity, :math:`K(x,y)` is the bulk modulus,
|
15 |
+
and :math:`\rho(x,y)` is the density.
|
16 |
+
|
17 |
+
This example shows how to solve a problem with variable coefficients.
|
18 |
+
The left and right halves of the domain consist of different materials.
|
19 |
+
"""
|
20 |
+
|
21 |
+
from functools import partial
|
22 |
+
|
23 |
+
import matplotlib.pyplot as plt
|
24 |
+
import numpy as np
|
25 |
+
from skimage.transform import resize
|
26 |
+
|
27 |
+
|
28 |
+
def create_maze(dim, seed):
|
29 |
+
# Create a grid filled with walls
|
30 |
+
maze = np.ones((dim * 2 + 1, dim * 2 + 1))
|
31 |
+
|
32 |
+
# Define the starting point
|
33 |
+
x, y = (0, 0)
|
34 |
+
maze[2 * x + 1, 2 * y + 1] = 0
|
35 |
+
|
36 |
+
# Initialize the stack with the starting point
|
37 |
+
stack = [(x, y)]
|
38 |
+
while len(stack) > 0:
|
39 |
+
x, y = stack[-1]
|
40 |
+
|
41 |
+
# Define possible directions
|
42 |
+
directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
|
43 |
+
directions = seed.permutation(directions)
|
44 |
+
|
45 |
+
for dx, dy in directions:
|
46 |
+
nx, ny = x + dx, y + dy
|
47 |
+
if (
|
48 |
+
nx >= 0
|
49 |
+
and ny >= 0
|
50 |
+
and nx < dim
|
51 |
+
and ny < dim
|
52 |
+
and maze[2 * nx + 1, 2 * ny + 1] == 1
|
53 |
+
):
|
54 |
+
maze[2 * nx + 1, 2 * ny + 1] = 0
|
55 |
+
maze[2 * x + 1 + dx, 2 * y + 1 + dy] = 0
|
56 |
+
stack.append((nx, ny))
|
57 |
+
break
|
58 |
+
else:
|
59 |
+
stack.pop()
|
60 |
+
|
61 |
+
# Create an entrance and an exit
|
62 |
+
maze[1, 0] = 0
|
63 |
+
maze[-2, -1] = 0
|
64 |
+
|
65 |
+
return maze
|
66 |
+
|
67 |
+
|
68 |
+
def setup(
|
69 |
+
kernel_language="Fortran",
|
70 |
+
use_petsc=False,
|
71 |
+
outdir="./_output",
|
72 |
+
solver_type="classic",
|
73 |
+
time_integrator="SSP104",
|
74 |
+
lim_type=2,
|
75 |
+
disable_output=False,
|
76 |
+
num_cells=(256, 256),
|
77 |
+
seed=None,
|
78 |
+
T_max=4.0,
|
79 |
+
num_steps=201,
|
80 |
+
):
|
81 |
+
"""
|
82 |
+
Example python script for solving the 2d acoustics equations.
|
83 |
+
"""
|
84 |
+
from clawpack import riemann
|
85 |
+
|
86 |
+
if seed is None:
|
87 |
+
seed = np.random.default_rng()
|
88 |
+
if use_petsc:
|
89 |
+
import clawpack.petclaw as pyclaw
|
90 |
+
else:
|
91 |
+
from clawpack import pyclaw
|
92 |
+
|
93 |
+
if solver_type == "classic":
|
94 |
+
solver = pyclaw.ClawSolver2D(riemann.vc_acoustics_2D)
|
95 |
+
solver.dimensional_split = False
|
96 |
+
solver.limiters = pyclaw.limiters.tvd.MC
|
97 |
+
elif solver_type == "sharpclaw":
|
98 |
+
solver = pyclaw.SharpClawSolver2D(riemann.vc_acoustics_2D)
|
99 |
+
solver.time_integrator = time_integrator
|
100 |
+
if time_integrator == "SSPLMMk2":
|
101 |
+
solver.lmm_steps = 3
|
102 |
+
solver.cfl_max = 0.25
|
103 |
+
solver.cfl_desired = 0.24
|
104 |
+
|
105 |
+
solver.bc_lower[0] = pyclaw.BC.wall
|
106 |
+
solver.bc_upper[0] = pyclaw.BC.extrap
|
107 |
+
solver.bc_lower[1] = pyclaw.BC.wall
|
108 |
+
solver.bc_upper[1] = pyclaw.BC.extrap
|
109 |
+
solver.aux_bc_lower[0] = pyclaw.BC.wall
|
110 |
+
solver.aux_bc_upper[0] = pyclaw.BC.extrap
|
111 |
+
solver.aux_bc_lower[1] = pyclaw.BC.wall
|
112 |
+
solver.aux_bc_upper[1] = pyclaw.BC.extrap
|
113 |
+
|
114 |
+
x = pyclaw.Dimension(-1.0, 1.0, num_cells[0], name="x")
|
115 |
+
y = pyclaw.Dimension(-1.0, 1.0, num_cells[1], name="y")
|
116 |
+
domain = pyclaw.Domain([x, y])
|
117 |
+
|
118 |
+
num_eqn = 3
|
119 |
+
num_aux = 2 # density, sound speed
|
120 |
+
state = pyclaw.State(domain, num_eqn, num_aux)
|
121 |
+
|
122 |
+
grid = state.grid
|
123 |
+
X, Y = grid.p_centers
|
124 |
+
|
125 |
+
def construct_maze_background(aux, seed, base_maze_low=3, base_maze_high=8):
|
126 |
+
maze_size = seed.integers(base_maze_low, base_maze_high + 1)
|
127 |
+
maze = create_maze(maze_size, seed)
|
128 |
+
maze = resize(maze, (aux[0].shape[-2], aux[0].shape[-1]), order=0)
|
129 |
+
rho = maze * 1e6 + 3
|
130 |
+
return rho
|
131 |
+
|
132 |
+
rho = construct_maze_background(state.aux, seed)
|
133 |
+
c = np.sqrt(4.0 / rho)
|
134 |
+
state.aux[0, :, :] = rho
|
135 |
+
state.aux[1, :, :] = c
|
136 |
+
|
137 |
+
state.q[0, :, :] = 0.0
|
138 |
+
state.q[1, :, :] = 0.0
|
139 |
+
state.q[2, :, :] = 0.0
|
140 |
+
# Set initial condition
|
141 |
+
n_waves = seed.integers(1, 6)
|
142 |
+
mask = rho < 100
|
143 |
+
for i in range(n_waves):
|
144 |
+
center_pixel = seed.choice(rho[mask].shape[0])
|
145 |
+
x0 = X[mask][center_pixel]
|
146 |
+
y0 = Y[mask][center_pixel]
|
147 |
+
width = seed.uniform(0.01, 0.02)
|
148 |
+
rad = seed.uniform(0.01, 0.04)
|
149 |
+
intensity = seed.uniform(3.0, 5.0)
|
150 |
+
# x0 = -0.5; y0 = 0.
|
151 |
+
r = np.sqrt((X - x0) ** 2 + (Y - y0) ** 2)
|
152 |
+
# width = 0.1; rad = 0.25
|
153 |
+
state.q[0, :, :] += (np.abs(r - rad) <= width) * (
|
154 |
+
intensity + np.cos(np.pi * (r - rad) / width)
|
155 |
+
)
|
156 |
+
|
157 |
+
state.q[0][~mask] = 0.0
|
158 |
+
|
159 |
+
claw = pyclaw.Controller()
|
160 |
+
claw.keep_copy = True
|
161 |
+
if disable_output:
|
162 |
+
claw.output_format = None
|
163 |
+
claw.solution = pyclaw.Solution(state, domain)
|
164 |
+
claw.solver = solver
|
165 |
+
claw.outdir = outdir
|
166 |
+
claw.tfinal = T_max
|
167 |
+
claw.num_output_times = num_steps
|
168 |
+
claw.write_aux_init = True
|
169 |
+
claw.setplot = setplot
|
170 |
+
claw.output_options = {"format": "binary"}
|
171 |
+
if use_petsc:
|
172 |
+
claw.output_options = {"format": "binary"}
|
173 |
+
|
174 |
+
return claw
|
175 |
+
|
176 |
+
|
177 |
+
def setplot(plotdata):
|
178 |
+
"""
|
179 |
+
Plot solution using VisClaw.
|
180 |
+
|
181 |
+
This example shows how to mark an internal boundary on a 2D plot.
|
182 |
+
"""
|
183 |
+
|
184 |
+
from clawpack.visclaw import colormaps
|
185 |
+
|
186 |
+
plotdata.clearfigures() # clear any old figures,axes,items data
|
187 |
+
|
188 |
+
# Figure for pressure
|
189 |
+
plotfigure = plotdata.new_plotfigure(name="Pressure", figno=0)
|
190 |
+
|
191 |
+
# Set up for axes in this figure:
|
192 |
+
plotaxes = plotfigure.new_plotaxes()
|
193 |
+
plotaxes.title = "Pressure"
|
194 |
+
plotaxes.scaled = True # so aspect ratio is 1
|
195 |
+
plotaxes.afteraxes = mark_interface
|
196 |
+
|
197 |
+
# Set up for item on these axes:
|
198 |
+
plotitem = plotaxes.new_plotitem(plot_type="2d_pcolor")
|
199 |
+
plotitem.plot_var = 0
|
200 |
+
plotitem.pcolor_cmap = colormaps.yellow_red_blue
|
201 |
+
plotitem.add_colorbar = True
|
202 |
+
plotitem.pcolor_cmin = 0.0
|
203 |
+
plotitem.pcolor_cmax = 1.0
|
204 |
+
|
205 |
+
# Figure for x-velocity plot
|
206 |
+
plotfigure = plotdata.new_plotfigure(name="x-Velocity", figno=1)
|
207 |
+
|
208 |
+
# Set up for axes in this figure:
|
209 |
+
plotaxes = plotfigure.new_plotaxes()
|
210 |
+
plotaxes.title = "u"
|
211 |
+
plotaxes.afteraxes = mark_interface
|
212 |
+
|
213 |
+
plotitem = plotaxes.new_plotitem(plot_type="2d_pcolor")
|
214 |
+
plotitem.plot_var = 1
|
215 |
+
plotitem.pcolor_cmap = colormaps.yellow_red_blue
|
216 |
+
plotitem.add_colorbar = True
|
217 |
+
plotitem.pcolor_cmin = -0.3
|
218 |
+
plotitem.pcolor_cmax = 0.3
|
219 |
+
|
220 |
+
return plotdata
|
221 |
+
|
222 |
+
|
223 |
+
def mark_interface(current_data):
|
224 |
+
plt.plot((0.0, 0.0), (-1.0, 1.0), "-k", linewidth=2)
|
225 |
+
|
226 |
+
|
227 |
+
if __name__ == "__main__":
|
228 |
+
from clawpack.pyclaw.util import run_app_from_main
|
229 |
+
|
230 |
+
setup_wrapped = partial(setup, seed=np.random.default_rng(1))
|
231 |
+
output = run_app_from_main(setup_wrapped, setplot)
|
generation/generate_acoustics_data.py
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import argparse
|
2 |
+
import multiprocessing as mp
|
3 |
+
from functools import partial
|
4 |
+
|
5 |
+
import numpy as np
|
6 |
+
from acoustics_2d_interface_maze import setup as maze_setup
|
7 |
+
from acoustics_2d_interface_random_medium import setup as random_setup
|
8 |
+
|
9 |
+
# Time/steps/samples
|
10 |
+
steps_map = {
|
11 |
+
"continuous": (2.0, 101, 2000),
|
12 |
+
"discontinuous": (2.0, 101, 2000),
|
13 |
+
"inclusions": (2.0, 101, 4000),
|
14 |
+
"maze": (4.0, 201, 2000),
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
def mp_wrapper(
|
19 |
+
seed,
|
20 |
+
discontinuous,
|
21 |
+
inclusions,
|
22 |
+
maze,
|
23 |
+
output_dir="/mnt/home/polymathic/ceph/the_well/testing_before_adding/clawpack_data/acoustics_2d_variable/",
|
24 |
+
):
|
25 |
+
if discontinuous:
|
26 |
+
run_func = partial(
|
27 |
+
inner_gen_sample,
|
28 |
+
discontinuous=True,
|
29 |
+
inclusions=False,
|
30 |
+
maze=False,
|
31 |
+
output_dir=output_dir,
|
32 |
+
)
|
33 |
+
num_samples = 2000
|
34 |
+
elif inclusions:
|
35 |
+
run_func = partial(
|
36 |
+
inner_gen_sample,
|
37 |
+
discontinuous=False,
|
38 |
+
inclusions=True,
|
39 |
+
maze=False,
|
40 |
+
output_dir=output_dir,
|
41 |
+
)
|
42 |
+
num_samples = 4000
|
43 |
+
elif maze:
|
44 |
+
run_func = partial(
|
45 |
+
inner_gen_sample,
|
46 |
+
discontinuous=False,
|
47 |
+
inclusions=False,
|
48 |
+
maze=True,
|
49 |
+
output_dir=output_dir,
|
50 |
+
)
|
51 |
+
num_samples = 2000
|
52 |
+
else:
|
53 |
+
run_func = partial(
|
54 |
+
inner_gen_sample,
|
55 |
+
discontinuous=False,
|
56 |
+
inclusions=False,
|
57 |
+
maze=False,
|
58 |
+
output_dir=output_dir,
|
59 |
+
)
|
60 |
+
num_samples = 2000
|
61 |
+
cores = mp.cpu_count()
|
62 |
+
seeds = seed.spawn(num_samples)
|
63 |
+
with mp.Pool(cores // 2) as pool:
|
64 |
+
pool.map(run_func, seeds)
|
65 |
+
# run_func(seeds[0])
|
66 |
+
|
67 |
+
|
68 |
+
def inner_gen_sample(
|
69 |
+
seed=0, discontinuous=False, inclusions=False, maze=False, output_dir=""
|
70 |
+
):
|
71 |
+
"""
|
72 |
+
Iterate num samples times and enerate sample file. Use
|
73 |
+
it to overwrite qinit, then run .make output to generate trajectory.
|
74 |
+
|
75 |
+
Make sure overwrite is False in the make file before running.
|
76 |
+
"""
|
77 |
+
# Check conditions and set up names
|
78 |
+
file_suffix = f"{str(seed.bit_generator.seed_seq.entropy)}_{str(seed.bit_generator.seed_seq.spawn_key)}"
|
79 |
+
if discontinuous:
|
80 |
+
file_suffix = "discontinuous_" + file_suffix
|
81 |
+
run_func = partial(
|
82 |
+
random_setup,
|
83 |
+
seed=seed,
|
84 |
+
include_splits=True,
|
85 |
+
include_inclusions=False,
|
86 |
+
outdir=output_dir + file_suffix,
|
87 |
+
T_max=2.0,
|
88 |
+
num_steps=101,
|
89 |
+
)
|
90 |
+
elif inclusions:
|
91 |
+
file_suffix = "inclusions_" + file_suffix
|
92 |
+
run_func = partial(
|
93 |
+
random_setup,
|
94 |
+
seed=seed,
|
95 |
+
include_splits=True,
|
96 |
+
include_inclusions=True,
|
97 |
+
outdir=output_dir + file_suffix,
|
98 |
+
T_max=2.0,
|
99 |
+
num_steps=101,
|
100 |
+
)
|
101 |
+
elif maze:
|
102 |
+
file_suffix = "maze_" + file_suffix
|
103 |
+
run_func = partial(
|
104 |
+
maze_setup,
|
105 |
+
seed=seed,
|
106 |
+
outdir=output_dir + file_suffix,
|
107 |
+
T_max=4.0,
|
108 |
+
num_steps=201,
|
109 |
+
)
|
110 |
+
else:
|
111 |
+
file_suffix = "continuous_" + file_suffix
|
112 |
+
run_func = partial(
|
113 |
+
random_setup,
|
114 |
+
seed=seed,
|
115 |
+
include_splits=False,
|
116 |
+
include_inclusions=False,
|
117 |
+
outdir=output_dir + file_suffix,
|
118 |
+
T_max=2.0,
|
119 |
+
num_steps=101,
|
120 |
+
)
|
121 |
+
|
122 |
+
claw = run_func(output_dir + file_suffix)
|
123 |
+
claw.run()
|
124 |
+
|
125 |
+
|
126 |
+
if __name__ == "__main__":
|
127 |
+
# print(len(gases))
|
128 |
+
parser = argparse.ArgumentParser(
|
129 |
+
description="Generate initial conditions for 2D Euler quadrants"
|
130 |
+
)
|
131 |
+
# parser.add_argument('--num_samples', type=int, default=1000, help='Number of samples to generate')
|
132 |
+
parser.add_argument(
|
133 |
+
"--discontinuity",
|
134 |
+
action="store_true",
|
135 |
+
help="Whether to generate random samples",
|
136 |
+
)
|
137 |
+
parser.add_argument(
|
138 |
+
"--inclusions", action="store_true", help="Whether to generate random samples"
|
139 |
+
)
|
140 |
+
parser.add_argument(
|
141 |
+
"--switch_to_maze",
|
142 |
+
action="store_true",
|
143 |
+
help="Whether to generate random samples",
|
144 |
+
)
|
145 |
+
# parser.add_argument('--bc', type=str, default='extrap', help='Boundary conditions')
|
146 |
+
# parser.add_argument('--gas_index', type=int, default=0, help='Index of gas to use (0-9 inclusive)')
|
147 |
+
parser.add_argument(
|
148 |
+
"--seed",
|
149 |
+
type=int,
|
150 |
+
default=0,
|
151 |
+
help="Seed for random samples - use different one per gas/bc if par",
|
152 |
+
)
|
153 |
+
parser.add_argument(
|
154 |
+
"--raw_output_dir",
|
155 |
+
type=str,
|
156 |
+
default=" /mnt/home/polymathic/ceph/the_well/testing_before_adding/clawpack_data/",
|
157 |
+
help="Directory to store raw output",
|
158 |
+
)
|
159 |
+
args = parser.parse_args()
|
160 |
+
seed = np.random.default_rng(
|
161 |
+
args.seed
|
162 |
+
+ 100 * int(args.discontinuity)
|
163 |
+
+ 1000 * int(args.inclusions)
|
164 |
+
+ 10000 * int(args.switch_to_maze)
|
165 |
+
)
|
166 |
+
mp_wrapper(seed, args.discontinuity, args.inclusions, args.switch_to_maze)
|
generation/run_mazes.sh
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash -l
|
2 |
+
#SBATCH --time=24:00:00
|
3 |
+
#SBATCH -p cmbas
|
4 |
+
#SBATCH --nodes=1
|
5 |
+
#SBATCH --ntasks-per-node=1
|
6 |
+
#SBATCH -J acou_maze
|
7 |
+
#SBATCH -o acou_maze
|
8 |
+
#SBATCH -C icelake
|
9 |
+
|
10 |
+
source ~/venvs/clawpack/bin/activate
|
11 |
+
|
12 |
+
srun python generate_acoustics_data.py --switch_to_maze
|
gif/mazes_density.png
ADDED
![]() |
Git LFS Details
|
gif/pressure_normalized.gif
ADDED
![]() |
Git LFS Details
|
gif/pressure_unnormalized.gif
ADDED
![]() |
Git LFS Details
|
stats.yaml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
mean:
|
2 |
+
bulk_modulus: 0.4914537656565528
|
3 |
+
density: 575388.1413726807
|
4 |
+
pressure: 0.011643124502395175
|
5 |
+
velocity:
|
6 |
+
- 7.811991663938063e-05
|
7 |
+
- 0.00013353731981243736
|
8 |
+
std:
|
9 |
+
bulk_modulus: 0.5697618996294348
|
10 |
+
density: 494284.41251997923
|
11 |
+
pressure: 0.12435384628054441
|
12 |
+
velocity:
|
13 |
+
- 0.024985422681220726
|
14 |
+
- 0.025001445400120472
|
visualization_acoustic_scattering_maze.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|