Pins or physics informed neural networks are.
A neural network that is a deep neural network that combines both the power of neural networks with
the physics laws.
Of course, the purpose of doing pins is to solve a mainly partial differential equations.
However, the idea is is mainly about.
Using physics and its laws along with neural networks, to achieve modeling, modeling of a system.
And by that we can actually calculate a whole system in a very quick way.
It's all about how we train the neural network and for how many boundary condition, for how many initial
conditions to actually make it successful to achieve that.
So basically this is a pens and as I said, it is a combination physics with neural networks.
Now how it works.
So basically the pins will work using or training on a data and this data or in order to model an actual
system, we need to do well, mainly two things.
The first thing is we need to to have this network and have this loss to be calculated.
Now, it's not enough to actually calculating the the the loss.
That is, we model the system as X, for example, if it's one dimensional system, we have X and T
and we will get you.
It's not enough to have an input of X, an input of T, and we only get you for let's say, the boundary
condition and so on.
And of course the initial condition.
The problem is what we will face is there are many points in the domain like in between that needs to
converge.
And this is why we need well, basically the the partial differential equation.
And these points have to follow these pdes laws.
And well, basically, now we have the we have to we have the loss that has to be minimized.
And the loss comes from two sources.
That is the PDE and of course the partial well, the the the boundary condition and the initial condition.
So basically this is what how how mainly it works.
And so we need a system.
We need a partial differential equation that is capable to solve our problem.
Capable is not it depends on how complex the problem.
We will build these networks.
And it's for for simple equations.
We don't have to be very deep.
And of course we we don't have to have many input conditions and of course, output conditions.
The second thing, of course, we need a that describes the physical systems and then we just calculate
the loss.
So, so this is the idea behind pens is just need to have the PDE to calculate the losses.
Now how the domain works or okay, you want to calculate the loss, but for what?
Where did you where do you get the data?
The data is actually is the boundary condition and the initial condition.
So this is you have two parts of data.
The first one is boundary condition and initial condition.
This is these conditions are part of the data and it's very important part of the data.
The second part of the data is the domain parts.
And these domain points which are in the middle all over here randomly, you know, you can put them
over there just randomly with the with the sufficient density.
Of course, it has to be sufficient.
And the sufficient means.
It depends on the actual equation and the problem we're trying to solve.
And we have to basically calculate the loss in order to satisfy the boundary conditions and satisfy
the physics of the initial conditions.
So the the network, if you put a a point in the boundary, the network has to understand this is this
is a boundary point and it has a specific value in order to achieve so well, we need to.
That means we have to create many boundary points and to feed these boundary points to the network in
order to make sure that whenever the network sees this as a boundary point, it will give it the correct
answer.
The domain point is the same.
We put a domain point, and this domain point has, along with everything around it, has to satisfy
the physics law.
We keep doing this until basically the network is converged and the loss is minimized.
Getting, well, a converged solution, get a solution.
And then once we have that, we have the network, we give it X, we give it T or x, Y, whatever the
network, whatever the situation is, and it will give us the answer.
So how to solve it?
We have basically a general steps.
The first step is you define the network or this is how to solve it while using torch or using, you
know, like a library that is will handle the deep neural network.
However, of course we will also solve it using some easy or well written libraries for only solving
pens.
However, these are the steps that we need to achieve in order to solve the network using, um, well,
mainly torch.
The first thing is we need to define the network.
We need to define what are the inputs and what are the outputs.
For example, if it's a 2D problem, we will have X and Y and we will get a value or multiple value.
For example, the velocity in the direction, the velocity in the V direction and let's say the rho,
the the density.
After that, we have to define the initial condition and the boundary conditions and a well followed
by this.
We have to set our optimizers, usually in pins.
We start with a kind of general optimizer like Adam, and then we go for a optimizers that will take
into consideration or will tweak the loss to be as small as possible.
And then what we will do is we need to define the loss function.
We're trying to define the loss functions to basically satisfy the both the boundary, the the the the
the boundary conditions and the initial condition as well as the residual errors or the pdes that needs
to be calculated.
And after that we just run the training loop we need, same as any network.
It has epochs, it has to be trained and, you know, like go round and round until the loss is minimized.
And then once we have the result, we have the post-processing, we get these results and we plot them
as any CFD or finite difference methods.
So these are the general steps of solving pens.
And hopefully in this course we will as much as possible be detailed in the explanation.
Of course, pens and numerical solutions is not, well let's say, established.
It's not well developed.
But I think in the next in the in the future, we will have more and more well researchers and engineers
that they are going to use it in order to get a fast solutions.