What we need to do now is to define the PD of Navier Stokes equation.
Of course, our PD is the Navier Stokes equation, which is.
This one.
So we will do it.
And of course, a step by step.
Okay.
So to define it, we need as we did before, it will have.
X and Y.
And X is basically the values in which we are.
The independent values and the Y is the dependent values.
So X is is like like x and y and y is u, P and V, of course.
So the first thing is we have in this equation, let's see, we have we have we have second derivative
of u over all of them has to be defined.
So let's start with d, u, d, x, d, x equals.
And we will see.
Of course there are.
The good thing is in the documentation of deep, this equation is more or less similar to Navier-Stokes
equation.
And then we can see how they are basically doing this like first derivative, this is the second derivative
and so on.
So the first derivative and I want you to also kind of training is you always look at the documentation,
you always try to mimic the documentation and even you use another method or another library to to do
this work.
You can always use it.
And for example, for the first derivative, you use this one and you just copy it and put it here.
D Grad dot Jacobian.
What is the first?
Of course u is not you here put it he's he's putting u here and x we have here u is y so we put y changing
with x x he put it here, small x we put a with big x and zero zero means the first component is the
U, which is basically the U that he put here.
Y So that means is means the velocity which is zero and J is X, which is also zero.
So d v over d, x has to be a little bit different.
The V means the velocity.
Or d u over d y d u over d y.
We need velocity, which is zero, but J has to be one.
Why?
Because now we are talking about.
A y axis.
So here you also see it.
He's doing the same thing.
Velocity and Y has to be J equals one.
Okay.
Okay, So we continue.
De.
V over and over.
D y, d v over will become one zero and over.
D y is one.
Y y.
Because V is one.
The second component.
The first component is zero.
U second component is one V and of course, J.
As we go.
The last thing is or not the last thing.
The first derivative.
Last thing is we need.
P.
And P over the X and over Y.
And here is going to be two and two zero for X and one for Y.
Of course, you can also see it in here.
The P over the X you.
Just like 2021.
So it's all, uh.
Yeah, this one is not exist.
So basically, this is our first derivative, and this is just we see a little bit the equation.
We can see we have the U over the X, we have the U over D y, we have DV over the x over d, y, d,
p, over the x, p over d y.
So now we already made this.
Made this, this, this, this and this.
Now, the second derivative is a bit tricky.
Tricky because it's, it's, it seems a strange logic the way they define it.
But basically the second derivative, which is this one, um, or let's take this 1UXX the first thing
he defined the component which is the U and then it will become, which is the first derivative and
what is the second derivative.
So.
D u over x x well equals we use heisen.
Or Haitian.
A method.
And here it's going to be why?
Here.
Why?
Here.
X component is you.
It is zero.
X is also zero and Y is also zero.
So this is the way to go.
Now we.
Do another thing, which is the second derivative of U over Y.
The first component is zero.
That's correct.
The second component is one, and J is one.
Why?
Because first derivative.
The second derivative of Y and y.
So this is y y it will be one one.
Do the same thing, but this time dv.
Second derivative dv.
DV.
We have the same thing here.
X x will be x x and.
But here one.
And when.
That's it.
That's the small derivatives.
However, we need now to combine everything.
D or E?
Of.
The you.
This is the momentum.
Or.
Yeah, well you can say like this of the.
Which is that the momentum in the direction and.
Continuity.
We need to all be defined.
So the first one is we need to consider, well, in our case you do over the X, so let's consider this
equation.
D u over d x multiplied by u.
So which is why this value is going to be everything and 0 to 1 which is the first component multiplied
d u d x plus.
The same thing.
Well for all the points.
And zero one bit became one too, because now it's you.
Multiplied the.
You over the one thing.
The over the.
The you over.
Why?
Plus one over Rho.
Or roll.
Multiply DPI.
Over.
Minus.
Mu over rho.
Multiplied.
The you.
X.
X plus do.
Why?
What does that mean?
Means.
This is you.
The you over the and this is the the you over.
And this one.
We have to move it to this direction.
One over P the P over this plus become minus.
And this is we said the kinematic viscosity, which is mu over rho.
So this is we put it mu over rho the second derivative of u over the second derivative of u over D This
is why this become minus and this become positive.
This is going to be the first residual.
The second thing, what we will do here, where more or less the same you and here V but this is becomes
the V over the y, the v over y, dp over y.
And.
Second derivative of.
Y y.
Oh, no, it's just here.
V not because X and Y already exist in both.
So here you and you.
I think it's pretty much no problem.
The last one is.
Well, there's this very simple thing.
Is this one.
The U over x plus D over over d, y, d.
You're over X.
Plus DV.
Why?
Return.
Everything.
Just these.
These are the things that has to be equal.
That has to equal to zero because.
We have all of this.
It's called residual and residual.
Basically, we keep all the equation on one side and we equal it to zero.
It has to be achieved if we want to converge our solution.
Shift.
Enter.
Hopefully we didn't forget anything.
And this is basically our now data.
The data.
We need to create.
Data is basically that the neural network has to train on it in order to converge.
The dot data dot PD.
What we need to add.
The first one is geometry.
This one.
Second one is.
Which is the whole thing, this one.
And of course, it has these little beads.
I would say like the like everything it will have now, number of domain points equals one 2000.
Domain points, number of boundary.
Bone.
The points is again 2000.
This should be domain boundary is also okay.
Number of test.
Just put it wherever.
Just keep it.
100.
Just 200.
Because.
Follow the 2 to 2 and pretty much.
That's it.
Shift.
Enter.
And.
There's the problem.
It is business.
Oh, sorry, sorry, sorry, sorry.
Boundary conditions.
We forgot.
It's a big problem.
Sorry.
Here.
We put our.
Well, it's not.
Yeah.
The first one is, well, the wall boundary.
You wall boundary.
The.
And.
And let's.
And let the.
Pressure.
Um, pressure outlet v and outlet pressure.
I think now it seems correct.
This is.
Let's just skipping a bit.
Higher.
Seems okay.
Okay.
Now I think it will work.
Shift.
Enter.
Okay, so now he's passing all this data to our functions and he's checking if it's if these points.
This is a problem.
There are.
It just seems to be some issue.
The problem is we didn't pass on X and on boundary.
We didn't pass the points.
So this is what causes trouble.
Now we.
Well, it's better to shift like run the whole thing from the beginning because we don't know what we
already defined.
I think now is okay.
And before I put here 2000 points, now it's just change it to 200 points.
It seems.
No.
Point is running.
Okay.
Let's take just a little bit like this.
Yeah.
Now.
It's.
It's good.
Do you see this?
False and true means we create a 200 boundaries.
We create 200 boundary points.
If the boundary matches the well.
True or false, the the the boundary condition here we put it will give false and it will not apply
this boundary condition with zero or UN or whatever we define.
So this is a little bit more solid way to define it rather than before.
However, before method can work, however, you have to be very cautious that when you enter this boundary
points you have to decide which is which.
So now we have done it.
Let's just plot.
The.
Figure.
Like plot the point itself.
Fixed size.
Equals.
Eight.
Dot.
Scatter.
And that train is the same as we did before.
Uh, so just this is the X, and we do the same thing here.
Or why?
X equals 0.5.
Well.
Pldt.
That X label.
And just plotting things.
Yep, that's it.
PLT dot show.
So these are our points.
We can see this is the boundary points.
This is the domain points.
Of course, this is like.
Scattered randomly and.
The last thing we have to do is define the neural network.
So.
The network will equals the dot maps dot forward neural network and it will have input of two Y is two
because we have X and y only.
A plus.
We have 64 multiplied by multiplied five.
This is going to be our hidden layer.
We put it like this.
And output is three, Y is three because u, V and P3A activation function.
Then it.
Then H and the initialization we said we need to initialize everything with a mean of zero.
So they will spread, but they will have the mean of zero.
Elk Lodge.
Rot uniform.
Form.
Shift into.
And this is our network.
Next thing, what we will do is we need to train the actual network.