Now we are going to solve the burgers equation.
So when when we talk about the burgers equation, first let's look at the terms of the burgers equation.
And in this case, we'll have the first one is the temporal difference, which or the temperance, the
temporal component which is du over DT We can see well, basically it it govern or it.
Show the difference between the new value with the time itself.
And plus you itself.
This is you.
And then the change of you with respect to the to the which is the change of you with space, which
is we call it the spatial component of Berger's equations.
And this will equal to viscosity denoted by V and the second derivative of U with respect to space.
So we have two spatial components and one temporal component or time well governed or like change of
U with respect to time.
So solving this equation means we have to solve U for every time step we have.
So what we will need to do is we will have an X, which is space, and we will have time.
And.
Basically what we need to have is a neural network that will take the space and the time we we assign
it and it will give us.
That you value.
So this is basically what we are doing or what we want to do.
So let's let's code it and step by step.
Of course, let's have like discussion of what kind of things we need to consider.
So the first thing is we need to we start by basically just writing the file.
Name, which is Burgers, girls.
It will mean.
And actually, it's one.
And we as always, we import the needed libraries.
So we start with importing math.
I'm not sure we're going to use math, but but let's import it anyway.
If we needed some mathematical issues or features or like functions as NP numpy of course import for
plotting seaborne, we will import we will plot the like heat contour plot so it will be useful, see
like see Seaborn.
And then of course import matplotlib.
Plot lib dot pyplot as plt.
And.
But I'm take you.
The import.
Dcdm.
Import.
Torch and of course import torch dot n.
N.
As in n network.
Tqdm is just to show us the progress bar if we needed to see the progress bar.
So these are the libraries we need to upload and of course shift enter to take them.
Now it's set and we can start by first.
Building our network.
The network we need to build is going to, as I said, take X and T and provide us with basically the
value.
So so let's let's write a neural network for that.
So we start by class in, in and neural network, we inherit the module.
And as as as any like TensorFlow.
In.
The PyTorch module.
We.
We always right this way.
And super.
Neural network.
We take it.
And self.
We initiate.
Well, basically this one.
In it.
And now we will start writing the neural network.
So the neural network has to start with basically two.
Two inputs.
So but of course we need a sequential to torch and n dot.
Sequential.
And seek.
One chill seems legit.
And.
We start by the neural network.
Linear.
Two inputs and it will expand to 20.
So what's happening here?
We're starting with two inputs X and T, and then the network will expand to 28 elements.
And of course, we need to also.
I'm not sure why it's not.
Oh, this way.
Yeah, I wanted to to have on the same line as here.
So after that we need to put an activation function.
So we use an activation function very also common activation function.
And after that, what we will need to do is we said we have 20 a a well after two it will expand to
20 neurons and then 20 we want to expand to 30.
So what we have is basically we will start by two neurons.
And then we will have the first layer.
It will be 20.
A well, 20 nodes, and then we will expand to even 30 nodes and we will continue a little bit 30 and
then we will go back to 20.
So I think this way.
So this is what we are trying to build.
And of course, at the end we need just one, which is the.
Of course.
Which is the you here?
Of course.
We have to also.
Consider the activation function.
And here we take on 30 and let's say we provide another 30 or we keep it the same level.
Even if you change it differently, it will work.
Even if all of this is 20 is going to work.
But the reason I'm doing this is just to try to.
Have more command over the network.
So we try to change this network.
Here, 2020.
And then basically.
We take 20 and make it into.
One value and just remove this one.
So we'll have to 20, 20, 30, 30, 30, 30, 20, 2020, and then 20 to 1.
And of course we don't have an activation function after that.
Okay.
So this one is going to be the network we have, and then we have to assign the forward pass, which
is self.
And X also very usual thing output will equals to self.
Dot net and it will have.
And return.
The output.
This way we assign the neural network and it is it will have an input size, an input size of two,
and then you will have the first layer of 20.
Second layer of 30.
Third layer of 30.
Fourth layer of 20.
And fifth layer is the final layer, which is there's just one, one point.
It's just the point we need to calculate, which is you.
So here we, we do this and then we shift enter.
Now we already took it by now.
We already assigned the network.
The next step is going to be considering the data that we need to use.
And the data means we have the.
A Well, the state the data means the boundary condition along with the initial condition that this
network has to bind with to get the right solution for us.