So now we need to evaluate our model as we have, of course, now the model if we want to well, see
how the model is just this is a kind of we already wrote it here.
So model.
Evaluation.
We can see the model we have is a sequential model.
Of course, like two input and one output feature.
And this is the all of the well, the sizes of the model.
So.
The network we have is supposed to work like this.
We give it X and we give it time and it will give us u.
So let's do it first.
We make another computational domain and this time we make it smaller like H equals 0.01.
In the past it was 0.1, I think.
Yeah.
0.1.
So we don't really care.
Or the of course our our.
Why is that?
Yeah.
Our training model is is only trained on a very specific boundary and initial condition.
And this is a problem.
But in general, if you want a model that works in a wide range of boundary conditions and initial conditions,
you have to train it on much more boundary conditions and initial conditions.
However, let's change a little bit to just to make it more exciting, just to change it, the computational
domain.
But of course, in your case you have to consider the initial condition, boundary condition to get
a very quick results from this model in the training part of it.
So here or like a good result like now it will we will only change one thing which is the the grid.
But in Pence, the general dream or like motivation of Pence is we need a model that is capable to give
us approximation on a wide range of.
Initial conditions and boundary conditions.
So this is actually why we do it.
But other than, you know, the fun of it.
Arrange is we just keep it the same boundary condition to make it work well.
You can of course change the boundary condition and see how your model behaves.
T is from 0 to 1.
For me, it just.
I will just put it as is.
And yeah, this is the the.
I'm like, I'm not going to train it on different boundary conditions and initial conditions and so
on.
But it it if you to get a good answers, we always have to consider this kind of thing.
So here torch dot um stack.
And torch dot mesh the same thing.
Grid X and T.
And reshape.
Two minus one.
Transpose it.
And x equals x.
To.
Net dot x dot.
Device.
And of course the X will be this way.
It's already put on cuda.
And if you want to see the shape.
It's 2000 by two, 2000 points by, of course, X, just two, 2000 different rows, and then two is
X and T.
So so basically now what we need is to predict it.
And.
A model.
Is equals to net dot.
Model.
And.
Model.
Noel.
Evaluation.
And with.
Torch?
No.
Grad.
Why predict?
Predict equals model.
X dot reshape.
If or just we can put it like this.
Why?
The dict equals.
Dot reshape.
The shape length of X.
And length of T.
So we will get a kind of beautiful.
A matrix that we can plot numpy.
Shift into.
And then why predict we can see the shape of it?
And then we can see the actual values of this.
And let's now of course, contour plot it so it's in s dot set.
This style.
No white.
P l t dot.
Bigger.
Big.
Size equals.
Five and three.
DPI.
And just the.
The solution is in s dot heat.
Map.
Y predict.
C map equals jet.
Oh, sorry.
Git shift.
Enter.
And we look at the drawing.
So basically we start by having a sine wave and it will converge to something that looks like a step
and actually we can look at it.
PLT dot.
We will print this part and this part so the left side and the right side.
And of course, you can in between like plot.
Why?
Predict.
All of it and zero shift enter.
So start will be a wave, which is this swipe predict we're printing all the values at time equals zero.
We can see it looks like this.
And at the end of it, just let's take it.
Uh, like, minus one.
We can see the step function if you want in between like you have to put like I think this is 20,000.
Uh, the shape is 100 steps.
So like, we can consider like 50.
It gives us something in between.
We see.
At ten.
It's still it's it didn't converge into this step.
A 40.
It's more.
100.
We cannot.
99.
We can.
So this is the last one and maybe just put it 40.
But for a little bit too already kind of converged.
30.
Yeah, it's a little bit.
We can see the kind of wavy shape still and here is more sharp.
So this is how to solve burgers equation using PyTorch.