sr5434 commited on
Commit
0d45fb8
·
verified ·
1 Parent(s): b218a13

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +41 -4
README.md CHANGED
@@ -1,3 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Physics-Informed Neural Networks
2
  This contains the pretrained model weights for a collection of physics-informed neural networks (PINNs) that are designed to solve problems in quantum mechanics, thermodynamics, and fluid dynamics by learning directly from physics rather than from labeled data. For training and evaluation scripts, check out the [main repository](https://github.com/sr5434/pinns).
3
 
@@ -60,7 +97,7 @@ The initial conditions loss makes sure that the model's outputs at timestep 0 fo
60
  This implementation uses dimensionless quantities normalized to [0, 1] for numerical stability and generality. The solutions can be scaled to any physical units by applying appropriate transformations. This is standard practice in computational physics and ensures the neural network trains effectively.
61
 
62
  ## Heat Equation
63
- <video src="./plots/heat_equation_3d_visualization.mp4" width="320" height="240" controls></video>
64
 
65
 
66
  The repository contains code to train PINNs on the 1d, 2d, and 3d heat equations. It also contains code to generate visualizations from the 2d and 3d models (the 3d visualization is just a slice from the middle of a cube). The trained models predict how heat diffuses through a rod, a tile, and a cube respectively. This is the 3d heat equation (for 2d, remove the second derivative w.r.t. z, and for 1d, also remove the second derivative w.r.t. y):
@@ -70,7 +107,7 @@ $\frac{∂u}{∂t} = \alpha(\frac{∂^2u}{∂x^2} + \frac{∂^2u}{∂y^2} + \fra
70
  Here, $\alpha$ is a constant representing the thermal diffusivity of a material. Our model aims to estimate the value of $u(x, y, z)$. The model is trained to support any value of $\alpha$ between 0 and 1, inclusive of the lower and exclusive of the upper. Our model is trained using the Adam optimizer with a fixed learning rate of $1*10^{-3}$. It uses the tanh activation function. The architectures of the 1d, 2d, and 3d models are the same, ignoring differences in the number of input/output channels. They all have 1 hidden layer, with a 50 dimension hidden state. The 1d model is trained for 10,000 steps and trained on 20,000,000 sample inputs (unlabeled random coordinates, timesteps, and values of $\alpha$), while the 2d and 3d models were both trained for 15,000 steps on 75,000,000 sample inputs. I evaluated my model by comparing its results to the results generated by an analytical solution at several points (the points can be seen inside of the training scripts). The 1d model never had more than 1% error, the 2d model did not have more than 1.5% error, and the 3d model got 10% error in one test case, but got less than 5% for the rest of the test points. This jump in error for the 3d model is expected, as it is a much more complicated problem than the 1d and 2d models. Also, the 10% error occurred at the last timestep, meaning that errors had compounded over previous timesteps.
71
 
72
  ## Burger's Equation
73
- <video src="./plots/burgers_equation_1d_visualization.mp4" width="320" height="240" controls></video>
74
 
75
 
76
  The repository also contains a script to train a PINN on the 1-dimensional variant of Burger's Equation (higher dimensions coming soon!), which predicts the instantaneous velocity of a particle in a fluid. This is the equation for 1d fluids:
@@ -81,7 +118,7 @@ $\frac{∂u}{∂t} + u\frac{∂u}{∂x} = \nu\frac{∂^2u}{∂x^2}$
81
  $\nu$ represents the viscosity of the fluid, and has the same range as $\alpha$. The model for Burger's Equation is a deeper and wider version of the one used for the heat equation (2 hidden layers as opposed to one, and 100 hidden dimensions instead of 50). The model supports any value of $\nu$ in the range \[0, 1\). Instead of using a fixed learning rate, the learning rate was decayed following a cosine schedule from $1*10^{-3}$ to $1*10^{-5}$ over the first 15,000 steps, and then kept flat at $1*10^{-5}$ for an additional 10,000 steps. The model was trained on a total of 50,000,000 examples. As mentioned earlier, I enforce initial and boundary conditions at the model level, so I only use the PDE loss. The model was evaluated using the visualization script, and percent error was calculated by the frame. The error goes from about 0.5% in earlier frames to 4.5% in later frames.
82
 
83
  ## Schrödinger's Equation
84
- <video src="./plots/schrodinger_equation_1d.mp4" width="320" height="240" controls></video>
85
 
86
 
87
  There is a script to train a model to predict the wavefunction of a quantum particle in a 1d box over time, following the Time-Dependent Schrödinger's Equation:
@@ -126,4 +163,4 @@ Working on this project brought back some nostalgia for a time when I was very p
126
  - Enable inverse problems, where the model solves for physical constants given observations of a system
127
 
128
  ## Acknowledgements
129
- I want to thank [Krivan Semlani](https://www.linkedin.com/in/krivansemlani/) for inspiring me to work on PINNs and encouraging me to keep up the work.
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - physics
5
+ - pinn
6
+ - pde
7
+ - pytorch
8
+ - heat-equation
9
+ - burgers-equation
10
+ - schrodinger
11
+ model-index:
12
+ - name: Heat Equation 3D
13
+ results:
14
+ - task:
15
+ type: physics-simulation
16
+ name: Heat Equation
17
+ dataset:
18
+ type: synthetic
19
+ name: Generated Data
20
+ metrics:
21
+ - type: mean_absolute_error
22
+ name: Max Error
23
+ value: 0.01
24
+ - name: Burger's Equation 1D
25
+ results:
26
+ - task:
27
+ type: physics-simulation
28
+ name: Burger's Equation
29
+ dataset:
30
+ type: synthetic
31
+ name: Generated Data
32
+ metrics:
33
+ - type: mean_absolute_error
34
+ name: Max Error
35
+ value: 0.045
36
+ ---
37
+
38
  # Physics-Informed Neural Networks
39
  This contains the pretrained model weights for a collection of physics-informed neural networks (PINNs) that are designed to solve problems in quantum mechanics, thermodynamics, and fluid dynamics by learning directly from physics rather than from labeled data. For training and evaluation scripts, check out the [main repository](https://github.com/sr5434/pinns).
40
 
 
97
  This implementation uses dimensionless quantities normalized to [0, 1] for numerical stability and generality. The solutions can be scaled to any physical units by applying appropriate transformations. This is standard practice in computational physics and ensures the neural network trains effectively.
98
 
99
  ## Heat Equation
100
+ <video src="https://github.com/user-attachments/assets/60dc2456-4292-490c-99aa-bce706ce7bb7" width="320" height="240" controls></video>
101
 
102
 
103
  The repository contains code to train PINNs on the 1d, 2d, and 3d heat equations. It also contains code to generate visualizations from the 2d and 3d models (the 3d visualization is just a slice from the middle of a cube). The trained models predict how heat diffuses through a rod, a tile, and a cube respectively. This is the 3d heat equation (for 2d, remove the second derivative w.r.t. z, and for 1d, also remove the second derivative w.r.t. y):
 
107
  Here, $\alpha$ is a constant representing the thermal diffusivity of a material. Our model aims to estimate the value of $u(x, y, z)$. The model is trained to support any value of $\alpha$ between 0 and 1, inclusive of the lower and exclusive of the upper. Our model is trained using the Adam optimizer with a fixed learning rate of $1*10^{-3}$. It uses the tanh activation function. The architectures of the 1d, 2d, and 3d models are the same, ignoring differences in the number of input/output channels. They all have 1 hidden layer, with a 50 dimension hidden state. The 1d model is trained for 10,000 steps and trained on 20,000,000 sample inputs (unlabeled random coordinates, timesteps, and values of $\alpha$), while the 2d and 3d models were both trained for 15,000 steps on 75,000,000 sample inputs. I evaluated my model by comparing its results to the results generated by an analytical solution at several points (the points can be seen inside of the training scripts). The 1d model never had more than 1% error, the 2d model did not have more than 1.5% error, and the 3d model got 10% error in one test case, but got less than 5% for the rest of the test points. This jump in error for the 3d model is expected, as it is a much more complicated problem than the 1d and 2d models. Also, the 10% error occurred at the last timestep, meaning that errors had compounded over previous timesteps.
108
 
109
  ## Burger's Equation
110
+ <video src="https://github.com/user-attachments/assets/087da0a3-1385-4069-abf7-c7fc6d569190" width="320" height="240" controls></video>
111
 
112
 
113
  The repository also contains a script to train a PINN on the 1-dimensional variant of Burger's Equation (higher dimensions coming soon!), which predicts the instantaneous velocity of a particle in a fluid. This is the equation for 1d fluids:
 
118
  $\nu$ represents the viscosity of the fluid, and has the same range as $\alpha$. The model for Burger's Equation is a deeper and wider version of the one used for the heat equation (2 hidden layers as opposed to one, and 100 hidden dimensions instead of 50). The model supports any value of $\nu$ in the range \[0, 1\). Instead of using a fixed learning rate, the learning rate was decayed following a cosine schedule from $1*10^{-3}$ to $1*10^{-5}$ over the first 15,000 steps, and then kept flat at $1*10^{-5}$ for an additional 10,000 steps. The model was trained on a total of 50,000,000 examples. As mentioned earlier, I enforce initial and boundary conditions at the model level, so I only use the PDE loss. The model was evaluated using the visualization script, and percent error was calculated by the frame. The error goes from about 0.5% in earlier frames to 4.5% in later frames.
119
 
120
  ## Schrödinger's Equation
121
+ <video src="https://github.com/user-attachments/assets/fe98af31-a5e0-40f0-8170-24a4bfe92f13" width="320" height="240" controls></video>
122
 
123
 
124
  There is a script to train a model to predict the wavefunction of a quantum particle in a 1d box over time, following the Time-Dependent Schrödinger's Equation:
 
163
  - Enable inverse problems, where the model solves for physical constants given observations of a system
164
 
165
  ## Acknowledgements
166
+ I want to thank [Krivan Semlani](https://www.linkedin.com/in/krivansemlani/) for inspiring me to work on PINNs and encouraging me to keep up the work.