Skip to content

Commit

Permalink
Minor changes to preamble
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcummins committed Mar 7, 2024
1 parent 5ad6039 commit b81a246
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions PINNs_NavierStokes_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"source": [
"# Overview\n",
"\n",
"This notebook is based on two papers: *[Physics-Informed Neural Networks: A Deep LearningFramework for Solving Forward and Inverse ProblemsInvolving Nonlinear Partial Differential Equations](https://www.sciencedirect.com/science/article/pii/S0021999118307125)* and *[Hidden Physics Models: Machine Learning of NonlinearPartial Differential Equations](https://www.sciencedirect.com/science/article/pii/S0021999117309014)* with the help of Fergus Shone and Michael Macraild.\n",
"This notebook is based on two papers: *[Physics-Informed Neural Networks: A Deep Learning Framework for Solving Forward and Inverse Problems Involving Nonlinear Partial Differential Equations](https://www.sciencedirect.com/science/article/pii/S0021999118307125)* and *[Hidden Physics Models: Machine Learning of Nonlinear Partial Differential Equations](https://www.sciencedirect.com/science/article/pii/S0021999117309014)* with the help of Fergus Shone and Michael Macraild.\n",
"\n",
"These tutorials will go through solving Partial Differential Equations using Physics Informed Neuaral Networks focusing on the Burgers Equation and a more complex example using the Navier Stokes Equation\n",
"These tutorials will go through solving Partial Differential Equations using Physics Informed Neural Networks, focusing on the Burgers Equation and a more complex example using the Navier Stokes Equations.\n",
"\n",
"**This introduction section is replicated in all PINN tutorial notebooks (please skip if you've already been through)** "
"**This introduction section is replicated in all PINN tutorial notebooks (please skip if you've already been through).** "
]
},
{
Expand All @@ -32,13 +32,14 @@
"metadata": {},
"source": [
"<div style=\"background-color: #ccffcc; padding: 10px;\">\n",
"If you have not already then in your repositoy directory please run the following code. Via the terminal (mac or linux) or gitbash (windows)\n",
"If you have not already then in your repository directory please run the following code. Via the terminal (mac or linux) or gitbash (windows)\n",
" \n",
"```bash\n",
"git submodule init\n",
"git submodule update --init --recursive\n",
"```\n",
"**If this does not work please clone the [PINNs](https://github.com/maziarraissi/PINNs) repository into your Physics_Informed_Neural_Networks folder**\n",
"\n",
"**If this does not work please clone the [PINNs](https://github.com/maziarraissi/PINNs) repository into your Physics_Informed_Neural_Networks folder.**\n",
" \n",
"</div>"
]
Expand All @@ -52,20 +53,23 @@
"\n",
"<h1>Physics Informed Neural Networks</h1>\n",
"\n",
"For a typical Neural Network using algorithims like gradient descent to look for a hypothesis, data is the only guide, however if the data is noisy or sparse and we already have governing physical models we can use the knowledge we already know to optamize and inform the algoithms. This can be done via [feature enginnering]() or by adding a physicall inconsistency term to the loss function.\n",
"For a typical Neural Network using algorithms like gradient descent to look for a hypothesis, data is the only guide. However, if the data are noisy or sparse and we already have governing physical models, we can use the knowledge we already know to optimize and inform the algorithms. This can be done via [feature engineering](https://en.wikipedia.org/wiki/Feature_engineering) or by adding a physical inconsistency term to the loss function.\n",
"\n",
"\n",
"<a href=\"https://towardsdatascience.com/physics-guided-neural-networks-pgnns-8fe9dbad9414\">\n",
"<img src=\"https://miro.medium.com/max/700/1*uM2Qh4PFQLWLLI_KHbgaVw.png\">\n",
"</a> \n",
" \n",
" \n",
" \n",
"## The very basics\n",
"\n",
"If you know nothing about neural networks there is a [toy neural network python code example](https://github.com/cemac/LIFD_ENV_ML_NOTEBOOKS/tree/main/ToyNeuralNetwork) included in the [LIFD ENV ML Notebooks Repository]( https://github.com/cemac/LIFD_ENV_ML_NOTEBOOKS). Creating a 2 layer neural network to illustrate the fundamentals of how Neural Networks work and the equivlent code using the python machine learning library [tensorflow](https://keras.io/). \n",
"If you are new to neural networks there is a [toy neural network python code example](https://github.com/cemac/LIFD_ENV_ML_NOTEBOOKS/tree/main/ToyNeuralNetwork) included in the [LIFD ENV ML Notebooks Repository]( https://github.com/cemac/LIFD_ENV_ML_NOTEBOOKS). There we build a two-layer neural network to illustrate the fundamentals of how Neural Networks work, and give equivalent code using the Python machine learning library [TensorFlow](https://keras.io/).\n",
"\n",
" \n",
"## Recommended reading \n",
"## Recommended reading\n",
" \n",
"The in-depth theory behind neural networks will not be covered here as this tutorial is focusing on application of machine learning methods. If you wish to learn more here are some great starting points. \n",
"The in-depth theory behind neural networks will not be covered here as this tutorial is focusing on application of machine learning methods. If you wish to learn more, here are some great starting points. \n",
" \n",
"\n",
"* [All you need to know on Neural networks](https://towardsdatascience.com/nns-aynk-c34efe37f15a) \n",
"* [Introduction to Neural Networks](https://victorzhou.com/blog/intro-to-neural-networks/)\n",
Expand Down Expand Up @@ -93,18 +97,22 @@
" \n",
"## Physics informed Neural Networks\n",
"\n",
"Neural networks work by using lots of data to calculate weights and biases from data alone to minimise the loss function enabling them to act as universal fuction approximators. However these loose their robustness when data is limited. However by using know physical laws or empirical validated relationships the solutions from neural networks can be sufficiently constrianed by disregardins no realistic solutions.\n",
"Neural networks work by using lots of data to calculate weights and biases which minimise the loss function, enabling them to act as universal function approximators. Because they rely purely on observed relationships in the data, these networks lose their robustness when data is limited. However, by using known physical laws or empirically validated relationships, the solutions from neural networks can be sufficiently constrained by disregarding unrealistic solutions.\n",
" \n",
"A Physics Informed Nueral Network considers a parameterized and nonlinear partial differential equation in the genral form;\n",
"A Physics Informed Neural Network considers a parameterized and nonlinear partial differential equation in the general form\n",
"\n",
"\n",
"\n",
" \n",
"\\begin{align}\n",
"u_t + \\mathcal{N}[u; \\lambda] = 0, x \\in \\Omega, t \\in [0,T],\\\\\n",
" u_t + \\mathcal{N}[u; \\lambda] &= 0, && x \\in \\Omega, t \\in [0,T],\\\\\n",
"\\end{align}\n",
" \n",
"\n",
"\n",
"where $\\mathcal{u(t,x)}$ denores the hidden solution, $\\mathcal{N}$ is a nonlinear differential operator acting on $u$, $\\mathcal{\\lambda}$ and $\\Omega$ is a subset of $\\mathbb{R}^D$ (the perscribed data). This set up an encapuslate a wide range of problems such as diffusion processes, conservation laws, advection-diffusion-reaction systems, and kinetic equations and conservation laws. \n",
"where $\\mathcal{u(t,x)}$ denotes the hidden solution, $\\mathcal{N}$ is a nonlinear differential operator acting on $u$, $\\mathcal{\\lambda}$ and $\\Omega$ is a subset of $\\mathbb{R}^D$ (the prescribed data). This set up encapsulates a wide range of problems such as diffusion processes, conservation laws, advection-diffusion-reaction systems, and kinetic equations and conservation laws.\n",
"\n",
"Here we will go though this for the 1D Heat equation and Navier stokes equations\n",
"Here we will go though this for the 1D Heat equation and for the Navier Stokes equations.\n",
"\n",
"\n",
"</div> "
Expand All @@ -120,14 +128,14 @@
"<h1> Python </h1>\n",
"\n",
" \n",
"## Tensorflow \n",
"## TensorFlow \n",
" \n",
"There are many machine learning python libraries available, [TensorFlow](https://www.tensorflow.org/) a is one such library. If you have GPUs on the machine you are using TensorFlow will automatically use them and run the code even faster!\n",
"There are many machine learning Python libraries available. [TensorFlow](https://www.tensorflow.org/) is one such library. If you have GPUs on your machine, TensorFlow will automatically use them and run the code even faster!\n",
"\n",
"## Further Reading\n",
"\n",
"* [Running Jupyter Notebooks](https://jupyter.readthedocs.io/en/latest/running.html#running)\n",
"* [Tensorflow optimizers](https://www.tutorialspoint.com/tensorflow/tensorflow_optimizers.htm)\n",
"* [TensorFlow optimizers](https://www.tutorialspoint.com/tensorflow/tensorflow_optimizers.htm)\n",
"\n",
"</div>\n",
" \n",
Expand All @@ -143,19 +151,19 @@
" \n",
"<h1> Requirements </h1>\n",
"\n",
"These notebooks should run with the following requirements satisfied\n",
"These notebooks should run with the following requirements satisfied.\n",
"\n",
"<h2> Python Packages: </h2>\n",
"\n",
"* Python 3\n",
"* tensorflow > 2\n",
"* TensorFlow > 2\n",
"* numpy \n",
"* matplotlib\n",
"* scipy\n",
"\n",
"<h2> Data Requirements</h2>\n",
" \n",
"This notebook referes to some data included in the git hub repositroy\n",
"This notebook refers to some data included in the GitHub repository, imported via the git submodules command mentioned in the installation instructions.\n",
" \n",
"</div>\n"
]
Expand Down Expand Up @@ -187,7 +195,7 @@
"metadata": {},
"source": [
"<div style=\"background-color: #cce5ff; padding: 10px;\">\n",
"Load in all required modules (includig some auxillary code) and turn off warnings. \n",
"Load in all required modules (including some auxiliary code) and turn off warnings. \n",
"</div>"
]
},
Expand Down Expand Up @@ -1370,19 +1378,11 @@
"[Navier-Stokes PINNs Hidden Fluid Mechanics](PINNs_NavierStokes_HFM.ipynb)\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4f4b2310",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1396,7 +1396,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
"version": "3.9.18"
}
},
"nbformat": 4,
Expand Down

0 comments on commit b81a246

Please sign in to comment.