QuickerSim CFD Toolbox – Facebook Course, Lesson 2 – Potential Flow over an Airfoil


Hi, welcome to our second lesson. Today we
are going to perform the first free flow summation and what we are going to do is
we are going to simulate the potential flow over NACA0012 airfoil.
as most of you probably know potential flow is the most basic type of flow
model so this probably will not have very big practical implications for your
simulations but but the way thing is very nice to show on this very simple
example what is the idea of performing simulations in this Matlab Toolbox. So
let me remind you that the potential flow is is defined by assuming that the
velocity can be cast as a gradient of a potential field and secondly you
know that you deal with an incompressible fluid flow so divergence
of velocity must be zero if you substitute this equation into that you
end up with the Laplace equation for the velocity potential field the proper
boundary conditions if you want to have the flow which is coming from this
direction you need to specify a Neumann boundary here with the Neumann
condition for phi and let me say this would be 50 meters per second on the
outlet boundary you have to define the potential value so we say it
would be simply zero you can always assume every other constant if we
have absolutely no implications since velocity is defined as the gradient so
even if we define a different constant this will also be fine
we need to figure out what the boundary condition for all the walls is and for a
solid wall where the velocity does not penetrate a solid wall so you have to
specify zero homogenous Neumann boundary condition and you can do the same at
some channel walls which are pretty far from the airfoil that’s also
correct. So now let’s summarize this what do we have to do we
have to solve a Laplace equation and assume this boundary conditions for the
Neumann boundary condition a flux boundary condition zero
Neumann boundary condition and zero the original boundary condition what we do
is we go to MATLAB right now I have the whole script already written for you but
we will describe it step by step so what we do at the beginning we simply cleared
the workspace in the comment window and then as usually in every CFD solver what you do – you have to import a mesh p, e and t will be variables that that store mesh in our QuickerSim CFD Toolbox. Without going into the theory of the data structures and
without going into the details simply remember P E and T usually denote all
the data which store the mesh P is something which will be important this
are coordinates of all the nodes in the mesh
so P array simply defines the locations of the mesh nodes alright so we call
“importMeshGmsh” function and you have to download this file, mesh file we
have already created for you in Gmsh and uploaded to Facebook so please
simply use our mesh what is important you can find after downloading our Toolbox in the documentation you can find a link to the to another tutorial on geometry
creation so that’s why we do not cover geometric creation in this very simple
Facebook course if you are interested in geometric creation in
Gmsh simply refer to the links that you have obtained during the
registration process what is important is we have some how to
define the inlet boundary and this will be you can denote the boundaries on the
physical line ideas that you have created in Gmsh so please remember
creating physical line gives a certain physical ID Inlet has got nine hour air
air 4 has got 11 and outlet boundary is 10 so police simply keep in mind these
these IDs alright we are going back to MATLAB we
have said that we need to solve a Laplace equation so basically a diffusion
problem so there is nothing as what we need to do we simply assemble the
diffusion matrix we assemble a linear system for equations based on the point
element method the the arguments that we need to pass to this assemble diffusion
matrix function is information about the mesh P entity arrays it is not needed at
all at this moment and one is diffusivity basically for a diffusion
problem you need to define a diffusivity because we are solving a very simple
Laplace problem then our diffusivity is simply equal to 1 and this assembles D
diffusion matrix and F right hand side vector alright so we have told that Toolbox that we want to solve a diffusion problem now what we need to do is we
need to define boundary conditions we do it by the following statements imposed
scholar boundary condition today PE mesh D matrix F right-hand side vector
nine denotes the physical line idea which means that we want to do something
here on the inlet and we want to specify Neumann boundary condition which is
called flux in our CFD Toolbox and this flux and this flux please notice that you
want to have 50 meters per second in this direction so from left to right
well as normal vector always points out of the domain so for having plus 50
meters per second along the x-axis we need to specify boundary condition minus
50 and on physical line turns at the outlet we define value boundary
conditions so basically there is a boundary condition which is equal to
zero and the three arguments that are modified during the coldest functions
are there the matrix and F right hand side actual then we need after we have
assembled the diffusion problem and imposed proper boundary conditions we
have to solve the system of linear equations for 4 pi so we easily call the
usual model function and what we do later is we want to check what the
velocity field is so for velocity field for a velocity field please notice we
need to compute a gradient of Phi that’s pretty easy V velocity equals solution
gradient today PT this is the mesh we need to know on which car of what kind
of mesh we want to differentiate we want to compute the gradient and we passed
the fi field basically in Erfurt simulations we are interested in the
velocity magnitude around the air for and the pressure coefficient so this is
these are simple MATLAB comments if you want to compute
the magnitude simply take the square root of and this is important they after
you call solution gradient this will return you velocity for each node and
the first first column the first column will give you X velocities and the
second column of the gradient will give you Y velocities so basically you take
the square of the X plus square of the Y and take the square roots this gives you
velocity magnitude if you want to compute pressure coefficient from the
basic formulas of aerodynamics you can find that Cp would be equal to one minus
V minus magnitude of velocity squared divided by the free stream velocity
squared because our free stream body was fifty we simply take the square of this
of this velocity and at the end we want to plot these values we want to plot the
the velocity field and the pressure field so we open a new figure and the
function display solution today is the usual function which is present
in the Toolbox to display scalar fields and again you have to pass P and
T information about mesh Cp is the field which is defined for every note in the
mesh and this is simply your description that you want to give to the plot this
will be pressure coefficient again the same way in the second figure but
right now we want to specify the x knob the magnitude simply the x and that’s it let me run this part is script with f9 button and you can see
what you get the pressure coefficient field and you get the x field what you are usually interested in airfoil simulation is what is the
pressure distribution along the airfoil so this is where we go to
base post-processing if you want to learn more about
post-processing please refer to tutorial 1 in our documentation then you will
have all this information getting step by step but basically what we need to do is to plot the pressure value the pressure
coefficient values at the mesh nodes which are lying on the airfoil so you
need to if you knew what nodes are lying here this would be easy to do it with a
simple plot comment in MATLAB all right so we need to figure out what nodes are
lying on this airfoil and we did by this function call airfoil notes equals
extract node IDs on edges and by call this function we extract all ideas
of nodes that are lying on your edge 11 and 11 is our airfoil and then you can
plot it with usual MATLAB function whereas cutter does basically the same
what plot does but it’s only displace you the points. And what we would
like to have is… I first show you the plot and then explain what we have
done basically what we want to have is we want to have the x over C X so the
courts or the location along the airfoil on one axis and on the second axis we’d
like to have the pressure coefficient all right so we did scatter ad and as I
said P denotes coordinates of nodes in the mesh 1
denotes this would be x coordinates 2 means we would like to plot the y
coordinates and we only want to do it for airfoil notes after coat this
function you see that air for nodes gives information about ideas of nodes
that we are interested in and the same here we want to plot pressure
coefficient but only for the nodes which are lying on the airfoil and then just
get a title x labor while angle and turn on the great so let me run the script
again with f5 so you can see by then this the velocity field you can see the
pressure coefficient field and what is probably most interesting is you get
this pressure distribution and if you if you look at some reference data you
can find that for zero angle for talk the reference date that way is exactly
the same you can see – Oh top opened for 0.4 here is driving – around 0.2 here
against 0.2 rate these pressure distribution which is simulated
with a very simple potential flow model is accurate for this simple
application. Thank you for this second lesson. In the next lesson, we are going
to simulate the full Navier-Stokes equations so… See you then!

1 thought on “QuickerSim CFD Toolbox – Facebook Course, Lesson 2 – Potential Flow over an Airfoil

Leave a Reply

Your email address will not be published. Required fields are marked *