Now what we will do is to solve the Navier Stokes equation.
Navier Stokes Equation is an equation or equations that describe the fluid motion, and by solving them,
we can actually simulate fluids.
Of course, there are many forms of stokes equations, and the form we will deal with is a two dimensional
form.
However, the form that actually we're going to solve, of course we will solve this one, but we will
consider a steady state solution.
A steady state solution is simply any change of anything with time will equal to zero.
So in this equation, what we will do is basically this is Navier Stokes equation du over dt plus u
du over dx plus v du over dy.
So this is the momentum equation in the x direction equals minus one rho over multiplied by d, p over
d, x plus kinematic viscosity and the second derivation of u over and second derivation of u over d
y.
So this is the X direction of momentum equation.
The momentum equation in the V direction or in the Y direction can be donated by DV over DT plus.
Here you got the same thing, but we need to change u here to V and here you will have to also change
this to V.
The last equation we need to solve is the continuity equation.
Of course this is make sure the, the the the the the mass is preserved.
So this is usually Navier-Stokes equation have three equations.
The first one is the continuity, which is make sure that the mass is preserved.
And and this is how the finalists form or in this form that we are going to solve.
And they have the the momentum that has to be preserved.
And the last one is the energy equation.
But because in this solution, what we will not really or we will not solve any energy change, so we
will just put it nothing like it will.
We will not consider it so.
So for city state, what we need to do is this location or let's make it a bit.
This one and this one has to be equals to zero.
And here also zero.
Nothing.
Why?
Because when we have a fluid at steady state, time doesn't change.
So the solution we will do is well, basically most of the this the solvers in the in the choosing pens
is actually explicit in implicit in nature.
So we will solve the whole X and Y together and we keep updating it as we go through our data that we
will create that is boundary condition, initial condition and not initial condition.
In this case it will be random and the most important is the boundary condition and the of course the
pens, the loss we have to keep solving.
So let's start.
Of course, this tutorial or class is built, of course, on Navier Stokes equation.
However, if we want to see the documentation, we can see this code cover Sinaia flow.
This one, basically the equation looks similar.
We can see this equation and if we.
See the this equation.
We can see how similar they both look dude here dude, why it exists here.
P over x exists everywhere is exist.
So it's quite useful to consider this tutorial or in order to understand what's going on in our equations.
So this is like many parts of the code.
You can see it's similar to our part of code.
The Navier-Stokes equation in the documentation of deep is not being considered.
However.
It's basically like we we we hope it will like it's not a problem because this equation is more or less
the same.
So let's step by step, start writing this solver.
So here it's Navier Stokes Deep.
Um Navier Stokes deep XD main and we start by always importing well a.
With TensorFlow tensor.
Flow as tf.
Just some libraries import deep XD as the the e import numpy.
As MP and for plotting import.
Import.
Matplotlib.
Lip.
Dot pyplot as plt and we shift enter a tensor.
Ten.
Flow.
Yeah.
Yeah, this is it.
So now what we will do is we start by row.
We put some values Mu which is the viscosity, of course, kinematic viscosity is mu over rho so we
will use mu over rho.
But of course we can, we can even new and put the value of nu or we can just mu and we divide by rho
it will be the same because it's one at the end.
We're not really considering the physics of the flow.
Rather we are considering the actual numerical or uh, like mathematical modeling or like just modeling
of the problem.
So these, this is D and L, basically it's the boundary or the competition zone we are considering.
In our case, what we have is or what we are going to have.
Maybe it's better black like this.
What we will have is we will have el.
The length.
Of this one.
This 60.
So here is L and D is the width.
And x.
The x axis is going.
To pass.
This is the x axis in the middle and the y axis also going to pass in the middle.
As here is not so much middle here.
About here.
So this is basically our competition domain.
And what we will have also regarding the boundary condition, we can consider it.
This one which is here is.
You in?
Basically the flow.
And here is.
Just wall.
So here we will have.
What is it?
Wall.
Or here we are also going to have a wall.
And here we will have the boundary we have is, um.
Basically or not basically is is constant pressure.
We know that at this there will be a velocity of the fluid that will make this thing converge.
And this is we don't want to specify it here.
We know it's inlet velocity and that the wall is non-slip condition, which is u is equal zero and the
end we don't want to define U but what we have to define is p the pressure.
So pressure equals well value.
I forget basically how much, but I think I will just say the code.
So basically here we will have a pressure.
A in here, that's going to be kind of constant pressure surface.
So this is the domain we have.
It will spread from minus a this is, of course.
The whole thing like this is the whole thing is hell.
This is the whole thing is you.
So the, the the actual domain is going to spread from minus.
Over two to.
Plus L over two.
And in here it will minus the over two to here, which is plus the over two.
And that's it.
So this is the computation domain.
The boundary condition, as said here is inlet, here is wall, and here is a constant pressure.
Let's apply it.
So this is these values.
And then we have to start writing basically our we can start by writing geometry.
So geometry.
Geometry equals E dot.
Geometry.
Dot.
Rick.
Dangle.
And X.
Min.
Oh, not here.
This is how the syntax from minus L over two to.
Well l over over to.
And.
X max.
Equals.
Uh, well.
Sorry.
This is x max.
Minus D over two.
This is a rectangle, so we need to put two parameters.
I'll show you.
So basically here, this point, we need to define this point.
Put it.
We need to define this point and this point.
So this point is minus X over over two and minus L over two, and the maximum is a plus the over two
and plus L over two.
So this is where this thing comes from.
L Over two.
L Over two and D over two.
So this is the geometry.
And we shift.
Enter.
Of course.