Datasets:
Add files using upload-large-folder tool
Browse files- .gitattributes +20 -0
- README.md +114 -0
- acoustic_scattering_discontinuous.yaml +28 -0
- data/test/acoustic_scattering_discontinuous_chunk_18.hdf5 +3 -0
- data/test/acoustic_scattering_discontinuous_chunk_19.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_0.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_1.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_10.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_11.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_12.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_13.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_14.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_15.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_2.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_3.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_4.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_5.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_6.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_7.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_8.hdf5 +3 -0
- data/train/acoustic_scattering_discontinuous_chunk_9.hdf5 +3 -0
- data/valid/acoustic_scattering_discontinuous_chunk_16.hdf5 +3 -0
- data/valid/acoustic_scattering_discontinuous_chunk_17.hdf5 +3 -0
- generation/acoustics_2d_interface_random_medium.py +297 -0
- generation/generate_acoustics_data.py +166 -0
- generation/run_discontinuous.sh +12 -0
- gif/discontinuous_density.png +3 -0
- stats.yaml +14 -0
- visualization_acoustic_scattering_discontinuous.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_discontinuous_chunk_2.hdf5 filter=lfs diff=lfs merge=lfs -text
|
60 |
+
data/test/acoustic_scattering_discontinuous_chunk_18.hdf5 filter=lfs diff=lfs merge=lfs -text
|
61 |
+
data/train/acoustic_scattering_discontinuous_chunk_8.hdf5 filter=lfs diff=lfs merge=lfs -text
|
62 |
+
data/train/acoustic_scattering_discontinuous_chunk_6.hdf5 filter=lfs diff=lfs merge=lfs -text
|
63 |
+
data/train/acoustic_scattering_discontinuous_chunk_0.hdf5 filter=lfs diff=lfs merge=lfs -text
|
64 |
+
data/train/acoustic_scattering_discontinuous_chunk_4.hdf5 filter=lfs diff=lfs merge=lfs -text
|
65 |
+
data/train/acoustic_scattering_discontinuous_chunk_15.hdf5 filter=lfs diff=lfs merge=lfs -text
|
66 |
+
data/train/acoustic_scattering_discontinuous_chunk_13.hdf5 filter=lfs diff=lfs merge=lfs -text
|
67 |
+
data/train/acoustic_scattering_discontinuous_chunk_7.hdf5 filter=lfs diff=lfs merge=lfs -text
|
68 |
+
data/valid/acoustic_scattering_discontinuous_chunk_17.hdf5 filter=lfs diff=lfs merge=lfs -text
|
69 |
+
data/train/acoustic_scattering_discontinuous_chunk_11.hdf5 filter=lfs diff=lfs merge=lfs -text
|
70 |
+
data/train/acoustic_scattering_discontinuous_chunk_10.hdf5 filter=lfs diff=lfs merge=lfs -text
|
71 |
+
data/train/acoustic_scattering_discontinuous_chunk_5.hdf5 filter=lfs diff=lfs merge=lfs -text
|
72 |
+
data/train/acoustic_scattering_discontinuous_chunk_12.hdf5 filter=lfs diff=lfs merge=lfs -text
|
73 |
+
data/valid/acoustic_scattering_discontinuous_chunk_16.hdf5 filter=lfs diff=lfs merge=lfs -text
|
74 |
+
data/train/acoustic_scattering_discontinuous_chunk_1.hdf5 filter=lfs diff=lfs merge=lfs -text
|
75 |
+
data/train/acoustic_scattering_discontinuous_chunk_14.hdf5 filter=lfs diff=lfs merge=lfs -text
|
76 |
+
data/test/acoustic_scattering_discontinuous_chunk_19.hdf5 filter=lfs diff=lfs merge=lfs -text
|
77 |
+
data/train/acoustic_scattering_discontinuous_chunk_9.hdf5 filter=lfs diff=lfs merge=lfs -text
|
78 |
+
data/train/acoustic_scattering_discontinuous_chunk_3.hdf5 filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_discontinuous",
|
27 |
+
)
|
28 |
+
train_dataloader = datamodule.train_dataloader()
|
29 |
+
|
30 |
+
for batch in dataloader:
|
31 |
+
# Process training batch
|
32 |
+
...
|
33 |
+
```
|
34 |
+
|
35 |
+
# Acoustic Scattering - Single Discontinuity
|
36 |
+
|
37 |
+
**One line description of the data:** Simple acoustic wave propogation over a domain split into two continuously varying sub-domains with a single discountinuous interface.
|
38 |
+
|
39 |
+
**Longer description of the data:** These variable-coefficient acoustic equations describe the propogation of an acoustic pressure wave through domains consisting of multiple materials with different scattering properties. This problem emerges in source optimization and it's inverse - that of identifying the material properties from the scattering of the wave - is a vital problem in geology and radar design. This is the simplest of three scenarios. In this case, we have a variable number of initial point sources and single discontinuity separating two sub-domains. Within each subdomain, the density of the underlying material varies smoothly.
|
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 v} &= 0
|
52 |
+
\end{align}
|
53 |
+
```
|
54 |
+
|
55 |
+
with \\(\rho\\) the material density, \\(u, v\\) the velocity in the \\(x, y\\) directions respectively, \\(p\\) the pressure, and \\(K\\) the bulk modulus.
|
56 |
+
|
57 |
+
Example material densities can be seen below:
|
58 |
+
|
59 |
+
![image](https://users.flatironinstitute.org/~polymathic/data/the_well/datasets/acoustic_scattering_discontinuous/gif/discontinuous_density.png)
|
60 |
+
|
61 |
+
# About the data
|
62 |
+
|
63 |
+
**Dimension of discretized data:** 101 steps of 256 \\(\times\\) 256 images.
|
64 |
+
|
65 |
+
**Fields available in the data:** pressure (scalar field), material density (constant scalar field), material speed of sound (constant scalar field), velocity field (vector field).
|
66 |
+
|
67 |
+
**Number of trajectories:** 2000.
|
68 |
+
|
69 |
+
**Estimated size of the ensemble of all simulations:** 157.7 GB.
|
70 |
+
|
71 |
+
**Grid type:** uniform, cartesian coordinates.
|
72 |
+
|
73 |
+
**Initial conditions:** Flat pressure static field with 1-4 high pressure rings randomly placed in domain. The rings are defined with variable intensity \\(\sim \mathcal U(.5, 2)\\) and radius \\(\sim \mathcal U(.06, .15)\\).
|
74 |
+
|
75 |
+
**Boundary conditions:** Open domain in \\(y\\), reflective walls in \\(x\\).
|
76 |
+
|
77 |
+
**Simulation time-step:** Variable based on CFL with safety factor .25.
|
78 |
+
|
79 |
+
**Data are stored separated by (\\(\Delta t\\)):** 2/101.
|
80 |
+
|
81 |
+
**Total time range (\\(t_{min}\\) to \\(t_{max}\\)):** [0, 2]
|
82 |
+
|
83 |
+
**Spatial domain size (\\(L_x\\), \\(L_y\\)):** [-1, 1] x [-1, 1]
|
84 |
+
|
85 |
+
**Set of coefficients or non-dimensional parameters evaluated:**
|
86 |
+
|
87 |
+
- \\(K\\) is fixed at 4.0.
|
88 |
+
|
89 |
+
- \\(\rho\\) is the primary coefficient here. Each side is generated with one of the following distributions:
|
90 |
+
- Gaussian Bump - Peak density samples from \\(\sim\mathcal U(1, 7)\\) and \\(\sigma \sim\mathcal U(.1, 5)\\) with the center of the bump uniformly sampled from the extent of the subdomain.
|
91 |
+
- Linear gradient - Four corners sampled with \\(\rho \sim \mathcal U(1, 7)\\). Inner density is bilinearly interpolated.
|
92 |
+
- Constant - Constant \\(\rho \sim\mathcal U(1, 7)\\).
|
93 |
+
- Smoothed Gaussian Noise - Constant background sampled \\(\rho \sim\mathcal U(1, 7)\\) with IID standard normal noise applied. This is then smoothed by a Gaussian filter of varying sigma \\(\sigma \sim\mathcal U(5, 10)\\).
|
94 |
+
|
95 |
+
**Approximate time to generate the data:** ~15 minutes per simulation.
|
96 |
+
|
97 |
+
**Hardware used to generate the data and precision used for generating the data:** 64 Intel Icelake cores per simulation. Generated in double precision.
|
98 |
+
|
99 |
+
# What is interesting and challenging about the data:
|
100 |
+
Wave propogation through discontinuous media. Most existing machine learning datasets for computational physics are highly smooth and the acoustic challenges presented here offer challenging discontinuous scenarios that approximate complicated geometry through the variable density.
|
101 |
+
|
102 |
+
Please cite the associated paper if you use this data in your research:
|
103 |
+
|
104 |
+
```
|
105 |
+
@article{mandli2016clawpack,
|
106 |
+
title={Clawpack: building an open source ecosystem for solving hyperbolic PDEs},
|
107 |
+
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},
|
108 |
+
journal={PeerJ Computer Science},
|
109 |
+
volume={2},
|
110 |
+
pages={e68},
|
111 |
+
year={2016},
|
112 |
+
publisher={PeerJ Inc.}
|
113 |
+
}
|
114 |
+
```
|
acoustic_scattering_discontinuous.yaml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
dataset_name: acoustic_scattering_discontinuous
|
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 |
+
- 102
|
27 |
+
- 102
|
28 |
+
grid_type: cartesian
|
data/test/acoustic_scattering_discontinuous_chunk_18.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ba1bd990bc0e4b5ac99722f93086350de7c2d00980acf7275de7bec119b7f55e
|
3 |
+
size 8111783936
|
data/test/acoustic_scattering_discontinuous_chunk_19.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ada4c55dd6ae5ee511fbc102e8448815377f1a67414fb7832af4af68b30339f4
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_0.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:89cc58f6bc178c445980d86c8ac23326b7c948fa3ccf456d48771a103bdd8588
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_1.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:261f8e55bc93039f36e5dd0a22e46578d260941afa7cb6271fe9376fe48764ab
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_10.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ee1dc55e60304166c4987cdd49c5444578ede98c95054166eb899a3bc75b412d
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_11.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a3bb691574f9db8446d7bd7d77e95aea3b0a0df0bbcb4f42ab7699bb7397db89
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_12.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:852849eab35e2b70d86e6afc6dc1eeffb33c4fd28b1b073bc68ae7988d29fdc5
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_13.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:58ef135e709d2078a91f435264a8106bad25cfefde9d63e01590a88c8109a4c3
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_14.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8a93647706406e72004f896265984c660d89bb973fc5230441b1550aba3b1e54
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_15.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f0c8ca1059c1ffcb8fd963cca05a6784e2c42aeaab90923ddedac9d549a8a0c0
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_2.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd7f73617207688a39cdf40853a12e4c0a57a9f2c198168add324933f318b723
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_3.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:74b98083be84d82fa1976eb1f17fbb09b3eb4ac3bc36b7549a189a0436a3b56f
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_4.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7cd0dba38b52e3cd97c3543cab994c1c3b2f09e4287ede8eef916201e4256502
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_5.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:706b56b1ddd4c6a00b6721f8f882489ba80058b077c2ea5a9024d457fd7dacdf
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_6.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:99ef738dde15999c4f1c0c736d1a0b76d7e32199e091fb1e0839b1b055e062c1
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_7.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f1af11966317488ab67f700c80594722c3f7037678c6b88f32aedd6b4a11ebf6
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_8.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1c0d74f83562a3446156741165f7d4b01f602c053f5116dc59938eaaabee7a26
|
3 |
+
size 8111783936
|
data/train/acoustic_scattering_discontinuous_chunk_9.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a08863920567dc8b233ee5eba0c16f974ebf165ea031082d3c46ecfc78dbeb10
|
3 |
+
size 8111783936
|
data/valid/acoustic_scattering_discontinuous_chunk_16.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4034dde5ced1ac0edfdc34098c2f0c24d9711df182b657149bbee3db0dbe824e
|
3 |
+
size 8111783936
|
data/valid/acoustic_scattering_discontinuous_chunk_17.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e816fd74fa644a61a0206ff590afd582ea372eb33505eca8eb2702c4a722fd91
|
3 |
+
size 8111783936
|
generation/acoustics_2d_interface_random_medium.py
ADDED
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 numpy as np
|
24 |
+
from scipy.ndimage import gaussian_filter
|
25 |
+
|
26 |
+
|
27 |
+
def setup(
|
28 |
+
kernel_language="Fortran",
|
29 |
+
use_petsc=False,
|
30 |
+
outdir="./_output",
|
31 |
+
solver_type="classic",
|
32 |
+
time_integrator="SSP104",
|
33 |
+
lim_type=2,
|
34 |
+
disable_output=False,
|
35 |
+
num_cells=(256, 256),
|
36 |
+
seed=None,
|
37 |
+
include_splits=True,
|
38 |
+
include_inclusions=True,
|
39 |
+
T_max=2.0,
|
40 |
+
num_steps=101,
|
41 |
+
):
|
42 |
+
"""
|
43 |
+
Example python script for solving the 2d acoustics equations.
|
44 |
+
"""
|
45 |
+
from clawpack import riemann
|
46 |
+
|
47 |
+
if seed is None:
|
48 |
+
seed = np.random.default_rng()
|
49 |
+
if use_petsc:
|
50 |
+
import clawpack.petclaw as pyclaw
|
51 |
+
else:
|
52 |
+
from clawpack import pyclaw
|
53 |
+
|
54 |
+
if solver_type == "classic":
|
55 |
+
solver = pyclaw.ClawSolver2D(riemann.vc_acoustics_2D)
|
56 |
+
solver.dimensional_split = False
|
57 |
+
solver.limiters = pyclaw.limiters.tvd.MC
|
58 |
+
elif solver_type == "sharpclaw":
|
59 |
+
solver = pyclaw.SharpClawSolver2D(riemann.vc_acoustics_2D)
|
60 |
+
solver.time_integrator = time_integrator
|
61 |
+
if time_integrator == "SSPLMMk2":
|
62 |
+
solver.lmm_steps = 3
|
63 |
+
solver.cfl_max = 0.25
|
64 |
+
solver.cfl_desired = 0.24
|
65 |
+
|
66 |
+
solver.bc_lower[0] = pyclaw.BC.wall
|
67 |
+
solver.bc_upper[0] = pyclaw.BC.extrap
|
68 |
+
solver.bc_lower[1] = pyclaw.BC.wall
|
69 |
+
solver.bc_upper[1] = pyclaw.BC.extrap
|
70 |
+
solver.aux_bc_lower[0] = pyclaw.BC.wall
|
71 |
+
solver.aux_bc_upper[0] = pyclaw.BC.extrap
|
72 |
+
solver.aux_bc_lower[1] = pyclaw.BC.wall
|
73 |
+
solver.aux_bc_upper[1] = pyclaw.BC.extrap
|
74 |
+
|
75 |
+
x = pyclaw.Dimension(-1.0, 1.0, num_cells[0], name="x")
|
76 |
+
y = pyclaw.Dimension(-1.0, 1.0, num_cells[1], name="y")
|
77 |
+
domain = pyclaw.Domain([x, y])
|
78 |
+
|
79 |
+
num_eqn = 3
|
80 |
+
num_aux = 2 # density, sound speed
|
81 |
+
state = pyclaw.State(domain, num_eqn, num_aux)
|
82 |
+
|
83 |
+
grid = state.grid
|
84 |
+
X, Y = grid.p_centers
|
85 |
+
is_vert = seed.integers(0, 2)
|
86 |
+
midpoint = seed.uniform(-0.8, 0.8)
|
87 |
+
rho_left = seed.uniform(0.2, 7) # 4.0 # Density in left half
|
88 |
+
rho_right = seed.uniform(0.2, 7) # 1.0 # Density in right half
|
89 |
+
bulk_left = 4.0 # Bulk modulus in left half
|
90 |
+
bulk_right = 4.0 # Bulk modulus in right half
|
91 |
+
|
92 |
+
def gaussian_bump(
|
93 |
+
aux, mask, seed, rho_low=1, rho_high=7.0, sigma_low=0.1, sigma_high=5
|
94 |
+
):
|
95 |
+
rho_bump = seed.uniform(rho_low, rho_high)
|
96 |
+
rho_base = seed.uniform(rho_low, rho_high)
|
97 |
+
|
98 |
+
Xmask = X[mask]
|
99 |
+
xmax = Xmask.max()
|
100 |
+
xmin = Xmask.min()
|
101 |
+
Ymask = Y[mask]
|
102 |
+
ymax = Ymask.max()
|
103 |
+
ymin = Ymask.min()
|
104 |
+
|
105 |
+
xc = seed.uniform(xmin, xmax)
|
106 |
+
yc = seed.uniform(ymin, ymax)
|
107 |
+
sigma = seed.uniform(sigma_low, sigma_high)
|
108 |
+
rho = rho_base + (rho_bump - rho_base) * np.exp(
|
109 |
+
-((Xmask - xc) ** 2 + (Ymask - yc) ** 2) / (sigma)
|
110 |
+
)
|
111 |
+
c = np.sqrt(bulk_left / rho)
|
112 |
+
aux[0][mask] = rho
|
113 |
+
aux[1][mask] = c
|
114 |
+
|
115 |
+
def linear_gradient(aux, mask, seed, rho_low=1, rho_high=7.0):
|
116 |
+
rho_x0 = seed.uniform(rho_low, rho_high)
|
117 |
+
rho_x1 = seed.uniform(rho_low, rho_high)
|
118 |
+
rho_y0 = seed.uniform(rho_low, rho_high)
|
119 |
+
rho_y1 = seed.uniform(rho_low, rho_high)
|
120 |
+
|
121 |
+
# Bilinearly interpolate between the four values
|
122 |
+
Xmask = (X[mask] + 1) / 2
|
123 |
+
xmax = Xmask.max()
|
124 |
+
xmin = Xmask.min()
|
125 |
+
Ymask = (Y[mask] + 1) / 2
|
126 |
+
ymax = Ymask.max()
|
127 |
+
ymin = Ymask.min()
|
128 |
+
|
129 |
+
Xrel = (Xmask - xmin) / (xmax - xmin)
|
130 |
+
Yrel = (Ymask - ymin) / (ymax - ymin)
|
131 |
+
|
132 |
+
rho = (
|
133 |
+
(1 - Xrel) * (1 - Yrel) * rho_x0
|
134 |
+
+ Xrel * (1 - Yrel) * rho_x1
|
135 |
+
+ (1 - Xrel) * Yrel * rho_y0
|
136 |
+
+ Xrel * Yrel * rho_y1
|
137 |
+
)
|
138 |
+
c = np.sqrt(bulk_left / rho)
|
139 |
+
aux[0][mask] = rho
|
140 |
+
aux[1][mask] = c
|
141 |
+
|
142 |
+
def constant(aux, mask, seed, rho_low=1, rho_high=7.0):
|
143 |
+
rho = seed.uniform(rho_low, rho_high)
|
144 |
+
c = np.sqrt(bulk_left / rho)
|
145 |
+
aux[0][mask] = rho
|
146 |
+
aux[1][mask] = c
|
147 |
+
|
148 |
+
def smoothed_gaussian_noise(
|
149 |
+
aux, mask, seed, rho_low=1, rho_high=7.0, std=2, sigma_low=5, sigma_high=10
|
150 |
+
):
|
151 |
+
rho = seed.uniform(rho_low, rho_high)
|
152 |
+
background = seed.standard_normal(mask.shape)
|
153 |
+
sigma = seed.uniform(sigma_low, sigma_high)
|
154 |
+
|
155 |
+
background = gaussian_filter(background, sigma)
|
156 |
+
rho = rho + background[mask]
|
157 |
+
c = np.sqrt(bulk_left / rho)
|
158 |
+
aux[0][mask] = rho
|
159 |
+
aux[1][mask] = c
|
160 |
+
|
161 |
+
gen_funcs = [gaussian_bump, linear_gradient, constant, smoothed_gaussian_noise]
|
162 |
+
|
163 |
+
c_left = np.sqrt(bulk_left / rho_left) # Sound speed (left)
|
164 |
+
if include_splits:
|
165 |
+
if is_vert:
|
166 |
+
mask = Y < midpoint
|
167 |
+
else:
|
168 |
+
mask = X < midpoint
|
169 |
+
seed.choice(gen_funcs)(state.aux, (~mask), seed)
|
170 |
+
else:
|
171 |
+
mask = np.ones_like(X, dtype=bool)
|
172 |
+
seed.choice(gen_funcs)(state.aux, mask, seed)
|
173 |
+
|
174 |
+
state.q[0, :, :] = 0.0
|
175 |
+
state.q[1, :, :] = 0.0
|
176 |
+
state.q[2, :, :] = 0.0
|
177 |
+
# Set initial condition
|
178 |
+
n_waves = seed.integers(1, 4)
|
179 |
+
for i in range(n_waves):
|
180 |
+
center = seed.uniform(-0.95, 0.95, 2)
|
181 |
+
x0 = center[0]
|
182 |
+
y0 = center[1]
|
183 |
+
width = seed.uniform(0.05, 0.15)
|
184 |
+
rad = seed.uniform(width + 0.01, 0.3)
|
185 |
+
intensity = seed.uniform(0.5, 2.0)
|
186 |
+
# x0 = -0.5; y0 = 0.
|
187 |
+
r = np.sqrt((X - x0) ** 2 + (Y - y0) ** 2)
|
188 |
+
# width = 0.1; rad = 0.25
|
189 |
+
state.q[0, :, :] += (np.abs(r - rad) <= width) * (
|
190 |
+
intensity + np.cos(np.pi * (r - rad) / width)
|
191 |
+
)
|
192 |
+
|
193 |
+
if include_inclusions:
|
194 |
+
n_inclusions = seed.integers(0, 15)
|
195 |
+
for i in range(n_inclusions):
|
196 |
+
# Copied elipse code from
|
197 |
+
g_ell_center = seed.uniform(-0.95, 0.95, 2)
|
198 |
+
rads = seed.uniform(0.05, 0.6, 2)
|
199 |
+
g_ell_width = rads[0]
|
200 |
+
g_ell_height = rads[1]
|
201 |
+
angle = seed.uniform(-45, 45)
|
202 |
+
|
203 |
+
cos_angle = np.cos(np.radians(180.0 - angle))
|
204 |
+
sin_angle = np.sin(np.radians(180.0 - angle))
|
205 |
+
|
206 |
+
xc = X - g_ell_center[0]
|
207 |
+
yc = Y - g_ell_center[1]
|
208 |
+
|
209 |
+
xct = xc * cos_angle - yc * sin_angle
|
210 |
+
yct = xc * sin_angle + yc * cos_angle
|
211 |
+
|
212 |
+
rad_cc = (xct**2 / (g_ell_width / 2.0) ** 2) + (
|
213 |
+
yct**2 / (g_ell_height / 2.0) ** 2
|
214 |
+
)
|
215 |
+
|
216 |
+
inclusion_rho = np.exp(seed.uniform(-1, 10))
|
217 |
+
# r = np.sqrt((X-x0)**2 + (Y-y0)**2)
|
218 |
+
c_left = np.sqrt(bulk_left / inclusion_rho) # Sound speed (left)
|
219 |
+
state.aux[0][rad_cc <= 1] = inclusion_rho
|
220 |
+
state.aux[1][rad_cc <= 1] = c_left
|
221 |
+
state.q[0][rad_cc <= 1] = 0.0
|
222 |
+
|
223 |
+
claw = pyclaw.Controller()
|
224 |
+
claw.keep_copy = True
|
225 |
+
if disable_output:
|
226 |
+
claw.output_format = None
|
227 |
+
claw.solution = pyclaw.Solution(state, domain)
|
228 |
+
claw.solver = solver
|
229 |
+
claw.outdir = outdir
|
230 |
+
claw.tfinal = T_max
|
231 |
+
claw.num_output_times = num_steps
|
232 |
+
claw.write_aux_init = True
|
233 |
+
claw.setplot = setplot
|
234 |
+
claw.output_options = {"format": "binary"}
|
235 |
+
if use_petsc:
|
236 |
+
claw.output_options = {"format": "binary"}
|
237 |
+
|
238 |
+
return claw
|
239 |
+
|
240 |
+
|
241 |
+
def setplot(plotdata):
|
242 |
+
"""
|
243 |
+
Plot solution using VisClaw.
|
244 |
+
|
245 |
+
This example shows how to mark an internal boundary on a 2D plot.
|
246 |
+
"""
|
247 |
+
|
248 |
+
from clawpack.visclaw import colormaps
|
249 |
+
|
250 |
+
plotdata.clearfigures() # clear any old figures,axes,items data
|
251 |
+
|
252 |
+
# Figure for pressure
|
253 |
+
plotfigure = plotdata.new_plotfigure(name="Pressure", figno=0)
|
254 |
+
|
255 |
+
# Set up for axes in this figure:
|
256 |
+
plotaxes = plotfigure.new_plotaxes()
|
257 |
+
plotaxes.title = "Pressure"
|
258 |
+
plotaxes.scaled = True # so aspect ratio is 1
|
259 |
+
plotaxes.afteraxes = mark_interface
|
260 |
+
|
261 |
+
# Set up for item on these axes:
|
262 |
+
plotitem = plotaxes.new_plotitem(plot_type="2d_pcolor")
|
263 |
+
plotitem.plot_var = 0
|
264 |
+
plotitem.pcolor_cmap = colormaps.yellow_red_blue
|
265 |
+
plotitem.add_colorbar = True
|
266 |
+
plotitem.pcolor_cmin = 0.0
|
267 |
+
plotitem.pcolor_cmax = 1.0
|
268 |
+
|
269 |
+
# Figure for x-velocity plot
|
270 |
+
plotfigure = plotdata.new_plotfigure(name="x-Velocity", figno=1)
|
271 |
+
|
272 |
+
# Set up for axes in this figure:
|
273 |
+
plotaxes = plotfigure.new_plotaxes()
|
274 |
+
plotaxes.title = "u"
|
275 |
+
plotaxes.afteraxes = mark_interface
|
276 |
+
|
277 |
+
plotitem = plotaxes.new_plotitem(plot_type="2d_pcolor")
|
278 |
+
plotitem.plot_var = 1
|
279 |
+
plotitem.pcolor_cmap = colormaps.yellow_red_blue
|
280 |
+
plotitem.add_colorbar = True
|
281 |
+
plotitem.pcolor_cmin = -0.3
|
282 |
+
plotitem.pcolor_cmax = 0.3
|
283 |
+
|
284 |
+
return plotdata
|
285 |
+
|
286 |
+
|
287 |
+
def mark_interface(current_data):
|
288 |
+
import matplotlib.pyplot as plt
|
289 |
+
|
290 |
+
plt.plot((0.0, 0.0), (-1.0, 1.0), "-k", linewidth=2)
|
291 |
+
|
292 |
+
|
293 |
+
if __name__ == "__main__":
|
294 |
+
from clawpack.pyclaw.util import run_app_from_main
|
295 |
+
|
296 |
+
setup_wrapped = partial(setup, seed=np.random.default_rng(42))
|
297 |
+
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_discontinuous.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_disccont
|
7 |
+
#SBATCH -o acou_disccont
|
8 |
+
#SBATCH -C icelake
|
9 |
+
|
10 |
+
source ~/venvs/clawpack/bin/activate
|
11 |
+
|
12 |
+
srun python generate_acoustics_data.py --discontinuity
|
gif/discontinuous_density.png
ADDED
Git LFS Details
|
stats.yaml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
mean:
|
2 |
+
bulk_modulus: 1.084273461543434
|
3 |
+
density: 3.958672131453937
|
4 |
+
pressure: 0.10382298641950555
|
5 |
+
velocity:
|
6 |
+
- 0.004736874341594803
|
7 |
+
- 0.005733050392328638
|
8 |
+
std:
|
9 |
+
bulk_modulus: 0.27286848219233156
|
10 |
+
density: 1.5745694576257623
|
11 |
+
pressure: 0.31642700584198546
|
12 |
+
velocity:
|
13 |
+
- 0.05996821345863354
|
14 |
+
- 0.05960856047624785
|
visualization_acoustic_scattering_discontinuous.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|